Yinghai Lu | d49c428 | 2008-06-08 18:31:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * APIC driver for the IBM NUMAQ chipset. |
| 3 | */ |
| 4 | #define APIC_DEFINITION 1 |
| 5 | #include <linux/threads.h> |
| 6 | #include <linux/cpumask.h> |
Yinghai Lu | d49c428 | 2008-06-08 18:31:54 -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> |
| 13 | #include <linux/init.h> |
Yinghai Lu | edb181a | 2008-07-25 02:17:55 -0700 | [diff] [blame] | 14 | #include <asm/numaq/apicdef.h> |
Yinghai Lu | 4696ca5 | 2008-07-11 18:43:10 -0700 | [diff] [blame] | 15 | #include <linux/smp.h> |
Yinghai Lu | edb181a | 2008-07-25 02:17:55 -0700 | [diff] [blame] | 16 | #include <asm/numaq/apic.h> |
| 17 | #include <asm/numaq/ipi.h> |
| 18 | #include <asm/numaq/mpparse.h> |
| 19 | #include <asm/numaq/wakecpu.h> |
Yinghai Lu | d49c428 | 2008-06-08 18:31:54 -0700 | [diff] [blame] | 20 | #include <asm/numaq.h> |
| 21 | |
Jaswinder Singh Rajput | f29521e | 2009-01-03 15:46:57 +0530 | [diff] [blame] | 22 | static int mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) |
Yinghai Lu | d49c428 | 2008-06-08 18:31:54 -0700 | [diff] [blame] | 23 | { |
| 24 | numaq_mps_oem_check(mpc, oem, productid); |
| 25 | return found_numaq; |
| 26 | } |
| 27 | |
| 28 | static int probe_numaq(void) |
| 29 | { |
| 30 | /* already know from get_memcfg_numaq() */ |
| 31 | return found_numaq; |
| 32 | } |
| 33 | |
Ingo Molnar | e2d40b1 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 34 | static void numaq_vector_allocation_domain(int cpu, cpumask_t *retmask) |
Yinghai Lu | 497c9a1 | 2008-08-19 20:50:28 -0700 | [diff] [blame] | 35 | { |
| 36 | /* Careful. Some cpus do not strictly honor the set of cpus |
| 37 | * specified in the interrupt destination when using lowest |
| 38 | * priority interrupt delivery mode. |
| 39 | * |
| 40 | * In particular there was a hyperthreading cpu observed to |
| 41 | * deliver interrupts to the wrong hyperthread when only one |
| 42 | * hyperthread was specified in the interrupt desitination. |
| 43 | */ |
Mike Travis | e798673 | 2008-12-16 17:33:52 -0800 | [diff] [blame] | 44 | *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } }; |
Yinghai Lu | 497c9a1 | 2008-08-19 20:50:28 -0700 | [diff] [blame] | 45 | } |
| 46 | |
Ingo Molnar | d83093b | 2009-01-28 12:43:18 +0100 | [diff] [blame] | 47 | static void numaq_setup_portio_remap(void) |
| 48 | { |
| 49 | int num_quads = num_online_nodes(); |
| 50 | |
| 51 | if (num_quads <= 1) |
| 52 | return; |
| 53 | |
| 54 | printk("Remapping cross-quad port I/O for %d quads\n", num_quads); |
| 55 | xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD); |
| 56 | printk("xquad_portio vaddr 0x%08lx, len %08lx\n", |
| 57 | (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD); |
| 58 | } |
| 59 | |
Ingo Molnar | fea3437 | 2009-01-28 03:32:03 +0100 | [diff] [blame] | 60 | struct genapic apic_numaq = { |
| 61 | |
| 62 | .name = "NUMAQ", |
| 63 | .probe = probe_numaq, |
Ingo Molnar | 306db03 | 2009-01-28 03:43:47 +0100 | [diff] [blame] | 64 | .acpi_madt_oem_check = NULL, |
Ingo Molnar | 7ed248d | 2009-01-28 03:43:47 +0100 | [diff] [blame] | 65 | .apic_id_registered = numaq_apic_id_registered, |
Ingo Molnar | fea3437 | 2009-01-28 03:32:03 +0100 | [diff] [blame] | 66 | |
Ingo Molnar | 1b1bcb3 | 2009-01-28 04:16:01 +0100 | [diff] [blame] | 67 | .irq_delivery_mode = dest_LowestPrio, |
| 68 | /* physical delivery on LOCAL quad: */ |
| 69 | .irq_dest_mode = 0, |
Ingo Molnar | fea3437 | 2009-01-28 03:32:03 +0100 | [diff] [blame] | 70 | |
Ingo Molnar | 0a9cc20 | 2009-01-28 04:30:40 +0100 | [diff] [blame] | 71 | .target_cpus = numaq_target_cpus, |
Ingo Molnar | 08125d3 | 2009-01-28 05:08:44 +0100 | [diff] [blame] | 72 | .disable_esr = 1, |
Ingo Molnar | bdb1a9b | 2009-01-28 05:29:25 +0100 | [diff] [blame] | 73 | .dest_logical = APIC_DEST_LOGICAL, |
Ingo Molnar | d1d7cae | 2009-01-28 05:41:42 +0100 | [diff] [blame] | 74 | .check_apicid_used = numaq_check_apicid_used, |
| 75 | .check_apicid_present = numaq_check_apicid_present, |
Ingo Molnar | fea3437 | 2009-01-28 03:32:03 +0100 | [diff] [blame] | 76 | |
Ingo Molnar | e2d40b1 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 77 | .vector_allocation_domain = numaq_vector_allocation_domain, |
Ingo Molnar | a5c4329 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 78 | .init_apic_ldr = numaq_init_apic_ldr, |
Ingo Molnar | fea3437 | 2009-01-28 03:32:03 +0100 | [diff] [blame] | 79 | |
Ingo Molnar | d190cb8 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 80 | .ioapic_phys_id_map = numaq_ioapic_phys_id_map, |
Ingo Molnar | 72ce016 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 81 | .setup_apic_routing = numaq_setup_apic_routing, |
Ingo Molnar | 33a201f | 2009-01-28 07:17:26 +0100 | [diff] [blame] | 82 | .multi_timer_check = numaq_multi_timer_check, |
Ingo Molnar | 3f57a31 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 83 | .apicid_to_node = numaq_apicid_to_node, |
Ingo Molnar | 5257c51 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 84 | .cpu_to_logical_apicid = numaq_cpu_to_logical_apicid, |
Ingo Molnar | a21769a4 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 85 | .cpu_present_to_apicid = numaq_cpu_present_to_apicid, |
Ingo Molnar | 8058714 | 2009-01-28 06:50:47 +0100 | [diff] [blame] | 86 | .apicid_to_cpu_present = numaq_apicid_to_cpu_present, |
Ingo Molnar | d83093b | 2009-01-28 12:43:18 +0100 | [diff] [blame] | 87 | .setup_portio_remap = numaq_setup_portio_remap, |
Ingo Molnar | a27a621 | 2009-01-28 12:43:18 +0100 | [diff] [blame^] | 88 | .check_phys_apicid_present = numaq_check_phys_apicid_present, |
Ingo Molnar | fea3437 | 2009-01-28 03:32:03 +0100 | [diff] [blame] | 89 | .enable_apic_mode = enable_apic_mode, |
| 90 | .phys_pkg_id = phys_pkg_id, |
| 91 | .mps_oem_check = mps_oem_check, |
| 92 | |
| 93 | .get_apic_id = get_apic_id, |
| 94 | .set_apic_id = NULL, |
| 95 | .apic_id_mask = APIC_ID_MASK, |
| 96 | |
| 97 | .cpu_mask_to_apicid = cpu_mask_to_apicid, |
| 98 | .cpu_mask_to_apicid_and = cpu_mask_to_apicid_and, |
| 99 | |
| 100 | .send_IPI_mask = send_IPI_mask, |
| 101 | .send_IPI_mask_allbutself = NULL, |
| 102 | .send_IPI_allbutself = send_IPI_allbutself, |
| 103 | .send_IPI_all = send_IPI_all, |
| 104 | .send_IPI_self = NULL, |
| 105 | |
| 106 | .wakeup_cpu = NULL, |
| 107 | .trampoline_phys_low = TRAMPOLINE_PHYS_LOW, |
| 108 | .trampoline_phys_high = TRAMPOLINE_PHYS_HIGH, |
| 109 | .wait_for_init_deassert = wait_for_init_deassert, |
| 110 | .smp_callin_clear_local_apic = smp_callin_clear_local_apic, |
| 111 | .store_NMI_vector = store_NMI_vector, |
| 112 | .restore_NMI_vector = restore_NMI_vector, |
| 113 | .inquire_remote_apic = inquire_remote_apic, |
| 114 | }; |