xref: /openbmc/linux/arch/x86/kernel/apic/probe_64.c (revision 9d87f5b6)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright 2004 James Cleverdon, IBM.
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  */
11 #include <linux/thread_info.h>
12 #include <asm/apic.h>
13 
14 #include "local.h"
15 
16 /* Select the appropriate APIC driver */
17 void __init x86_64_probe_apic(void)
18 {
19 	struct apic **drv;
20 
21 	enable_IR_x2apic();
22 
23 	for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) {
24 		if ((*drv)->probe && (*drv)->probe()) {
25 			if (apic != *drv) {
26 				apic = *drv;
27 				pr_info("Switched APIC routing to %s.\n",
28 					apic->name);
29 			}
30 			break;
31 		}
32 	}
33 }
34 
35 int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
36 {
37 	struct apic **drv;
38 
39 	for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) {
40 		if ((*drv)->acpi_madt_oem_check(oem_id, oem_table_id)) {
41 			if (apic != *drv) {
42 				apic = *drv;
43 				pr_info("Setting APIC routing to %s.\n",
44 					apic->name);
45 			}
46 			return 1;
47 		}
48 	}
49 	return 0;
50 }
51