diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-09-04 15:09:45 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-04 15:09:45 -0400 |
commit | 10a434fcb23a57c385177a0086955fae01003f64 (patch) | |
tree | 2688fd54185dd635ae5567fcbbccf99a4d600655 /arch/x86/kernel/cpu/common_64.c | |
parent | 9d31d35b5f9d619bb2482235cc889326de049e29 (diff) |
x86: remove cpu_vendor_dev
1. add c_x86_vendor into cpu_dev
2. change cpu_devs to static
3. check c_x86_vendor before put that cpu_dev into array
4. remove alignment for 64bit
5. order the sequence in cpu_devs according to link sequence...
so could put intel at first, then amd...
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu/common_64.c')
-rw-r--r-- | arch/x86/kernel/cpu/common_64.c | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/arch/x86/kernel/cpu/common_64.c b/arch/x86/kernel/cpu/common_64.c index 522a5f2e405..b82479c1083 100644 --- a/arch/x86/kernel/cpu/common_64.c +++ b/arch/x86/kernel/cpu/common_64.c | |||
@@ -66,7 +66,7 @@ void switch_to_new_gdt(void) | |||
66 | load_gdt(&gdt_descr); | 66 | load_gdt(&gdt_descr); |
67 | } | 67 | } |
68 | 68 | ||
69 | struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {}; | 69 | static struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {}; |
70 | 70 | ||
71 | static void __cpuinit default_init(struct cpuinfo_x86 *c) | 71 | static void __cpuinit default_init(struct cpuinfo_x86 *c) |
72 | { | 72 | { |
@@ -76,8 +76,9 @@ static void __cpuinit default_init(struct cpuinfo_x86 *c) | |||
76 | static struct cpu_dev __cpuinitdata default_cpu = { | 76 | static struct cpu_dev __cpuinitdata default_cpu = { |
77 | .c_init = default_init, | 77 | .c_init = default_init, |
78 | .c_vendor = "Unknown", | 78 | .c_vendor = "Unknown", |
79 | .c_x86_vendor = X86_VENDOR_UNKNOWN, | ||
79 | }; | 80 | }; |
80 | static struct cpu_dev *this_cpu __cpuinitdata = &default_cpu; | 81 | static struct cpu_dev *this_cpu __cpuinitdata; |
81 | 82 | ||
82 | int __cpuinit get_model_name(struct cpuinfo_x86 *c) | 83 | int __cpuinit get_model_name(struct cpuinfo_x86 *c) |
83 | { | 84 | { |
@@ -178,44 +179,28 @@ static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c) | |||
178 | static int printed; | 179 | static int printed; |
179 | 180 | ||
180 | for (i = 0; i < X86_VENDOR_NUM; i++) { | 181 | for (i = 0; i < X86_VENDOR_NUM; i++) { |
181 | if (cpu_devs[i]) { | 182 | if (!cpu_devs[i]) |
182 | if (!strcmp(v, cpu_devs[i]->c_ident[0]) || | 183 | break; |
183 | (cpu_devs[i]->c_ident[1] && | 184 | |
184 | !strcmp(v, cpu_devs[i]->c_ident[1]))) { | 185 | if (!strcmp(v, cpu_devs[i]->c_ident[0]) || |
185 | c->x86_vendor = i; | 186 | (cpu_devs[i]->c_ident[1] && |
186 | this_cpu = cpu_devs[i]; | 187 | !strcmp(v, cpu_devs[i]->c_ident[1]))) { |
187 | return; | 188 | this_cpu = cpu_devs[i]; |
188 | } | 189 | c->x86_vendor = this_cpu->c_x86_vendor; |
190 | return; | ||
189 | } | 191 | } |
190 | } | 192 | } |
193 | |||
191 | if (!printed) { | 194 | if (!printed) { |
192 | printed++; | 195 | printed++; |
193 | printk(KERN_ERR "CPU: Vendor unknown, using generic init.\n"); | 196 | printk(KERN_ERR "CPU: Vendor unknown, using generic init.\n"); |
194 | printk(KERN_ERR "CPU: Your system may be unstable.\n"); | 197 | printk(KERN_ERR "CPU: Your system may be unstable.\n"); |
195 | } | 198 | } |
199 | |||
196 | c->x86_vendor = X86_VENDOR_UNKNOWN; | 200 | c->x86_vendor = X86_VENDOR_UNKNOWN; |
197 | this_cpu = &default_cpu; | 201 | this_cpu = &default_cpu; |
198 | } | 202 | } |
199 | 203 | ||
200 | static void __init early_cpu_support_print(void) | ||
201 | { | ||
202 | int i,j; | ||
203 | struct cpu_dev *cpu_devx; | ||
204 | |||
205 | printk("KERNEL supported cpus:\n"); | ||
206 | for (i = 0; i < X86_VENDOR_NUM; i++) { | ||
207 | cpu_devx = cpu_devs[i]; | ||
208 | if (!cpu_devx) | ||
209 | continue; | ||
210 | for (j = 0; j < 2; j++) { | ||
211 | if (!cpu_devx->c_ident[j]) | ||
212 | continue; | ||
213 | printk(" %s %s\n", cpu_devx->c_vendor, | ||
214 | cpu_devx->c_ident[j]); | ||
215 | } | ||
216 | } | ||
217 | } | ||
218 | |||
219 | void __cpuinit cpu_detect(struct cpuinfo_x86 *c) | 204 | void __cpuinit cpu_detect(struct cpuinfo_x86 *c) |
220 | { | 205 | { |
221 | /* Get vendor name */ | 206 | /* Get vendor name */ |
@@ -306,21 +291,35 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) | |||
306 | 291 | ||
307 | get_cpu_cap(c); | 292 | get_cpu_cap(c); |
308 | 293 | ||
309 | if (c->x86_vendor != X86_VENDOR_UNKNOWN && | 294 | if (this_cpu->c_early_init) |
310 | cpu_devs[c->x86_vendor]->c_early_init) | 295 | this_cpu->c_early_init(c); |
311 | cpu_devs[c->x86_vendor]->c_early_init(c); | ||
312 | 296 | ||
313 | validate_pat_support(c); | 297 | validate_pat_support(c); |
314 | } | 298 | } |
315 | 299 | ||
316 | void __init early_cpu_init(void) | 300 | void __init early_cpu_init(void) |
317 | { | 301 | { |
318 | struct cpu_vendor_dev *cvdev; | 302 | struct cpu_dev **cdev; |
303 | int count = 0; | ||
304 | |||
305 | printk("KERNEL supported cpus:\n"); | ||
306 | for (cdev = __x86_cpu_dev_start; cdev < __x86_cpu_dev_end; cdev++) { | ||
307 | struct cpu_dev *cpudev = *cdev; | ||
308 | unsigned int j; | ||
319 | 309 | ||
320 | for (cvdev = __x86cpuvendor_start; cvdev < __x86cpuvendor_end; cvdev++) | 310 | if (count >= X86_VENDOR_NUM) |
321 | cpu_devs[cvdev->vendor] = cvdev->cpu_dev; | 311 | break; |
312 | cpu_devs[count] = cpudev; | ||
313 | count++; | ||
314 | |||
315 | for (j = 0; j < 2; j++) { | ||
316 | if (!cpudev->c_ident[j]) | ||
317 | continue; | ||
318 | printk(" %s %s\n", cpudev->c_vendor, | ||
319 | cpudev->c_ident[j]); | ||
320 | } | ||
321 | } | ||
322 | 322 | ||
323 | early_cpu_support_print(); | ||
324 | early_identify_cpu(&boot_cpu_data); | 323 | early_identify_cpu(&boot_cpu_data); |
325 | } | 324 | } |
326 | 325 | ||