blob: b70833e3597671097ec06cca779de504f0afecd6 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * APIC driver for the Unisys ES7000 chipset.
3 */
4#define APIC_DEFINITION 1
Linus Torvalds1da177e2005-04-16 15:20:36 -07005#include <linux/threads.h>
6#include <linux/cpumask.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/init.h>
Yinghai Luc7e79642008-07-25 02:17:33 -070014#include <asm/es7000/apicdef.h>
Yinghai Lu4696ca52008-07-11 18:43:10 -070015#include <linux/smp.h>
Yinghai Luc7e79642008-07-25 02:17:33 -070016#include <asm/es7000/apic.h>
17#include <asm/es7000/ipi.h>
18#include <asm/es7000/mpparse.h>
Yinghai Lub5fe3632008-11-18 08:14:14 -080019#include <asm/mach-default/mach_wakecpu.h>
20
21void __init es7000_update_genapic_to_cluster(void)
22{
Ingo Molnarc8d46cf2009-01-28 00:14:11 +010023 apic->target_cpus = target_cpus_cluster;
Ingo Molnarf8987a12009-01-28 04:02:31 +010024 apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER;
25 apic->irq_dest_mode = INT_DEST_MODE_CLUSTER;
Yinghai Lub5fe3632008-11-18 08:14:14 -080026
Ingo Molnara5c43292009-01-28 06:50:47 +010027 apic->init_apic_ldr = es7000_init_apic_ldr_cluster;
Yinghai Lub5fe3632008-11-18 08:14:14 -080028
Ingo Molnarc8d46cf2009-01-28 00:14:11 +010029 apic->cpu_mask_to_apicid = cpu_mask_to_apicid_cluster;
Yinghai Lub5fe3632008-11-18 08:14:14 -080030}
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
Vivek Goyale96763d2007-01-11 01:52:44 +010032static int probe_es7000(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070033{
34 /* probed later in mptable/ACPI hooks */
35 return 0;
36}
37
Vivek Goyal1833d6b2007-05-02 19:27:08 +020038extern void es7000_sw_apic(void);
39static void __init enable_apic_mode(void)
40{
41 es7000_sw_apic();
42 return;
43}
44
Jaswinder Singh Rajputf29521e2009-01-03 15:46:57 +053045static __init int
46mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
Vivek Goyal1833d6b2007-05-02 19:27:08 +020047{
Jaswinder Singh Rajput6c65da52009-01-04 22:22:56 +053048 if (mpc->oemptr) {
Jaswinder Singh Rajputb0e239f2009-01-03 15:52:54 +053049 struct mpc_oemtable *oem_table =
Jaswinder Singh Rajput6c65da52009-01-04 22:22:56 +053050 (struct mpc_oemtable *)mpc->oemptr;
Vivek Goyal1833d6b2007-05-02 19:27:08 +020051 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 */
Ingo Molnar306db032009-01-28 03:43:47 +010059static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
Vivek Goyal1833d6b2007-05-02 19:27:08 +020060{
Yinghai Lua73aaed2008-09-14 02:33:14 -070061 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
Vivek Goyal1833d6b2007-05-02 19:27:08 +020068 if (!find_unisys_acpi_oem_table(&oem_addr)) {
Yinghai Lua73aaed2008-09-14 02:33:14 -070069 if (check_dsdt)
70 ret = parse_unisys_oem((char *)oem_addr);
Vivek Goyal1833d6b2007-05-02 19:27:08 +020071 else {
72 setup_unisys();
Yinghai Lua73aaed2008-09-14 02:33:14 -070073 ret = 1;
Vivek Goyal1833d6b2007-05-02 19:27:08 +020074 }
Yinghai Lua73aaed2008-09-14 02:33:14 -070075 /*
76 * we need to unmap it
77 */
78 unmap_unisys_acpi_oem_table(oem_addr);
Vivek Goyal1833d6b2007-05-02 19:27:08 +020079 }
Yinghai Lua73aaed2008-09-14 02:33:14 -070080 return ret;
Vivek Goyal1833d6b2007-05-02 19:27:08 +020081}
82#else
Ingo Molnar306db032009-01-28 03:43:47 +010083static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
Vivek Goyal1833d6b2007-05-02 19:27:08 +020084{
85 return 0;
86}
87#endif
88
Ingo Molnare2d40b12009-01-28 06:50:47 +010089static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask)
Yinghai Lu497c9a12008-08-19 20:50:28 -070090{
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 */
Mike Travise7986732008-12-16 17:33:52 -080099 *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
Yinghai Lu497c9a12008-08-19 20:50:28 -0700100}
101
Ingo Molnarfed53eb2009-01-28 03:32:03 +0100102struct genapic apic_es7000 = {
103
104 .name = "es7000",
105 .probe = probe_es7000,
Ingo Molnar306db032009-01-28 03:43:47 +0100106 .acpi_madt_oem_check = es7000_acpi_madt_oem_check,
Ingo Molnar7ed248d2009-01-28 03:43:47 +0100107 .apic_id_registered = es7000_apic_id_registered,
Ingo Molnarfed53eb2009-01-28 03:32:03 +0100108
Ingo Molnar38bd77a2009-01-28 04:16:01 +0100109 .irq_delivery_mode = dest_Fixed,
110 /* phys delivery to target CPUs: */
111 .irq_dest_mode = 0,
Ingo Molnarfed53eb2009-01-28 03:32:03 +0100112
Ingo Molnar0a9cc202009-01-28 04:30:40 +0100113 .target_cpus = es7000_target_cpus,
Ingo Molnar08125d32009-01-28 05:08:44 +0100114 .disable_esr = 1,
Ingo Molnarbdb1a9b2009-01-28 05:29:25 +0100115 .dest_logical = 0,
Ingo Molnard1d7cae2009-01-28 05:41:42 +0100116 .check_apicid_used = es7000_check_apicid_used,
117 .check_apicid_present = es7000_check_apicid_present,
Ingo Molnarfed53eb2009-01-28 03:32:03 +0100118
Ingo Molnare2d40b12009-01-28 06:50:47 +0100119 .vector_allocation_domain = es7000_vector_allocation_domain,
Ingo Molnara5c43292009-01-28 06:50:47 +0100120 .init_apic_ldr = es7000_init_apic_ldr,
Ingo Molnarfed53eb2009-01-28 03:32:03 +0100121
122 .ioapic_phys_id_map = ioapic_phys_id_map,
123 .setup_apic_routing = setup_apic_routing,
124 .multi_timer_check = multi_timer_check,
125 .apicid_to_node = apicid_to_node,
126 .cpu_to_logical_apicid = cpu_to_logical_apicid,
127 .cpu_present_to_apicid = cpu_present_to_apicid,
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};