diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:16:39 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:16:39 -0400 |
commit | c750a66b0ebfcd8f4cb353ab37b286c8cd93ad10 (patch) | |
tree | a97f03edb6b38ffa69160b6f9ae5291138b2b231 /arch/x86 | |
parent | c2b84d8d1a66a0a886de51f1bfef5c4f16c0c784 (diff) |
i386: move mach-generic
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/mach-generic/Makefile | 8 | ||||
-rw-r--r-- | arch/x86/mach-generic/bigsmp.c | 57 | ||||
-rw-r--r-- | arch/x86/mach-generic/default.c | 26 | ||||
-rw-r--r-- | arch/x86/mach-generic/es7000.c | 69 | ||||
-rw-r--r-- | arch/x86/mach-generic/probe.c | 125 | ||||
-rw-r--r-- | arch/x86/mach-generic/summit.c | 27 |
6 files changed, 312 insertions, 0 deletions
diff --git a/arch/x86/mach-generic/Makefile b/arch/x86/mach-generic/Makefile new file mode 100644 index 000000000000..2f216f55b2dd --- /dev/null +++ b/arch/x86/mach-generic/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # | ||
2 | # Makefile for the generic architecture | ||
3 | # | ||
4 | |||
5 | EXTRA_CFLAGS := -Iarch/i386/kernel | ||
6 | |||
7 | obj-y := probe.o summit.o bigsmp.o es7000.o default.o | ||
8 | obj-y += ../../i386/mach-es7000/ | ||
diff --git a/arch/x86/mach-generic/bigsmp.c b/arch/x86/mach-generic/bigsmp.c new file mode 100644 index 000000000000..58a477baec30 --- /dev/null +++ b/arch/x86/mach-generic/bigsmp.c | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * APIC driver for "bigsmp" XAPIC machines with more than 8 virtual CPUs. | ||
3 | * Drives the local APIC in "clustered mode". | ||
4 | */ | ||
5 | #define APIC_DEFINITION 1 | ||
6 | #include <linux/threads.h> | ||
7 | #include <linux/cpumask.h> | ||
8 | #include <asm/smp.h> | ||
9 | #include <asm/mpspec.h> | ||
10 | #include <asm/genapic.h> | ||
11 | #include <asm/fixmap.h> | ||
12 | #include <asm/apicdef.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/smp.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/dmi.h> | ||
17 | #include <asm/mach-bigsmp/mach_apic.h> | ||
18 | #include <asm/mach-bigsmp/mach_apicdef.h> | ||
19 | #include <asm/mach-bigsmp/mach_ipi.h> | ||
20 | #include <asm/mach-default/mach_mpparse.h> | ||
21 | |||
22 | static int dmi_bigsmp; /* can be set by dmi scanners */ | ||
23 | |||
24 | static int hp_ht_bigsmp(struct dmi_system_id *d) | ||
25 | { | ||
26 | #ifdef CONFIG_X86_GENERICARCH | ||
27 | printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); | ||
28 | dmi_bigsmp = 1; | ||
29 | #endif | ||
30 | return 0; | ||
31 | } | ||
32 | |||
33 | |||
34 | static struct dmi_system_id bigsmp_dmi_table[] = { | ||
35 | { hp_ht_bigsmp, "HP ProLiant DL760 G2", { | ||
36 | DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | ||
37 | DMI_MATCH(DMI_BIOS_VERSION, "P44-"), | ||
38 | }}, | ||
39 | |||
40 | { hp_ht_bigsmp, "HP ProLiant DL740", { | ||
41 | DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | ||
42 | DMI_MATCH(DMI_BIOS_VERSION, "P47-"), | ||
43 | }}, | ||
44 | { } | ||
45 | }; | ||
46 | |||
47 | |||
48 | static int probe_bigsmp(void) | ||
49 | { | ||
50 | if (def_to_bigsmp) | ||
51 | dmi_bigsmp = 1; | ||
52 | else | ||
53 | dmi_check_system(bigsmp_dmi_table); | ||
54 | return dmi_bigsmp; | ||
55 | } | ||
56 | |||
57 | struct genapic apic_bigsmp = APIC_INIT("bigsmp", probe_bigsmp); | ||
diff --git a/arch/x86/mach-generic/default.c b/arch/x86/mach-generic/default.c new file mode 100644 index 000000000000..8685208d8512 --- /dev/null +++ b/arch/x86/mach-generic/default.c | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Default generic APIC driver. This handles upto 8 CPUs. | ||
3 | */ | ||
4 | #define APIC_DEFINITION 1 | ||
5 | #include <linux/threads.h> | ||
6 | #include <linux/cpumask.h> | ||
7 | #include <asm/mpspec.h> | ||
8 | #include <asm/mach-default/mach_apicdef.h> | ||
9 | #include <asm/genapic.h> | ||
10 | #include <asm/fixmap.h> | ||
11 | #include <asm/apicdef.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/string.h> | ||
14 | #include <linux/smp.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <asm/mach-default/mach_apic.h> | ||
17 | #include <asm/mach-default/mach_ipi.h> | ||
18 | #include <asm/mach-default/mach_mpparse.h> | ||
19 | |||
20 | /* should be called last. */ | ||
21 | static int probe_default(void) | ||
22 | { | ||
23 | return 1; | ||
24 | } | ||
25 | |||
26 | struct genapic apic_default = APIC_INIT("default", probe_default); | ||
diff --git a/arch/x86/mach-generic/es7000.c b/arch/x86/mach-generic/es7000.c new file mode 100644 index 000000000000..4742626f08c4 --- /dev/null +++ b/arch/x86/mach-generic/es7000.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * APIC driver for the Unisys ES7000 chipset. | ||
3 | */ | ||
4 | #define APIC_DEFINITION 1 | ||
5 | #include <linux/threads.h> | ||
6 | #include <linux/cpumask.h> | ||
7 | #include <asm/smp.h> | ||
8 | #include <asm/mpspec.h> | ||
9 | #include <asm/genapic.h> | ||
10 | #include <asm/fixmap.h> | ||
11 | #include <asm/apicdef.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/string.h> | ||
14 | #include <linux/smp.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <asm/mach-es7000/mach_apicdef.h> | ||
17 | #include <asm/mach-es7000/mach_apic.h> | ||
18 | #include <asm/mach-es7000/mach_ipi.h> | ||
19 | #include <asm/mach-es7000/mach_mpparse.h> | ||
20 | #include <asm/mach-es7000/mach_wakecpu.h> | ||
21 | |||
22 | static int probe_es7000(void) | ||
23 | { | ||
24 | /* probed later in mptable/ACPI hooks */ | ||
25 | return 0; | ||
26 | } | ||
27 | |||
28 | extern void es7000_sw_apic(void); | ||
29 | static void __init enable_apic_mode(void) | ||
30 | { | ||
31 | es7000_sw_apic(); | ||
32 | return; | ||
33 | } | ||
34 | |||
35 | static __init int mps_oem_check(struct mp_config_table *mpc, char *oem, | ||
36 | char *productid) | ||
37 | { | ||
38 | if (mpc->mpc_oemptr) { | ||
39 | struct mp_config_oemtable *oem_table = | ||
40 | (struct mp_config_oemtable *)mpc->mpc_oemptr; | ||
41 | if (!strncmp(oem, "UNISYS", 6)) | ||
42 | return parse_unisys_oem((char *)oem_table); | ||
43 | } | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | #ifdef CONFIG_ACPI | ||
48 | /* Hook from generic ACPI tables.c */ | ||
49 | static int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
50 | { | ||
51 | unsigned long oem_addr; | ||
52 | if (!find_unisys_acpi_oem_table(&oem_addr)) { | ||
53 | if (es7000_check_dsdt()) | ||
54 | return parse_unisys_oem((char *)oem_addr); | ||
55 | else { | ||
56 | setup_unisys(); | ||
57 | return 1; | ||
58 | } | ||
59 | } | ||
60 | return 0; | ||
61 | } | ||
62 | #else | ||
63 | static int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
64 | { | ||
65 | return 0; | ||
66 | } | ||
67 | #endif | ||
68 | |||
69 | struct genapic __initdata_refok apic_es7000 = APIC_INIT("es7000", probe_es7000); | ||
diff --git a/arch/x86/mach-generic/probe.c b/arch/x86/mach-generic/probe.c new file mode 100644 index 000000000000..74f3da634423 --- /dev/null +++ b/arch/x86/mach-generic/probe.c | |||
@@ -0,0 +1,125 @@ | |||
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/threads.h> | ||
7 | #include <linux/cpumask.h> | ||
8 | #include <linux/string.h> | ||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/ctype.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/errno.h> | ||
13 | #include <asm/fixmap.h> | ||
14 | #include <asm/mpspec.h> | ||
15 | #include <asm/apicdef.h> | ||
16 | #include <asm/genapic.h> | ||
17 | |||
18 | extern struct genapic apic_summit; | ||
19 | extern struct genapic apic_bigsmp; | ||
20 | extern struct genapic apic_es7000; | ||
21 | extern struct genapic apic_default; | ||
22 | |||
23 | struct genapic *genapic = &apic_default; | ||
24 | |||
25 | struct genapic *apic_probe[] __initdata = { | ||
26 | &apic_summit, | ||
27 | &apic_bigsmp, | ||
28 | &apic_es7000, | ||
29 | &apic_default, /* must be last */ | ||
30 | NULL, | ||
31 | }; | ||
32 | |||
33 | static int cmdline_apic __initdata; | ||
34 | static int __init parse_apic(char *arg) | ||
35 | { | ||
36 | int i; | ||
37 | |||
38 | if (!arg) | ||
39 | return -EINVAL; | ||
40 | |||
41 | for (i = 0; apic_probe[i]; i++) { | ||
42 | if (!strcmp(apic_probe[i]->name, arg)) { | ||
43 | genapic = apic_probe[i]; | ||
44 | cmdline_apic = 1; | ||
45 | return 0; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | /* Parsed again by __setup for debug/verbose */ | ||
50 | return 0; | ||
51 | } | ||
52 | early_param("apic", parse_apic); | ||
53 | |||
54 | void __init generic_bigsmp_probe(void) | ||
55 | { | ||
56 | /* | ||
57 | * This routine is used to switch to bigsmp mode when | ||
58 | * - There is no apic= option specified by the user | ||
59 | * - generic_apic_probe() has choosen apic_default as the sub_arch | ||
60 | * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support | ||
61 | */ | ||
62 | |||
63 | if (!cmdline_apic && genapic == &apic_default) | ||
64 | if (apic_bigsmp.probe()) { | ||
65 | genapic = &apic_bigsmp; | ||
66 | printk(KERN_INFO "Overriding APIC driver with %s\n", | ||
67 | genapic->name); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | void __init generic_apic_probe(void) | ||
72 | { | ||
73 | if (!cmdline_apic) { | ||
74 | int i; | ||
75 | for (i = 0; apic_probe[i]; i++) { | ||
76 | if (apic_probe[i]->probe()) { | ||
77 | genapic = apic_probe[i]; | ||
78 | break; | ||
79 | } | ||
80 | } | ||
81 | /* Not visible without early console */ | ||
82 | if (!apic_probe[i]) | ||
83 | panic("Didn't find an APIC driver"); | ||
84 | } | ||
85 | printk(KERN_INFO "Using APIC driver %s\n", genapic->name); | ||
86 | } | ||
87 | |||
88 | /* These functions can switch the APIC even after the initial ->probe() */ | ||
89 | |||
90 | int __init mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid) | ||
91 | { | ||
92 | int i; | ||
93 | for (i = 0; apic_probe[i]; ++i) { | ||
94 | if (apic_probe[i]->mps_oem_check(mpc,oem,productid)) { | ||
95 | if (!cmdline_apic) { | ||
96 | genapic = apic_probe[i]; | ||
97 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | ||
98 | genapic->name); | ||
99 | } | ||
100 | return 1; | ||
101 | } | ||
102 | } | ||
103 | return 0; | ||
104 | } | ||
105 | |||
106 | int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
107 | { | ||
108 | int i; | ||
109 | for (i = 0; apic_probe[i]; ++i) { | ||
110 | if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) { | ||
111 | if (!cmdline_apic) { | ||
112 | genapic = apic_probe[i]; | ||
113 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | ||
114 | genapic->name); | ||
115 | } | ||
116 | return 1; | ||
117 | } | ||
118 | } | ||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | int hard_smp_processor_id(void) | ||
123 | { | ||
124 | return genapic->get_apic_id(*(unsigned long *)(APIC_BASE+APIC_ID)); | ||
125 | } | ||
diff --git a/arch/x86/mach-generic/summit.c b/arch/x86/mach-generic/summit.c new file mode 100644 index 000000000000..74883ccb8f73 --- /dev/null +++ b/arch/x86/mach-generic/summit.c | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * APIC driver for the IBM "Summit" chipset. | ||
3 | */ | ||
4 | #define APIC_DEFINITION 1 | ||
5 | #include <linux/threads.h> | ||
6 | #include <linux/cpumask.h> | ||
7 | #include <asm/smp.h> | ||
8 | #include <asm/mpspec.h> | ||
9 | #include <asm/genapic.h> | ||
10 | #include <asm/fixmap.h> | ||
11 | #include <asm/apicdef.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/string.h> | ||
14 | #include <linux/smp.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <asm/mach-summit/mach_apic.h> | ||
17 | #include <asm/mach-summit/mach_apicdef.h> | ||
18 | #include <asm/mach-summit/mach_ipi.h> | ||
19 | #include <asm/mach-summit/mach_mpparse.h> | ||
20 | |||
21 | static int probe_summit(void) | ||
22 | { | ||
23 | /* probed later in mptable/ACPI hooks */ | ||
24 | return 0; | ||
25 | } | ||
26 | |||
27 | struct genapic apic_summit = APIC_INIT("summit", probe_summit); | ||