diff options
Diffstat (limited to 'arch/i386/kernel/cpu/common.c')
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 57 |
1 files changed, 37 insertions, 20 deletions
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index e6bd095ae108..a06a49075f10 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -25,9 +25,10 @@ EXPORT_PER_CPU_SYMBOL(cpu_gdt_descr); | |||
25 | DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); | 25 | DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); |
26 | EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack); | 26 | EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack); |
27 | 27 | ||
28 | static int cachesize_override __devinitdata = -1; | 28 | static int cachesize_override __cpuinitdata = -1; |
29 | static int disable_x86_fxsr __devinitdata = 0; | 29 | static int disable_x86_fxsr __cpuinitdata; |
30 | static int disable_x86_serial_nr __devinitdata = 1; | 30 | static int disable_x86_serial_nr __cpuinitdata = 1; |
31 | static int disable_x86_sep __cpuinitdata; | ||
31 | 32 | ||
32 | struct cpu_dev * cpu_devs[X86_VENDOR_NUM] = {}; | 33 | struct cpu_dev * cpu_devs[X86_VENDOR_NUM] = {}; |
33 | 34 | ||
@@ -59,7 +60,7 @@ static int __init cachesize_setup(char *str) | |||
59 | } | 60 | } |
60 | __setup("cachesize=", cachesize_setup); | 61 | __setup("cachesize=", cachesize_setup); |
61 | 62 | ||
62 | int __devinit get_model_name(struct cpuinfo_x86 *c) | 63 | int __cpuinit get_model_name(struct cpuinfo_x86 *c) |
63 | { | 64 | { |
64 | unsigned int *v; | 65 | unsigned int *v; |
65 | char *p, *q; | 66 | char *p, *q; |
@@ -89,7 +90,7 @@ int __devinit get_model_name(struct cpuinfo_x86 *c) | |||
89 | } | 90 | } |
90 | 91 | ||
91 | 92 | ||
92 | void __devinit display_cacheinfo(struct cpuinfo_x86 *c) | 93 | void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c) |
93 | { | 94 | { |
94 | unsigned int n, dummy, ecx, edx, l2size; | 95 | unsigned int n, dummy, ecx, edx, l2size; |
95 | 96 | ||
@@ -130,7 +131,7 @@ void __devinit display_cacheinfo(struct cpuinfo_x86 *c) | |||
130 | /* in particular, if CPUID levels 0x80000002..4 are supported, this isn't used */ | 131 | /* in particular, if CPUID levels 0x80000002..4 are supported, this isn't used */ |
131 | 132 | ||
132 | /* Look up CPU names by table lookup. */ | 133 | /* Look up CPU names by table lookup. */ |
133 | static char __devinit *table_lookup_model(struct cpuinfo_x86 *c) | 134 | static char __cpuinit *table_lookup_model(struct cpuinfo_x86 *c) |
134 | { | 135 | { |
135 | struct cpu_model_info *info; | 136 | struct cpu_model_info *info; |
136 | 137 | ||
@@ -151,7 +152,7 @@ static char __devinit *table_lookup_model(struct cpuinfo_x86 *c) | |||
151 | } | 152 | } |
152 | 153 | ||
153 | 154 | ||
154 | static void __devinit get_cpu_vendor(struct cpuinfo_x86 *c, int early) | 155 | static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c, int early) |
155 | { | 156 | { |
156 | char *v = c->x86_vendor_id; | 157 | char *v = c->x86_vendor_id; |
157 | int i; | 158 | int i; |
@@ -187,6 +188,14 @@ static int __init x86_fxsr_setup(char * s) | |||
187 | __setup("nofxsr", x86_fxsr_setup); | 188 | __setup("nofxsr", x86_fxsr_setup); |
188 | 189 | ||
189 | 190 | ||
191 | static int __init x86_sep_setup(char * s) | ||
192 | { | ||
193 | disable_x86_sep = 1; | ||
194 | return 1; | ||
195 | } | ||
196 | __setup("nosep", x86_sep_setup); | ||
197 | |||
198 | |||
190 | /* Standard macro to see if a specific flag is changeable */ | 199 | /* Standard macro to see if a specific flag is changeable */ |
191 | static inline int flag_is_changeable_p(u32 flag) | 200 | static inline int flag_is_changeable_p(u32 flag) |
192 | { | 201 | { |
@@ -210,7 +219,7 @@ static inline int flag_is_changeable_p(u32 flag) | |||
210 | 219 | ||
211 | 220 | ||
212 | /* Probe for the CPUID instruction */ | 221 | /* Probe for the CPUID instruction */ |
213 | static int __devinit have_cpuid_p(void) | 222 | static int __cpuinit have_cpuid_p(void) |
214 | { | 223 | { |
215 | return flag_is_changeable_p(X86_EFLAGS_ID); | 224 | return flag_is_changeable_p(X86_EFLAGS_ID); |
216 | } | 225 | } |
@@ -254,10 +263,10 @@ static void __init early_cpu_detect(void) | |||
254 | } | 263 | } |
255 | } | 264 | } |
256 | 265 | ||
257 | void __devinit generic_identify(struct cpuinfo_x86 * c) | 266 | void __cpuinit generic_identify(struct cpuinfo_x86 * c) |
258 | { | 267 | { |
259 | u32 tfms, xlvl; | 268 | u32 tfms, xlvl; |
260 | int junk; | 269 | int ebx; |
261 | 270 | ||
262 | if (have_cpuid_p()) { | 271 | if (have_cpuid_p()) { |
263 | /* Get vendor name */ | 272 | /* Get vendor name */ |
@@ -273,7 +282,7 @@ void __devinit generic_identify(struct cpuinfo_x86 * c) | |||
273 | /* Intel-defined flags: level 0x00000001 */ | 282 | /* Intel-defined flags: level 0x00000001 */ |
274 | if ( c->cpuid_level >= 0x00000001 ) { | 283 | if ( c->cpuid_level >= 0x00000001 ) { |
275 | u32 capability, excap; | 284 | u32 capability, excap; |
276 | cpuid(0x00000001, &tfms, &junk, &excap, &capability); | 285 | cpuid(0x00000001, &tfms, &ebx, &excap, &capability); |
277 | c->x86_capability[0] = capability; | 286 | c->x86_capability[0] = capability; |
278 | c->x86_capability[4] = excap; | 287 | c->x86_capability[4] = excap; |
279 | c->x86 = (tfms >> 8) & 15; | 288 | c->x86 = (tfms >> 8) & 15; |
@@ -283,6 +292,11 @@ void __devinit generic_identify(struct cpuinfo_x86 * c) | |||
283 | if (c->x86 >= 0x6) | 292 | if (c->x86 >= 0x6) |
284 | c->x86_model += ((tfms >> 16) & 0xF) << 4; | 293 | c->x86_model += ((tfms >> 16) & 0xF) << 4; |
285 | c->x86_mask = tfms & 15; | 294 | c->x86_mask = tfms & 15; |
295 | #ifdef CONFIG_SMP | ||
296 | c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0); | ||
297 | #else | ||
298 | c->apicid = (ebx >> 24) & 0xFF; | ||
299 | #endif | ||
286 | } else { | 300 | } else { |
287 | /* Have CPUID level 0 only - unheard of */ | 301 | /* Have CPUID level 0 only - unheard of */ |
288 | c->x86 = 4; | 302 | c->x86 = 4; |
@@ -307,7 +321,7 @@ void __devinit generic_identify(struct cpuinfo_x86 * c) | |||
307 | #endif | 321 | #endif |
308 | } | 322 | } |
309 | 323 | ||
310 | static void __devinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) | 324 | static void __cpuinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) |
311 | { | 325 | { |
312 | if (cpu_has(c, X86_FEATURE_PN) && disable_x86_serial_nr ) { | 326 | if (cpu_has(c, X86_FEATURE_PN) && disable_x86_serial_nr ) { |
313 | /* Disable processor serial number */ | 327 | /* Disable processor serial number */ |
@@ -335,7 +349,7 @@ __setup("serialnumber", x86_serial_nr_setup); | |||
335 | /* | 349 | /* |
336 | * This does the hard work of actually picking apart the CPU stuff... | 350 | * This does the hard work of actually picking apart the CPU stuff... |
337 | */ | 351 | */ |
338 | void __devinit identify_cpu(struct cpuinfo_x86 *c) | 352 | void __cpuinit identify_cpu(struct cpuinfo_x86 *c) |
339 | { | 353 | { |
340 | int i; | 354 | int i; |
341 | 355 | ||
@@ -405,6 +419,10 @@ void __devinit identify_cpu(struct cpuinfo_x86 *c) | |||
405 | clear_bit(X86_FEATURE_XMM, c->x86_capability); | 419 | clear_bit(X86_FEATURE_XMM, c->x86_capability); |
406 | } | 420 | } |
407 | 421 | ||
422 | /* SEP disabled? */ | ||
423 | if (disable_x86_sep) | ||
424 | clear_bit(X86_FEATURE_SEP, c->x86_capability); | ||
425 | |||
408 | if (disable_pse) | 426 | if (disable_pse) |
409 | clear_bit(X86_FEATURE_PSE, c->x86_capability); | 427 | clear_bit(X86_FEATURE_PSE, c->x86_capability); |
410 | 428 | ||
@@ -417,7 +435,7 @@ void __devinit identify_cpu(struct cpuinfo_x86 *c) | |||
417 | else | 435 | else |
418 | /* Last resort... */ | 436 | /* Last resort... */ |
419 | sprintf(c->x86_model_id, "%02x/%02x", | 437 | sprintf(c->x86_model_id, "%02x/%02x", |
420 | c->x86_vendor, c->x86_model); | 438 | c->x86, c->x86_model); |
421 | } | 439 | } |
422 | 440 | ||
423 | /* Now the feature flags better reflect actual CPU features! */ | 441 | /* Now the feature flags better reflect actual CPU features! */ |
@@ -453,7 +471,7 @@ void __devinit identify_cpu(struct cpuinfo_x86 *c) | |||
453 | } | 471 | } |
454 | 472 | ||
455 | #ifdef CONFIG_X86_HT | 473 | #ifdef CONFIG_X86_HT |
456 | void __devinit detect_ht(struct cpuinfo_x86 *c) | 474 | void __cpuinit detect_ht(struct cpuinfo_x86 *c) |
457 | { | 475 | { |
458 | u32 eax, ebx, ecx, edx; | 476 | u32 eax, ebx, ecx, edx; |
459 | int index_msb, core_bits; | 477 | int index_msb, core_bits; |
@@ -461,7 +479,6 @@ void __devinit detect_ht(struct cpuinfo_x86 *c) | |||
461 | 479 | ||
462 | cpuid(1, &eax, &ebx, &ecx, &edx); | 480 | cpuid(1, &eax, &ebx, &ecx, &edx); |
463 | 481 | ||
464 | c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0); | ||
465 | 482 | ||
466 | if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY)) | 483 | if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY)) |
467 | return; | 484 | return; |
@@ -500,7 +517,7 @@ void __devinit detect_ht(struct cpuinfo_x86 *c) | |||
500 | } | 517 | } |
501 | #endif | 518 | #endif |
502 | 519 | ||
503 | void __devinit print_cpu_info(struct cpuinfo_x86 *c) | 520 | void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) |
504 | { | 521 | { |
505 | char *vendor = NULL; | 522 | char *vendor = NULL; |
506 | 523 | ||
@@ -523,7 +540,7 @@ void __devinit print_cpu_info(struct cpuinfo_x86 *c) | |||
523 | printk("\n"); | 540 | printk("\n"); |
524 | } | 541 | } |
525 | 542 | ||
526 | cpumask_t cpu_initialized __devinitdata = CPU_MASK_NONE; | 543 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; |
527 | 544 | ||
528 | /* This is hacky. :) | 545 | /* This is hacky. :) |
529 | * We're emulating future behavior. | 546 | * We're emulating future behavior. |
@@ -570,7 +587,7 @@ void __init early_cpu_init(void) | |||
570 | * and IDT. We reload them nevertheless, this function acts as a | 587 | * and IDT. We reload them nevertheless, this function acts as a |
571 | * 'CPU state barrier', nothing should get across. | 588 | * 'CPU state barrier', nothing should get across. |
572 | */ | 589 | */ |
573 | void __devinit cpu_init(void) | 590 | void __cpuinit cpu_init(void) |
574 | { | 591 | { |
575 | int cpu = smp_processor_id(); | 592 | int cpu = smp_processor_id(); |
576 | struct tss_struct * t = &per_cpu(init_tss, cpu); | 593 | struct tss_struct * t = &per_cpu(init_tss, cpu); |
@@ -670,7 +687,7 @@ void __devinit cpu_init(void) | |||
670 | } | 687 | } |
671 | 688 | ||
672 | #ifdef CONFIG_HOTPLUG_CPU | 689 | #ifdef CONFIG_HOTPLUG_CPU |
673 | void __devinit cpu_uninit(void) | 690 | void __cpuinit cpu_uninit(void) |
674 | { | 691 | { |
675 | int cpu = raw_smp_processor_id(); | 692 | int cpu = raw_smp_processor_id(); |
676 | cpu_clear(cpu, cpu_initialized); | 693 | cpu_clear(cpu, cpu_initialized); |