x86-32: Make AT_VECTOR_SIZE_ARCH=2
[deliverable/linux.git] / arch / x86 / kernel / apic / probe_32.c
CommitLineData
9b0c5028 1/*
7b387253
IM
2 * Default generic APIC driver. This handles up to 8 CPUs.
3 *
9b0c5028
PC
4 * Copyright 2003 Andi Kleen, SuSE Labs.
5 * Subject to the GNU Public License, v.2
6 *
1da177e4 7 * Generic x86 APIC driver probe layer.
9b0c5028 8 */
1da177e4
LT
9#include <linux/threads.h>
10#include <linux/cpumask.h>
7d01d32d 11#include <linux/module.h>
1da177e4
LT
12#include <linux/string.h>
13#include <linux/kernel.h>
14#include <linux/ctype.h>
15#include <linux/init.h>
1a3f239d 16#include <linux/errno.h>
1da177e4
LT
17#include <asm/fixmap.h>
18#include <asm/mpspec.h>
19#include <asm/apicdef.h>
7b6aa335 20#include <asm/apic.h>
54ac14a8 21#include <asm/setup.h>
1da177e4 22
7b387253 23#include <linux/smp.h>
7b387253
IM
24#include <asm/ipi.h>
25
6bda2c8b
IM
26#include <linux/interrupt.h>
27#include <asm/acpi.h>
6bda2c8b 28#include <asm/e820.h>
6bda2c8b 29
6bda2c8b
IM
30#ifdef CONFIG_HOTPLUG_CPU
31#define DEFAULT_SEND_IPI (1)
32#else
33#define DEFAULT_SEND_IPI (0)
34#endif
35
36int no_broadcast = DEFAULT_SEND_IPI;
37
9be1b56a
IM
38static __init int no_ipi_broadcast(char *str)
39{
40 get_option(&str, &no_broadcast);
41 pr_info("Using %s mode\n",
42 no_broadcast ? "No IPI Broadcast" : "IPI Broadcast");
43 return 1;
44}
45__setup("no_ipi_broadcast=", no_ipi_broadcast);
46
47static int __init print_ipi_mode(void)
48{
49 pr_info("Using IPI %s mode\n",
50 no_broadcast ? "No-Shortcut" : "Shortcut");
51 return 0;
52}
53late_initcall(print_ipi_mode);
6bda2c8b 54
28aa29ee
IM
55void default_setup_apic_routing(void)
56{
57#ifdef CONFIG_X86_IO_APIC
58 printk(KERN_INFO
59 "Enabling APIC mode: Flat. Using %d I/O APICs\n",
60 nr_ioapics);
61#endif
62}
63
7b387253
IM
64static void default_vector_allocation_domain(int cpu, struct cpumask *retmask)
65{
66 /*
67 * Careful. Some cpus do not strictly honor the set of cpus
68 * specified in the interrupt destination when using lowest
69 * priority interrupt delivery mode.
70 *
71 * In particular there was a hyperthreading cpu observed to
72 * deliver interrupts to the wrong hyperthread when only one
73 * hyperthread was specified in the interrupt desitination.
74 */
5c6cb5e2
RR
75 cpumask_clear(retmask);
76 cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
7b387253
IM
77}
78
79/* should be called last. */
80static int probe_default(void)
81{
82 return 1;
83}
84
be163a15 85struct apic apic_default = {
7b387253
IM
86
87 .name = "default",
88 .probe = probe_default,
89 .acpi_madt_oem_check = NULL,
90 .apic_id_registered = default_apic_id_registered,
91
92 .irq_delivery_mode = dest_LowestPrio,
93 /* logical delivery broadcast to all CPUs: */
94 .irq_dest_mode = 1,
95
96 .target_cpus = default_target_cpus,
97 .disable_esr = 0,
98 .dest_logical = APIC_DEST_LOGICAL,
99 .check_apicid_used = default_check_apicid_used,
100 .check_apicid_present = default_check_apicid_present,
101
102 .vector_allocation_domain = default_vector_allocation_domain,
103 .init_apic_ldr = default_init_apic_ldr,
104
105 .ioapic_phys_id_map = default_ioapic_phys_id_map,
106 .setup_apic_routing = default_setup_apic_routing,
107 .multi_timer_check = NULL,
108 .apicid_to_node = default_apicid_to_node,
109 .cpu_to_logical_apicid = default_cpu_to_logical_apicid,
110 .cpu_present_to_apicid = default_cpu_present_to_apicid,
7abc0753 111 .apicid_to_cpu_present = physid_set_mask_of_physid,
7b387253
IM
112 .setup_portio_remap = NULL,
113 .check_phys_apicid_present = default_check_phys_apicid_present,
114 .enable_apic_mode = NULL,
115 .phys_pkg_id = default_phys_pkg_id,
116 .mps_oem_check = NULL,
117
118 .get_apic_id = default_get_apic_id,
119 .set_apic_id = NULL,
120 .apic_id_mask = 0x0F << 24,
121
122 .cpu_mask_to_apicid = default_cpu_mask_to_apicid,
123 .cpu_mask_to_apicid_and = default_cpu_mask_to_apicid_and,
124
43f39890
YL
125 .send_IPI_mask = default_send_IPI_mask_logical,
126 .send_IPI_mask_allbutself = default_send_IPI_mask_allbutself_logical,
7b387253
IM
127 .send_IPI_allbutself = default_send_IPI_allbutself,
128 .send_IPI_all = default_send_IPI_all,
6b64ee02 129 .send_IPI_self = default_send_IPI_self,
7b387253 130
7b387253
IM
131 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
132 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
133
134 .wait_for_init_deassert = default_wait_for_init_deassert,
135
136 .smp_callin_clear_local_apic = NULL,
7b387253 137 .inquire_remote_apic = default_inquire_remote_apic,
c1eeb2de
YL
138
139 .read = native_apic_mem_read,
140 .write = native_apic_mem_write,
141 .icr_read = native_apic_icr_read,
142 .icr_write = native_apic_icr_write,
143 .wait_icr_idle = native_apic_wait_icr_idle,
144 .safe_wait_icr_idle = native_safe_apic_wait_icr_idle,
7b387253
IM
145};
146
be163a15
IM
147extern struct apic apic_numaq;
148extern struct apic apic_summit;
149extern struct apic apic_bigsmp;
150extern struct apic apic_es7000;
2b6163bf 151extern struct apic apic_es7000_cluster;
1da177e4 152
be163a15 153struct apic *apic = &apic_default;
7d01d32d 154EXPORT_SYMBOL_GPL(apic);
1da177e4 155
be163a15 156static struct apic *apic_probe[] __initdata = {
d49c4288
YL
157#ifdef CONFIG_X86_NUMAQ
158 &apic_numaq,
159#endif
160#ifdef CONFIG_X86_SUMMIT
1da177e4 161 &apic_summit,
d49c4288
YL
162#endif
163#ifdef CONFIG_X86_BIGSMP
9b0c5028 164 &apic_bigsmp,
d49c4288
YL
165#endif
166#ifdef CONFIG_X86_ES7000
1da177e4 167 &apic_es7000,
2b6163bf 168 &apic_es7000_cluster,
d49c4288 169#endif
1da177e4
LT
170 &apic_default, /* must be last */
171 NULL,
172};
173
1a3f239d
RR
174static int cmdline_apic __initdata;
175static int __init parse_apic(char *arg)
176{
177 int i;
178
179 if (!arg)
180 return -EINVAL;
181
182 for (i = 0; apic_probe[i]; i++) {
183 if (!strcmp(apic_probe[i]->name, arg)) {
c8d46cf0 184 apic = apic_probe[i];
1a3f239d
RR
185 cmdline_apic = 1;
186 return 0;
187 }
188 }
9a8cb626
AK
189
190 /* Parsed again by __setup for debug/verbose */
191 return 0;
1a3f239d
RR
192}
193early_param("apic", parse_apic);
911a62d4
VP
194
195void __init generic_bigsmp_probe(void)
196{
b20d70b7 197#ifdef CONFIG_X86_BIGSMP
911a62d4
VP
198 /*
199 * This routine is used to switch to bigsmp mode when
200 * - There is no apic= option specified by the user
27b46d76 201 * - generic_apic_probe() has chosen apic_default as the sub_arch
911a62d4
VP
202 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support
203 */
204
c8d46cf0 205 if (!cmdline_apic && apic == &apic_default) {
911a62d4 206 if (apic_bigsmp.probe()) {
c8d46cf0 207 apic = &apic_bigsmp;
911a62d4 208 printk(KERN_INFO "Overriding APIC driver with %s\n",
c8d46cf0 209 apic->name);
911a62d4 210 }
87f76065 211 }
d49c4288 212#endif
911a62d4
VP
213}
214
1a3f239d 215void __init generic_apic_probe(void)
9b0c5028 216{
1a3f239d
RR
217 if (!cmdline_apic) {
218 int i;
219 for (i = 0; apic_probe[i]; i++) {
220 if (apic_probe[i]->probe()) {
c8d46cf0 221 apic = apic_probe[i];
1a3f239d 222 break;
1da177e4
LT
223 }
224 }
1a3f239d
RR
225 /* Not visible without early console */
226 if (!apic_probe[i])
227 panic("Didn't find an APIC driver");
1da177e4 228 }
c8d46cf0 229 printk(KERN_INFO "Using APIC driver %s\n", apic->name);
9b0c5028 230}
1da177e4
LT
231
232/* These functions can switch the APIC even after the initial ->probe() */
233
9c764247
IM
234int __init
235generic_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
9b0c5028 236{
1da177e4 237 int i;
5f836405 238
9b0c5028 239 for (i = 0; apic_probe[i]; ++i) {
5f836405
IM
240 if (!apic_probe[i]->mps_oem_check)
241 continue;
242 if (!apic_probe[i]->mps_oem_check(mpc, oem, productid))
243 continue;
244
245 if (!cmdline_apic) {
246 apic = apic_probe[i];
5f836405
IM
247 printk(KERN_INFO "Switched to APIC driver `%s'.\n",
248 apic->name);
9b0c5028 249 }
5f836405 250 return 1;
9b0c5028 251 }
1da177e4 252 return 0;
9b0c5028 253}
1da177e4 254
306db03b 255int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
1da177e4
LT
256{
257 int i;
306db03b 258
9b0c5028 259 for (i = 0; apic_probe[i]; ++i) {
306db03b
IM
260 if (!apic_probe[i]->acpi_madt_oem_check)
261 continue;
262 if (!apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id))
263 continue;
264
265 if (!cmdline_apic) {
266 apic = apic_probe[i];
306db03b
IM
267 printk(KERN_INFO "Switched to APIC driver `%s'.\n",
268 apic->name);
9b0c5028 269 }
306db03b 270 return 1;
9b0c5028
PC
271 }
272 return 0;
1da177e4 273}
This page took 0.45285 seconds and 5 git commands to generate.