aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/mach-generic/probe.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/i386/mach-generic/probe.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/i386/mach-generic/probe.c')
-rw-r--r--arch/i386/mach-generic/probe.c102
1 files changed, 102 insertions, 0 deletions
diff --git a/arch/i386/mach-generic/probe.c b/arch/i386/mach-generic/probe.c
new file mode 100644
index 000000000000..5497c65a8790
--- /dev/null
+++ b/arch/i386/mach-generic/probe.c
@@ -0,0 +1,102 @@
1/* Copyright 2003 Andi Kleen, SuSE Labs.
2 * Subject to the GNU Public License, v.2
3 *
4 * Generic x86 APIC driver probe layer.
5 */
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>
17
18extern struct genapic apic_summit;
19extern struct genapic apic_bigsmp;
20extern struct genapic apic_es7000;
21extern struct genapic apic_default;
22
23struct genapic *genapic = &apic_default;
24
25struct genapic *apic_probe[] __initdata = {
26 &apic_summit,
27 &apic_bigsmp,
28 &apic_es7000,
29 &apic_default, /* must be last */
30 NULL,
31};
32
33void __init generic_apic_probe(char *command_line)
34{
35 char *s;
36 int i;
37 int changed = 0;
38
39 s = strstr(command_line, "apic=");
40 if (s && (s == command_line || isspace(s[-1]))) {
41 char *p = strchr(s, ' '), old;
42 if (!p)
43 p = strchr(s, '\0');
44 old = *p;
45 *p = 0;
46 for (i = 0; !changed && apic_probe[i]; i++) {
47 if (!strcmp(apic_probe[i]->name, s+5)) {
48 changed = 1;
49 genapic = apic_probe[i];
50 }
51 }
52 if (!changed)
53 printk(KERN_ERR "Unknown genapic `%s' specified.\n", s);
54 *p = old;
55 }
56 for (i = 0; !changed && apic_probe[i]; i++) {
57 if (apic_probe[i]->probe()) {
58 changed = 1;
59 genapic = apic_probe[i];
60 }
61 }
62 /* Not visible without early console */
63 if (!changed)
64 panic("Didn't find an APIC driver");
65
66 printk(KERN_INFO "Using APIC driver %s\n", genapic->name);
67}
68
69/* These functions can switch the APIC even after the initial ->probe() */
70
71int __init mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid)
72{
73 int i;
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",
78 genapic->name);
79 return 1;
80 }
81 }
82 return 0;
83}
84
85int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
86{
87 int i;
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",
92 genapic->name);
93 return 1;
94 }
95 }
96 return 0;
97}
98
99int hard_smp_processor_id(void)
100{
101 return genapic->get_apic_id(*(unsigned long *)(APIC_BASE+APIC_ID));
102}