blob: 1793dba7a741bcf22271b71848fa92293bddde70 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright 2004 James Cleverdon, IBM.
3 * Subject to the GNU Public License, v.2
4 *
5 * Generic APIC sub-arch probe layer.
6 *
7 * Hacked for x86-64 by James Cleverdon from i386 architecture code by
8 * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
9 * James Cleverdon.
10 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/threads.h>
12#include <linux/cpumask.h>
13#include <linux/string.h>
Ingo Molnar07c7c472007-05-02 19:27:04 +020014#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/kernel.h>
16#include <linux/ctype.h>
17#include <linux/init.h>
Jack Steinerac23d4e2008-03-28 14:12:16 -050018#include <linux/hardirq.h>
Yinghai Lud25ae382008-07-25 19:39:03 -070019#include <linux/dmar.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
21#include <asm/smp.h>
Ingo Molnar7b6aa332009-02-17 13:58:15 +010022#include <asm/apic.h>
Yinghai Luc1eeb2d2009-02-16 23:02:14 -080023#include <asm/ipi.h>
Yinghai Lu54ac14a2008-11-17 15:19:53 -080024#include <asm/setup.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
Linus Torvalds1da177e2005-04-16 15:20:36 -070026/*
27 * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
28 */
Ingo Molnar72ce0162009-01-28 06:50:47 +010029void __init default_setup_apic_routing(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070030{
Suresh Siddha8b37e882011-05-20 17:51:18 -070031 struct apic **drv;
Suresh Siddhafa47f7e2010-08-27 11:09:50 -070032
33 enable_IR_x2apic();
34
Suresh Siddha8b37e882011-05-20 17:51:18 -070035 for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) {
36 if ((*drv)->probe && (*drv)->probe()) {
37 if (apic != *drv) {
38 apic = *drv;
39 pr_info("Switched APIC routing to %s.\n",
40 apic->name);
41 }
Suresh Siddha9ebd6802011-05-19 16:45:46 -070042 break;
43 }
Yinghai Lud25ae382008-07-25 19:39:03 -070044 }
45
Ido Yariv7db971b2012-06-03 01:11:34 +030046 if (x86_platform.apic_post_init)
47 x86_platform.apic_post_init();
Linus Torvalds1da177e2005-04-16 15:20:36 -070048}
49
Ingo Molnar07c7c472007-05-02 19:27:04 +020050/* Same for both flat and physical. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
Suresh Siddhacff73a62008-07-10 11:16:53 -070052void apic_send_IPI_self(int vector)
Linus Torvalds1da177e2005-04-16 15:20:36 -070053{
Ingo Molnardac5f412009-01-28 15:42:24 +010054 __default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
Linus Torvalds1da177e2005-04-16 15:20:36 -070055}
Jack Steinerae261862008-03-28 14:12:06 -050056
Ingo Molnar306db032009-01-28 03:43:47 +010057int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
Jack Steinerae261862008-03-28 14:12:06 -050058{
Suresh Siddha8b37e882011-05-20 17:51:18 -070059 struct apic **drv;
Yinghai Lu1b9b89e2008-07-21 22:08:21 -070060
Suresh Siddha8b37e882011-05-20 17:51:18 -070061 for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) {
62 if ((*drv)->acpi_madt_oem_check(oem_id, oem_table_id)) {
63 if (apic != *drv) {
64 apic = *drv;
65 pr_info("Setting APIC routing to %s.\n",
66 apic->name);
67 }
Yinghai Lu1b9b89e2008-07-21 22:08:21 -070068 return 1;
69 }
Jack Steinerae261862008-03-28 14:12:06 -050070 }
71 return 0;
72}