mpparse.c 31 KB

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