aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/amd.c
diff options
context:
space:
mode:
authorPaolo Ciarrocchi <paolo.ciarrocchi@gmail.com>2008-02-22 17:10:33 -0500
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:40:50 -0400
commitfb87a298fb79357fa5b27e6916ae1c45bf94dac7 (patch)
tree54c3a86f7563bd8bd186c4c285e71ed19c66f8e5 /arch/x86/kernel/cpu/amd.c
parentf97518271941fdb2dab07d7bd58bf9fa39ba3f65 (diff)
x86: coding style fixes to arch/x86/kernel/cpu/amd.c
Before: total: 42 errors, 26 warnings, 350 lines checked After: total: 0 errors, 26 warnings, 352 lines checked No code changed: arch/x86/kernel/cpu/amd.o: text data bss dec hex filename 1936 328 0 2264 8d8 amd.o.before 1936 328 0 2264 8d8 amd.o.after md5: 873430a88faaf31bb4bbfe3a2a691e45 amd.o.before.asm 873430a88faaf31bb4bbfe3a2a691e45 amd.o.after.asm Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu/amd.c')
-rw-r--r--arch/x86/kernel/cpu/amd.c94
1 files changed, 48 insertions, 46 deletions
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index cab4e562b5cb..1a3e1bb4d758 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -20,7 +20,7 @@
20 * the chip setting when fixing the bug but they also tweaked some 20 * the chip setting when fixing the bug but they also tweaked some
21 * performance at the same time.. 21 * performance at the same time..
22 */ 22 */
23 23
24extern void vide(void); 24extern void vide(void);
25__asm__(".align 4\nvide: ret"); 25__asm__(".align 4\nvide: ret");
26 26
@@ -81,7 +81,8 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
81#ifdef CONFIG_SMP 81#ifdef CONFIG_SMP
82 unsigned long long value; 82 unsigned long long value;
83 83
84 /* Disable TLB flush filter by setting HWCR.FFDIS on K8 84 /*
85 * Disable TLB flush filter by setting HWCR.FFDIS on K8
85 * bit 6 of msr C001_0015 86 * bit 6 of msr C001_0015
86 * 87 *
87 * Errata 63 for SH-B3 steppings 88 * Errata 63 for SH-B3 steppings
@@ -102,15 +103,16 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
102 * no bus pipeline) 103 * no bus pipeline)
103 */ 104 */
104 105
105 /* Bit 31 in normal CPUID used for nonstandard 3DNow ID; 106 /*
106 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */ 107 * Bit 31 in normal CPUID used for nonstandard 3DNow ID;
108 * DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway
109 */
107 clear_bit(0*32+31, c->x86_capability); 110 clear_bit(0*32+31, c->x86_capability);
108 111
109 r = get_model_name(c); 112 r = get_model_name(c);
110 113
111 switch(c->x86) 114 switch (c->x86) {
112 { 115 case 4:
113 case 4:
114 /* 116 /*
115 * General Systems BIOSen alias the cpu frequency registers 117 * General Systems BIOSen alias the cpu frequency registers
116 * of the Elan at 0x000df000. Unfortuantly, one of the Linux 118 * of the Elan at 0x000df000. Unfortuantly, one of the Linux
@@ -120,61 +122,60 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
120#define CBAR (0xfffc) /* Configuration Base Address (32-bit) */ 122#define CBAR (0xfffc) /* Configuration Base Address (32-bit) */
121#define CBAR_ENB (0x80000000) 123#define CBAR_ENB (0x80000000)
122#define CBAR_KEY (0X000000CB) 124#define CBAR_KEY (0X000000CB)
123 if (c->x86_model==9 || c->x86_model == 10) { 125 if (c->x86_model == 9 || c->x86_model == 10) {
124 if (inl (CBAR) & CBAR_ENB) 126 if (inl (CBAR) & CBAR_ENB)
125 outl (0 | CBAR_KEY, CBAR); 127 outl (0 | CBAR_KEY, CBAR);
126 } 128 }
127 break; 129 break;
128 case 5: 130 case 5:
129 if( c->x86_model < 6 ) 131 if (c->x86_model < 6) {
130 {
131 /* Based on AMD doc 20734R - June 2000 */ 132 /* Based on AMD doc 20734R - June 2000 */
132 if ( c->x86_model == 0 ) { 133 if (c->x86_model == 0) {
133 clear_bit(X86_FEATURE_APIC, c->x86_capability); 134 clear_bit(X86_FEATURE_APIC, c->x86_capability);
134 set_bit(X86_FEATURE_PGE, c->x86_capability); 135 set_bit(X86_FEATURE_PGE, c->x86_capability);
135 } 136 }
136 break; 137 break;
137 } 138 }
138 139
139 if ( c->x86_model == 6 && c->x86_mask == 1 ) { 140 if (c->x86_model == 6 && c->x86_mask == 1) {
140 const int K6_BUG_LOOP = 1000000; 141 const int K6_BUG_LOOP = 1000000;
141 int n; 142 int n;
142 void (*f_vide)(void); 143 void (*f_vide)(void);
143 unsigned long d, d2; 144 unsigned long d, d2;
144 145
145 printk(KERN_INFO "AMD K6 stepping B detected - "); 146 printk(KERN_INFO "AMD K6 stepping B detected - ");
146 147
147 /* 148 /*
148 * It looks like AMD fixed the 2.6.2 bug and improved indirect 149 * It looks like AMD fixed the 2.6.2 bug and improved indirect
149 * calls at the same time. 150 * calls at the same time.
150 */ 151 */
151 152
152 n = K6_BUG_LOOP; 153 n = K6_BUG_LOOP;
153 f_vide = vide; 154 f_vide = vide;
154 rdtscl(d); 155 rdtscl(d);
155 while (n--) 156 while (n--)
156 f_vide(); 157 f_vide();
157 rdtscl(d2); 158 rdtscl(d2);
158 d = d2-d; 159 d = d2-d;
159 160
160 if (d > 20*K6_BUG_LOOP) 161 if (d > 20*K6_BUG_LOOP)
161 printk("system stability may be impaired when more than 32 MB are used.\n"); 162 printk("system stability may be impaired when more than 32 MB are used.\n");
162 else 163 else
163 printk("probably OK (after B9730xxxx).\n"); 164 printk("probably OK (after B9730xxxx).\n");
164 printk(KERN_INFO "Please see http://membres.lycos.fr/poulot/k6bug.html\n"); 165 printk(KERN_INFO "Please see http://membres.lycos.fr/poulot/k6bug.html\n");
165 } 166 }
166 167
167 /* K6 with old style WHCR */ 168 /* K6 with old style WHCR */
168 if (c->x86_model < 8 || 169 if (c->x86_model < 8 ||
169 (c->x86_model== 8 && c->x86_mask < 8)) { 170 (c->x86_model == 8 && c->x86_mask < 8)) {
170 /* We can only write allocate on the low 508Mb */ 171 /* We can only write allocate on the low 508Mb */
171 if(mbytes>508) 172 if (mbytes > 508)
172 mbytes=508; 173 mbytes = 508;
173 174
174 rdmsr(MSR_K6_WHCR, l, h); 175 rdmsr(MSR_K6_WHCR, l, h);
175 if ((l&0x0000FFFF)==0) { 176 if ((l&0x0000FFFF) == 0) {
176 unsigned long flags; 177 unsigned long flags;
177 l=(1<<0)|((mbytes/4)<<1); 178 l = (1<<0)|((mbytes/4)<<1);
178 local_irq_save(flags); 179 local_irq_save(flags);
179 wbinvd(); 180 wbinvd();
180 wrmsr(MSR_K6_WHCR, l, h); 181 wrmsr(MSR_K6_WHCR, l, h);
@@ -185,17 +186,17 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
185 break; 186 break;
186 } 187 }
187 188
188 if ((c->x86_model == 8 && c->x86_mask >7) || 189 if ((c->x86_model == 8 && c->x86_mask > 7) ||
189 c->x86_model == 9 || c->x86_model == 13) { 190 c->x86_model == 9 || c->x86_model == 13) {
190 /* The more serious chips .. */ 191 /* The more serious chips .. */
191 192
192 if(mbytes>4092) 193 if (mbytes > 4092)
193 mbytes=4092; 194 mbytes = 4092;
194 195
195 rdmsr(MSR_K6_WHCR, l, h); 196 rdmsr(MSR_K6_WHCR, l, h);
196 if ((l&0xFFFF0000)==0) { 197 if ((l&0xFFFF0000) == 0) {
197 unsigned long flags; 198 unsigned long flags;
198 l=((mbytes>>2)<<22)|(1<<16); 199 l = ((mbytes>>2)<<22)|(1<<16);
199 local_irq_save(flags); 200 local_irq_save(flags);
200 wbinvd(); 201 wbinvd();
201 wrmsr(MSR_K6_WHCR, l, h); 202 wrmsr(MSR_K6_WHCR, l, h);
@@ -217,10 +218,11 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
217 break; 218 break;
218 } 219 }
219 break; 220 break;
220 case 6: /* An Athlon/Duron */ 221 case 6: /* An Athlon/Duron */
221 222
222 /* Bit 15 of Athlon specific MSR 15, needs to be 0 223 /*
223 * to enable SSE on Palomino/Morgan/Barton CPU's. 224 * Bit 15 of Athlon specific MSR 15, needs to be 0
225 * to enable SSE on Palomino/Morgan/Barton CPU's.
224 * If the BIOS didn't enable it already, enable it here. 226 * If the BIOS didn't enable it already, enable it here.
225 */ 227 */
226 if (c->x86_model >= 6 && c->x86_model <= 10) { 228 if (c->x86_model >= 6 && c->x86_model <= 10) {
@@ -233,11 +235,12 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
233 } 235 }
234 } 236 }
235 237
236 /* It's been determined by AMD that Athlons since model 8 stepping 1 238 /*
239 * It's been determined by AMD that Athlons since model 8 stepping 1
237 * are more robust with CLK_CTL set to 200xxxxx instead of 600xxxxx 240 * are more robust with CLK_CTL set to 200xxxxx instead of 600xxxxx
238 * As per AMD technical note 27212 0.2 241 * As per AMD technical note 27212 0.2
239 */ 242 */
240 if ((c->x86_model == 8 && c->x86_mask>=1) || (c->x86_model > 8)) { 243 if ((c->x86_model == 8 && c->x86_mask >= 1) || (c->x86_model > 8)) {
241 rdmsr(MSR_K7_CLK_CTL, l, h); 244 rdmsr(MSR_K7_CLK_CTL, l, h);
242 if ((l & 0xfff00000) != 0x20000000) { 245 if ((l & 0xfff00000) != 0x20000000) {
243 printk ("CPU: CLK_CTL MSR was %x. Reprogramming to %x\n", l, 246 printk ("CPU: CLK_CTL MSR was %x. Reprogramming to %x\n", l,
@@ -256,7 +259,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
256 set_bit(X86_FEATURE_K8, c->x86_capability); 259 set_bit(X86_FEATURE_K8, c->x86_capability);
257 break; 260 break;
258 case 6: 261 case 6:
259 set_bit(X86_FEATURE_K7, c->x86_capability); 262 set_bit(X86_FEATURE_K7, c->x86_capability);
260 break; 263 break;
261 } 264 }
262 if (c->x86 >= 6) 265 if (c->x86 >= 6)
@@ -264,9 +267,8 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
264 267
265 display_cacheinfo(c); 268 display_cacheinfo(c);
266 269
267 if (cpuid_eax(0x80000000) >= 0x80000008) { 270 if (cpuid_eax(0x80000000) >= 0x80000008)
268 c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1; 271 c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1;
269 }
270 272
271#ifdef CONFIG_X86_HT 273#ifdef CONFIG_X86_HT
272 /* 274 /*
@@ -308,14 +310,14 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
308 set_bit(X86_FEATURE_MFENCE_RDTSC, c->x86_capability); 310 set_bit(X86_FEATURE_MFENCE_RDTSC, c->x86_capability);
309} 311}
310 312
311static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 * c, unsigned int size) 313static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c, unsigned int size)
312{ 314{
313 /* AMD errata T13 (order #21922) */ 315 /* AMD errata T13 (order #21922) */
314 if ((c->x86 == 6)) { 316 if ((c->x86 == 6)) {
315 if (c->x86_model == 3 && c->x86_mask == 0) /* Duron Rev A0 */ 317 if (c->x86_model == 3 && c->x86_mask == 0) /* Duron Rev A0 */
316 size = 64; 318 size = 64;
317 if (c->x86_model == 4 && 319 if (c->x86_model == 4 &&
318 (c->x86_mask==0 || c->x86_mask==1)) /* Tbird rev A1/A2 */ 320 (c->x86_mask == 0 || c->x86_mask == 1)) /* Tbird rev A1/A2 */
319 size = 256; 321 size = 256;
320 } 322 }
321 return size; 323 return size;
@@ -323,16 +325,16 @@ static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 * c, unsigned in
323 325
324static struct cpu_dev amd_cpu_dev __cpuinitdata = { 326static struct cpu_dev amd_cpu_dev __cpuinitdata = {
325 .c_vendor = "AMD", 327 .c_vendor = "AMD",
326 .c_ident = { "AuthenticAMD" }, 328 .c_ident = { "AuthenticAMD" },
327 .c_models = { 329 .c_models = {
328 { .vendor = X86_VENDOR_AMD, .family = 4, .model_names = 330 { .vendor = X86_VENDOR_AMD, .family = 4, .model_names =
329 { 331 {
330 [3] = "486 DX/2", 332 [3] = "486 DX/2",
331 [7] = "486 DX/2-WB", 333 [7] = "486 DX/2-WB",
332 [8] = "486 DX/4", 334 [8] = "486 DX/4",
333 [9] = "486 DX/4-WB", 335 [9] = "486 DX/4-WB",
334 [14] = "Am5x86-WT", 336 [14] = "Am5x86-WT",
335 [15] = "Am5x86-WB" 337 [15] = "Am5x86-WB"
336 } 338 }
337 }, 339 },
338 }, 340 },