aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/common.c
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2008-02-15 06:00:23 -0500
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:40:47 -0400
commit03ae5768b6110ebaa97dc3e7abf1c3d8bec5f874 (patch)
treee9dffa8c5eccd43ea8284d7e2e48b782166bbcac /arch/x86/kernel/cpu/common.c
parentbc7c314d7048017caa0725b41cc577cccf4fc53b (diff)
x86: use ELF section to list CPU vendor specific code
Replace the hardcoded list of initialization functions for each CPU vendor by a list in an ELF section, which is read at initialization in arch/x86/kernel/cpu/cpu.c to fill the cpu_devs[] array. The ELF section, named .x86cpuvendor.init, is reclaimed after boot, and contains entries of type "struct cpu_vendor_dev" which associates a vendor number with a pointer to a "struct cpu_dev" structure. This first modification allows to remove all the VENDOR_init_cpu() functions. This patch also removes the hardcoded calls to early_init_amd() and early_init_intel(). Instead, we add a "c_early_init" member to the cpu_dev structure, which is then called if not NULL by the generic CPU initialization code. Unfortunately, in early_cpu_detect(), this_cpu is not yet set, so we have to use the cpu_devs[] array directly. This patch is part of the Linux Tiny project, and is needed for further patch that will allow to disable compilation of unused CPU support code. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/cpu/common.c')
-rw-r--r--arch/x86/kernel/cpu/common.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index a38aafaefc23..0fd6be154d5d 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -328,14 +328,9 @@ static void __init early_cpu_detect(void)
328 328
329 get_cpu_vendor(c, 1); 329 get_cpu_vendor(c, 1);
330 330
331 switch (c->x86_vendor) { 331 if (c->x86_vendor != X86_VENDOR_UNKNOWN &&
332 case X86_VENDOR_AMD: 332 cpu_devs[c->x86_vendor]->c_early_init)
333 early_init_amd(c); 333 cpu_devs[c->x86_vendor]->c_early_init(c);
334 break;
335 case X86_VENDOR_INTEL:
336 early_init_intel(c);
337 break;
338 }
339 334
340 early_get_cap(c); 335 early_get_cap(c);
341} 336}
@@ -616,23 +611,15 @@ __setup("clearcpuid=", setup_disablecpuid);
616 611
617cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; 612cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
618 613
619/* This is hacky. :)
620 * We're emulating future behavior.
621 * In the future, the cpu-specific init functions will be called implicitly
622 * via the magic of initcalls.
623 * They will insert themselves into the cpu_devs structure.
624 * Then, when cpu_init() is called, we can just iterate over that array.
625 */
626void __init early_cpu_init(void) 614void __init early_cpu_init(void)
627{ 615{
628 intel_cpu_init(); 616 struct cpu_vendor_dev *cvdev;
629 cyrix_init_cpu(); 617
630 nsc_init_cpu(); 618 for (cvdev = __x86cpuvendor_start ;
631 amd_init_cpu(); 619 cvdev < __x86cpuvendor_end ;
632 centaur_init_cpu(); 620 cvdev++)
633 transmeta_init_cpu(); 621 cpu_devs[cvdev->vendor] = cvdev->cpu_dev;
634 nexgen_init_cpu(); 622
635 umc_init_cpu();
636 early_cpu_detect(); 623 early_cpu_detect();
637} 624}
638 625