mpparse_32.c 31 KB

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