diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2011-05-20 20:51:18 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-05-22 05:48:03 -0400 |
commit | 8b37e88061e229e78959fe3257649fd5ce05f8af (patch) | |
tree | 4c58ea023a554c1bec8be80f7fd4045a4747a09f /arch/x86/kernel | |
parent | 107e0e0cd85beeee05af7ea374fda14d037ee500 (diff) |
x86, apic: Use .apicdrivers section for the apic drivers list
This will eliminate the need for apic_probe[], as the probing
now will happen based on the apic drivers order in the
.apcidrivers section.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: steiner@sgi.com
Cc: gorcunov@openvz.org
Cc: yinghai@kernel.org
Link: http://lkml.kernel.org/r/20110521005526.164277071@sbsiddha-MOBL3.sc.intel.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/apic/probe_32.c | 39 | ||||
-rw-r--r-- | arch/x86/kernel/apic/probe_64.c | 28 |
2 files changed, 36 insertions, 31 deletions
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c index a319b33cfc14..8796e1d25f0c 100644 --- a/arch/x86/kernel/apic/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c | |||
@@ -206,14 +206,14 @@ static struct apic *apic_probe[] __initdata = { | |||
206 | static int cmdline_apic __initdata; | 206 | static int cmdline_apic __initdata; |
207 | static int __init parse_apic(char *arg) | 207 | static int __init parse_apic(char *arg) |
208 | { | 208 | { |
209 | int i; | 209 | struct apic **drv; |
210 | 210 | ||
211 | if (!arg) | 211 | if (!arg) |
212 | return -EINVAL; | 212 | return -EINVAL; |
213 | 213 | ||
214 | for (i = 0; apic_probe[i]; i++) { | 214 | for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) { |
215 | if (!strcmp(apic_probe[i]->name, arg)) { | 215 | if (!strcmp((*drv)->name, arg)) { |
216 | apic = apic_probe[i]; | 216 | apic = *drv; |
217 | cmdline_apic = 1; | 217 | cmdline_apic = 1; |
218 | return 0; | 218 | return 0; |
219 | } | 219 | } |
@@ -247,15 +247,16 @@ void __init generic_bigsmp_probe(void) | |||
247 | void __init generic_apic_probe(void) | 247 | void __init generic_apic_probe(void) |
248 | { | 248 | { |
249 | if (!cmdline_apic) { | 249 | if (!cmdline_apic) { |
250 | int i; | 250 | struct apic **drv; |
251 | for (i = 0; apic_probe[i]; i++) { | 251 | |
252 | if (apic_probe[i]->probe()) { | 252 | for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) { |
253 | apic = apic_probe[i]; | 253 | if ((*drv)->probe()) { |
254 | apic = *drv; | ||
254 | break; | 255 | break; |
255 | } | 256 | } |
256 | } | 257 | } |
257 | /* Not visible without early console */ | 258 | /* Not visible without early console */ |
258 | if (!apic_probe[i]) | 259 | if (drv == __apicdrivers_end) |
259 | panic("Didn't find an APIC driver"); | 260 | panic("Didn't find an APIC driver"); |
260 | } | 261 | } |
261 | printk(KERN_INFO "Using APIC driver %s\n", apic->name); | 262 | printk(KERN_INFO "Using APIC driver %s\n", apic->name); |
@@ -266,16 +267,16 @@ void __init generic_apic_probe(void) | |||
266 | int __init | 267 | int __init |
267 | generic_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | 268 | generic_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) |
268 | { | 269 | { |
269 | int i; | 270 | struct apic **drv; |
270 | 271 | ||
271 | for (i = 0; apic_probe[i]; ++i) { | 272 | for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) { |
272 | if (!apic_probe[i]->mps_oem_check) | 273 | if (!((*drv)->mps_oem_check)) |
273 | continue; | 274 | continue; |
274 | if (!apic_probe[i]->mps_oem_check(mpc, oem, productid)) | 275 | if (!(*drv)->mps_oem_check(mpc, oem, productid)) |
275 | continue; | 276 | continue; |
276 | 277 | ||
277 | if (!cmdline_apic) { | 278 | if (!cmdline_apic) { |
278 | apic = apic_probe[i]; | 279 | apic = *drv; |
279 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | 280 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", |
280 | apic->name); | 281 | apic->name); |
281 | } | 282 | } |
@@ -286,16 +287,16 @@ generic_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | |||
286 | 287 | ||
287 | int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | 288 | int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
288 | { | 289 | { |
289 | int i; | 290 | struct apic **drv; |
290 | 291 | ||
291 | for (i = 0; apic_probe[i]; ++i) { | 292 | for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) { |
292 | if (!apic_probe[i]->acpi_madt_oem_check) | 293 | if (!(*drv)->acpi_madt_oem_check) |
293 | continue; | 294 | continue; |
294 | if (!apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) | 295 | if (!(*drv)->acpi_madt_oem_check(oem_id, oem_table_id)) |
295 | continue; | 296 | continue; |
296 | 297 | ||
297 | if (!cmdline_apic) { | 298 | if (!cmdline_apic) { |
298 | apic = apic_probe[i]; | 299 | apic = *drv; |
299 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | 300 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", |
300 | apic->name); | 301 | apic->name); |
301 | } | 302 | } |
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c index 39fb42b51f6a..e2c361d0fb96 100644 --- a/arch/x86/kernel/apic/probe_64.c +++ b/arch/x86/kernel/apic/probe_64.c | |||
@@ -54,19 +54,21 @@ static int apicid_phys_pkg_id(int initial_apic_id, int index_msb) | |||
54 | */ | 54 | */ |
55 | void __init default_setup_apic_routing(void) | 55 | void __init default_setup_apic_routing(void) |
56 | { | 56 | { |
57 | int i; | 57 | struct apic **drv; |
58 | 58 | ||
59 | enable_IR_x2apic(); | 59 | enable_IR_x2apic(); |
60 | 60 | ||
61 | for (i = 0; apic_probe[i]; ++i) { | 61 | for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) { |
62 | if (apic_probe[i]->probe()) { | 62 | if ((*drv)->probe && (*drv)->probe()) { |
63 | apic = apic_probe[i]; | 63 | if (apic != *drv) { |
64 | apic = *drv; | ||
65 | pr_info("Switched APIC routing to %s.\n", | ||
66 | apic->name); | ||
67 | } | ||
64 | break; | 68 | break; |
65 | } | 69 | } |
66 | } | 70 | } |
67 | 71 | ||
68 | printk(KERN_INFO "APIC routing finalized to %s.\n", apic->name); | ||
69 | |||
70 | if (is_vsmp_box()) { | 72 | if (is_vsmp_box()) { |
71 | /* need to update phys_pkg_id */ | 73 | /* need to update phys_pkg_id */ |
72 | apic->phys_pkg_id = apicid_phys_pkg_id; | 74 | apic->phys_pkg_id = apicid_phys_pkg_id; |
@@ -82,13 +84,15 @@ void apic_send_IPI_self(int vector) | |||
82 | 84 | ||
83 | int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | 85 | int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
84 | { | 86 | { |
85 | int i; | 87 | struct apic **drv; |
86 | 88 | ||
87 | for (i = 0; apic_probe[i]; ++i) { | 89 | for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) { |
88 | if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) { | 90 | if ((*drv)->acpi_madt_oem_check(oem_id, oem_table_id)) { |
89 | apic = apic_probe[i]; | 91 | if (apic != *drv) { |
90 | printk(KERN_INFO "Setting APIC routing to %s.\n", | 92 | apic = *drv; |
91 | apic->name); | 93 | pr_info("Setting APIC routing to %s.\n", |
94 | apic->name); | ||
95 | } | ||
92 | return 1; | 96 | return 1; |
93 | } | 97 | } |
94 | } | 98 | } |