Remove some unused variables
[sfrench/cifs-2.6.git] / arch / i386 / kernel / verify_cpu.S
1 /* Check if CPU has some minimum CPUID bits
2    This runs in 16bit mode so that the caller can still use the BIOS
3    to output errors on the screen */
4 #include <asm/cpufeature.h>
5 #include <asm/msr.h>
6
7 verify_cpu:
8         pushfl                          # Save caller passed flags
9         pushl   $0                      # Kill any dangerous flags
10         popfl
11
12 #if CONFIG_X86_MINIMUM_CPU_MODEL >= 4
13         pushfl
14         pop     %eax
15         orl     $(1<<18),%eax           # try setting AC
16         push    %eax
17         popfl
18         pushfl
19         popl    %eax
20         testl   $(1<<18),%eax
21         jz      bad
22 #endif
23 #if REQUIRED_MASK1 != 0
24         pushfl                          # standard way to check for cpuid
25         popl    %eax
26         movl    %eax,%ebx
27         xorl    $0x200000,%eax
28         pushl   %eax
29         popfl
30         pushfl
31         popl    %eax
32         cmpl    %eax,%ebx
33         pushfl                          # standard way to check for cpuid
34         popl    %eax
35         movl    %eax,%ebx
36         xorl    $0x200000,%eax
37         pushl   %eax
38         popfl
39         pushfl
40         popl    %eax
41         cmpl    %eax,%ebx
42         jz      bad                     # REQUIRED_MASK1 != 0 requires CPUID
43
44         movl    $0x0,%eax               # See if cpuid 1 is implemented
45         cpuid
46         cmpl    $0x1,%eax
47         jb      bad                     # no cpuid 1
48
49 #if REQUIRED_MASK1 & NEED_CMPXCHG64
50         /* Some VIA C3s need magic MSRs to enable CX64. Do this here */
51         cmpl    $0x746e6543,%ebx        # Cent
52         jne     1f
53         cmpl    $0x48727561,%edx        # aurH
54         jne     1f
55         cmpl    $0x736c7561,%ecx        # auls
56         jne     1f
57         movl    $1,%eax                 # check model
58         cpuid
59         movl    %eax,%ebx
60         shr     $8,%ebx
61         andl    $0xf,%ebx
62         cmp     $6,%ebx                 # check family == 6
63         jne     1f
64         shr     $4,%eax
65         andl    $0xf,%eax
66         cmpl    $6,%eax                 # check model >= 6
67         jb      1f
68         # assume models >= 6 all support this MSR
69         movl    $MSR_VIA_FCR,%ecx
70         rdmsr
71         orl     $((1<<1)|(1<<7)),%eax   # enable CMPXCHG64 and PGE
72         wrmsr
73 1:
74 #endif
75         movl    $0x1,%eax               # Does the cpu have what it takes
76         cpuid
77
78 #if CONFIG_X86_MINIMUM_CPU_MODEL > 4
79 #error  add proper model checking here
80 #endif
81
82         andl    $REQUIRED_MASK1,%edx
83         xorl    $REQUIRED_MASK1,%edx
84         jnz     bad
85 #endif /* REQUIRED_MASK1 */
86
87         popfl
88         xor     %eax,%eax
89         ret
90
91 bad:
92         popfl
93         movl    $1,%eax
94         ret