diff options
Diffstat (limited to 'arch/x86/kernel/cpu/common.c')
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 10e89ae5a600..ee1044ca481d 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -75,7 +75,7 @@ void switch_to_new_gdt(void) | |||
75 | static int cachesize_override __cpuinitdata = -1; | 75 | static int cachesize_override __cpuinitdata = -1; |
76 | static int disable_x86_serial_nr __cpuinitdata = 1; | 76 | static int disable_x86_serial_nr __cpuinitdata = 1; |
77 | 77 | ||
78 | struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {}; | 78 | static struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {}; |
79 | 79 | ||
80 | static void __cpuinit default_init(struct cpuinfo_x86 *c) | 80 | static void __cpuinit default_init(struct cpuinfo_x86 *c) |
81 | { | 81 | { |
@@ -93,8 +93,9 @@ static void __cpuinit default_init(struct cpuinfo_x86 *c) | |||
93 | static struct cpu_dev __cpuinitdata default_cpu = { | 93 | static struct cpu_dev __cpuinitdata default_cpu = { |
94 | .c_init = default_init, | 94 | .c_init = default_init, |
95 | .c_vendor = "Unknown", | 95 | .c_vendor = "Unknown", |
96 | .c_x86_vendor = X86_VENDOR_UNKNOWN, | ||
96 | }; | 97 | }; |
97 | static struct cpu_dev *this_cpu __cpuinitdata = &default_cpu; | 98 | static struct cpu_dev *this_cpu __cpuinitdata; |
98 | 99 | ||
99 | static int __init cachesize_setup(char *str) | 100 | static int __init cachesize_setup(char *str) |
100 | { | 101 | { |
@@ -250,21 +251,24 @@ static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c) | |||
250 | static int printed; | 251 | static int printed; |
251 | 252 | ||
252 | for (i = 0; i < X86_VENDOR_NUM; i++) { | 253 | for (i = 0; i < X86_VENDOR_NUM; i++) { |
253 | if (cpu_devs[i]) { | 254 | if (!cpu_devs[i]) |
254 | if (!strcmp(v, cpu_devs[i]->c_ident[0]) || | 255 | break; |
255 | (cpu_devs[i]->c_ident[1] && | 256 | |
256 | !strcmp(v, cpu_devs[i]->c_ident[1]))) { | 257 | if (!strcmp(v, cpu_devs[i]->c_ident[0]) || |
257 | c->x86_vendor = i; | 258 | (cpu_devs[i]->c_ident[1] && |
258 | this_cpu = cpu_devs[i]; | 259 | !strcmp(v, cpu_devs[i]->c_ident[1]))) { |
259 | return; | 260 | this_cpu = cpu_devs[i]; |
260 | } | 261 | c->x86_vendor = this_cpu->c_x86_vendor; |
262 | return; | ||
261 | } | 263 | } |
262 | } | 264 | } |
265 | |||
263 | if (!printed) { | 266 | if (!printed) { |
264 | printed++; | 267 | printed++; |
265 | printk(KERN_ERR "CPU: Vendor unknown, using generic init.\n"); | 268 | printk(KERN_ERR "CPU: Vendor unknown, using generic init.\n"); |
266 | printk(KERN_ERR "CPU: Your system may be unstable.\n"); | 269 | printk(KERN_ERR "CPU: Your system may be unstable.\n"); |
267 | } | 270 | } |
271 | |||
268 | c->x86_vendor = X86_VENDOR_UNKNOWN; | 272 | c->x86_vendor = X86_VENDOR_UNKNOWN; |
269 | this_cpu = &default_cpu; | 273 | this_cpu = &default_cpu; |
270 | } | 274 | } |
@@ -315,25 +319,6 @@ static int __cpuinit have_cpuid_p(void) | |||
315 | return flag_is_changeable_p(X86_EFLAGS_ID); | 319 | return flag_is_changeable_p(X86_EFLAGS_ID); |
316 | } | 320 | } |
317 | 321 | ||
318 | static void __init early_cpu_support_print(void) | ||
319 | { | ||
320 | int i,j; | ||
321 | struct cpu_dev *cpu_devx; | ||
322 | |||
323 | printk("KERNEL supported cpus:\n"); | ||
324 | for (i = 0; i < X86_VENDOR_NUM; i++) { | ||
325 | cpu_devx = cpu_devs[i]; | ||
326 | if (!cpu_devx) | ||
327 | continue; | ||
328 | for (j = 0; j < 2; j++) { | ||
329 | if (!cpu_devx->c_ident[j]) | ||
330 | continue; | ||
331 | printk(" %s %s\n", cpu_devx->c_vendor, | ||
332 | cpu_devx->c_ident[j]); | ||
333 | } | ||
334 | } | ||
335 | } | ||
336 | |||
337 | void __cpuinit cpu_detect(struct cpuinfo_x86 *c) | 322 | void __cpuinit cpu_detect(struct cpuinfo_x86 *c) |
338 | { | 323 | { |
339 | /* Get vendor name */ | 324 | /* Get vendor name */ |
@@ -411,21 +396,35 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) | |||
411 | 396 | ||
412 | get_cpu_cap(c); | 397 | get_cpu_cap(c); |
413 | 398 | ||
414 | if (c->x86_vendor != X86_VENDOR_UNKNOWN && | 399 | if (this_cpu->c_early_init) |
415 | cpu_devs[c->x86_vendor]->c_early_init) | 400 | this_cpu->c_early_init(c); |
416 | cpu_devs[c->x86_vendor]->c_early_init(c); | ||
417 | 401 | ||
418 | validate_pat_support(c); | 402 | validate_pat_support(c); |
419 | } | 403 | } |
420 | 404 | ||
421 | void __init early_cpu_init(void) | 405 | void __init early_cpu_init(void) |
422 | { | 406 | { |
423 | struct cpu_vendor_dev *cvdev; | 407 | struct cpu_dev **cdev; |
408 | int count = 0; | ||
409 | |||
410 | printk("KERNEL supported cpus:\n"); | ||
411 | for (cdev = __x86_cpu_dev_start; cdev < __x86_cpu_dev_end; cdev++) { | ||
412 | struct cpu_dev *cpudev = *cdev; | ||
413 | unsigned int j; | ||
424 | 414 | ||
425 | for (cvdev = __x86cpuvendor_start; cvdev < __x86cpuvendor_end; cvdev++) | 415 | if (count >= X86_VENDOR_NUM) |
426 | cpu_devs[cvdev->vendor] = cvdev->cpu_dev; | 416 | break; |
417 | cpu_devs[count] = cpudev; | ||
418 | count++; | ||
419 | |||
420 | for (j = 0; j < 2; j++) { | ||
421 | if (!cpudev->c_ident[j]) | ||
422 | continue; | ||
423 | printk(" %s %s\n", cpudev->c_vendor, | ||
424 | cpudev->c_ident[j]); | ||
425 | } | ||
426 | } | ||
427 | 427 | ||
428 | early_cpu_support_print(); | ||
429 | early_identify_cpu(&boot_cpu_data); | 428 | early_identify_cpu(&boot_cpu_data); |
430 | } | 429 | } |
431 | 430 | ||