PRCM: 34XX: Fix wrong shift value used in dpll4_m4x2_ck enable bit
[linux-ginger.git] / arch / x86 / mach-generic / probe.c
blobc5ae751b994a317c32f086d59c2cf33f120b402e
1 /*
2 * Copyright 2003 Andi Kleen, SuSE Labs.
3 * Subject to the GNU Public License, v.2
5 * Generic x86 APIC driver probe layer.
6 */
7 #include <linux/threads.h>
8 #include <linux/cpumask.h>
9 #include <linux/string.h>
10 #include <linux/kernel.h>
11 #include <linux/ctype.h>
12 #include <linux/init.h>
13 #include <linux/errno.h>
14 #include <asm/fixmap.h>
15 #include <asm/mpspec.h>
16 #include <asm/apicdef.h>
17 #include <asm/genapic.h>
19 extern struct genapic apic_summit;
20 extern struct genapic apic_bigsmp;
21 extern struct genapic apic_es7000;
22 extern struct genapic apic_default;
24 struct genapic *genapic = &apic_default;
26 static struct genapic *apic_probe[] __initdata = {
27 &apic_summit,
28 &apic_bigsmp,
29 &apic_es7000,
30 &apic_default, /* must be last */
31 NULL,
34 static int cmdline_apic __initdata;
35 static int __init parse_apic(char *arg)
37 int i;
39 if (!arg)
40 return -EINVAL;
42 for (i = 0; apic_probe[i]; i++) {
43 if (!strcmp(apic_probe[i]->name, arg)) {
44 genapic = apic_probe[i];
45 cmdline_apic = 1;
46 return 0;
50 /* Parsed again by __setup for debug/verbose */
51 return 0;
53 early_param("apic", parse_apic);
55 void __init generic_bigsmp_probe(void)
58 * This routine is used to switch to bigsmp mode when
59 * - There is no apic= option specified by the user
60 * - generic_apic_probe() has chosen apic_default as the sub_arch
61 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support
64 if (!cmdline_apic && genapic == &apic_default)
65 if (apic_bigsmp.probe()) {
66 genapic = &apic_bigsmp;
67 printk(KERN_INFO "Overriding APIC driver with %s\n",
68 genapic->name);
72 void __init generic_apic_probe(void)
74 if (!cmdline_apic) {
75 int i;
76 for (i = 0; apic_probe[i]; i++) {
77 if (apic_probe[i]->probe()) {
78 genapic = apic_probe[i];
79 break;
82 /* Not visible without early console */
83 if (!apic_probe[i])
84 panic("Didn't find an APIC driver");
86 printk(KERN_INFO "Using APIC driver %s\n", genapic->name);
89 /* These functions can switch the APIC even after the initial ->probe() */
91 int __init mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid)
93 int i;
94 for (i = 0; apic_probe[i]; ++i) {
95 if (apic_probe[i]->mps_oem_check(mpc, oem, productid)) {
96 if (!cmdline_apic) {
97 genapic = apic_probe[i];
98 printk(KERN_INFO "Switched to APIC driver `%s'.\n",
99 genapic->name);
101 return 1;
104 return 0;
107 int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
109 int i;
110 for (i = 0; apic_probe[i]; ++i) {
111 if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) {
112 if (!cmdline_apic) {
113 genapic = apic_probe[i];
114 printk(KERN_INFO "Switched to APIC driver `%s'.\n",
115 genapic->name);
117 return 1;
120 return 0;
123 int hard_smp_processor_id(void)
125 return genapic->get_apic_id(*(unsigned long *)(APIC_BASE+APIC_ID));