diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2006-12-06 20:14:08 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-12-06 20:14:08 -0500 |
commit | d7cd56111f30259e1b532a12e06f59f8e0a20355 (patch) | |
tree | 760e9548511ba30cf095f1873bcc9e301a89fa92 /arch | |
parent | 139ec7c416248b9ea227d21839235344edfee1e0 (diff) |
[PATCH] i386: cpu_detect extraction
Both lhype and Xen want to call the core of the x86 cpu detect code before
calling start_kernel.
(extracted from larger patch)
AK: folded in start_kernel header patch
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index cda41aef79ad..68bcb687019a 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -236,29 +236,14 @@ static int __cpuinit have_cpuid_p(void) | |||
236 | return flag_is_changeable_p(X86_EFLAGS_ID); | 236 | return flag_is_changeable_p(X86_EFLAGS_ID); |
237 | } | 237 | } |
238 | 238 | ||
239 | /* Do minimum CPU detection early. | 239 | void __init cpu_detect(struct cpuinfo_x86 *c) |
240 | Fields really needed: vendor, cpuid_level, family, model, mask, cache alignment. | ||
241 | The others are not touched to avoid unwanted side effects. | ||
242 | |||
243 | WARNING: this function is only called on the BP. Don't add code here | ||
244 | that is supposed to run on all CPUs. */ | ||
245 | static void __init early_cpu_detect(void) | ||
246 | { | 240 | { |
247 | struct cpuinfo_x86 *c = &boot_cpu_data; | ||
248 | |||
249 | c->x86_cache_alignment = 32; | ||
250 | |||
251 | if (!have_cpuid_p()) | ||
252 | return; | ||
253 | |||
254 | /* Get vendor name */ | 241 | /* Get vendor name */ |
255 | cpuid(0x00000000, &c->cpuid_level, | 242 | cpuid(0x00000000, &c->cpuid_level, |
256 | (int *)&c->x86_vendor_id[0], | 243 | (int *)&c->x86_vendor_id[0], |
257 | (int *)&c->x86_vendor_id[8], | 244 | (int *)&c->x86_vendor_id[8], |
258 | (int *)&c->x86_vendor_id[4]); | 245 | (int *)&c->x86_vendor_id[4]); |
259 | 246 | ||
260 | get_cpu_vendor(c, 1); | ||
261 | |||
262 | c->x86 = 4; | 247 | c->x86 = 4; |
263 | if (c->cpuid_level >= 0x00000001) { | 248 | if (c->cpuid_level >= 0x00000001) { |
264 | u32 junk, tfms, cap0, misc; | 249 | u32 junk, tfms, cap0, misc; |
@@ -275,6 +260,26 @@ static void __init early_cpu_detect(void) | |||
275 | } | 260 | } |
276 | } | 261 | } |
277 | 262 | ||
263 | /* Do minimum CPU detection early. | ||
264 | Fields really needed: vendor, cpuid_level, family, model, mask, cache alignment. | ||
265 | The others are not touched to avoid unwanted side effects. | ||
266 | |||
267 | WARNING: this function is only called on the BP. Don't add code here | ||
268 | that is supposed to run on all CPUs. */ | ||
269 | static void __init early_cpu_detect(void) | ||
270 | { | ||
271 | struct cpuinfo_x86 *c = &boot_cpu_data; | ||
272 | |||
273 | c->x86_cache_alignment = 32; | ||
274 | |||
275 | if (!have_cpuid_p()) | ||
276 | return; | ||
277 | |||
278 | cpu_detect(c); | ||
279 | |||
280 | get_cpu_vendor(c, 1); | ||
281 | } | ||
282 | |||
278 | static void __cpuinit generic_identify(struct cpuinfo_x86 * c) | 283 | static void __cpuinit generic_identify(struct cpuinfo_x86 * c) |
279 | { | 284 | { |
280 | u32 tfms, xlvl; | 285 | u32 tfms, xlvl; |