Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * APIC driver for the Unisys ES7000 chipset. |
| 3 | */ |
| 4 | #define APIC_DEFINITION 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #include <linux/threads.h> |
| 6 | #include <linux/cpumask.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/init.h> |
Yinghai Lu | c7e7964 | 2008-07-25 02:17:33 -0700 | [diff] [blame] | 14 | #include <asm/es7000/apicdef.h> |
Yinghai Lu | 4696ca5 | 2008-07-11 18:43:10 -0700 | [diff] [blame] | 15 | #include <linux/smp.h> |
Yinghai Lu | c7e7964 | 2008-07-25 02:17:33 -0700 | [diff] [blame] | 16 | #include <asm/es7000/apic.h> |
| 17 | #include <asm/es7000/ipi.h> |
| 18 | #include <asm/es7000/mpparse.h> |
Yinghai Lu | b5fe363 | 2008-11-18 08:14:14 -0800 | [diff] [blame] | 19 | #include <asm/mach-default/mach_wakecpu.h> |
| 20 | |
| 21 | void __init es7000_update_genapic_to_cluster(void) |
| 22 | { |
Ingo Molnar | c8d46cf | 2009-01-28 00:14:11 +0100 | [diff] [blame] | 23 | apic->target_cpus = target_cpus_cluster; |
Ingo Molnar | f8987a1 | 2009-01-28 04:02:31 +0100 | [diff] [blame] | 24 | apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER; |
| 25 | apic->irq_dest_mode = INT_DEST_MODE_CLUSTER; |
Yinghai Lu | b5fe363 | 2008-11-18 08:14:14 -0800 | [diff] [blame] | 26 | |
Ingo Molnar | a5c4329 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 27 | apic->init_apic_ldr = es7000_init_apic_ldr_cluster; |
Yinghai Lu | b5fe363 | 2008-11-18 08:14:14 -0800 | [diff] [blame] | 28 | |
Ingo Molnar | c8d46cf | 2009-01-28 00:14:11 +0100 | [diff] [blame] | 29 | apic->cpu_mask_to_apicid = cpu_mask_to_apicid_cluster; |
Yinghai Lu | b5fe363 | 2008-11-18 08:14:14 -0800 | [diff] [blame] | 30 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
Vivek Goyal | e96763d | 2007-01-11 01:52:44 +0100 | [diff] [blame] | 32 | static int probe_es7000(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | { |
| 34 | /* probed later in mptable/ACPI hooks */ |
| 35 | return 0; |
| 36 | } |
| 37 | |
Jaswinder Singh Rajput | f29521e | 2009-01-03 15:46:57 +0530 | [diff] [blame] | 38 | static __init int |
| 39 | mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 40 | { |
Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 41 | if (mpc->oemptr) { |
Jaswinder Singh Rajput | b0e239f | 2009-01-03 15:52:54 +0530 | [diff] [blame] | 42 | struct mpc_oemtable *oem_table = |
Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 43 | (struct mpc_oemtable *)mpc->oemptr; |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 44 | if (!strncmp(oem, "UNISYS", 6)) |
| 45 | return parse_unisys_oem((char *)oem_table); |
| 46 | } |
| 47 | return 0; |
| 48 | } |
| 49 | |
| 50 | #ifdef CONFIG_ACPI |
| 51 | /* Hook from generic ACPI tables.c */ |
Ingo Molnar | 306db03 | 2009-01-28 03:43:47 +0100 | [diff] [blame] | 52 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 53 | { |
Yinghai Lu | a73aaed | 2008-09-14 02:33:14 -0700 | [diff] [blame] | 54 | unsigned long oem_addr = 0; |
| 55 | int check_dsdt; |
| 56 | int ret = 0; |
| 57 | |
| 58 | /* check dsdt at first to avoid clear fix_map for oem_addr */ |
| 59 | check_dsdt = es7000_check_dsdt(); |
| 60 | |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 61 | if (!find_unisys_acpi_oem_table(&oem_addr)) { |
Yinghai Lu | a73aaed | 2008-09-14 02:33:14 -0700 | [diff] [blame] | 62 | if (check_dsdt) |
| 63 | ret = parse_unisys_oem((char *)oem_addr); |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 64 | else { |
| 65 | setup_unisys(); |
Yinghai Lu | a73aaed | 2008-09-14 02:33:14 -0700 | [diff] [blame] | 66 | ret = 1; |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 67 | } |
Yinghai Lu | a73aaed | 2008-09-14 02:33:14 -0700 | [diff] [blame] | 68 | /* |
| 69 | * we need to unmap it |
| 70 | */ |
| 71 | unmap_unisys_acpi_oem_table(oem_addr); |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 72 | } |
Yinghai Lu | a73aaed | 2008-09-14 02:33:14 -0700 | [diff] [blame] | 73 | return ret; |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 74 | } |
| 75 | #else |
Ingo Molnar | 306db03 | 2009-01-28 03:43:47 +0100 | [diff] [blame] | 76 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 77 | { |
| 78 | return 0; |
| 79 | } |
| 80 | #endif |
| 81 | |
Ingo Molnar | e2d40b1 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 82 | static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask) |
Yinghai Lu | 497c9a1 | 2008-08-19 20:50:28 -0700 | [diff] [blame] | 83 | { |
| 84 | /* Careful. Some cpus do not strictly honor the set of cpus |
| 85 | * specified in the interrupt destination when using lowest |
| 86 | * priority interrupt delivery mode. |
| 87 | * |
| 88 | * In particular there was a hyperthreading cpu observed to |
| 89 | * deliver interrupts to the wrong hyperthread when only one |
| 90 | * hyperthread was specified in the interrupt desitination. |
| 91 | */ |
Mike Travis | e798673 | 2008-12-16 17:33:52 -0800 | [diff] [blame] | 92 | *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; |
Yinghai Lu | 497c9a1 | 2008-08-19 20:50:28 -0700 | [diff] [blame] | 93 | } |
| 94 | |
Ingo Molnar | fed53eb | 2009-01-28 03:32:03 +0100 | [diff] [blame] | 95 | struct genapic apic_es7000 = { |
| 96 | |
| 97 | .name = "es7000", |
| 98 | .probe = probe_es7000, |
Ingo Molnar | 306db03 | 2009-01-28 03:43:47 +0100 | [diff] [blame] | 99 | .acpi_madt_oem_check = es7000_acpi_madt_oem_check, |
Ingo Molnar | 7ed248d | 2009-01-28 03:43:47 +0100 | [diff] [blame] | 100 | .apic_id_registered = es7000_apic_id_registered, |
Ingo Molnar | fed53eb | 2009-01-28 03:32:03 +0100 | [diff] [blame] | 101 | |
Ingo Molnar | 38bd77a | 2009-01-28 04:16:01 +0100 | [diff] [blame] | 102 | .irq_delivery_mode = dest_Fixed, |
| 103 | /* phys delivery to target CPUs: */ |
| 104 | .irq_dest_mode = 0, |
Ingo Molnar | fed53eb | 2009-01-28 03:32:03 +0100 | [diff] [blame] | 105 | |
Ingo Molnar | 0a9cc20 | 2009-01-28 04:30:40 +0100 | [diff] [blame] | 106 | .target_cpus = es7000_target_cpus, |
Ingo Molnar | 08125d3 | 2009-01-28 05:08:44 +0100 | [diff] [blame] | 107 | .disable_esr = 1, |
Ingo Molnar | bdb1a9b | 2009-01-28 05:29:25 +0100 | [diff] [blame] | 108 | .dest_logical = 0, |
Ingo Molnar | d1d7cae | 2009-01-28 05:41:42 +0100 | [diff] [blame] | 109 | .check_apicid_used = es7000_check_apicid_used, |
| 110 | .check_apicid_present = es7000_check_apicid_present, |
Ingo Molnar | fed53eb | 2009-01-28 03:32:03 +0100 | [diff] [blame] | 111 | |
Ingo Molnar | e2d40b1 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 112 | .vector_allocation_domain = es7000_vector_allocation_domain, |
Ingo Molnar | a5c4329 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 113 | .init_apic_ldr = es7000_init_apic_ldr, |
Ingo Molnar | fed53eb | 2009-01-28 03:32:03 +0100 | [diff] [blame] | 114 | |
Ingo Molnar | d190cb8 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 115 | .ioapic_phys_id_map = es7000_ioapic_phys_id_map, |
Ingo Molnar | 72ce016 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 116 | .setup_apic_routing = es7000_setup_apic_routing, |
Ingo Molnar | 33a201f | 2009-01-28 07:17:26 +0100 | [diff] [blame] | 117 | .multi_timer_check = NULL, |
Ingo Molnar | 3f57a31 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 118 | .apicid_to_node = es7000_apicid_to_node, |
Ingo Molnar | 5257c51 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 119 | .cpu_to_logical_apicid = es7000_cpu_to_logical_apicid, |
Ingo Molnar | a21769a4 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 120 | .cpu_present_to_apicid = es7000_cpu_present_to_apicid, |
Ingo Molnar | 8058714 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 121 | .apicid_to_cpu_present = es7000_apicid_to_cpu_present, |
Ingo Molnar | d83093b | 2009-01-28 12:43:18 +0100 | [diff] [blame] | 122 | .setup_portio_remap = NULL, |
Ingo Molnar | a27a621 | 2009-01-28 12:43:18 +0100 | [diff] [blame] | 123 | .check_phys_apicid_present = es7000_check_phys_apicid_present, |
Ingo Molnar | 4904033 | 2009-01-28 12:43:18 +0100 | [diff] [blame] | 124 | .enable_apic_mode = es7000_enable_apic_mode, |
Ingo Molnar | cb8cc44 | 2009-01-28 13:24:54 +0100 | [diff] [blame^] | 125 | .phys_pkg_id = es7000_phys_pkg_id, |
Ingo Molnar | fed53eb | 2009-01-28 03:32:03 +0100 | [diff] [blame] | 126 | .mps_oem_check = mps_oem_check, |
| 127 | |
| 128 | .get_apic_id = get_apic_id, |
| 129 | .set_apic_id = NULL, |
| 130 | .apic_id_mask = APIC_ID_MASK, |
| 131 | |
| 132 | .cpu_mask_to_apicid = cpu_mask_to_apicid, |
| 133 | .cpu_mask_to_apicid_and = cpu_mask_to_apicid_and, |
| 134 | |
| 135 | .send_IPI_mask = send_IPI_mask, |
| 136 | .send_IPI_mask_allbutself = NULL, |
| 137 | .send_IPI_allbutself = send_IPI_allbutself, |
| 138 | .send_IPI_all = send_IPI_all, |
| 139 | .send_IPI_self = NULL, |
| 140 | |
| 141 | .wakeup_cpu = NULL, |
| 142 | .trampoline_phys_low = TRAMPOLINE_PHYS_LOW, |
| 143 | .trampoline_phys_high = TRAMPOLINE_PHYS_HIGH, |
| 144 | .wait_for_init_deassert = wait_for_init_deassert, |
| 145 | .smp_callin_clear_local_apic = smp_callin_clear_local_apic, |
| 146 | .store_NMI_vector = store_NMI_vector, |
| 147 | .restore_NMI_vector = restore_NMI_vector, |
| 148 | .inquire_remote_apic = inquire_remote_apic, |
| 149 | }; |