Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * APIC driver for the Unisys ES7000 chipset. | |
3 | */ | |
4 | #define APIC_DEFINITION 1 | |
1da177e4 LT |
5 | #include <linux/threads.h> |
6 | #include <linux/cpumask.h> | |
7 | #include <asm/mpspec.h> | |
8 | #include <asm/genapic.h> | |
9 | #include <asm/fixmap.h> | |
10 | #include <asm/apicdef.h> | |
11 | #include <linux/kernel.h> | |
12 | #include <linux/string.h> | |
1da177e4 | 13 | #include <linux/init.h> |
c7e7964c | 14 | #include <asm/es7000/apicdef.h> |
4696ca5b | 15 | #include <linux/smp.h> |
c7e7964c YL |
16 | #include <asm/es7000/apic.h> |
17 | #include <asm/es7000/ipi.h> | |
18 | #include <asm/es7000/mpparse.h> | |
b5fe363b YL |
19 | #include <asm/mach-default/mach_wakecpu.h> |
20 | ||
21 | void __init es7000_update_genapic_to_cluster(void) | |
22 | { | |
c8d46cf0 | 23 | apic->target_cpus = target_cpus_cluster; |
f8987a10 IM |
24 | apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER; |
25 | apic->irq_dest_mode = INT_DEST_MODE_CLUSTER; | |
b5fe363b | 26 | |
a5c43296 | 27 | apic->init_apic_ldr = es7000_init_apic_ldr_cluster; |
b5fe363b | 28 | |
c8d46cf0 | 29 | apic->cpu_mask_to_apicid = cpu_mask_to_apicid_cluster; |
b5fe363b | 30 | } |
1da177e4 | 31 | |
e96763d6 | 32 | static int probe_es7000(void) |
1da177e4 LT |
33 | { |
34 | /* probed later in mptable/ACPI hooks */ | |
35 | return 0; | |
36 | } | |
37 | ||
1833d6bc VG |
38 | extern void es7000_sw_apic(void); |
39 | static void __init enable_apic_mode(void) | |
40 | { | |
41 | es7000_sw_apic(); | |
42 | return; | |
43 | } | |
44 | ||
f29521e4 JSR |
45 | static __init int |
46 | mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | |
1833d6bc | 47 | { |
6c65da50 | 48 | if (mpc->oemptr) { |
b0e239ff | 49 | struct mpc_oemtable *oem_table = |
6c65da50 | 50 | (struct mpc_oemtable *)mpc->oemptr; |
1833d6bc VG |
51 | if (!strncmp(oem, "UNISYS", 6)) |
52 | return parse_unisys_oem((char *)oem_table); | |
53 | } | |
54 | return 0; | |
55 | } | |
56 | ||
57 | #ifdef CONFIG_ACPI | |
58 | /* Hook from generic ACPI tables.c */ | |
306db03b | 59 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
1833d6bc | 60 | { |
a73aaedd YL |
61 | unsigned long oem_addr = 0; |
62 | int check_dsdt; | |
63 | int ret = 0; | |
64 | ||
65 | /* check dsdt at first to avoid clear fix_map for oem_addr */ | |
66 | check_dsdt = es7000_check_dsdt(); | |
67 | ||
1833d6bc | 68 | if (!find_unisys_acpi_oem_table(&oem_addr)) { |
a73aaedd YL |
69 | if (check_dsdt) |
70 | ret = parse_unisys_oem((char *)oem_addr); | |
1833d6bc VG |
71 | else { |
72 | setup_unisys(); | |
a73aaedd | 73 | ret = 1; |
1833d6bc | 74 | } |
a73aaedd YL |
75 | /* |
76 | * we need to unmap it | |
77 | */ | |
78 | unmap_unisys_acpi_oem_table(oem_addr); | |
1833d6bc | 79 | } |
a73aaedd | 80 | return ret; |
1833d6bc VG |
81 | } |
82 | #else | |
306db03b | 83 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
1833d6bc VG |
84 | { |
85 | return 0; | |
86 | } | |
87 | #endif | |
88 | ||
e2d40b18 | 89 | static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask) |
497c9a19 YL |
90 | { |
91 | /* Careful. Some cpus do not strictly honor the set of cpus | |
92 | * specified in the interrupt destination when using lowest | |
93 | * priority interrupt delivery mode. | |
94 | * | |
95 | * In particular there was a hyperthreading cpu observed to | |
96 | * deliver interrupts to the wrong hyperthread when only one | |
97 | * hyperthread was specified in the interrupt desitination. | |
98 | */ | |
e7986739 | 99 | *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; |
497c9a19 YL |
100 | } |
101 | ||
fed53ebf IM |
102 | struct genapic apic_es7000 = { |
103 | ||
104 | .name = "es7000", | |
105 | .probe = probe_es7000, | |
306db03b | 106 | .acpi_madt_oem_check = es7000_acpi_madt_oem_check, |
7ed248da | 107 | .apic_id_registered = es7000_apic_id_registered, |
fed53ebf | 108 | |
38bd77a6 IM |
109 | .irq_delivery_mode = dest_Fixed, |
110 | /* phys delivery to target CPUs: */ | |
111 | .irq_dest_mode = 0, | |
fed53ebf | 112 | |
0a9cc20b | 113 | .target_cpus = es7000_target_cpus, |
08125d3e | 114 | .disable_esr = 1, |
bdb1a9b6 | 115 | .dest_logical = 0, |
d1d7cae8 IM |
116 | .check_apicid_used = es7000_check_apicid_used, |
117 | .check_apicid_present = es7000_check_apicid_present, | |
fed53ebf | 118 | |
e2d40b18 | 119 | .vector_allocation_domain = es7000_vector_allocation_domain, |
a5c43296 | 120 | .init_apic_ldr = es7000_init_apic_ldr, |
fed53ebf | 121 | |
d190cb87 | 122 | .ioapic_phys_id_map = es7000_ioapic_phys_id_map, |
72ce0165 | 123 | .setup_apic_routing = es7000_setup_apic_routing, |
33a201fa | 124 | .multi_timer_check = NULL, |
3f57a318 | 125 | .apicid_to_node = es7000_apicid_to_node, |
5257c511 | 126 | .cpu_to_logical_apicid = es7000_cpu_to_logical_apicid, |
a21769a4 | 127 | .cpu_present_to_apicid = es7000_cpu_present_to_apicid, |
fed53ebf IM |
128 | .apicid_to_cpu_present = apicid_to_cpu_present, |
129 | .setup_portio_remap = setup_portio_remap, | |
130 | .check_phys_apicid_present = check_phys_apicid_present, | |
131 | .enable_apic_mode = enable_apic_mode, | |
132 | .phys_pkg_id = phys_pkg_id, | |
133 | .mps_oem_check = mps_oem_check, | |
134 | ||
135 | .get_apic_id = get_apic_id, | |
136 | .set_apic_id = NULL, | |
137 | .apic_id_mask = APIC_ID_MASK, | |
138 | ||
139 | .cpu_mask_to_apicid = cpu_mask_to_apicid, | |
140 | .cpu_mask_to_apicid_and = cpu_mask_to_apicid_and, | |
141 | ||
142 | .send_IPI_mask = send_IPI_mask, | |
143 | .send_IPI_mask_allbutself = NULL, | |
144 | .send_IPI_allbutself = send_IPI_allbutself, | |
145 | .send_IPI_all = send_IPI_all, | |
146 | .send_IPI_self = NULL, | |
147 | ||
148 | .wakeup_cpu = NULL, | |
149 | .trampoline_phys_low = TRAMPOLINE_PHYS_LOW, | |
150 | .trampoline_phys_high = TRAMPOLINE_PHYS_HIGH, | |
151 | .wait_for_init_deassert = wait_for_init_deassert, | |
152 | .smp_callin_clear_local_apic = smp_callin_clear_local_apic, | |
153 | .store_NMI_vector = store_NMI_vector, | |
154 | .restore_NMI_vector = restore_NMI_vector, | |
155 | .inquire_remote_apic = inquire_remote_apic, | |
156 | }; |