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 | { |
| 23 | genapic->target_cpus = target_cpus_cluster; |
| 24 | genapic->int_delivery_mode = INT_DELIVERY_MODE_CLUSTER; |
| 25 | genapic->int_dest_mode = INT_DEST_MODE_CLUSTER; |
| 26 | genapic->no_balance_irq = NO_BALANCE_IRQ_CLUSTER; |
| 27 | |
| 28 | genapic->init_apic_ldr = init_apic_ldr_cluster; |
| 29 | |
| 30 | genapic->cpu_mask_to_apicid = cpu_mask_to_apicid_cluster; |
| 31 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | |
Vivek Goyal | e96763d | 2007-01-11 01:52:44 +0100 | [diff] [blame] | 33 | static int probe_es7000(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | { |
| 35 | /* probed later in mptable/ACPI hooks */ |
| 36 | return 0; |
| 37 | } |
| 38 | |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 39 | extern void es7000_sw_apic(void); |
| 40 | static void __init enable_apic_mode(void) |
| 41 | { |
| 42 | es7000_sw_apic(); |
| 43 | return; |
| 44 | } |
| 45 | |
Jaswinder Singh Rajput | f29521e | 2009-01-03 15:46:57 +0530 | [diff] [blame] | 46 | static __init int |
| 47 | mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 48 | { |
Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 49 | if (mpc->oemptr) { |
Jaswinder Singh Rajput | b0e239f | 2009-01-03 15:52:54 +0530 | [diff] [blame] | 50 | struct mpc_oemtable *oem_table = |
Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 51 | (struct mpc_oemtable *)mpc->oemptr; |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 52 | if (!strncmp(oem, "UNISYS", 6)) |
| 53 | return parse_unisys_oem((char *)oem_table); |
| 54 | } |
| 55 | return 0; |
| 56 | } |
| 57 | |
| 58 | #ifdef CONFIG_ACPI |
| 59 | /* Hook from generic ACPI tables.c */ |
| 60 | static int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
| 61 | { |
Yinghai Lu | a73aaed | 2008-09-14 02:33:14 -0700 | [diff] [blame] | 62 | unsigned long oem_addr = 0; |
| 63 | int check_dsdt; |
| 64 | int ret = 0; |
| 65 | |
| 66 | /* check dsdt at first to avoid clear fix_map for oem_addr */ |
| 67 | check_dsdt = es7000_check_dsdt(); |
| 68 | |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 69 | if (!find_unisys_acpi_oem_table(&oem_addr)) { |
Yinghai Lu | a73aaed | 2008-09-14 02:33:14 -0700 | [diff] [blame] | 70 | if (check_dsdt) |
| 71 | ret = parse_unisys_oem((char *)oem_addr); |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 72 | else { |
| 73 | setup_unisys(); |
Yinghai Lu | a73aaed | 2008-09-14 02:33:14 -0700 | [diff] [blame] | 74 | ret = 1; |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 75 | } |
Yinghai Lu | a73aaed | 2008-09-14 02:33:14 -0700 | [diff] [blame] | 76 | /* |
| 77 | * we need to unmap it |
| 78 | */ |
| 79 | unmap_unisys_acpi_oem_table(oem_addr); |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 80 | } |
Yinghai Lu | a73aaed | 2008-09-14 02:33:14 -0700 | [diff] [blame] | 81 | return ret; |
Vivek Goyal | 1833d6b | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 82 | } |
| 83 | #else |
| 84 | static int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
| 85 | { |
| 86 | return 0; |
| 87 | } |
| 88 | #endif |
| 89 | |
Mike Travis | e798673 | 2008-12-16 17:33:52 -0800 | [diff] [blame] | 90 | static void vector_allocation_domain(int cpu, cpumask_t *retmask) |
Yinghai Lu | 497c9a1 | 2008-08-19 20:50:28 -0700 | [diff] [blame] | 91 | { |
| 92 | /* Careful. Some cpus do not strictly honor the set of cpus |
| 93 | * specified in the interrupt destination when using lowest |
| 94 | * priority interrupt delivery mode. |
| 95 | * |
| 96 | * In particular there was a hyperthreading cpu observed to |
| 97 | * deliver interrupts to the wrong hyperthread when only one |
| 98 | * hyperthread was specified in the interrupt desitination. |
| 99 | */ |
Mike Travis | e798673 | 2008-12-16 17:33:52 -0800 | [diff] [blame] | 100 | *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; |
Yinghai Lu | 497c9a1 | 2008-08-19 20:50:28 -0700 | [diff] [blame] | 101 | } |
| 102 | |
Sam Ravnborg | d3ab785 | 2007-06-03 00:05:10 +0200 | [diff] [blame] | 103 | struct genapic __initdata_refok apic_es7000 = APIC_INIT("es7000", probe_es7000); |