1 /* Copyright 2003 Andi Kleen, SuSE Labs.
2 * Subject to the GNU Public License, v.2
4 * Generic x86 APIC driver probe layer.
6 #include <linux/config.h>
7 #include <linux/threads.h>
8 #include <linux/cpumask.h>
9 #include <linux/string.h>
10 #include <linux/kernel.h>
11 #include <linux/ctype.h>
12 #include <linux/init.h>
13 #include <asm/fixmap.h>
14 #include <asm/mpspec.h>
15 #include <asm/apicdef.h>
16 #include <asm/genapic.h>
18 extern struct genapic apic_summit;
19 extern struct genapic apic_bigsmp;
20 extern struct genapic apic_es7000;
21 extern struct genapic apic_default;
23 struct genapic *genapic = &apic_default;
25 struct genapic *apic_probe[] __initdata = {
29 &apic_default, /* must be last */
33 void __init generic_apic_probe(char *command_line)
39 s = strstr(command_line, "apic=");
40 if (s && (s == command_line || isspace(s[-1]))) {
41 char *p = strchr(s, ' '), old;
46 for (i = 0; !changed && apic_probe[i]; i++) {
47 if (!strcmp(apic_probe[i]->name, s+5)) {
49 genapic = apic_probe[i];
53 printk(KERN_ERR "Unknown genapic `%s' specified.\n", s);
56 for (i = 0; !changed && apic_probe[i]; i++) {
57 if (apic_probe[i]->probe()) {
59 genapic = apic_probe[i];
62 /* Not visible without early console */
64 panic("Didn't find an APIC driver");
66 printk(KERN_INFO "Using APIC driver %s\n", genapic->name);
69 /* These functions can switch the APIC even after the initial ->probe() */
71 int __init mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid)
74 for (i = 0; apic_probe[i]; ++i) {
75 if (apic_probe[i]->mps_oem_check(mpc,oem,productid)) {
76 genapic = apic_probe[i];
77 printk(KERN_INFO "Switched to APIC driver `%s'.\n",
85 int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
88 for (i = 0; apic_probe[i]; ++i) {
89 if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) {
90 genapic = apic_probe[i];
91 printk(KERN_INFO "Switched to APIC driver `%s'.\n",
99 int hard_smp_processor_id(void)
101 return genapic->get_apic_id(*(unsigned long *)(APIC_BASE+APIC_ID));