Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Intel Multiprocessor Specification 1.1 and 1.4 |
| 3 | * compliant MP-table parsing routines. |
| 4 | * |
| 5 | * (c) 1995 Alan Cox, Building #3 <alan@redhat.com> |
| 6 | * (c) 1998, 1999, 2000 Ingo Molnar <mingo@redhat.com> |
Alexey Starikovskiy | 85bddde | 2008-04-04 23:43:18 +0400 | [diff] [blame] | 7 | * (c) 2008 Alexey Starikovskiy <astarikovskiy@suse.de> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #include <linux/mm.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/delay.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/bootmem.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/kernel_stat.h> |
| 15 | #include <linux/mc146818rtc.h> |
| 16 | #include <linux/bitops.h> |
Alexey Starikovskiy | 85bddde | 2008-04-04 23:43:18 +0400 | [diff] [blame] | 17 | #include <linux/acpi.h> |
| 18 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
| 20 | #include <asm/smp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #include <asm/mtrr.h> |
| 22 | #include <asm/mpspec.h> |
Alexey Starikovskiy | 85bddde | 2008-04-04 23:43:18 +0400 | [diff] [blame] | 23 | #include <asm/pgalloc.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | #include <asm/io_apic.h> |
Alexey Starikovskiy | 85bddde | 2008-04-04 23:43:18 +0400 | [diff] [blame] | 25 | #include <asm/proto.h> |
| 26 | #include <asm/acpi.h> |
Alexey Starikovskiy | ce3fe6b | 2008-03-17 22:08:17 +0300 | [diff] [blame] | 27 | #include <asm/bios_ebda.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
| 29 | #include <mach_apic.h> |
Alexey Starikovskiy | 85bddde | 2008-04-04 23:43:18 +0400 | [diff] [blame] | 30 | #ifdef CONFIG_X86_32 |
Andi Kleen | 874c4fe | 2006-09-26 10:52:26 +0200 | [diff] [blame] | 31 | #include <mach_apicdef.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include <mach_mpparse.h> |
Alexey Starikovskiy | 85bddde | 2008-04-04 23:43:18 +0400 | [diff] [blame] | 33 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
| 35 | /* Have we found an MP table */ |
| 36 | int smp_found_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | |
| 38 | /* |
| 39 | * Various Linux-internal data structures created from the |
| 40 | * MP-table. |
| 41 | */ |
Alexey Starikovskiy | c0a282c | 2008-03-20 14:55:02 +0300 | [diff] [blame] | 42 | #if defined (CONFIG_MCA) || defined (CONFIG_EISA) |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 43 | int mp_bus_id_to_type[MAX_MP_BUSSES]; |
Alexey Starikovskiy | c0a282c | 2008-03-20 14:55:02 +0300 | [diff] [blame] | 44 | #endif |
Alexey Starikovskiy | 85bddde | 2008-04-04 23:43:18 +0400 | [diff] [blame] | 45 | |
Alexey Starikovskiy | a6333c3 | 2008-03-20 14:54:09 +0300 | [diff] [blame] | 46 | DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 47 | int mp_bus_id_to_pci_bus[MAX_MP_BUSSES] = {[0 ... MAX_MP_BUSSES - 1] = -1 }; |
Alexey Starikovskiy | 85bddde | 2008-04-04 23:43:18 +0400 | [diff] [blame] | 48 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | static int mp_current_pci_id; |
| 50 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | int pic_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | /* |
| 54 | * Intel MP BIOS table parsing routines: |
| 55 | */ |
| 56 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | /* |
| 58 | * Checksum an MP configuration block. |
| 59 | */ |
| 60 | |
| 61 | static int __init mpf_checksum(unsigned char *mp, int len) |
| 62 | { |
| 63 | int sum = 0; |
| 64 | |
| 65 | while (len--) |
| 66 | sum += *mp++; |
| 67 | |
| 68 | return sum & 0xFF; |
| 69 | } |
| 70 | |
Alexey Starikovskiy | 8642050 | 2008-03-17 22:08:55 +0300 | [diff] [blame] | 71 | #ifdef CONFIG_X86_NUMAQ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | /* |
| 73 | * Have to match translation table entries to main table entries by counter |
| 74 | * hence the mpc_record variable .... can't see a less disgusting way of |
| 75 | * doing this .... |
| 76 | */ |
| 77 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 78 | static int mpc_record; |
| 79 | static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] |
| 80 | __cpuinitdata; |
Alexey Starikovskiy | 8642050 | 2008-03-17 22:08:55 +0300 | [diff] [blame] | 81 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | |
Alexey Starikovskiy | c853c67 | 2008-03-27 23:54:13 +0300 | [diff] [blame] | 83 | static void __cpuinit MP_processor_info(struct mpc_config_processor *m) |
| 84 | { |
| 85 | int apicid; |
Alexey Starikovskiy | 746f224 | 2008-04-04 23:42:15 +0400 | [diff] [blame] | 86 | char *bootup_cpu = ""; |
Alexey Starikovskiy | c853c67 | 2008-03-27 23:54:13 +0300 | [diff] [blame] | 87 | |
Glauber Costa | 7b1292e | 2008-03-03 14:12:41 -0300 | [diff] [blame] | 88 | if (!(m->mpc_cpuflag & CPU_ENABLED)) { |
| 89 | disabled_cpus++; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | return; |
Glauber Costa | 7b1292e | 2008-03-03 14:12:41 -0300 | [diff] [blame] | 91 | } |
Alexey Starikovskiy | 4655c7d | 2008-03-17 22:08:36 +0300 | [diff] [blame] | 92 | #ifdef CONFIG_X86_NUMAQ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | apicid = mpc_apic_id(m, translation_table[mpc_record]); |
Alexey Starikovskiy | 4655c7d | 2008-03-17 22:08:36 +0300 | [diff] [blame] | 94 | #else |
Alexey Starikovskiy | 4655c7d | 2008-03-17 22:08:36 +0300 | [diff] [blame] | 95 | apicid = m->mpc_apicid; |
| 96 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { |
Alexey Starikovskiy | 746f224 | 2008-04-04 23:42:15 +0400 | [diff] [blame] | 98 | bootup_cpu = " (Bootup-CPU)"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | boot_cpu_physical_apicid = m->mpc_apicid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | } |
| 101 | |
Alexey Starikovskiy | 746f224 | 2008-04-04 23:42:15 +0400 | [diff] [blame] | 102 | printk(KERN_INFO "Processor #%d%s\n", m->mpc_apicid, bootup_cpu); |
Alexey Starikovskiy | c853c67 | 2008-03-27 23:54:13 +0300 | [diff] [blame] | 103 | generic_processor_info(apicid, m->mpc_apicver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | } |
| 105 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 106 | static void __init MP_bus_info(struct mpc_config_bus *m) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | { |
| 108 | char str[7]; |
| 109 | |
| 110 | memcpy(str, m->mpc_bustype, 6); |
| 111 | str[6] = 0; |
| 112 | |
Alexey Starikovskiy | 0ec153a | 2008-03-17 22:08:48 +0300 | [diff] [blame] | 113 | #ifdef CONFIG_X86_NUMAQ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | mpc_oem_bus_info(m, str, translation_table[mpc_record]); |
Alexey Starikovskiy | 0ec153a | 2008-03-17 22:08:48 +0300 | [diff] [blame] | 115 | #else |
| 116 | Dprintk("Bus #%d is %s\n", m->mpc_busid, str); |
| 117 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | |
Andi Kleen | 5e4edbb | 2006-09-26 10:52:35 +0200 | [diff] [blame] | 119 | #if MAX_MP_BUSSES < 256 |
Randy Dunlap | c0ec31a | 2006-04-10 22:53:13 -0700 | [diff] [blame] | 120 | if (m->mpc_busid >= MAX_MP_BUSSES) { |
| 121 | printk(KERN_WARNING "MP table busid value (%d) for bustype %s " |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 122 | " is too large, max. supported is %d\n", |
| 123 | m->mpc_busid, str, MAX_MP_BUSSES - 1); |
Randy Dunlap | c0ec31a | 2006-04-10 22:53:13 -0700 | [diff] [blame] | 124 | return; |
| 125 | } |
Andi Kleen | 5e4edbb | 2006-09-26 10:52:35 +0200 | [diff] [blame] | 126 | #endif |
Randy Dunlap | c0ec31a | 2006-04-10 22:53:13 -0700 | [diff] [blame] | 127 | |
Alexey Starikovskiy | f8924e7 | 2008-04-04 23:42:21 +0400 | [diff] [blame] | 128 | if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA) - 1) == 0) { |
| 129 | set_bit(m->mpc_busid, mp_bus_not_pci); |
| 130 | #if defined(CONFIG_EISA) || defined (CONFIG_MCA) |
| 131 | mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA; |
| 132 | #endif |
| 133 | } else if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI) - 1) == 0) { |
Alexey Starikovskiy | d285e33 | 2008-03-17 22:08:42 +0300 | [diff] [blame] | 134 | #ifdef CONFIG_X86_NUMAQ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | mpc_oem_pci_bus(m, translation_table[mpc_record]); |
Alexey Starikovskiy | d285e33 | 2008-03-17 22:08:42 +0300 | [diff] [blame] | 136 | #endif |
Alexey Starikovskiy | a6333c3 | 2008-03-20 14:54:09 +0300 | [diff] [blame] | 137 | clear_bit(m->mpc_busid, mp_bus_not_pci); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | mp_bus_id_to_pci_bus[m->mpc_busid] = mp_current_pci_id; |
| 139 | mp_current_pci_id++; |
Alexey Starikovskiy | c0a282c | 2008-03-20 14:55:02 +0300 | [diff] [blame] | 140 | #if defined(CONFIG_EISA) || defined (CONFIG_MCA) |
| 141 | mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 142 | } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA) - 1) == 0) { |
Alexey Starikovskiy | 9e0a2de | 2008-03-20 14:54:56 +0300 | [diff] [blame] | 143 | mp_bus_id_to_type[m->mpc_busid] = MP_BUS_EISA; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 144 | } else if (strncmp(str, BUSTYPE_MCA, sizeof(BUSTYPE_MCA) - 1) == 0) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | mp_bus_id_to_type[m->mpc_busid] = MP_BUS_MCA; |
Alexey Starikovskiy | c0a282c | 2008-03-20 14:55:02 +0300 | [diff] [blame] | 146 | #endif |
Alexey Starikovskiy | f8924e7 | 2008-04-04 23:42:21 +0400 | [diff] [blame] | 147 | } else |
| 148 | printk(KERN_WARNING "Unknown bustype %s - ignoring\n", str); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | } |
| 150 | |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 151 | #ifdef CONFIG_X86_IO_APIC |
| 152 | |
Alexey Starikovskiy | 857033a | 2008-03-17 22:08:05 +0300 | [diff] [blame] | 153 | static int bad_ioapic(unsigned long address) |
| 154 | { |
| 155 | if (nr_ioapics >= MAX_IO_APICS) { |
| 156 | printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded " |
| 157 | "(found %d)\n", MAX_IO_APICS, nr_ioapics); |
| 158 | panic("Recompile kernel with bigger MAX_IO_APICS!\n"); |
| 159 | } |
| 160 | if (!address) { |
| 161 | printk(KERN_ERR "WARNING: Bogus (zero) I/O APIC address" |
| 162 | " found in table, skipping!\n"); |
| 163 | return 1; |
| 164 | } |
| 165 | return 0; |
| 166 | } |
| 167 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 168 | static void __init MP_ioapic_info(struct mpc_config_ioapic *m) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | { |
| 170 | if (!(m->mpc_flags & MPC_APIC_USABLE)) |
| 171 | return; |
| 172 | |
Thomas Gleixner | 64883ab | 2008-01-30 13:30:35 +0100 | [diff] [blame] | 173 | printk(KERN_INFO "I/O APIC #%d Version %d at 0x%X.\n", |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 174 | m->mpc_apicid, m->mpc_apicver, m->mpc_apicaddr); |
Alexey Starikovskiy | 857033a | 2008-03-17 22:08:05 +0300 | [diff] [blame] | 175 | |
| 176 | if (bad_ioapic(m->mpc_apicaddr)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | return; |
Alexey Starikovskiy | 857033a | 2008-03-17 22:08:05 +0300 | [diff] [blame] | 178 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | mp_ioapics[nr_ioapics] = *m; |
| 180 | nr_ioapics++; |
| 181 | } |
| 182 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 183 | static void __init MP_intsrc_info(struct mpc_config_intsrc *m) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | { |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 185 | mp_irqs[mp_irq_entries] = *m; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | Dprintk("Int: type %d, pol %d, trig %d, bus %d," |
| 187 | " IRQ %02x, APIC ID %x, APIC INT %02x\n", |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 188 | m->mpc_irqtype, m->mpc_irqflag & 3, |
| 189 | (m->mpc_irqflag >> 2) & 3, m->mpc_srcbus, |
| 190 | m->mpc_srcbusirq, m->mpc_dstapic, m->mpc_dstirq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | if (++mp_irq_entries == MAX_IRQ_SOURCES) |
| 192 | panic("Max # of irq sources exceeded!!\n"); |
| 193 | } |
| 194 | |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 195 | #endif |
| 196 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 197 | static void __init MP_lintsrc_info(struct mpc_config_lintsrc *m) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | { |
| 199 | Dprintk("Lint: type %d, pol %d, trig %d, bus %d," |
| 200 | " IRQ %02x, APIC ID %x, APIC LINT %02x\n", |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 201 | m->mpc_irqtype, m->mpc_irqflag & 3, |
| 202 | (m->mpc_irqflag >> 2) & 3, m->mpc_srcbusid, |
| 203 | m->mpc_srcbusirq, m->mpc_destapic, m->mpc_destapiclint); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | #ifdef CONFIG_X86_NUMAQ |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 207 | static void __init MP_translation_info(struct mpc_config_translation *m) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | { |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 209 | printk(KERN_INFO |
| 210 | "Translation: record %d, type %d, quad %d, global %d, local %d\n", |
| 211 | mpc_record, m->trans_type, m->trans_quad, m->trans_global, |
| 212 | m->trans_local); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 214 | if (mpc_record >= MAX_MPC_ENTRY) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n"); |
| 216 | else |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 217 | translation_table[mpc_record] = m; /* stash this for later */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | if (m->trans_quad < MAX_NUMNODES && !node_online(m->trans_quad)) |
| 219 | node_set_online(m->trans_quad); |
| 220 | } |
| 221 | |
| 222 | /* |
| 223 | * Read/parse the MPC oem tables |
| 224 | */ |
| 225 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 226 | static void __init smp_read_mpc_oem(struct mp_config_oemtable *oemtable, |
| 227 | unsigned short oemsize) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | { |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 229 | int count = sizeof(*oemtable); /* the header size */ |
| 230 | unsigned char *oemptr = ((unsigned char *)oemtable) + count; |
| 231 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | mpc_record = 0; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 233 | printk(KERN_INFO "Found an OEM MPC table at %8p - parsing it ... \n", |
| 234 | oemtable); |
| 235 | if (memcmp(oemtable->oem_signature, MPC_OEM_SIGNATURE, 4)) { |
| 236 | printk(KERN_WARNING |
| 237 | "SMP mpc oemtable: bad signature [%c%c%c%c]!\n", |
| 238 | oemtable->oem_signature[0], oemtable->oem_signature[1], |
| 239 | oemtable->oem_signature[2], oemtable->oem_signature[3]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | return; |
| 241 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 242 | if (mpf_checksum((unsigned char *)oemtable, oemtable->oem_length)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | printk(KERN_WARNING "SMP oem mptable: checksum error!\n"); |
| 244 | return; |
| 245 | } |
| 246 | while (count < oemtable->oem_length) { |
| 247 | switch (*oemptr) { |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 248 | case MP_TRANSLATION: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | { |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 250 | struct mpc_config_translation *m = |
| 251 | (struct mpc_config_translation *)oemptr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | MP_translation_info(m); |
| 253 | oemptr += sizeof(*m); |
| 254 | count += sizeof(*m); |
| 255 | ++mpc_record; |
| 256 | break; |
| 257 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 258 | default: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | { |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 260 | printk(KERN_WARNING |
| 261 | "Unrecognised OEM table entry type! - %d\n", |
| 262 | (int)*oemptr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | return; |
| 264 | } |
| 265 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 266 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 270 | char *productid) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | { |
| 272 | if (strncmp(oem, "IBM NUMA", 8)) |
| 273 | printk("Warning! May not be a NUMA-Q system!\n"); |
| 274 | if (mpc->mpc_oemptr) |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 275 | smp_read_mpc_oem((struct mp_config_oemtable *)mpc->mpc_oemptr, |
| 276 | mpc->mpc_oemsize); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 278 | #endif /* CONFIG_X86_NUMAQ */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | |
| 280 | /* |
| 281 | * Read/parse the MPC |
| 282 | */ |
| 283 | |
Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 284 | static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | { |
| 286 | char str[16]; |
| 287 | char oem[10]; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 288 | int count = sizeof(*mpc); |
| 289 | unsigned char *mpt = ((unsigned char *)mpc) + count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 291 | if (memcmp(mpc->mpc_signature, MPC_SIGNATURE, 4)) { |
Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 292 | printk(KERN_ERR "MPTABLE: bad signature [%c%c%c%c]!\n", |
| 293 | mpc->mpc_signature[0], mpc->mpc_signature[1], |
| 294 | mpc->mpc_signature[2], mpc->mpc_signature[3]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | return 0; |
| 296 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 297 | if (mpf_checksum((unsigned char *)mpc, mpc->mpc_length)) { |
Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 298 | printk(KERN_ERR "MPTABLE: checksum error!\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | return 0; |
| 300 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 301 | if (mpc->mpc_spec != 0x01 && mpc->mpc_spec != 0x04) { |
Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 302 | printk(KERN_ERR "MPTABLE: bad table version (%d)!!\n", |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 303 | mpc->mpc_spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | return 0; |
| 305 | } |
| 306 | if (!mpc->mpc_lapic) { |
Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 307 | printk(KERN_ERR "MPTABLE: null local APIC address!\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | return 0; |
| 309 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 310 | memcpy(oem, mpc->mpc_oem, 8); |
| 311 | oem[8] = 0; |
Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 312 | printk(KERN_INFO "MPTABLE: OEM ID: %s ", oem); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 314 | memcpy(str, mpc->mpc_productid, 12); |
| 315 | str[12] = 0; |
| 316 | printk("Product ID: %s ", str); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | |
Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 318 | #ifdef CONFIG_X86_32 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | mps_oem_check(mpc, oem, str); |
Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 320 | #endif |
| 321 | printk(KERN_INFO "MPTABLE: Product ID: %s ", str); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | |
Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 323 | printk(KERN_INFO "MPTABLE: APIC at: 0x%X\n", mpc->mpc_lapic); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | |
Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 325 | /* save the local APIC address, it might be non-default */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | if (!acpi_lapic) |
| 327 | mp_lapic_addr = mpc->mpc_lapic; |
| 328 | |
Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 329 | if (early) |
| 330 | return 1; |
| 331 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | /* |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 333 | * Now process the configuration blocks. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | */ |
Alexey Starikovskiy | 8642050 | 2008-03-17 22:08:55 +0300 | [diff] [blame] | 335 | #ifdef CONFIG_X86_NUMAQ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | mpc_record = 0; |
Alexey Starikovskiy | 8642050 | 2008-03-17 22:08:55 +0300 | [diff] [blame] | 337 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | while (count < mpc->mpc_length) { |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 339 | switch (*mpt) { |
| 340 | case MP_PROCESSOR: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | { |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 342 | struct mpc_config_processor *m = |
| 343 | (struct mpc_config_processor *)mpt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | /* ACPI may have already provided this data */ |
| 345 | if (!acpi_lapic) |
| 346 | MP_processor_info(m); |
| 347 | mpt += sizeof(*m); |
| 348 | count += sizeof(*m); |
| 349 | break; |
| 350 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 351 | case MP_BUS: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | { |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 353 | struct mpc_config_bus *m = |
| 354 | (struct mpc_config_bus *)mpt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | MP_bus_info(m); |
| 356 | mpt += sizeof(*m); |
| 357 | count += sizeof(*m); |
| 358 | break; |
| 359 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 360 | case MP_IOAPIC: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | { |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 362 | #ifdef CONFIG_X86_IO_APIC |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 363 | struct mpc_config_ioapic *m = |
| 364 | (struct mpc_config_ioapic *)mpt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | MP_ioapic_info(m); |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 366 | #endif |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 367 | mpt += sizeof(struct mpc_config_ioapic); |
| 368 | count += sizeof(struct mpc_config_ioapic); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | break; |
| 370 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 371 | case MP_INTSRC: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | { |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 373 | #ifdef CONFIG_X86_IO_APIC |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 374 | struct mpc_config_intsrc *m = |
| 375 | (struct mpc_config_intsrc *)mpt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | |
| 377 | MP_intsrc_info(m); |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 378 | #endif |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 379 | mpt += sizeof(struct mpc_config_intsrc); |
| 380 | count += sizeof(struct mpc_config_intsrc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | break; |
| 382 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 383 | case MP_LINTSRC: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | { |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 385 | struct mpc_config_lintsrc *m = |
| 386 | (struct mpc_config_lintsrc *)mpt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | MP_lintsrc_info(m); |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 388 | mpt += sizeof(*m); |
| 389 | count += sizeof(*m); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | break; |
| 391 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 392 | default: |
Yinghai Lu | 711554d | 2008-04-07 11:36:39 -0700 | [diff] [blame^] | 393 | /* wrong mptable */ |
| 394 | printk(KERN_ERR "Your mptable is wrong, contact your HW vendor!\n"); |
| 395 | printk(KERN_ERR "type %x\n", *mpt); |
| 396 | print_hex_dump(KERN_ERR, " ", DUMP_PREFIX_ADDRESS, 16, |
| 397 | 1, mpc, mpc->mpc_length, 1); |
| 398 | count = mpc->mpc_length; |
| 399 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | } |
Alexey Starikovskiy | 8642050 | 2008-03-17 22:08:55 +0300 | [diff] [blame] | 401 | #ifdef CONFIG_X86_NUMAQ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | ++mpc_record; |
Alexey Starikovskiy | 8642050 | 2008-03-17 22:08:55 +0300 | [diff] [blame] | 403 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | } |
Ingo Molnar | 3c43f03 | 2007-05-02 19:27:04 +0200 | [diff] [blame] | 405 | setup_apic_routing(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 406 | if (!num_processors) |
Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 407 | printk(KERN_ERR "MPTABLE: no processors registered!\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 408 | return num_processors; |
| 409 | } |
| 410 | |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 411 | #ifdef CONFIG_X86_IO_APIC |
| 412 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | static int __init ELCR_trigger(unsigned int irq) |
| 414 | { |
| 415 | unsigned int port; |
| 416 | |
| 417 | port = 0x4d0 + (irq >> 3); |
| 418 | return (inb(port) >> (irq & 7)) & 1; |
| 419 | } |
| 420 | |
| 421 | static void __init construct_default_ioirq_mptable(int mpc_default_type) |
| 422 | { |
| 423 | struct mpc_config_intsrc intsrc; |
| 424 | int i; |
| 425 | int ELCR_fallback = 0; |
| 426 | |
| 427 | intsrc.mpc_type = MP_INTSRC; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 428 | intsrc.mpc_irqflag = 0; /* conforming */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 429 | intsrc.mpc_srcbus = 0; |
| 430 | intsrc.mpc_dstapic = mp_ioapics[0].mpc_apicid; |
| 431 | |
| 432 | intsrc.mpc_irqtype = mp_INT; |
| 433 | |
| 434 | /* |
| 435 | * If true, we have an ISA/PCI system with no IRQ entries |
| 436 | * in the MP table. To prevent the PCI interrupts from being set up |
| 437 | * incorrectly, we try to use the ELCR. The sanity check to see if |
| 438 | * there is good ELCR data is very simple - IRQ0, 1, 2 and 13 can |
| 439 | * never be level sensitive, so we simply see if the ELCR agrees. |
| 440 | * If it does, we assume it's valid. |
| 441 | */ |
| 442 | if (mpc_default_type == 5) { |
Alexey Starikovskiy | 62441bf | 2008-04-04 23:42:34 +0400 | [diff] [blame] | 443 | printk(KERN_INFO "ISA/PCI bus type with no IRQ information... " |
| 444 | "falling back to ELCR\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | |
Alexey Starikovskiy | 62441bf | 2008-04-04 23:42:34 +0400 | [diff] [blame] | 446 | if (ELCR_trigger(0) || ELCR_trigger(1) || ELCR_trigger(2) || |
| 447 | ELCR_trigger(13)) |
| 448 | printk(KERN_ERR "ELCR contains invalid data... " |
| 449 | "not using ELCR\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | else { |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 451 | printk(KERN_INFO |
| 452 | "Using ELCR to identify PCI interrupts\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 453 | ELCR_fallback = 1; |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | for (i = 0; i < 16; i++) { |
| 458 | switch (mpc_default_type) { |
| 459 | case 2: |
| 460 | if (i == 0 || i == 13) |
| 461 | continue; /* IRQ0 & IRQ13 not connected */ |
| 462 | /* fall through */ |
| 463 | default: |
| 464 | if (i == 2) |
| 465 | continue; /* IRQ2 is never connected */ |
| 466 | } |
| 467 | |
| 468 | if (ELCR_fallback) { |
| 469 | /* |
| 470 | * If the ELCR indicates a level-sensitive interrupt, we |
| 471 | * copy that information over to the MP table in the |
| 472 | * irqflag field (level sensitive, active high polarity). |
| 473 | */ |
| 474 | if (ELCR_trigger(i)) |
| 475 | intsrc.mpc_irqflag = 13; |
| 476 | else |
| 477 | intsrc.mpc_irqflag = 0; |
| 478 | } |
| 479 | |
| 480 | intsrc.mpc_srcbusirq = i; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 481 | intsrc.mpc_dstirq = i ? i : 2; /* IRQ0 to INTIN2 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | MP_intsrc_info(&intsrc); |
| 483 | } |
| 484 | |
| 485 | intsrc.mpc_irqtype = mp_ExtINT; |
| 486 | intsrc.mpc_srcbusirq = 0; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 487 | intsrc.mpc_dstirq = 0; /* 8259A to INTIN0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | MP_intsrc_info(&intsrc); |
| 489 | } |
| 490 | |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 491 | #endif |
| 492 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 493 | static inline void __init construct_default_ISA_mptable(int mpc_default_type) |
| 494 | { |
| 495 | struct mpc_config_processor processor; |
| 496 | struct mpc_config_bus bus; |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 497 | #ifdef CONFIG_X86_IO_APIC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | struct mpc_config_ioapic ioapic; |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 499 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 500 | struct mpc_config_lintsrc lintsrc; |
| 501 | int linttypes[2] = { mp_ExtINT, mp_NMI }; |
| 502 | int i; |
| 503 | |
| 504 | /* |
| 505 | * local APIC has default address |
| 506 | */ |
| 507 | mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; |
| 508 | |
| 509 | /* |
| 510 | * 2 CPUs, numbered 0 & 1. |
| 511 | */ |
| 512 | processor.mpc_type = MP_PROCESSOR; |
| 513 | /* Either an integrated APIC or a discrete 82489DX. */ |
| 514 | processor.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01; |
| 515 | processor.mpc_cpuflag = CPU_ENABLED; |
| 516 | processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 517 | (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_mask; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | processor.mpc_featureflag = boot_cpu_data.x86_capability[0]; |
| 519 | processor.mpc_reserved[0] = 0; |
| 520 | processor.mpc_reserved[1] = 0; |
| 521 | for (i = 0; i < 2; i++) { |
| 522 | processor.mpc_apicid = i; |
| 523 | MP_processor_info(&processor); |
| 524 | } |
| 525 | |
| 526 | bus.mpc_type = MP_BUS; |
| 527 | bus.mpc_busid = 0; |
| 528 | switch (mpc_default_type) { |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 529 | default: |
Alexey Starikovskiy | 62441bf | 2008-04-04 23:42:34 +0400 | [diff] [blame] | 530 | printk(KERN_ERR "???\nUnknown standard configuration %d\n", |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 531 | mpc_default_type); |
| 532 | /* fall through */ |
| 533 | case 1: |
| 534 | case 5: |
| 535 | memcpy(bus.mpc_bustype, "ISA ", 6); |
| 536 | break; |
| 537 | case 2: |
| 538 | case 6: |
| 539 | case 3: |
| 540 | memcpy(bus.mpc_bustype, "EISA ", 6); |
| 541 | break; |
| 542 | case 4: |
| 543 | case 7: |
| 544 | memcpy(bus.mpc_bustype, "MCA ", 6); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | } |
| 546 | MP_bus_info(&bus); |
| 547 | if (mpc_default_type > 4) { |
| 548 | bus.mpc_busid = 1; |
| 549 | memcpy(bus.mpc_bustype, "PCI ", 6); |
| 550 | MP_bus_info(&bus); |
| 551 | } |
| 552 | |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 553 | #ifdef CONFIG_X86_IO_APIC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 554 | ioapic.mpc_type = MP_IOAPIC; |
| 555 | ioapic.mpc_apicid = 2; |
| 556 | ioapic.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01; |
| 557 | ioapic.mpc_flags = MPC_APIC_USABLE; |
| 558 | ioapic.mpc_apicaddr = 0xFEC00000; |
| 559 | MP_ioapic_info(&ioapic); |
| 560 | |
| 561 | /* |
| 562 | * We set up most of the low 16 IO-APIC pins according to MPS rules. |
| 563 | */ |
| 564 | construct_default_ioirq_mptable(mpc_default_type); |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 565 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 566 | lintsrc.mpc_type = MP_LINTSRC; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 567 | lintsrc.mpc_irqflag = 0; /* conforming */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 568 | lintsrc.mpc_srcbusid = 0; |
| 569 | lintsrc.mpc_srcbusirq = 0; |
| 570 | lintsrc.mpc_destapic = MP_APIC_ALL; |
| 571 | for (i = 0; i < 2; i++) { |
| 572 | lintsrc.mpc_irqtype = linttypes[i]; |
| 573 | lintsrc.mpc_destapiclint = i; |
| 574 | MP_lintsrc_info(&lintsrc); |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | static struct intel_mp_floating *mpf_found; |
| 579 | |
| 580 | /* |
| 581 | * Scan the memory blocks for an SMP configuration block. |
| 582 | */ |
Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 583 | static void __init __get_smp_config(unsigned early) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 584 | { |
| 585 | struct intel_mp_floating *mpf = mpf_found; |
| 586 | |
Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 587 | if (acpi_lapic && early) |
| 588 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 589 | /* |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 590 | * ACPI supports both logical (e.g. Hyper-Threading) and physical |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 591 | * processors, where MPS only supports physical. |
| 592 | */ |
| 593 | if (acpi_lapic && acpi_ioapic) { |
Alexey Starikovskiy | 4421b1c | 2008-04-04 23:42:40 +0400 | [diff] [blame] | 594 | printk(KERN_INFO "Using ACPI (MADT) for SMP configuration " |
| 595 | "information\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 596 | return; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 597 | } else if (acpi_lapic) |
Alexey Starikovskiy | 4421b1c | 2008-04-04 23:42:40 +0400 | [diff] [blame] | 598 | printk(KERN_INFO "Using ACPI for processor (LAPIC) " |
| 599 | "configuration information\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 600 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 601 | printk(KERN_INFO "Intel MultiProcessor Specification v1.%d\n", |
| 602 | mpf->mpf_specification); |
Alexey Starikovskiy | 4421b1c | 2008-04-04 23:42:40 +0400 | [diff] [blame] | 603 | #ifdef CONFIG_X86_32 |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 604 | if (mpf->mpf_feature2 & (1 << 7)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 605 | printk(KERN_INFO " IMCR and PIC compatibility mode.\n"); |
| 606 | pic_mode = 1; |
| 607 | } else { |
| 608 | printk(KERN_INFO " Virtual Wire compatibility mode.\n"); |
| 609 | pic_mode = 0; |
| 610 | } |
Alexey Starikovskiy | 4421b1c | 2008-04-04 23:42:40 +0400 | [diff] [blame] | 611 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 612 | /* |
| 613 | * Now see if we need to read further. |
| 614 | */ |
| 615 | if (mpf->mpf_feature1 != 0) { |
Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 616 | if (early) { |
| 617 | /* |
| 618 | * local APIC has default address |
| 619 | */ |
| 620 | mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; |
| 621 | return; |
| 622 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 623 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 624 | printk(KERN_INFO "Default MP configuration #%d\n", |
| 625 | mpf->mpf_feature1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 626 | construct_default_ISA_mptable(mpf->mpf_feature1); |
| 627 | |
| 628 | } else if (mpf->mpf_physptr) { |
| 629 | |
| 630 | /* |
| 631 | * Read the physical hardware table. Anything here will |
| 632 | * override the defaults. |
| 633 | */ |
Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 634 | if (!smp_read_mpc(phys_to_virt(mpf->mpf_physptr), early)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 635 | smp_found_config = 0; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 636 | printk(KERN_ERR |
| 637 | "BIOS bug, MP table errors detected!...\n"); |
Alexey Starikovskiy | 4421b1c | 2008-04-04 23:42:40 +0400 | [diff] [blame] | 638 | printk(KERN_ERR "... disabling SMP support. " |
| 639 | "(tell your hw vendor)\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 640 | return; |
| 641 | } |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 642 | |
Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 643 | if (early) |
| 644 | return; |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 645 | #ifdef CONFIG_X86_IO_APIC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 646 | /* |
| 647 | * If there are no explicit MP IRQ entries, then we are |
| 648 | * broken. We set up most of the low 16 IO-APIC pins to |
| 649 | * ISA defaults and hope it will work. |
| 650 | */ |
| 651 | if (!mp_irq_entries) { |
| 652 | struct mpc_config_bus bus; |
| 653 | |
Alexey Starikovskiy | 4421b1c | 2008-04-04 23:42:40 +0400 | [diff] [blame] | 654 | printk(KERN_ERR "BIOS bug, no explicit IRQ entries, " |
| 655 | "using default mptable. " |
| 656 | "(tell your hw vendor)\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 657 | |
| 658 | bus.mpc_type = MP_BUS; |
| 659 | bus.mpc_busid = 0; |
| 660 | memcpy(bus.mpc_bustype, "ISA ", 6); |
| 661 | MP_bus_info(&bus); |
| 662 | |
| 663 | construct_default_ioirq_mptable(0); |
| 664 | } |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 665 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 666 | } else |
| 667 | BUG(); |
| 668 | |
Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 669 | if (!early) |
| 670 | printk(KERN_INFO "Processors: %d\n", num_processors); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 671 | /* |
| 672 | * Only use the first configuration found. |
| 673 | */ |
| 674 | } |
| 675 | |
Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 676 | void __init early_get_smp_config(void) |
| 677 | { |
| 678 | __get_smp_config(1); |
| 679 | } |
| 680 | |
| 681 | void __init get_smp_config(void) |
| 682 | { |
| 683 | __get_smp_config(0); |
| 684 | } |
| 685 | |
| 686 | static int __init smp_scan_config(unsigned long base, unsigned long length, |
| 687 | unsigned reserve) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 688 | { |
Alexey Starikovskiy | 92fd4b7 | 2008-04-04 23:42:46 +0400 | [diff] [blame] | 689 | extern void __bad_mpf_size(void); |
| 690 | unsigned int *bp = phys_to_virt(base); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | struct intel_mp_floating *mpf; |
| 692 | |
Alexey Starikovskiy | 92fd4b7 | 2008-04-04 23:42:46 +0400 | [diff] [blame] | 693 | Dprintk("Scan SMP from %p for %ld bytes.\n", bp, length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 694 | if (sizeof(*mpf) != 16) |
Alexey Starikovskiy | 92fd4b7 | 2008-04-04 23:42:46 +0400 | [diff] [blame] | 695 | __bad_mpf_size(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 696 | |
| 697 | while (length > 0) { |
| 698 | mpf = (struct intel_mp_floating *)bp; |
| 699 | if ((*bp == SMP_MAGIC_IDENT) && |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 700 | (mpf->mpf_length == 1) && |
| 701 | !mpf_checksum((unsigned char *)bp, 16) && |
| 702 | ((mpf->mpf_specification == 1) |
| 703 | || (mpf->mpf_specification == 4))) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 704 | |
| 705 | smp_found_config = 1; |
Alexey Starikovskiy | 92fd4b7 | 2008-04-04 23:42:46 +0400 | [diff] [blame] | 706 | mpf_found = mpf; |
| 707 | #ifdef CONFIG_X86_32 |
Ingo Molnar | e91a3b4 | 2008-01-30 13:33:08 +0100 | [diff] [blame] | 708 | printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n", |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 709 | mpf, virt_to_phys(mpf)); |
Bernhard Walle | 72a7fe3 | 2008-02-07 00:15:17 -0800 | [diff] [blame] | 710 | reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE, |
| 711 | BOOTMEM_DEFAULT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 712 | if (mpf->mpf_physptr) { |
| 713 | /* |
| 714 | * We cannot access to MPC table to compute |
| 715 | * table size yet, as only few megabytes from |
| 716 | * the bottom is mapped now. |
| 717 | * PC-9800's MPC table places on the very last |
| 718 | * of physical memory; so that simply reserving |
| 719 | * PAGE_SIZE from mpg->mpf_physptr yields BUG() |
| 720 | * in reserve_bootmem. |
| 721 | */ |
| 722 | unsigned long size = PAGE_SIZE; |
| 723 | unsigned long end = max_low_pfn * PAGE_SIZE; |
| 724 | if (mpf->mpf_physptr + size > end) |
| 725 | size = end - mpf->mpf_physptr; |
Bernhard Walle | 72a7fe3 | 2008-02-07 00:15:17 -0800 | [diff] [blame] | 726 | reserve_bootmem(mpf->mpf_physptr, size, |
| 727 | BOOTMEM_DEFAULT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 728 | } |
| 729 | |
Alexey Starikovskiy | 92fd4b7 | 2008-04-04 23:42:46 +0400 | [diff] [blame] | 730 | #else |
| 731 | if (!reserve) |
| 732 | return 1; |
| 733 | |
| 734 | reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE); |
| 735 | if (mpf->mpf_physptr) |
| 736 | reserve_bootmem_generic(mpf->mpf_physptr, |
| 737 | PAGE_SIZE); |
| 738 | #endif |
| 739 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 740 | } |
| 741 | bp += 4; |
| 742 | length -= 16; |
| 743 | } |
| 744 | return 0; |
| 745 | } |
| 746 | |
Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 747 | static void __init __find_smp_config(unsigned reserve) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 748 | { |
| 749 | unsigned int address; |
| 750 | |
| 751 | /* |
| 752 | * FIXME: Linux assumes you have 640K of base ram.. |
| 753 | * this continues the error... |
| 754 | * |
| 755 | * 1) Scan the bottom 1K for a signature |
| 756 | * 2) Scan the top 1K of base RAM |
| 757 | * 3) Scan the 64K of bios |
| 758 | */ |
Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 759 | if (smp_scan_config(0x0, 0x400, reserve) || |
| 760 | smp_scan_config(639 * 0x400, 0x400, reserve) || |
| 761 | smp_scan_config(0xF0000, 0x10000, reserve)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 762 | return; |
| 763 | /* |
| 764 | * If it is an SMP machine we should know now, unless the |
| 765 | * configuration is in an EISA/MCA bus machine with an |
| 766 | * extended bios data area. |
| 767 | * |
| 768 | * there is a real-mode segmented pointer pointing to the |
| 769 | * 4K EBDA area at 0x40E, calculate and scan it here. |
| 770 | * |
| 771 | * NOTE! There are Linux loaders that will corrupt the EBDA |
| 772 | * area, and as such this kind of SMP config may be less |
| 773 | * trustworthy, simply because the SMP table may have been |
| 774 | * stomped on during early boot. These loaders are buggy and |
| 775 | * should be fixed. |
| 776 | * |
| 777 | * MP1.4 SPEC states to only scan first 1K of 4K EBDA. |
| 778 | */ |
| 779 | |
| 780 | address = get_bios_ebda(); |
| 781 | if (address) |
Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 782 | smp_scan_config(address, 0x400, reserve); |
| 783 | } |
| 784 | |
| 785 | void __init early_find_smp_config(void) |
| 786 | { |
| 787 | __find_smp_config(0); |
| 788 | } |
| 789 | |
| 790 | void __init find_smp_config(void) |
| 791 | { |
| 792 | __find_smp_config(1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 793 | } |
| 794 | |
| 795 | /* -------------------------------------------------------------------------- |
| 796 | ACPI-based MP Configuration |
| 797 | -------------------------------------------------------------------------- */ |
| 798 | |
Len Brown | 888ba6c | 2005-08-24 12:07:20 -0400 | [diff] [blame] | 799 | #ifdef CONFIG_ACPI |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 800 | |
Len Brown | 8466361 | 2005-08-24 12:09:07 -0400 | [diff] [blame] | 801 | #ifdef CONFIG_X86_IO_APIC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 802 | |
| 803 | #define MP_ISA_BUS 0 |
| 804 | #define MP_MAX_IOAPIC_PIN 127 |
| 805 | |
Alexey Starikovskiy | 9e5c5f1 | 2008-04-04 23:41:26 +0400 | [diff] [blame] | 806 | extern struct mp_ioapic_routing mp_ioapic_routing[MAX_IO_APICS]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 807 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 808 | static int mp_find_ioapic(int gsi) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 809 | { |
Andi Kleen | 19f03ff | 2006-09-26 10:52:30 +0200 | [diff] [blame] | 810 | int i = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 811 | |
| 812 | /* Find the IOAPIC that manages this GSI. */ |
| 813 | for (i = 0; i < nr_ioapics; i++) { |
| 814 | if ((gsi >= mp_ioapic_routing[i].gsi_base) |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 815 | && (gsi <= mp_ioapic_routing[i].gsi_end)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 816 | return i; |
| 817 | } |
| 818 | |
| 819 | printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 820 | return -1; |
| 821 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 822 | |
Alexey Starikovskiy | e3e3ffa | 2008-03-17 22:08:11 +0300 | [diff] [blame] | 823 | static u8 uniq_ioapic_id(u8 id) |
| 824 | { |
Alexey Starikovskiy | 22cbb4b | 2008-04-04 23:42:53 +0400 | [diff] [blame] | 825 | #ifdef CONFIG_X86_32 |
Alexey Starikovskiy | e3e3ffa | 2008-03-17 22:08:11 +0300 | [diff] [blame] | 826 | if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && |
| 827 | !APIC_XAPIC(apic_version[boot_cpu_physical_apicid])) |
| 828 | return io_apic_get_unique_id(nr_ioapics, id); |
| 829 | else |
| 830 | return id; |
Alexey Starikovskiy | 22cbb4b | 2008-04-04 23:42:53 +0400 | [diff] [blame] | 831 | #else |
| 832 | int i; |
| 833 | DECLARE_BITMAP(used, 256); |
| 834 | bitmap_zero(used, 256); |
| 835 | for (i = 0; i < nr_ioapics; i++) { |
| 836 | struct mpc_config_ioapic *ia = &mp_ioapics[i]; |
| 837 | __set_bit(ia->mpc_apicid, used); |
| 838 | } |
| 839 | if (!test_bit(id, used)) |
| 840 | return id; |
| 841 | return find_first_zero_bit(used, 256); |
| 842 | #endif |
Alexey Starikovskiy | e3e3ffa | 2008-03-17 22:08:11 +0300 | [diff] [blame] | 843 | } |
| 844 | |
Jack Steiner | a65d1d6 | 2008-03-28 14:12:08 -0500 | [diff] [blame] | 845 | void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 846 | { |
Andi Kleen | 19f03ff | 2006-09-26 10:52:30 +0200 | [diff] [blame] | 847 | int idx = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 848 | |
Alexey Starikovskiy | 857033a | 2008-03-17 22:08:05 +0300 | [diff] [blame] | 849 | if (bad_ioapic(address)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 850 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 851 | |
Alexey Starikovskiy | e3e3ffa | 2008-03-17 22:08:11 +0300 | [diff] [blame] | 852 | idx = nr_ioapics; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 853 | |
| 854 | mp_ioapics[idx].mpc_type = MP_IOAPIC; |
| 855 | mp_ioapics[idx].mpc_flags = MPC_APIC_USABLE; |
| 856 | mp_ioapics[idx].mpc_apicaddr = address; |
| 857 | |
| 858 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); |
Alexey Starikovskiy | e3e3ffa | 2008-03-17 22:08:11 +0300 | [diff] [blame] | 859 | mp_ioapics[idx].mpc_apicid = uniq_ioapic_id(id); |
Alexey Starikovskiy | 57b733e | 2008-04-04 23:43:00 +0400 | [diff] [blame] | 860 | #ifdef CONFIG_X86_32 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 861 | mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx); |
Alexey Starikovskiy | 57b733e | 2008-04-04 23:43:00 +0400 | [diff] [blame] | 862 | #else |
| 863 | mp_ioapics[idx].mpc_apicver = 0; |
| 864 | #endif |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 865 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 866 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups |
| 867 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). |
| 868 | */ |
| 869 | mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].mpc_apicid; |
| 870 | mp_ioapic_routing[idx].gsi_base = gsi_base; |
Thomas Gleixner | 64883ab | 2008-01-30 13:30:35 +0100 | [diff] [blame] | 871 | mp_ioapic_routing[idx].gsi_end = gsi_base + |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 872 | io_apic_get_redir_entries(idx); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 873 | |
Alexey Starikovskiy | 57b733e | 2008-04-04 23:43:00 +0400 | [diff] [blame] | 874 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " |
Thomas Gleixner | 64883ab | 2008-01-30 13:30:35 +0100 | [diff] [blame] | 875 | "GSI %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, |
Alexey Starikovskiy | 57b733e | 2008-04-04 23:43:00 +0400 | [diff] [blame] | 876 | mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr, |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 877 | mp_ioapic_routing[idx].gsi_base, mp_ioapic_routing[idx].gsi_end); |
Alexey Starikovskiy | e3e3ffa | 2008-03-17 22:08:11 +0300 | [diff] [blame] | 878 | |
| 879 | nr_ioapics++; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 880 | } |
| 881 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 882 | void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 883 | { |
| 884 | struct mpc_config_intsrc intsrc; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 885 | int ioapic = -1; |
| 886 | int pin = -1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 887 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 888 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 889 | * Convert 'gsi' to 'ioapic.pin'. |
| 890 | */ |
| 891 | ioapic = mp_find_ioapic(gsi); |
| 892 | if (ioapic < 0) |
| 893 | return; |
| 894 | pin = gsi - mp_ioapic_routing[ioapic].gsi_base; |
| 895 | |
| 896 | /* |
| 897 | * TBD: This check is for faulty timer entries, where the override |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 898 | * erroneously sets the trigger to level, resulting in a HUGE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 899 | * increase of timer interrupts! |
| 900 | */ |
| 901 | if ((bus_irq == 0) && (trigger == 3)) |
| 902 | trigger = 1; |
| 903 | |
| 904 | intsrc.mpc_type = MP_INTSRC; |
| 905 | intsrc.mpc_irqtype = mp_INT; |
| 906 | intsrc.mpc_irqflag = (trigger << 2) | polarity; |
| 907 | intsrc.mpc_srcbus = MP_ISA_BUS; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 908 | intsrc.mpc_srcbusirq = bus_irq; /* IRQ */ |
| 909 | intsrc.mpc_dstapic = mp_ioapics[ioapic].mpc_apicid; /* APIC ID */ |
| 910 | intsrc.mpc_dstirq = pin; /* INTIN# */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 911 | |
| 912 | Dprintk("Int: type %d, pol %d, trig %d, bus %d, irq %d, %d-%d\n", |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 913 | intsrc.mpc_irqtype, intsrc.mpc_irqflag & 3, |
| 914 | (intsrc.mpc_irqflag >> 2) & 3, intsrc.mpc_srcbus, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 915 | intsrc.mpc_srcbusirq, intsrc.mpc_dstapic, intsrc.mpc_dstirq); |
| 916 | |
| 917 | mp_irqs[mp_irq_entries] = intsrc; |
| 918 | if (++mp_irq_entries == MAX_IRQ_SOURCES) |
| 919 | panic("Max # of irq sources exceeded!\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 920 | } |
| 921 | |
Alexey Starikovskiy | 2df2972 | 2008-03-27 23:53:54 +0300 | [diff] [blame] | 922 | int es7000_plat; |
| 923 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 924 | void __init mp_config_acpi_legacy_irqs(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 925 | { |
| 926 | struct mpc_config_intsrc intsrc; |
Andi Kleen | 19f03ff | 2006-09-26 10:52:30 +0200 | [diff] [blame] | 927 | int i = 0; |
| 928 | int ioapic = -1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 929 | |
Alexey Starikovskiy | c0a282c | 2008-03-20 14:55:02 +0300 | [diff] [blame] | 930 | #if defined (CONFIG_MCA) || defined (CONFIG_EISA) |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 931 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 932 | * Fabricate the legacy ISA bus (bus #31). |
| 933 | */ |
| 934 | mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA; |
Alexey Starikovskiy | c0a282c | 2008-03-20 14:55:02 +0300 | [diff] [blame] | 935 | #endif |
Alexey Starikovskiy | a6333c3 | 2008-03-20 14:54:09 +0300 | [diff] [blame] | 936 | set_bit(MP_ISA_BUS, mp_bus_not_pci); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 937 | Dprintk("Bus #%d is ISA\n", MP_ISA_BUS); |
| 938 | |
| 939 | /* |
| 940 | * Older generations of ES7000 have no legacy identity mappings |
| 941 | */ |
| 942 | if (es7000_plat == 1) |
| 943 | return; |
| 944 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 945 | /* |
| 946 | * Locate the IOAPIC that manages the ISA IRQs (0-15). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 947 | */ |
| 948 | ioapic = mp_find_ioapic(0); |
| 949 | if (ioapic < 0) |
| 950 | return; |
| 951 | |
| 952 | intsrc.mpc_type = MP_INTSRC; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 953 | intsrc.mpc_irqflag = 0; /* Conforming */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 954 | intsrc.mpc_srcbus = MP_ISA_BUS; |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 955 | #ifdef CONFIG_X86_IO_APIC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 956 | intsrc.mpc_dstapic = mp_ioapics[ioapic].mpc_apicid; |
Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 957 | #endif |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 958 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 959 | * Use the default configuration for the IRQs 0-15. Unless |
Simon Arlott | 27b46d7 | 2007-10-20 01:13:56 +0200 | [diff] [blame] | 960 | * overridden by (MADT) interrupt source override entries. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 961 | */ |
| 962 | for (i = 0; i < 16; i++) { |
| 963 | int idx; |
| 964 | |
| 965 | for (idx = 0; idx < mp_irq_entries; idx++) { |
| 966 | struct mpc_config_intsrc *irq = mp_irqs + idx; |
| 967 | |
| 968 | /* Do we already have a mapping for this ISA IRQ? */ |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 969 | if (irq->mpc_srcbus == MP_ISA_BUS |
| 970 | && irq->mpc_srcbusirq == i) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 971 | break; |
| 972 | |
| 973 | /* Do we already have a mapping for this IOAPIC pin */ |
| 974 | if ((irq->mpc_dstapic == intsrc.mpc_dstapic) && |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 975 | (irq->mpc_dstirq == i)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 976 | break; |
| 977 | } |
| 978 | |
| 979 | if (idx != mp_irq_entries) { |
| 980 | printk(KERN_DEBUG "ACPI: IRQ%d used by override.\n", i); |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 981 | continue; /* IRQ already used */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 982 | } |
| 983 | |
| 984 | intsrc.mpc_irqtype = mp_INT; |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 985 | intsrc.mpc_srcbusirq = i; /* Identity mapped */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 986 | intsrc.mpc_dstirq = i; |
| 987 | |
| 988 | Dprintk("Int: type %d, pol %d, trig %d, bus %d, irq %d, " |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 989 | "%d-%d\n", intsrc.mpc_irqtype, intsrc.mpc_irqflag & 3, |
| 990 | (intsrc.mpc_irqflag >> 2) & 3, intsrc.mpc_srcbus, |
| 991 | intsrc.mpc_srcbusirq, intsrc.mpc_dstapic, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 992 | intsrc.mpc_dstirq); |
| 993 | |
| 994 | mp_irqs[mp_irq_entries] = intsrc; |
| 995 | if (++mp_irq_entries == MAX_IRQ_SOURCES) |
| 996 | panic("Max # of irq sources exceeded!\n"); |
| 997 | } |
| 998 | } |
| 999 | |
Andi Kleen | 19f03ff | 2006-09-26 10:52:30 +0200 | [diff] [blame] | 1000 | int mp_register_gsi(u32 gsi, int triggering, int polarity) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1001 | { |
Andi Kleen | 19f03ff | 2006-09-26 10:52:30 +0200 | [diff] [blame] | 1002 | int ioapic = -1; |
| 1003 | int ioapic_pin = 0; |
| 1004 | int idx, bit = 0; |
Alexey Starikovskiy | cfa08d6 | 2008-04-04 23:43:12 +0400 | [diff] [blame] | 1005 | #ifdef CONFIG_X86_32 |
| 1006 | #define MAX_GSI_NUM 4096 |
| 1007 | #define IRQ_COMPRESSION_START 64 |
| 1008 | |
Len Brown | 2ba7dee | 2008-01-30 13:31:02 +0100 | [diff] [blame] | 1009 | static int pci_irq = IRQ_COMPRESSION_START; |
Natalie Protasevich | c434b7a | 2005-06-23 00:08:29 -0700 | [diff] [blame] | 1010 | /* |
Joe Perches | ab4a574 | 2008-01-30 13:31:42 +0100 | [diff] [blame] | 1011 | * Mapping between Global System Interrupts, which |
Natalie Protasevich | c434b7a | 2005-06-23 00:08:29 -0700 | [diff] [blame] | 1012 | * represent all possible interrupts, and IRQs |
| 1013 | * assigned to actual devices. |
| 1014 | */ |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 1015 | static int gsi_to_irq[MAX_GSI_NUM]; |
Alexey Starikovskiy | cfa08d6 | 2008-04-04 23:43:12 +0400 | [diff] [blame] | 1016 | #else |
| 1017 | |
| 1018 | if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) |
| 1019 | return gsi; |
| 1020 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1021 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1022 | /* Don't set up the ACPI SCI because it's already set up */ |
Alexey Starikovskiy | cee324b | 2007-02-02 19:48:22 +0300 | [diff] [blame] | 1023 | if (acpi_gbl_FADT.sci_interrupt == gsi) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1024 | return gsi; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1025 | |
| 1026 | ioapic = mp_find_ioapic(gsi); |
| 1027 | if (ioapic < 0) { |
| 1028 | printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi); |
| 1029 | return gsi; |
| 1030 | } |
| 1031 | |
| 1032 | ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base; |
| 1033 | |
Alexey Starikovskiy | cfa08d6 | 2008-04-04 23:43:12 +0400 | [diff] [blame] | 1034 | #ifdef CONFIG_X86_32 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1035 | if (ioapic_renumber_irq) |
| 1036 | gsi = ioapic_renumber_irq(ioapic, gsi); |
Alexey Starikovskiy | cfa08d6 | 2008-04-04 23:43:12 +0400 | [diff] [blame] | 1037 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1038 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 1039 | /* |
| 1040 | * Avoid pin reprogramming. PRTs typically include entries |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1041 | * with redundant pin->gsi mappings (but unique PCI devices); |
| 1042 | * we only program the IOAPIC on the first. |
| 1043 | */ |
| 1044 | bit = ioapic_pin % 32; |
| 1045 | idx = (ioapic_pin < 32) ? 0 : (ioapic_pin / 32); |
| 1046 | if (idx > 3) { |
| 1047 | printk(KERN_ERR "Invalid reference to IOAPIC pin " |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 1048 | "%d-%d\n", mp_ioapic_routing[ioapic].apic_id, |
| 1049 | ioapic_pin); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1050 | return gsi; |
| 1051 | } |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 1052 | if ((1 << bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1053 | Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n", |
| 1054 | mp_ioapic_routing[ioapic].apic_id, ioapic_pin); |
Alexey Starikovskiy | cfa08d6 | 2008-04-04 23:43:12 +0400 | [diff] [blame] | 1055 | #ifdef CONFIG_X86_32 |
Len Brown | 2ba7dee | 2008-01-30 13:31:02 +0100 | [diff] [blame] | 1056 | return (gsi < IRQ_COMPRESSION_START ? gsi : gsi_to_irq[gsi]); |
Alexey Starikovskiy | cfa08d6 | 2008-04-04 23:43:12 +0400 | [diff] [blame] | 1057 | #else |
| 1058 | return gsi; |
| 1059 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1060 | } |
| 1061 | |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 1062 | mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1 << bit); |
Alexey Starikovskiy | cfa08d6 | 2008-04-04 23:43:12 +0400 | [diff] [blame] | 1063 | #ifdef CONFIG_X86_32 |
Len Brown | 2ba7dee | 2008-01-30 13:31:02 +0100 | [diff] [blame] | 1064 | /* |
| 1065 | * For GSI >= 64, use IRQ compression |
| 1066 | */ |
| 1067 | if ((gsi >= IRQ_COMPRESSION_START) |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 1068 | && (triggering == ACPI_LEVEL_SENSITIVE)) { |
Natalie Protasevich | c434b7a | 2005-06-23 00:08:29 -0700 | [diff] [blame] | 1069 | /* |
| 1070 | * For PCI devices assign IRQs in order, avoiding gaps |
| 1071 | * due to unused I/O APIC pins. |
| 1072 | */ |
| 1073 | int irq = gsi; |
| 1074 | if (gsi < MAX_GSI_NUM) { |
Kimball Murray | e0c1e9b | 2006-05-08 15:17:16 +0200 | [diff] [blame] | 1075 | /* |
| 1076 | * Retain the VIA chipset work-around (gsi > 15), but |
| 1077 | * avoid a problem where the 8254 timer (IRQ0) is setup |
| 1078 | * via an override (so it's not on pin 0 of the ioapic), |
| 1079 | * and at the same time, the pin 0 interrupt is a PCI |
| 1080 | * type. The gsi > 15 test could cause these two pins |
| 1081 | * to be shared as IRQ0, and they are not shareable. |
| 1082 | * So test for this condition, and if necessary, avoid |
| 1083 | * the pin collision. |
| 1084 | */ |
Adrian Bunk | ede1389 | 2008-03-17 22:29:32 +0200 | [diff] [blame] | 1085 | gsi = pci_irq++; |
Natalie.Protasevich@unisys.com | e1afc3f | 2005-07-29 14:03:32 -0700 | [diff] [blame] | 1086 | /* |
| 1087 | * Don't assign IRQ used by ACPI SCI |
| 1088 | */ |
Alexey Starikovskiy | cee324b | 2007-02-02 19:48:22 +0300 | [diff] [blame] | 1089 | if (gsi == acpi_gbl_FADT.sci_interrupt) |
Natalie.Protasevich@unisys.com | e1afc3f | 2005-07-29 14:03:32 -0700 | [diff] [blame] | 1090 | gsi = pci_irq++; |
Natalie Protasevich | c434b7a | 2005-06-23 00:08:29 -0700 | [diff] [blame] | 1091 | gsi_to_irq[irq] = gsi; |
| 1092 | } else { |
| 1093 | printk(KERN_ERR "GSI %u is too high\n", gsi); |
| 1094 | return gsi; |
| 1095 | } |
| 1096 | } |
Alexey Starikovskiy | cfa08d6 | 2008-04-04 23:43:12 +0400 | [diff] [blame] | 1097 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1098 | io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, |
Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 1099 | triggering == ACPI_EDGE_SENSITIVE ? 0 : 1, |
| 1100 | polarity == ACPI_ACTIVE_HIGH ? 0 : 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1101 | return gsi; |
| 1102 | } |
| 1103 | |
Len Brown | 8466361 | 2005-08-24 12:09:07 -0400 | [diff] [blame] | 1104 | #endif /* CONFIG_X86_IO_APIC */ |
Len Brown | 888ba6c | 2005-08-24 12:07:20 -0400 | [diff] [blame] | 1105 | #endif /* CONFIG_ACPI */ |