mpparse_32.c 31 KB

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