| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
| Alexey Starikovskiy | 11113f8 | 2008-05-14 19:02:57 +0400 | [diff] [blame] | 2 | *	Intel Multiprocessor Specification 1.1 and 1.4 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | *	compliant MP-table parsing routines. | 
|  | 4 | * | 
| Alan Cox | 87c6fe2 | 2009-01-05 14:08:04 +0000 | [diff] [blame] | 5 | *	(c) 1995 Alan Cox, Building #3 <alan@lxorguk.ukuu.org.uk> | 
| Ingo Molnar | 8f47e16 | 2009-01-31 02:03:42 +0100 | [diff] [blame] | 6 | *	(c) 1998, 1999, 2000, 2009 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> | 
| Jaswinder Singh Rajput | 103ceff | 2009-01-02 23:43:25 +0530 | [diff] [blame] | 19 | #include <linux/smp.h> | 
| Yinghai Lu | 629e15d | 2009-05-15 13:05:16 -0700 | [diff] [blame] | 20 | #include <linux/pci.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <asm/mtrr.h> | 
|  | 23 | #include <asm/mpspec.h> | 
| Alexey Starikovskiy | 85bddde | 2008-04-04 23:43:18 +0400 | [diff] [blame] | 24 | #include <asm/pgalloc.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #include <asm/io_apic.h> | 
| Alexey Starikovskiy | 85bddde | 2008-04-04 23:43:18 +0400 | [diff] [blame] | 26 | #include <asm/proto.h> | 
| Alexey Starikovskiy | ce3fe6b | 2008-03-17 22:08:17 +0300 | [diff] [blame] | 27 | #include <asm/bios_ebda.h> | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 28 | #include <asm/e820.h> | 
|  | 29 | #include <asm/trampoline.h> | 
| Yinghai Lu | 3c9cb6d | 2008-07-19 02:07:25 -0700 | [diff] [blame] | 30 | #include <asm/setup.h> | 
| Jaswinder Singh Rajput | 4884d8e | 2009-01-11 18:38:55 +0530 | [diff] [blame] | 31 | #include <asm/smp.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 |  | 
| Ingo Molnar | 7b6aa33 | 2009-02-17 13:58:15 +0100 | [diff] [blame] | 33 | #include <asm/apic.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | /* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | * Checksum an MP configuration block. | 
|  | 36 | */ | 
|  | 37 |  | 
|  | 38 | static int __init mpf_checksum(unsigned char *mp, int len) | 
|  | 39 | { | 
|  | 40 | int sum = 0; | 
|  | 41 |  | 
|  | 42 | while (len--) | 
|  | 43 | sum += *mp++; | 
|  | 44 |  | 
|  | 45 | return sum & 0xFF; | 
|  | 46 | } | 
|  | 47 |  | 
| Thomas Gleixner | fd6c666 | 2009-08-20 10:41:58 +0200 | [diff] [blame] | 48 | int __init default_mpc_apic_id(struct mpc_cpu *m) | 
|  | 49 | { | 
|  | 50 | return m->apicid; | 
|  | 51 | } | 
|  | 52 |  | 
| Jaswinder Singh Rajput | f4f21b7 | 2009-01-03 15:48:52 +0530 | [diff] [blame] | 53 | static void __init MP_processor_info(struct mpc_cpu *m) | 
| Alexey Starikovskiy | c853c67 | 2008-03-27 23:54:13 +0300 | [diff] [blame] | 54 | { | 
|  | 55 | int apicid; | 
| Alexey Starikovskiy | 746f224 | 2008-04-04 23:42:15 +0400 | [diff] [blame] | 56 | char *bootup_cpu = ""; | 
| Alexey Starikovskiy | c853c67 | 2008-03-27 23:54:13 +0300 | [diff] [blame] | 57 |  | 
| Jaswinder Singh Rajput | c456382 | 2009-01-04 21:58:25 +0530 | [diff] [blame] | 58 | if (!(m->cpuflag & CPU_ENABLED)) { | 
| Glauber Costa | 7b1292e | 2008-03-03 14:12:41 -0300 | [diff] [blame] | 59 | disabled_cpus++; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | return; | 
| Glauber Costa | 7b1292e | 2008-03-03 14:12:41 -0300 | [diff] [blame] | 61 | } | 
| Yinghai Lu | 64898a8 | 2008-07-19 18:01:16 -0700 | [diff] [blame] | 62 |  | 
| Thomas Gleixner | fd6c666 | 2009-08-20 10:41:58 +0200 | [diff] [blame] | 63 | apicid = x86_init.mpparse.mpc_apic_id(m); | 
| Yinghai Lu | 64898a8 | 2008-07-19 18:01:16 -0700 | [diff] [blame] | 64 |  | 
| Jaswinder Singh Rajput | c456382 | 2009-01-04 21:58:25 +0530 | [diff] [blame] | 65 | if (m->cpuflag & CPU_BOOTPROCESSOR) { | 
| Alexey Starikovskiy | 746f224 | 2008-04-04 23:42:15 +0400 | [diff] [blame] | 66 | bootup_cpu = " (Bootup-CPU)"; | 
| Jaswinder Singh Rajput | c456382 | 2009-01-04 21:58:25 +0530 | [diff] [blame] | 67 | boot_cpu_physical_apicid = m->apicid; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | } | 
|  | 69 |  | 
| Jaswinder Singh Rajput | c456382 | 2009-01-04 21:58:25 +0530 | [diff] [blame] | 70 | printk(KERN_INFO "Processor #%d%s\n", m->apicid, bootup_cpu); | 
|  | 71 | generic_processor_info(apicid, m->apicver); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | } | 
|  | 73 |  | 
| Thomas Gleixner | 85cc35f | 2008-05-25 21:21:36 +0200 | [diff] [blame] | 74 | #ifdef CONFIG_X86_IO_APIC | 
| Thomas Gleixner | 90e1c69 | 2009-08-20 12:34:47 +0200 | [diff] [blame] | 75 | void __init default_mpc_oem_bus_info(struct mpc_bus *m, char *str) | 
|  | 76 | { | 
|  | 77 | memcpy(str, m->bustype, 6); | 
|  | 78 | str[6] = 0; | 
|  | 79 | apic_printk(APIC_VERBOSE, "Bus #%d is %s\n", m->busid, str); | 
|  | 80 | } | 
|  | 81 |  | 
| Jaswinder Singh Rajput | 00fb860 | 2009-01-03 15:47:32 +0530 | [diff] [blame] | 82 | static void __init MP_bus_info(struct mpc_bus *m) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | { | 
|  | 84 | char str[7]; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 |  | 
| Thomas Gleixner | 90e1c69 | 2009-08-20 12:34:47 +0200 | [diff] [blame] | 86 | x86_init.mpparse.mpc_oem_bus_info(m, str); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 |  | 
| Andi Kleen | 5e4edbb | 2006-09-26 10:52:35 +0200 | [diff] [blame] | 88 | #if MAX_MP_BUSSES < 256 | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 89 | if (m->busid >= MAX_MP_BUSSES) { | 
| Randy Dunlap | c0ec31a | 2006-04-10 22:53:13 -0700 | [diff] [blame] | 90 | printk(KERN_WARNING "MP table busid value (%d) for bustype %s " | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 91 | " is too large, max. supported is %d\n", | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 92 | m->busid, str, MAX_MP_BUSSES - 1); | 
| Randy Dunlap | c0ec31a | 2006-04-10 22:53:13 -0700 | [diff] [blame] | 93 | return; | 
|  | 94 | } | 
| Andi Kleen | 5e4edbb | 2006-09-26 10:52:35 +0200 | [diff] [blame] | 95 | #endif | 
| Randy Dunlap | c0ec31a | 2006-04-10 22:53:13 -0700 | [diff] [blame] | 96 |  | 
| Alexey Starikovskiy | f8924e7 | 2008-04-04 23:42:21 +0400 | [diff] [blame] | 97 | if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA) - 1) == 0) { | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 98 | set_bit(m->busid, mp_bus_not_pci); | 
| Jaswinder Singh Rajput | 103ceff | 2009-01-02 23:43:25 +0530 | [diff] [blame] | 99 | #if defined(CONFIG_EISA) || defined(CONFIG_MCA) | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 100 | mp_bus_id_to_type[m->busid] = MP_BUS_ISA; | 
| Alexey Starikovskiy | f8924e7 | 2008-04-04 23:42:21 +0400 | [diff] [blame] | 101 | #endif | 
|  | 102 | } else if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI) - 1) == 0) { | 
| Thomas Gleixner | 52fdb56 | 2009-08-20 12:45:33 +0200 | [diff] [blame] | 103 | if (x86_init.mpparse.mpc_oem_pci_bus) | 
|  | 104 | x86_init.mpparse.mpc_oem_pci_bus(m); | 
| Yinghai Lu | 64898a8 | 2008-07-19 18:01:16 -0700 | [diff] [blame] | 105 |  | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 106 | clear_bit(m->busid, mp_bus_not_pci); | 
| Jaswinder Singh Rajput | 103ceff | 2009-01-02 23:43:25 +0530 | [diff] [blame] | 107 | #if defined(CONFIG_EISA) || defined(CONFIG_MCA) | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 108 | mp_bus_id_to_type[m->busid] = MP_BUS_PCI; | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 109 | } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA) - 1) == 0) { | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 110 | mp_bus_id_to_type[m->busid] = MP_BUS_EISA; | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 111 | } else if (strncmp(str, BUSTYPE_MCA, sizeof(BUSTYPE_MCA) - 1) == 0) { | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 112 | mp_bus_id_to_type[m->busid] = MP_BUS_MCA; | 
| Alexey Starikovskiy | c0a282c | 2008-03-20 14:55:02 +0300 | [diff] [blame] | 113 | #endif | 
| Alexey Starikovskiy | f8924e7 | 2008-04-04 23:42:21 +0400 | [diff] [blame] | 114 | } else | 
|  | 115 | printk(KERN_WARNING "Unknown bustype %s - ignoring\n", str); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | } | 
| Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 117 |  | 
| Jaswinder Singh Rajput | 2b85b5f | 2009-01-03 15:49:57 +0530 | [diff] [blame] | 118 | static void __init MP_ioapic_info(struct mpc_ioapic *m) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | { | 
| Jaswinder Singh Rajput | 5df82c7 | 2009-01-04 21:54:39 +0530 | [diff] [blame] | 120 | if (!(m->flags & MPC_APIC_USABLE)) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | return; | 
|  | 122 |  | 
| Thomas Gleixner | 64883ab | 2008-01-30 13:30:35 +0100 | [diff] [blame] | 123 | printk(KERN_INFO "I/O APIC #%d Version %d at 0x%X.\n", | 
| Jaswinder Singh Rajput | 5df82c7 | 2009-01-04 21:54:39 +0530 | [diff] [blame] | 124 | m->apicid, m->apicver, m->apicaddr); | 
| Alexey Starikovskiy | 857033a | 2008-03-17 22:08:05 +0300 | [diff] [blame] | 125 |  | 
| Eric W. Biederman | cf7500c | 2010-03-30 01:07:11 -0700 | [diff] [blame] | 126 | mp_register_ioapic(m->apicid, m->apicaddr, gsi_end + 1); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | } | 
|  | 128 |  | 
| Jaswinder Singh Rajput | 540d4e7 | 2009-01-03 15:50:52 +0530 | [diff] [blame] | 129 | static void print_MP_intsrc_info(struct mpc_intsrc *m) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | { | 
| Rene Herman | eeb0d7d | 2008-08-11 17:44:57 +0200 | [diff] [blame] | 131 | apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x," | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | " IRQ %02x, APIC ID %x, APIC INT %02x\n", | 
| Jaswinder Singh Rajput | e253b39 | 2009-01-04 21:56:44 +0530 | [diff] [blame] | 133 | m->irqtype, m->irqflag & 3, (m->irqflag >> 2) & 3, m->srcbus, | 
|  | 134 | m->srcbusirq, m->dstapic, m->dstirq); | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 135 | } | 
|  | 136 |  | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 137 | static void __init print_mp_irq_info(struct mpc_intsrc *mp_irq) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 138 | { | 
| Rene Herman | eeb0d7d | 2008-08-11 17:44:57 +0200 | [diff] [blame] | 139 | apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x," | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 140 | " IRQ %02x, APIC ID %x, APIC INT %02x\n", | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 141 | mp_irq->irqtype, mp_irq->irqflag & 3, | 
|  | 142 | (mp_irq->irqflag >> 2) & 3, mp_irq->srcbus, | 
|  | 143 | mp_irq->srcbusirq, mp_irq->dstapic, mp_irq->dstirq); | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 144 | } | 
|  | 145 |  | 
| Jaswinder Singh Rajput | 540d4e7 | 2009-01-03 15:50:52 +0530 | [diff] [blame] | 146 | static void __init assign_to_mp_irq(struct mpc_intsrc *m, | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 147 | struct mpc_intsrc *mp_irq) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 148 | { | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 149 | mp_irq->dstapic = m->dstapic; | 
|  | 150 | mp_irq->type = m->type; | 
|  | 151 | mp_irq->irqtype = m->irqtype; | 
|  | 152 | mp_irq->irqflag = m->irqflag; | 
|  | 153 | mp_irq->srcbus = m->srcbus; | 
|  | 154 | mp_irq->srcbusirq = m->srcbusirq; | 
|  | 155 | mp_irq->dstirq = m->dstirq; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 156 | } | 
|  | 157 |  | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 158 | static void __init assign_to_mpc_intsrc(struct mpc_intsrc *mp_irq, | 
| Jaswinder Singh Rajput | 540d4e7 | 2009-01-03 15:50:52 +0530 | [diff] [blame] | 159 | struct mpc_intsrc *m) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 160 | { | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 161 | m->dstapic = mp_irq->dstapic; | 
|  | 162 | m->type = mp_irq->type; | 
|  | 163 | m->irqtype = mp_irq->irqtype; | 
|  | 164 | m->irqflag = mp_irq->irqflag; | 
|  | 165 | m->srcbus = mp_irq->srcbus; | 
|  | 166 | m->srcbusirq = mp_irq->srcbusirq; | 
|  | 167 | m->dstirq = mp_irq->dstirq; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 168 | } | 
|  | 169 |  | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 170 | static int __init mp_irq_mpc_intsrc_cmp(struct mpc_intsrc *mp_irq, | 
| Jaswinder Singh Rajput | 540d4e7 | 2009-01-03 15:50:52 +0530 | [diff] [blame] | 171 | struct mpc_intsrc *m) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 172 | { | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 173 | if (mp_irq->dstapic != m->dstapic) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 174 | return 1; | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 175 | if (mp_irq->type != m->type) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 176 | return 2; | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 177 | if (mp_irq->irqtype != m->irqtype) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 178 | return 3; | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 179 | if (mp_irq->irqflag != m->irqflag) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 180 | return 4; | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 181 | if (mp_irq->srcbus != m->srcbus) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 182 | return 5; | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 183 | if (mp_irq->srcbusirq != m->srcbusirq) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 184 | return 6; | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 185 | if (mp_irq->dstirq != m->dstirq) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 186 | return 7; | 
|  | 187 |  | 
|  | 188 | return 0; | 
|  | 189 | } | 
|  | 190 |  | 
| Jaswinder Singh Rajput | 540d4e7 | 2009-01-03 15:50:52 +0530 | [diff] [blame] | 191 | static void __init MP_intsrc_info(struct mpc_intsrc *m) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 192 | { | 
|  | 193 | int i; | 
|  | 194 |  | 
|  | 195 | print_MP_intsrc_info(m); | 
|  | 196 |  | 
| Yinghai Lu | fcfa146 | 2008-06-18 17:29:31 -0700 | [diff] [blame] | 197 | for (i = 0; i < mp_irq_entries; i++) { | 
|  | 198 | if (!mp_irq_mpc_intsrc_cmp(&mp_irqs[i], m)) | 
|  | 199 | return; | 
|  | 200 | } | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 201 |  | 
|  | 202 | assign_to_mp_irq(m, &mp_irqs[mp_irq_entries]); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | if (++mp_irq_entries == MAX_IRQ_SOURCES) | 
|  | 204 | panic("Max # of irq sources exceeded!!\n"); | 
|  | 205 | } | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 206 | #else /* CONFIG_X86_IO_APIC */ | 
|  | 207 | static inline void __init MP_bus_info(struct mpc_bus *m) {} | 
|  | 208 | static inline void __init MP_ioapic_info(struct mpc_ioapic *m) {} | 
|  | 209 | static inline void __init MP_intsrc_info(struct mpc_intsrc *m) {} | 
|  | 210 | #endif /* CONFIG_X86_IO_APIC */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 |  | 
| Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 212 |  | 
| Jaswinder Singh Rajput | 8fb2952 | 2009-01-03 15:51:54 +0530 | [diff] [blame] | 213 | static void __init MP_lintsrc_info(struct mpc_lintsrc *m) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | { | 
| Rene Herman | eeb0d7d | 2008-08-11 17:44:57 +0200 | [diff] [blame] | 215 | apic_printk(APIC_VERBOSE, "Lint: type %d, pol %d, trig %d, bus %02x," | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | " IRQ %02x, APIC ID %x, APIC LINT %02x\n", | 
| Jaswinder Singh Rajput | b5ced7c | 2009-01-04 21:55:53 +0530 | [diff] [blame] | 217 | m->irqtype, m->irqflag & 3, (m->irqflag >> 2) & 3, m->srcbusid, | 
|  | 218 | m->srcbusirq, m->destapic, m->destapiclint); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | } | 
|  | 220 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | /* | 
|  | 222 | * Read/parse the MPC | 
|  | 223 | */ | 
|  | 224 |  | 
| Jaswinder Singh Rajput | f29521e | 2009-01-03 15:46:57 +0530 | [diff] [blame] | 225 | static int __init smp_check_mpc(struct mpc_table *mpc, char *oem, char *str) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 |  | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 228 | if (memcmp(mpc->signature, MPC_SIGNATURE, 4)) { | 
| Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 229 | printk(KERN_ERR "MPTABLE: bad signature [%c%c%c%c]!\n", | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 230 | mpc->signature[0], mpc->signature[1], | 
|  | 231 | mpc->signature[2], mpc->signature[3]); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | return 0; | 
|  | 233 | } | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 234 | if (mpf_checksum((unsigned char *)mpc, mpc->length)) { | 
| Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 235 | printk(KERN_ERR "MPTABLE: checksum error!\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | return 0; | 
|  | 237 | } | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 238 | if (mpc->spec != 0x01 && mpc->spec != 0x04) { | 
| Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 239 | printk(KERN_ERR "MPTABLE: bad table version (%d)!!\n", | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 240 | mpc->spec); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | return 0; | 
|  | 242 | } | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 243 | if (!mpc->lapic) { | 
| Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 244 | printk(KERN_ERR "MPTABLE: null local APIC address!\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | return 0; | 
|  | 246 | } | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 247 | memcpy(oem, mpc->oem, 8); | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 248 | oem[8] = 0; | 
| Yinghai Lu | 11a62a0 | 2008-05-12 15:43:38 +0200 | [diff] [blame] | 249 | printk(KERN_INFO "MPTABLE: OEM ID: %s\n", oem); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 |  | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 251 | memcpy(str, mpc->productid, 12); | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 252 | str[12] = 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 |  | 
| Yinghai Lu | 11a62a0 | 2008-05-12 15:43:38 +0200 | [diff] [blame] | 254 | printk(KERN_INFO "MPTABLE: Product ID: %s\n", str); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 |  | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 256 | printk(KERN_INFO "MPTABLE: APIC at: 0x%X\n", mpc->lapic); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 |  | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 258 | return 1; | 
|  | 259 | } | 
|  | 260 |  | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 261 | static void skip_entry(unsigned char **ptr, int *count, int size) | 
|  | 262 | { | 
|  | 263 | *ptr += size; | 
|  | 264 | *count += size; | 
|  | 265 | } | 
|  | 266 |  | 
| Jaswinder Singh Rajput | 5a5737e | 2009-03-21 13:28:39 +0530 | [diff] [blame] | 267 | static void __init smp_dump_mptable(struct mpc_table *mpc, unsigned char *mpt) | 
|  | 268 | { | 
|  | 269 | printk(KERN_ERR "Your mptable is wrong, contact your HW vendor!\n" | 
|  | 270 | "type %x\n", *mpt); | 
|  | 271 | print_hex_dump(KERN_ERR, "  ", DUMP_PREFIX_ADDRESS, 16, | 
|  | 272 | 1, mpc, mpc->length, 1); | 
|  | 273 | } | 
|  | 274 |  | 
| Thomas Gleixner | 7230214 | 2009-08-20 12:18:32 +0200 | [diff] [blame] | 275 | void __init default_smp_read_mpc_oem(struct mpc_table *mpc) { } | 
|  | 276 |  | 
| Jaswinder Singh Rajput | f29521e | 2009-01-03 15:46:57 +0530 | [diff] [blame] | 277 | static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 278 | { | 
|  | 279 | char str[16]; | 
|  | 280 | char oem[10]; | 
|  | 281 |  | 
|  | 282 | int count = sizeof(*mpc); | 
|  | 283 | unsigned char *mpt = ((unsigned char *)mpc) + count; | 
|  | 284 |  | 
|  | 285 | if (!smp_check_mpc(mpc, oem, str)) | 
|  | 286 | return 0; | 
|  | 287 |  | 
|  | 288 | #ifdef CONFIG_X86_32 | 
| Ingo Molnar | 9c76424 | 2009-01-28 13:44:32 +0100 | [diff] [blame] | 289 | generic_mps_oem_check(mpc, oem, str); | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 290 | #endif | 
| Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 291 | /* save the local APIC address, it might be non-default */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | if (!acpi_lapic) | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 293 | mp_lapic_addr = mpc->lapic; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 |  | 
| Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 295 | if (early) | 
|  | 296 | return 1; | 
|  | 297 |  | 
| Thomas Gleixner | 7230214 | 2009-08-20 12:18:32 +0200 | [diff] [blame] | 298 | if (mpc->oemptr) | 
|  | 299 | x86_init.mpparse.smp_read_mpc_oem(mpc); | 
| Yinghai Lu | 64898a8 | 2008-07-19 18:01:16 -0700 | [diff] [blame] | 300 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | /* | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 302 | *      Now process the configuration blocks. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | */ | 
| Thomas Gleixner | f484847 | 2009-08-20 12:05:01 +0200 | [diff] [blame] | 304 | x86_init.mpparse.mpc_record(0); | 
| Yinghai Lu | 64898a8 | 2008-07-19 18:01:16 -0700 | [diff] [blame] | 305 |  | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 306 | while (count < mpc->length) { | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 307 | switch (*mpt) { | 
|  | 308 | case MP_PROCESSOR: | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 309 | /* ACPI may have already provided this data */ | 
|  | 310 | if (!acpi_lapic) | 
| Ingo Molnar | c58603e | 2009-03-19 08:50:35 +0100 | [diff] [blame] | 311 | MP_processor_info((struct mpc_cpu *)mpt); | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 312 | skip_entry(&mpt, &count, sizeof(struct mpc_cpu)); | 
|  | 313 | break; | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 314 | case MP_BUS: | 
| Ingo Molnar | c58603e | 2009-03-19 08:50:35 +0100 | [diff] [blame] | 315 | MP_bus_info((struct mpc_bus *)mpt); | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 316 | skip_entry(&mpt, &count, sizeof(struct mpc_bus)); | 
|  | 317 | break; | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 318 | case MP_IOAPIC: | 
| Ingo Molnar | c58603e | 2009-03-19 08:50:35 +0100 | [diff] [blame] | 319 | MP_ioapic_info((struct mpc_ioapic *)mpt); | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 320 | skip_entry(&mpt, &count, sizeof(struct mpc_ioapic)); | 
|  | 321 | break; | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 322 | case MP_INTSRC: | 
| Ingo Molnar | c58603e | 2009-03-19 08:50:35 +0100 | [diff] [blame] | 323 | MP_intsrc_info((struct mpc_intsrc *)mpt); | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 324 | skip_entry(&mpt, &count, sizeof(struct mpc_intsrc)); | 
|  | 325 | break; | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 326 | case MP_LINTSRC: | 
| Ingo Molnar | c58603e | 2009-03-19 08:50:35 +0100 | [diff] [blame] | 327 | MP_lintsrc_info((struct mpc_lintsrc *)mpt); | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 328 | skip_entry(&mpt, &count, sizeof(struct mpc_lintsrc)); | 
|  | 329 | break; | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 330 | default: | 
| Yinghai Lu | 711554d | 2008-04-07 11:36:39 -0700 | [diff] [blame] | 331 | /* wrong mptable */ | 
| Jaswinder Singh Rajput | 5a5737e | 2009-03-21 13:28:39 +0530 | [diff] [blame] | 332 | smp_dump_mptable(mpc, mpt); | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 333 | count = mpc->length; | 
| Yinghai Lu | 711554d | 2008-04-07 11:36:39 -0700 | [diff] [blame] | 334 | break; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | } | 
| Thomas Gleixner | f484847 | 2009-08-20 12:05:01 +0200 | [diff] [blame] | 336 | x86_init.mpparse.mpc_record(1); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | } | 
| Yinghai Lu | e0da336 | 2008-06-08 18:29:22 -0700 | [diff] [blame] | 338 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | if (!num_processors) | 
| Alexey Starikovskiy | e950bea | 2008-04-04 23:42:27 +0400 | [diff] [blame] | 340 | printk(KERN_ERR "MPTABLE: no processors registered!\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | return num_processors; | 
|  | 342 | } | 
|  | 343 |  | 
| Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 344 | #ifdef CONFIG_X86_IO_APIC | 
|  | 345 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | static int __init ELCR_trigger(unsigned int irq) | 
|  | 347 | { | 
|  | 348 | unsigned int port; | 
|  | 349 |  | 
|  | 350 | port = 0x4d0 + (irq >> 3); | 
|  | 351 | return (inb(port) >> (irq & 7)) & 1; | 
|  | 352 | } | 
|  | 353 |  | 
|  | 354 | static void __init construct_default_ioirq_mptable(int mpc_default_type) | 
|  | 355 | { | 
| Jaswinder Singh Rajput | 540d4e7 | 2009-01-03 15:50:52 +0530 | [diff] [blame] | 356 | struct mpc_intsrc intsrc; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | int i; | 
|  | 358 | int ELCR_fallback = 0; | 
|  | 359 |  | 
| Jaswinder Singh Rajput | e253b39 | 2009-01-04 21:56:44 +0530 | [diff] [blame] | 360 | intsrc.type = MP_INTSRC; | 
|  | 361 | intsrc.irqflag = 0;	/* conforming */ | 
|  | 362 | intsrc.srcbus = 0; | 
| Jaswinder Singh Rajput | b5ba7e6 | 2009-01-12 17:46:17 +0530 | [diff] [blame] | 363 | intsrc.dstapic = mp_ioapics[0].apicid; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 |  | 
| Jaswinder Singh Rajput | e253b39 | 2009-01-04 21:56:44 +0530 | [diff] [blame] | 365 | intsrc.irqtype = mp_INT; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 |  | 
|  | 367 | /* | 
|  | 368 | *  If true, we have an ISA/PCI system with no IRQ entries | 
|  | 369 | *  in the MP table. To prevent the PCI interrupts from being set up | 
|  | 370 | *  incorrectly, we try to use the ELCR. The sanity check to see if | 
|  | 371 | *  there is good ELCR data is very simple - IRQ0, 1, 2 and 13 can | 
|  | 372 | *  never be level sensitive, so we simply see if the ELCR agrees. | 
|  | 373 | *  If it does, we assume it's valid. | 
|  | 374 | */ | 
|  | 375 | if (mpc_default_type == 5) { | 
| Alexey Starikovskiy | 62441bf | 2008-04-04 23:42:34 +0400 | [diff] [blame] | 376 | printk(KERN_INFO "ISA/PCI bus type with no IRQ information... " | 
|  | 377 | "falling back to ELCR\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 |  | 
| Alexey Starikovskiy | 62441bf | 2008-04-04 23:42:34 +0400 | [diff] [blame] | 379 | if (ELCR_trigger(0) || ELCR_trigger(1) || ELCR_trigger(2) || | 
|  | 380 | ELCR_trigger(13)) | 
|  | 381 | printk(KERN_ERR "ELCR contains invalid data... " | 
|  | 382 | "not using ELCR\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | else { | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 384 | printk(KERN_INFO | 
|  | 385 | "Using ELCR to identify PCI interrupts\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | ELCR_fallback = 1; | 
|  | 387 | } | 
|  | 388 | } | 
|  | 389 |  | 
|  | 390 | for (i = 0; i < 16; i++) { | 
|  | 391 | switch (mpc_default_type) { | 
|  | 392 | case 2: | 
|  | 393 | if (i == 0 || i == 13) | 
|  | 394 | continue;	/* IRQ0 & IRQ13 not connected */ | 
|  | 395 | /* fall through */ | 
|  | 396 | default: | 
|  | 397 | if (i == 2) | 
|  | 398 | continue;	/* IRQ2 is never connected */ | 
|  | 399 | } | 
|  | 400 |  | 
|  | 401 | if (ELCR_fallback) { | 
|  | 402 | /* | 
|  | 403 | *  If the ELCR indicates a level-sensitive interrupt, we | 
|  | 404 | *  copy that information over to the MP table in the | 
|  | 405 | *  irqflag field (level sensitive, active high polarity). | 
|  | 406 | */ | 
|  | 407 | if (ELCR_trigger(i)) | 
| Jaswinder Singh Rajput | e253b39 | 2009-01-04 21:56:44 +0530 | [diff] [blame] | 408 | intsrc.irqflag = 13; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | else | 
| Jaswinder Singh Rajput | e253b39 | 2009-01-04 21:56:44 +0530 | [diff] [blame] | 410 | intsrc.irqflag = 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | } | 
|  | 412 |  | 
| Jaswinder Singh Rajput | e253b39 | 2009-01-04 21:56:44 +0530 | [diff] [blame] | 413 | intsrc.srcbusirq = i; | 
|  | 414 | intsrc.dstirq = i ? i : 2;	/* IRQ0 to INTIN2 */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | MP_intsrc_info(&intsrc); | 
|  | 416 | } | 
|  | 417 |  | 
| Jaswinder Singh Rajput | e253b39 | 2009-01-04 21:56:44 +0530 | [diff] [blame] | 418 | intsrc.irqtype = mp_ExtINT; | 
|  | 419 | intsrc.srcbusirq = 0; | 
|  | 420 | intsrc.dstirq = 0;	/* 8259A to INTIN0 */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | MP_intsrc_info(&intsrc); | 
|  | 422 | } | 
|  | 423 |  | 
| Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 424 |  | 
| Marcin Slusarz | 39e00fe | 2008-08-11 00:09:38 +0200 | [diff] [blame] | 425 | static void __init construct_ioapic_table(int mpc_default_type) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | { | 
| Jaswinder Singh Rajput | 2b85b5f | 2009-01-03 15:49:57 +0530 | [diff] [blame] | 427 | struct mpc_ioapic ioapic; | 
| Jaswinder Singh Rajput | 00fb860 | 2009-01-03 15:47:32 +0530 | [diff] [blame] | 428 | struct mpc_bus bus; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 429 |  | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 430 | bus.type = MP_BUS; | 
|  | 431 | bus.busid = 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | switch (mpc_default_type) { | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 433 | default: | 
| Alexey Starikovskiy | 62441bf | 2008-04-04 23:42:34 +0400 | [diff] [blame] | 434 | printk(KERN_ERR "???\nUnknown standard configuration %d\n", | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 435 | mpc_default_type); | 
|  | 436 | /* fall through */ | 
|  | 437 | case 1: | 
|  | 438 | case 5: | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 439 | memcpy(bus.bustype, "ISA   ", 6); | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 440 | break; | 
|  | 441 | case 2: | 
|  | 442 | case 6: | 
|  | 443 | case 3: | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 444 | memcpy(bus.bustype, "EISA  ", 6); | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 445 | break; | 
|  | 446 | case 4: | 
|  | 447 | case 7: | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 448 | memcpy(bus.bustype, "MCA   ", 6); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | } | 
|  | 450 | MP_bus_info(&bus); | 
|  | 451 | if (mpc_default_type > 4) { | 
| Jaswinder Singh Rajput | d4c715f | 2009-01-04 21:59:26 +0530 | [diff] [blame] | 452 | bus.busid = 1; | 
|  | 453 | memcpy(bus.bustype, "PCI   ", 6); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | MP_bus_info(&bus); | 
|  | 455 | } | 
|  | 456 |  | 
| Cyrill Gorcunov | 8f3e1df | 2009-08-24 21:53:36 +0400 | [diff] [blame] | 457 | ioapic.type	= MP_IOAPIC; | 
|  | 458 | ioapic.apicid	= 2; | 
|  | 459 | ioapic.apicver	= mpc_default_type > 4 ? 0x10 : 0x01; | 
|  | 460 | ioapic.flags	= MPC_APIC_USABLE; | 
|  | 461 | ioapic.apicaddr	= IO_APIC_DEFAULT_PHYS_BASE; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 | MP_ioapic_info(&ioapic); | 
|  | 463 |  | 
|  | 464 | /* | 
|  | 465 | * We set up most of the low 16 IO-APIC pins according to MPS rules. | 
|  | 466 | */ | 
|  | 467 | construct_default_ioirq_mptable(mpc_default_type); | 
| Thomas Gleixner | 85cc35f | 2008-05-25 21:21:36 +0200 | [diff] [blame] | 468 | } | 
|  | 469 | #else | 
| Marcin Slusarz | 39e00fe | 2008-08-11 00:09:38 +0200 | [diff] [blame] | 470 | static inline void __init construct_ioapic_table(int mpc_default_type) { } | 
| Alexey Starikovskiy | 61048c6 | 2008-04-04 23:41:07 +0400 | [diff] [blame] | 471 | #endif | 
| Thomas Gleixner | 85cc35f | 2008-05-25 21:21:36 +0200 | [diff] [blame] | 472 |  | 
|  | 473 | static inline void __init construct_default_ISA_mptable(int mpc_default_type) | 
|  | 474 | { | 
| Jaswinder Singh Rajput | f4f21b7 | 2009-01-03 15:48:52 +0530 | [diff] [blame] | 475 | struct mpc_cpu processor; | 
| Jaswinder Singh Rajput | 8fb2952 | 2009-01-03 15:51:54 +0530 | [diff] [blame] | 476 | struct mpc_lintsrc lintsrc; | 
| Thomas Gleixner | 85cc35f | 2008-05-25 21:21:36 +0200 | [diff] [blame] | 477 | int linttypes[2] = { mp_ExtINT, mp_NMI }; | 
|  | 478 | int i; | 
|  | 479 |  | 
|  | 480 | /* | 
|  | 481 | * local APIC has default address | 
|  | 482 | */ | 
|  | 483 | mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; | 
|  | 484 |  | 
|  | 485 | /* | 
|  | 486 | * 2 CPUs, numbered 0 & 1. | 
|  | 487 | */ | 
| Jaswinder Singh Rajput | c456382 | 2009-01-04 21:58:25 +0530 | [diff] [blame] | 488 | processor.type = MP_PROCESSOR; | 
| Thomas Gleixner | 85cc35f | 2008-05-25 21:21:36 +0200 | [diff] [blame] | 489 | /* Either an integrated APIC or a discrete 82489DX. */ | 
| Jaswinder Singh Rajput | c456382 | 2009-01-04 21:58:25 +0530 | [diff] [blame] | 490 | processor.apicver = mpc_default_type > 4 ? 0x10 : 0x01; | 
|  | 491 | processor.cpuflag = CPU_ENABLED; | 
|  | 492 | processor.cpufeature = (boot_cpu_data.x86 << 8) | | 
| Thomas Gleixner | 85cc35f | 2008-05-25 21:21:36 +0200 | [diff] [blame] | 493 | (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_mask; | 
| Jaswinder Singh Rajput | c456382 | 2009-01-04 21:58:25 +0530 | [diff] [blame] | 494 | processor.featureflag = boot_cpu_data.x86_capability[0]; | 
|  | 495 | processor.reserved[0] = 0; | 
|  | 496 | processor.reserved[1] = 0; | 
| Thomas Gleixner | 85cc35f | 2008-05-25 21:21:36 +0200 | [diff] [blame] | 497 | for (i = 0; i < 2; i++) { | 
| Jaswinder Singh Rajput | c456382 | 2009-01-04 21:58:25 +0530 | [diff] [blame] | 498 | processor.apicid = i; | 
| Thomas Gleixner | 85cc35f | 2008-05-25 21:21:36 +0200 | [diff] [blame] | 499 | MP_processor_info(&processor); | 
|  | 500 | } | 
|  | 501 |  | 
|  | 502 | construct_ioapic_table(mpc_default_type); | 
|  | 503 |  | 
| Jaswinder Singh Rajput | b5ced7c | 2009-01-04 21:55:53 +0530 | [diff] [blame] | 504 | lintsrc.type = MP_LINTSRC; | 
|  | 505 | lintsrc.irqflag = 0;		/* conforming */ | 
|  | 506 | lintsrc.srcbusid = 0; | 
|  | 507 | lintsrc.srcbusirq = 0; | 
|  | 508 | lintsrc.destapic = MP_APIC_ALL; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | for (i = 0; i < 2; i++) { | 
| Jaswinder Singh Rajput | b5ced7c | 2009-01-04 21:55:53 +0530 | [diff] [blame] | 510 | lintsrc.irqtype = linttypes[i]; | 
|  | 511 | lintsrc.destapiclint = i; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | MP_lintsrc_info(&lintsrc); | 
|  | 513 | } | 
|  | 514 | } | 
|  | 515 |  | 
| Jaswinder Singh Rajput | 41401db | 2009-01-08 15:42:46 +0530 | [diff] [blame] | 516 | static struct mpf_intel *mpf_found; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 517 |  | 
| Yinghai Lu | 8d4dd91 | 2009-03-04 01:25:21 -0800 | [diff] [blame] | 518 | static unsigned long __init get_mpc_size(unsigned long physptr) | 
|  | 519 | { | 
|  | 520 | struct mpc_table *mpc; | 
|  | 521 | unsigned long size; | 
|  | 522 |  | 
|  | 523 | mpc = early_ioremap(physptr, PAGE_SIZE); | 
|  | 524 | size = mpc->length; | 
|  | 525 | early_iounmap(mpc, PAGE_SIZE); | 
|  | 526 | apic_printk(APIC_VERBOSE, "  mpc: %lx-%lx\n", physptr, physptr + size); | 
|  | 527 |  | 
|  | 528 | return size; | 
|  | 529 | } | 
|  | 530 |  | 
| Jaswinder Singh Rajput | 0b3ba0c | 2009-03-21 13:43:20 +0530 | [diff] [blame] | 531 | static int __init check_physptr(struct mpf_intel *mpf, unsigned int early) | 
|  | 532 | { | 
|  | 533 | struct mpc_table *mpc; | 
|  | 534 | unsigned long size; | 
|  | 535 |  | 
|  | 536 | size = get_mpc_size(mpf->physptr); | 
|  | 537 | mpc = early_ioremap(mpf->physptr, size); | 
|  | 538 | /* | 
|  | 539 | * Read the physical hardware table.  Anything here will | 
|  | 540 | * override the defaults. | 
|  | 541 | */ | 
|  | 542 | if (!smp_read_mpc(mpc, early)) { | 
|  | 543 | #ifdef CONFIG_X86_LOCAL_APIC | 
|  | 544 | smp_found_config = 0; | 
|  | 545 | #endif | 
|  | 546 | printk(KERN_ERR "BIOS bug, MP table errors detected!...\n" | 
|  | 547 | "... disabling SMP support. (tell your hw vendor)\n"); | 
|  | 548 | early_iounmap(mpc, size); | 
|  | 549 | return -1; | 
|  | 550 | } | 
|  | 551 | early_iounmap(mpc, size); | 
|  | 552 |  | 
|  | 553 | if (early) | 
|  | 554 | return -1; | 
|  | 555 |  | 
|  | 556 | #ifdef CONFIG_X86_IO_APIC | 
|  | 557 | /* | 
|  | 558 | * If there are no explicit MP IRQ entries, then we are | 
|  | 559 | * broken.  We set up most of the low 16 IO-APIC pins to | 
|  | 560 | * ISA defaults and hope it will work. | 
|  | 561 | */ | 
|  | 562 | if (!mp_irq_entries) { | 
|  | 563 | struct mpc_bus bus; | 
|  | 564 |  | 
|  | 565 | printk(KERN_ERR "BIOS bug, no explicit IRQ entries, " | 
|  | 566 | "using default mptable. (tell your hw vendor)\n"); | 
|  | 567 |  | 
|  | 568 | bus.type = MP_BUS; | 
|  | 569 | bus.busid = 0; | 
|  | 570 | memcpy(bus.bustype, "ISA   ", 6); | 
|  | 571 | MP_bus_info(&bus); | 
|  | 572 |  | 
|  | 573 | construct_default_ioirq_mptable(0); | 
|  | 574 | } | 
|  | 575 | #endif | 
|  | 576 |  | 
|  | 577 | return 0; | 
|  | 578 | } | 
|  | 579 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 580 | /* | 
|  | 581 | * Scan the memory blocks for an SMP configuration block. | 
|  | 582 | */ | 
| Thomas Gleixner | b3f1b61 | 2009-08-20 11:11:52 +0200 | [diff] [blame] | 583 | void __init default_get_smp_config(unsigned int early) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 584 | { | 
| Jaswinder Singh Rajput | 41401db | 2009-01-08 15:42:46 +0530 | [diff] [blame] | 585 | struct mpf_intel *mpf = mpf_found; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 586 |  | 
| Yinghai Lu | 69b88af | 2008-12-05 22:45:50 -0800 | [diff] [blame] | 587 | if (!mpf) | 
|  | 588 | return; | 
|  | 589 |  | 
|  | 590 | if (acpi_lapic && early) | 
|  | 591 | return; | 
|  | 592 |  | 
|  | 593 | /* | 
|  | 594 | * MPS doesn't support hyperthreading, aka only have | 
|  | 595 | * thread 0 apic id in MPS table | 
|  | 596 | */ | 
|  | 597 | if (acpi_lapic && acpi_ioapic) | 
|  | 598 | return; | 
|  | 599 |  | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 600 | printk(KERN_INFO "Intel MultiProcessor Specification v1.%d\n", | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 601 | mpf->specification); | 
| Alexey Starikovskiy | b3e2416 | 2008-05-23 01:54:44 +0400 | [diff] [blame] | 602 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32) | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 603 | if (mpf->feature2 & (1 << 7)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 604 | printk(KERN_INFO "    IMCR and PIC compatibility mode.\n"); | 
|  | 605 | pic_mode = 1; | 
|  | 606 | } else { | 
|  | 607 | printk(KERN_INFO "    Virtual Wire compatibility mode.\n"); | 
|  | 608 | pic_mode = 0; | 
|  | 609 | } | 
| Alexey Starikovskiy | 4421b1c | 2008-04-04 23:42:40 +0400 | [diff] [blame] | 610 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 611 | /* | 
|  | 612 | * Now see if we need to read further. | 
|  | 613 | */ | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 614 | if (mpf->feature1 != 0) { | 
| Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 615 | if (early) { | 
|  | 616 | /* | 
|  | 617 | * local APIC has default address | 
|  | 618 | */ | 
|  | 619 | mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; | 
|  | 620 | return; | 
|  | 621 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 622 |  | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 623 | printk(KERN_INFO "Default MP configuration #%d\n", | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 624 | mpf->feature1); | 
|  | 625 | construct_default_ISA_mptable(mpf->feature1); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 626 |  | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 627 | } else if (mpf->physptr) { | 
| Jaswinder Singh Rajput | 0b3ba0c | 2009-03-21 13:43:20 +0530 | [diff] [blame] | 628 | if (check_physptr(mpf, early)) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 629 | return; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 630 | } else | 
|  | 631 | BUG(); | 
|  | 632 |  | 
| Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 633 | if (!early) | 
|  | 634 | printk(KERN_INFO "Processors: %d\n", num_processors); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 635 | /* | 
|  | 636 | * Only use the first configuration found. | 
|  | 637 | */ | 
|  | 638 | } | 
|  | 639 |  | 
| Yinghai Lu | b24c2a9 | 2009-11-24 02:48:18 -0800 | [diff] [blame] | 640 | static void __init smp_reserve_memory(struct mpf_intel *mpf) | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 641 | { | 
|  | 642 | unsigned long size = get_mpc_size(mpf->physptr); | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 643 |  | 
| Andi Kleen | 909fc87 | 2010-03-29 09:41:11 +0200 | [diff] [blame] | 644 | reserve_early_overlap_ok(mpf->physptr, mpf->physptr+size, "MP-table mpc"); | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 645 | } | 
|  | 646 |  | 
| Yinghai Lu | b24c2a9 | 2009-11-24 02:48:18 -0800 | [diff] [blame] | 647 | static int __init smp_scan_config(unsigned long base, unsigned long length) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 648 | { | 
| Alexey Starikovskiy | 92fd4b7 | 2008-04-04 23:42:46 +0400 | [diff] [blame] | 649 | unsigned int *bp = phys_to_virt(base); | 
| Jaswinder Singh Rajput | 41401db | 2009-01-08 15:42:46 +0530 | [diff] [blame] | 650 | struct mpf_intel *mpf; | 
| Yinghai Lu | b24c2a9 | 2009-11-24 02:48:18 -0800 | [diff] [blame] | 651 | unsigned long mem; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 652 |  | 
| Rene Herman | eeb0d7d | 2008-08-11 17:44:57 +0200 | [diff] [blame] | 653 | apic_printk(APIC_VERBOSE, "Scan SMP from %p for %ld bytes.\n", | 
|  | 654 | bp, length); | 
| Akinobu Mita | 5d47a27 | 2008-04-19 23:55:11 +0900 | [diff] [blame] | 655 | BUILD_BUG_ON(sizeof(*mpf) != 16); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 656 |  | 
|  | 657 | while (length > 0) { | 
| Jaswinder Singh Rajput | 41401db | 2009-01-08 15:42:46 +0530 | [diff] [blame] | 658 | mpf = (struct mpf_intel *)bp; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | if ((*bp == SMP_MAGIC_IDENT) && | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 660 | (mpf->length == 1) && | 
| Alexey Starikovskiy | 4ef8129 | 2008-04-04 23:42:03 +0400 | [diff] [blame] | 661 | !mpf_checksum((unsigned char *)bp, 16) && | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 662 | ((mpf->specification == 1) | 
|  | 663 | || (mpf->specification == 4))) { | 
| Alexey Starikovskiy | bab4b27 | 2008-05-19 19:47:03 +0400 | [diff] [blame] | 664 | #ifdef CONFIG_X86_LOCAL_APIC | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 665 | smp_found_config = 1; | 
| Alexey Starikovskiy | bab4b27 | 2008-05-19 19:47:03 +0400 | [diff] [blame] | 666 | #endif | 
| Alexey Starikovskiy | 92fd4b7 | 2008-04-04 23:42:46 +0400 | [diff] [blame] | 667 | mpf_found = mpf; | 
| Yinghai Lu | b1f006b | 2008-06-09 18:11:36 -0700 | [diff] [blame] | 668 |  | 
| Jaswinder Singh Rajput | ba1511b | 2009-02-11 23:38:25 +0530 | [diff] [blame] | 669 | printk(KERN_INFO "found SMP MP-table at [%p] %llx\n", | 
|  | 670 | mpf, (u64)virt_to_phys(mpf)); | 
| Yinghai Lu | b1f006b | 2008-06-09 18:11:36 -0700 | [diff] [blame] | 671 |  | 
| Yinghai Lu | b24c2a9 | 2009-11-24 02:48:18 -0800 | [diff] [blame] | 672 | mem = virt_to_phys(mpf); | 
| Andi Kleen | 909fc87 | 2010-03-29 09:41:11 +0200 | [diff] [blame] | 673 | reserve_early_overlap_ok(mem, mem + sizeof(*mpf), "MP-table mpf"); | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 674 | if (mpf->physptr) | 
| Yinghai Lu | b24c2a9 | 2009-11-24 02:48:18 -0800 | [diff] [blame] | 675 | smp_reserve_memory(mpf); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 676 |  | 
| Yinghai Lu | d2dbf34 | 2008-06-13 02:00:56 -0700 | [diff] [blame] | 677 | return 1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 678 | } | 
|  | 679 | bp += 4; | 
|  | 680 | length -= 16; | 
|  | 681 | } | 
|  | 682 | return 0; | 
|  | 683 | } | 
|  | 684 |  | 
| Yinghai Lu | b24c2a9 | 2009-11-24 02:48:18 -0800 | [diff] [blame] | 685 | void __init default_find_smp_config(void) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 686 | { | 
|  | 687 | unsigned int address; | 
|  | 688 |  | 
|  | 689 | /* | 
|  | 690 | * FIXME: Linux assumes you have 640K of base ram.. | 
|  | 691 | * this continues the error... | 
|  | 692 | * | 
|  | 693 | * 1) Scan the bottom 1K for a signature | 
|  | 694 | * 2) Scan the top 1K of base RAM | 
|  | 695 | * 3) Scan the 64K of bios | 
|  | 696 | */ | 
| Yinghai Lu | b24c2a9 | 2009-11-24 02:48:18 -0800 | [diff] [blame] | 697 | if (smp_scan_config(0x0, 0x400) || | 
|  | 698 | smp_scan_config(639 * 0x400, 0x400) || | 
|  | 699 | smp_scan_config(0xF0000, 0x10000)) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 700 | return; | 
|  | 701 | /* | 
|  | 702 | * If it is an SMP machine we should know now, unless the | 
|  | 703 | * configuration is in an EISA/MCA bus machine with an | 
|  | 704 | * extended bios data area. | 
|  | 705 | * | 
|  | 706 | * there is a real-mode segmented pointer pointing to the | 
|  | 707 | * 4K EBDA area at 0x40E, calculate and scan it here. | 
|  | 708 | * | 
|  | 709 | * NOTE! There are Linux loaders that will corrupt the EBDA | 
|  | 710 | * area, and as such this kind of SMP config may be less | 
|  | 711 | * trustworthy, simply because the SMP table may have been | 
|  | 712 | * stomped on during early boot. These loaders are buggy and | 
|  | 713 | * should be fixed. | 
|  | 714 | * | 
|  | 715 | * MP1.4 SPEC states to only scan first 1K of 4K EBDA. | 
|  | 716 | */ | 
|  | 717 |  | 
|  | 718 | address = get_bios_ebda(); | 
|  | 719 | if (address) | 
| Yinghai Lu | b24c2a9 | 2009-11-24 02:48:18 -0800 | [diff] [blame] | 720 | smp_scan_config(address, 0x400); | 
| Alexey Starikovskiy | 888032c | 2008-04-04 23:42:09 +0400 | [diff] [blame] | 721 | } | 
|  | 722 |  | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 723 | #ifdef CONFIG_X86_IO_APIC | 
|  | 724 | static u8 __initdata irq_used[MAX_IRQ_SOURCES]; | 
|  | 725 |  | 
| Jaswinder Singh Rajput | 540d4e7 | 2009-01-03 15:50:52 +0530 | [diff] [blame] | 726 | static int  __init get_MP_intsrc_index(struct mpc_intsrc *m) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 727 | { | 
|  | 728 | int i; | 
|  | 729 |  | 
| Jaswinder Singh Rajput | e253b39 | 2009-01-04 21:56:44 +0530 | [diff] [blame] | 730 | if (m->irqtype != mp_INT) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 731 | return 0; | 
|  | 732 |  | 
| Jaswinder Singh Rajput | e253b39 | 2009-01-04 21:56:44 +0530 | [diff] [blame] | 733 | if (m->irqflag != 0x0f) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 734 | return 0; | 
|  | 735 |  | 
|  | 736 | /* not legacy */ | 
|  | 737 |  | 
|  | 738 | for (i = 0; i < mp_irq_entries; i++) { | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 739 | if (mp_irqs[i].irqtype != mp_INT) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 740 | continue; | 
|  | 741 |  | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 742 | if (mp_irqs[i].irqflag != 0x0f) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 743 | continue; | 
|  | 744 |  | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 745 | if (mp_irqs[i].srcbus != m->srcbus) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 746 | continue; | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 747 | if (mp_irqs[i].srcbusirq != m->srcbusirq) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 748 | continue; | 
|  | 749 | if (irq_used[i]) { | 
|  | 750 | /* already claimed */ | 
|  | 751 | return -2; | 
|  | 752 | } | 
|  | 753 | irq_used[i] = 1; | 
|  | 754 | return i; | 
|  | 755 | } | 
|  | 756 |  | 
|  | 757 | /* not found */ | 
|  | 758 | return -1; | 
|  | 759 | } | 
|  | 760 |  | 
|  | 761 | #define SPARE_SLOT_NUM 20 | 
|  | 762 |  | 
| Jaswinder Singh Rajput | 540d4e7 | 2009-01-03 15:50:52 +0530 | [diff] [blame] | 763 | static struct mpc_intsrc __initdata *m_spare[SPARE_SLOT_NUM]; | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 764 |  | 
| Rakib Mullick | 5759222 | 2009-04-11 09:04:59 +0600 | [diff] [blame] | 765 | static void __init check_irq_src(struct mpc_intsrc *m, int *nr_m_spare) | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 766 | { | 
|  | 767 | int i; | 
|  | 768 |  | 
|  | 769 | apic_printk(APIC_VERBOSE, "OLD "); | 
|  | 770 | print_MP_intsrc_info(m); | 
|  | 771 |  | 
|  | 772 | i = get_MP_intsrc_index(m); | 
|  | 773 | if (i > 0) { | 
|  | 774 | assign_to_mpc_intsrc(&mp_irqs[i], m); | 
|  | 775 | apic_printk(APIC_VERBOSE, "NEW "); | 
|  | 776 | print_mp_irq_info(&mp_irqs[i]); | 
|  | 777 | return; | 
|  | 778 | } | 
|  | 779 | if (!i) { | 
|  | 780 | /* legacy, do nothing */ | 
|  | 781 | return; | 
|  | 782 | } | 
|  | 783 | if (*nr_m_spare < SPARE_SLOT_NUM) { | 
|  | 784 | /* | 
|  | 785 | * not found (-1), or duplicated (-2) are invalid entries, | 
|  | 786 | * we need to use the slot later | 
|  | 787 | */ | 
|  | 788 | m_spare[*nr_m_spare] = m; | 
|  | 789 | *nr_m_spare += 1; | 
|  | 790 | } | 
|  | 791 | } | 
|  | 792 | #else /* CONFIG_X86_IO_APIC */ | 
| Rakib Mullick | 5759222 | 2009-04-11 09:04:59 +0600 | [diff] [blame] | 793 | static | 
|  | 794 | inline void __init check_irq_src(struct mpc_intsrc *m, int *nr_m_spare) {} | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 795 | #endif /* CONFIG_X86_IO_APIC */ | 
|  | 796 |  | 
| Yinghai Lu | ee21455 | 2009-05-06 10:07:07 -0700 | [diff] [blame] | 797 | static int | 
|  | 798 | check_slot(unsigned long mpc_new_phys, unsigned long mpc_new_length, int count) | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 799 | { | 
| Yinghai Lu | ee21455 | 2009-05-06 10:07:07 -0700 | [diff] [blame] | 800 | int ret = 0; | 
|  | 801 |  | 
|  | 802 | if (!mpc_new_phys || count <= mpc_new_length) { | 
|  | 803 | WARN(1, "update_mptable: No spare slots (length: %x)\n", count); | 
|  | 804 | return -1; | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 805 | } | 
|  | 806 |  | 
| Yinghai Lu | ee21455 | 2009-05-06 10:07:07 -0700 | [diff] [blame] | 807 | return ret; | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 808 | } | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 809 |  | 
| Jaswinder Singh Rajput | f29521e | 2009-01-03 15:46:57 +0530 | [diff] [blame] | 810 | static int  __init replace_intsrc_all(struct mpc_table *mpc, | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 811 | unsigned long mpc_new_phys, | 
|  | 812 | unsigned long mpc_new_length) | 
|  | 813 | { | 
|  | 814 | #ifdef CONFIG_X86_IO_APIC | 
|  | 815 | int i; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 816 | #endif | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 817 | int count = sizeof(*mpc); | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 818 | int nr_m_spare = 0; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 819 | unsigned char *mpt = ((unsigned char *)mpc) + count; | 
|  | 820 |  | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 821 | printk(KERN_INFO "mpc_length %x\n", mpc->length); | 
|  | 822 | while (count < mpc->length) { | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 823 | switch (*mpt) { | 
|  | 824 | case MP_PROCESSOR: | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 825 | skip_entry(&mpt, &count, sizeof(struct mpc_cpu)); | 
|  | 826 | break; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 827 | case MP_BUS: | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 828 | skip_entry(&mpt, &count, sizeof(struct mpc_bus)); | 
|  | 829 | break; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 830 | case MP_IOAPIC: | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 831 | skip_entry(&mpt, &count, sizeof(struct mpc_ioapic)); | 
|  | 832 | break; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 833 | case MP_INTSRC: | 
| Ingo Molnar | c58603e | 2009-03-19 08:50:35 +0100 | [diff] [blame] | 834 | check_irq_src((struct mpc_intsrc *)mpt, &nr_m_spare); | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 835 | skip_entry(&mpt, &count, sizeof(struct mpc_intsrc)); | 
|  | 836 | break; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 837 | case MP_LINTSRC: | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 838 | skip_entry(&mpt, &count, sizeof(struct mpc_lintsrc)); | 
|  | 839 | break; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 840 | default: | 
|  | 841 | /* wrong mptable */ | 
| Jaswinder Singh Rajput | 5a5737e | 2009-03-21 13:28:39 +0530 | [diff] [blame] | 842 | smp_dump_mptable(mpc, mpt); | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 843 | goto out; | 
|  | 844 | } | 
|  | 845 | } | 
|  | 846 |  | 
|  | 847 | #ifdef CONFIG_X86_IO_APIC | 
|  | 848 | for (i = 0; i < mp_irq_entries; i++) { | 
|  | 849 | if (irq_used[i]) | 
|  | 850 | continue; | 
|  | 851 |  | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 852 | if (mp_irqs[i].irqtype != mp_INT) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 853 | continue; | 
|  | 854 |  | 
| Jaswinder Singh Rajput | c2c2174 | 2009-01-12 17:47:22 +0530 | [diff] [blame] | 855 | if (mp_irqs[i].irqflag != 0x0f) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 856 | continue; | 
|  | 857 |  | 
|  | 858 | if (nr_m_spare > 0) { | 
| Jan Beulich | 82034d6 | 2009-03-12 12:57:10 +0000 | [diff] [blame] | 859 | apic_printk(APIC_VERBOSE, "*NEW* found\n"); | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 860 | nr_m_spare--; | 
|  | 861 | assign_to_mpc_intsrc(&mp_irqs[i], m_spare[nr_m_spare]); | 
|  | 862 | m_spare[nr_m_spare] = NULL; | 
|  | 863 | } else { | 
| Jaswinder Singh Rajput | 540d4e7 | 2009-01-03 15:50:52 +0530 | [diff] [blame] | 864 | struct mpc_intsrc *m = (struct mpc_intsrc *)mpt; | 
|  | 865 | count += sizeof(struct mpc_intsrc); | 
| Yinghai Lu | ee21455 | 2009-05-06 10:07:07 -0700 | [diff] [blame] | 866 | if (check_slot(mpc_new_phys, mpc_new_length, count) < 0) | 
| Jaswinder Singh Rajput | a683027 | 2009-03-18 20:42:28 +0530 | [diff] [blame] | 867 | goto out; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 868 | assign_to_mpc_intsrc(&mp_irqs[i], m); | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 869 | mpc->length = count; | 
| Jaswinder Singh Rajput | 540d4e7 | 2009-01-03 15:50:52 +0530 | [diff] [blame] | 870 | mpt += sizeof(struct mpc_intsrc); | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 871 | } | 
|  | 872 | print_mp_irq_info(&mp_irqs[i]); | 
|  | 873 | } | 
|  | 874 | #endif | 
|  | 875 | out: | 
|  | 876 | /* update checksum */ | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 877 | mpc->checksum = 0; | 
|  | 878 | mpc->checksum -= mpf_checksum((unsigned char *)mpc, mpc->length); | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 879 |  | 
|  | 880 | return 0; | 
|  | 881 | } | 
|  | 882 |  | 
| Yinghai Lu | f1bdb52 | 2009-05-15 13:05:16 -0700 | [diff] [blame] | 883 | int enable_update_mptable; | 
| Yinghai Lu | fcfa146 | 2008-06-18 17:29:31 -0700 | [diff] [blame] | 884 |  | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 885 | static int __init update_mptable_setup(char *str) | 
|  | 886 | { | 
|  | 887 | enable_update_mptable = 1; | 
| Yinghai Lu | 629e15d | 2009-05-15 13:05:16 -0700 | [diff] [blame] | 888 | #ifdef CONFIG_PCI | 
|  | 889 | pci_routeirq = 1; | 
|  | 890 | #endif | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 891 | return 0; | 
|  | 892 | } | 
|  | 893 | early_param("update_mptable", update_mptable_setup); | 
|  | 894 |  | 
|  | 895 | static unsigned long __initdata mpc_new_phys; | 
|  | 896 | static unsigned long mpc_new_length __initdata = 4096; | 
|  | 897 |  | 
|  | 898 | /* alloc_mptable or alloc_mptable=4k */ | 
|  | 899 | static int __initdata alloc_mptable; | 
|  | 900 | static int __init parse_alloc_mptable_opt(char *p) | 
|  | 901 | { | 
|  | 902 | enable_update_mptable = 1; | 
| Yinghai Lu | 629e15d | 2009-05-15 13:05:16 -0700 | [diff] [blame] | 903 | #ifdef CONFIG_PCI | 
|  | 904 | pci_routeirq = 1; | 
|  | 905 | #endif | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 906 | alloc_mptable = 1; | 
|  | 907 | if (!p) | 
|  | 908 | return 0; | 
|  | 909 | mpc_new_length = memparse(p, &p); | 
|  | 910 | return 0; | 
|  | 911 | } | 
|  | 912 | early_param("alloc_mptable", parse_alloc_mptable_opt); | 
|  | 913 |  | 
|  | 914 | void __init early_reserve_e820_mpc_new(void) | 
|  | 915 | { | 
|  | 916 | if (enable_update_mptable && alloc_mptable) { | 
|  | 917 | u64 startt = 0; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 918 | mpc_new_phys = early_reserve_e820(startt, mpc_new_length, 4); | 
|  | 919 | } | 
|  | 920 | } | 
|  | 921 |  | 
|  | 922 | static int __init update_mp_table(void) | 
|  | 923 | { | 
|  | 924 | char str[16]; | 
|  | 925 | char oem[10]; | 
| Jaswinder Singh Rajput | 41401db | 2009-01-08 15:42:46 +0530 | [diff] [blame] | 926 | struct mpf_intel *mpf; | 
| Jaswinder Singh Rajput | f29521e | 2009-01-03 15:46:57 +0530 | [diff] [blame] | 927 | struct mpc_table *mpc, *mpc_new; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 928 |  | 
|  | 929 | if (!enable_update_mptable) | 
|  | 930 | return 0; | 
|  | 931 |  | 
|  | 932 | mpf = mpf_found; | 
|  | 933 | if (!mpf) | 
|  | 934 | return 0; | 
|  | 935 |  | 
|  | 936 | /* | 
|  | 937 | * Now see if we need to go further. | 
|  | 938 | */ | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 939 | if (mpf->feature1 != 0) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 940 | return 0; | 
|  | 941 |  | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 942 | if (!mpf->physptr) | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 943 | return 0; | 
|  | 944 |  | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 945 | mpc = phys_to_virt(mpf->physptr); | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 946 |  | 
|  | 947 | if (!smp_check_mpc(mpc, oem, str)) | 
|  | 948 | return 0; | 
|  | 949 |  | 
| Jaswinder Singh Rajput | ba1511b | 2009-02-11 23:38:25 +0530 | [diff] [blame] | 950 | printk(KERN_INFO "mpf: %llx\n", (u64)virt_to_phys(mpf)); | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 951 | printk(KERN_INFO "physptr: %x\n", mpf->physptr); | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 952 |  | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 953 | if (mpc_new_phys && mpc->length > mpc_new_length) { | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 954 | mpc_new_phys = 0; | 
|  | 955 | printk(KERN_INFO "mpc_new_length is %ld, please use alloc_mptable=8k\n", | 
|  | 956 | mpc_new_length); | 
|  | 957 | } | 
|  | 958 |  | 
|  | 959 | if (!mpc_new_phys) { | 
|  | 960 | unsigned char old, new; | 
|  | 961 | /* check if we can change the postion */ | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 962 | mpc->checksum = 0; | 
|  | 963 | old = mpf_checksum((unsigned char *)mpc, mpc->length); | 
|  | 964 | mpc->checksum = 0xff; | 
|  | 965 | new = mpf_checksum((unsigned char *)mpc, mpc->length); | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 966 | if (old == new) { | 
|  | 967 | printk(KERN_INFO "mpc is readonly, please try alloc_mptable instead\n"); | 
|  | 968 | return 0; | 
|  | 969 | } | 
|  | 970 | printk(KERN_INFO "use in-positon replacing\n"); | 
|  | 971 | } else { | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 972 | mpf->physptr = mpc_new_phys; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 973 | mpc_new = phys_to_virt(mpc_new_phys); | 
| Jaswinder Singh Rajput | 6c65da5 | 2009-01-04 22:22:56 +0530 | [diff] [blame] | 974 | memcpy(mpc_new, mpc, mpc->length); | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 975 | mpc = mpc_new; | 
|  | 976 | /* check if we can modify that */ | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 977 | if (mpc_new_phys - mpf->physptr) { | 
| Jaswinder Singh Rajput | 41401db | 2009-01-08 15:42:46 +0530 | [diff] [blame] | 978 | struct mpf_intel *mpf_new; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 979 | /* steal 16 bytes from [0, 1k) */ | 
|  | 980 | printk(KERN_INFO "mpf new: %x\n", 0x400 - 16); | 
|  | 981 | mpf_new = phys_to_virt(0x400 - 16); | 
|  | 982 | memcpy(mpf_new, mpf, 16); | 
|  | 983 | mpf = mpf_new; | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 984 | mpf->physptr = mpc_new_phys; | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 985 | } | 
| Jaswinder Singh Rajput | 1eb1b3b | 2009-01-08 15:43:26 +0530 | [diff] [blame] | 986 | mpf->checksum = 0; | 
|  | 987 | mpf->checksum -= mpf_checksum((unsigned char *)mpf, 16); | 
|  | 988 | printk(KERN_INFO "physptr new: %x\n", mpf->physptr); | 
| Yinghai Lu | 2944e16 | 2008-06-01 13:17:38 -0700 | [diff] [blame] | 989 | } | 
|  | 990 |  | 
|  | 991 | /* | 
|  | 992 | * only replace the one with mp_INT and | 
|  | 993 | *	 MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, | 
|  | 994 | * already in mp_irqs , stored by ... and mp_config_acpi_gsi, | 
|  | 995 | * may need pci=routeirq for all coverage | 
|  | 996 | */ | 
|  | 997 | replace_intsrc_all(mpc, mpc_new_phys, mpc_new_length); | 
|  | 998 |  | 
|  | 999 | return 0; | 
|  | 1000 | } | 
|  | 1001 |  | 
|  | 1002 | late_initcall(update_mp_table); |