boot.c 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328
  1. /*
  2. * boot.c - Architecture-Specific Low-Level ACPI Boot Support
  3. *
  4. * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
  5. * Copyright (C) 2001 Jun Nakajima <jun.nakajima@intel.com>
  6. *
  7. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. *
  23. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24. */
  25. #include <linux/init.h>
  26. #include <linux/acpi.h>
  27. #include <linux/efi.h>
  28. #include <linux/cpumask.h>
  29. #include <linux/module.h>
  30. #include <linux/dmi.h>
  31. #include <linux/irq.h>
  32. #include <linux/bootmem.h>
  33. #include <linux/ioport.h>
  34. #include <asm/pgtable.h>
  35. #include <asm/io_apic.h>
  36. #include <asm/apic.h>
  37. #include <asm/io.h>
  38. #include <asm/mpspec.h>
  39. static int __initdata acpi_force = 0;
  40. #ifdef CONFIG_ACPI
  41. int acpi_disabled = 0;
  42. #else
  43. int acpi_disabled = 1;
  44. #endif
  45. EXPORT_SYMBOL(acpi_disabled);
  46. #ifdef CONFIG_X86_64
  47. #include <asm/proto.h>
  48. static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) { return 0; }
  49. #else /* X86 */
  50. #ifdef CONFIG_X86_LOCAL_APIC
  51. #include <mach_apic.h>
  52. #include <mach_mpparse.h>
  53. #endif /* CONFIG_X86_LOCAL_APIC */
  54. static inline int gsi_irq_sharing(int gsi) { return gsi; }
  55. #endif /* X86 */
  56. #define BAD_MADT_ENTRY(entry, end) ( \
  57. (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
  58. ((acpi_table_entry_header *)entry)->length < sizeof(*entry))
  59. #define PREFIX "ACPI: "
  60. int acpi_noirq __initdata; /* skip ACPI IRQ initialization */
  61. int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */
  62. int acpi_ht __initdata = 1; /* enable HT */
  63. int acpi_lapic;
  64. int acpi_ioapic;
  65. int acpi_strict;
  66. EXPORT_SYMBOL(acpi_strict);
  67. acpi_interrupt_flags acpi_sci_flags __initdata;
  68. int acpi_sci_override_gsi __initdata;
  69. int acpi_skip_timer_override __initdata;
  70. #ifdef CONFIG_X86_LOCAL_APIC
  71. static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
  72. #endif
  73. #ifndef __HAVE_ARCH_CMPXCHG
  74. #warning ACPI uses CMPXCHG, i486 and later hardware
  75. #endif
  76. #define MAX_MADT_ENTRIES 256
  77. u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
  78. {[0 ... MAX_MADT_ENTRIES - 1] = 0xff };
  79. EXPORT_SYMBOL(x86_acpiid_to_apicid);
  80. /* --------------------------------------------------------------------------
  81. Boot-time Configuration
  82. -------------------------------------------------------------------------- */
  83. /*
  84. * The default interrupt routing model is PIC (8259). This gets
  85. * overriden if IOAPICs are enumerated (below).
  86. */
  87. enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
  88. #ifdef CONFIG_X86_64
  89. /* rely on all ACPI tables being in the direct mapping */
  90. char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
  91. {
  92. if (!phys_addr || !size)
  93. return NULL;
  94. if (phys_addr+size <= (end_pfn_map << PAGE_SHIFT) + PAGE_SIZE)
  95. return __va(phys_addr);
  96. return NULL;
  97. }
  98. #else
  99. /*
  100. * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
  101. * to map the target physical address. The problem is that set_fixmap()
  102. * provides a single page, and it is possible that the page is not
  103. * sufficient.
  104. * By using this area, we can map up to MAX_IO_APICS pages temporarily,
  105. * i.e. until the next __va_range() call.
  106. *
  107. * Important Safety Note: The fixed I/O APIC page numbers are *subtracted*
  108. * from the fixed base. That's why we start at FIX_IO_APIC_BASE_END and
  109. * count idx down while incrementing the phys address.
  110. */
  111. char *__acpi_map_table(unsigned long phys, unsigned long size)
  112. {
  113. unsigned long base, offset, mapped_size;
  114. int idx;
  115. if (phys + size < 8 * 1024 * 1024)
  116. return __va(phys);
  117. offset = phys & (PAGE_SIZE - 1);
  118. mapped_size = PAGE_SIZE - offset;
  119. set_fixmap(FIX_ACPI_END, phys);
  120. base = fix_to_virt(FIX_ACPI_END);
  121. /*
  122. * Most cases can be covered by the below.
  123. */
  124. idx = FIX_ACPI_END;
  125. while (mapped_size < size) {
  126. if (--idx < FIX_ACPI_BEGIN)
  127. return NULL; /* cannot handle this */
  128. phys += PAGE_SIZE;
  129. set_fixmap(idx, phys);
  130. mapped_size += PAGE_SIZE;
  131. }
  132. return ((unsigned char *)base + offset);
  133. }
  134. #endif
  135. #ifdef CONFIG_PCI_MMCONFIG
  136. /* The physical address of the MMCONFIG aperture. Set from ACPI tables. */
  137. struct acpi_table_mcfg_config *pci_mmcfg_config;
  138. int pci_mmcfg_config_num;
  139. int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
  140. {
  141. struct acpi_table_mcfg *mcfg;
  142. unsigned long i;
  143. int config_size;
  144. if (!phys_addr || !size)
  145. return -EINVAL;
  146. mcfg = (struct acpi_table_mcfg *)__acpi_map_table(phys_addr, size);
  147. if (!mcfg) {
  148. printk(KERN_WARNING PREFIX "Unable to map MCFG\n");
  149. return -ENODEV;
  150. }
  151. /* how many config structures do we have */
  152. pci_mmcfg_config_num = 0;
  153. i = size - sizeof(struct acpi_table_mcfg);
  154. while (i >= sizeof(struct acpi_table_mcfg_config)) {
  155. ++pci_mmcfg_config_num;
  156. i -= sizeof(struct acpi_table_mcfg_config);
  157. };
  158. if (pci_mmcfg_config_num == 0) {
  159. printk(KERN_ERR PREFIX "MMCONFIG has no entries\n");
  160. return -ENODEV;
  161. }
  162. config_size = pci_mmcfg_config_num * sizeof(*pci_mmcfg_config);
  163. pci_mmcfg_config = kmalloc(config_size, GFP_KERNEL);
  164. if (!pci_mmcfg_config) {
  165. printk(KERN_WARNING PREFIX
  166. "No memory for MCFG config tables\n");
  167. return -ENOMEM;
  168. }
  169. memcpy(pci_mmcfg_config, &mcfg->config, config_size);
  170. for (i = 0; i < pci_mmcfg_config_num; ++i) {
  171. if (mcfg->config[i].base_reserved) {
  172. printk(KERN_ERR PREFIX
  173. "MMCONFIG not in low 4GB of memory\n");
  174. kfree(pci_mmcfg_config);
  175. pci_mmcfg_config_num = 0;
  176. return -ENODEV;
  177. }
  178. }
  179. return 0;
  180. }
  181. #endif /* CONFIG_PCI_MMCONFIG */
  182. #ifdef CONFIG_X86_LOCAL_APIC
  183. static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
  184. {
  185. struct acpi_table_madt *madt = NULL;
  186. if (!phys_addr || !size || !cpu_has_apic)
  187. return -EINVAL;
  188. madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size);
  189. if (!madt) {
  190. printk(KERN_WARNING PREFIX "Unable to map MADT\n");
  191. return -ENODEV;
  192. }
  193. if (madt->lapic_address) {
  194. acpi_lapic_addr = (u64) madt->lapic_address;
  195. printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
  196. madt->lapic_address);
  197. }
  198. acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
  199. return 0;
  200. }
  201. static int __init
  202. acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
  203. {
  204. struct acpi_table_lapic *processor = NULL;
  205. processor = (struct acpi_table_lapic *)header;
  206. if (BAD_MADT_ENTRY(processor, end))
  207. return -EINVAL;
  208. acpi_table_print_madt_entry(header);
  209. /* Record local apic id only when enabled */
  210. if (processor->flags.enabled)
  211. x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
  212. /*
  213. * We need to register disabled CPU as well to permit
  214. * counting disabled CPUs. This allows us to size
  215. * cpus_possible_map more accurately, to permit
  216. * to not preallocating memory for all NR_CPUS
  217. * when we use CPU hotplug.
  218. */
  219. mp_register_lapic(processor->id, /* APIC ID */
  220. processor->flags.enabled); /* Enabled? */
  221. return 0;
  222. }
  223. static int __init
  224. acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
  225. const unsigned long end)
  226. {
  227. struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL;
  228. lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr *)header;
  229. if (BAD_MADT_ENTRY(lapic_addr_ovr, end))
  230. return -EINVAL;
  231. acpi_lapic_addr = lapic_addr_ovr->address;
  232. return 0;
  233. }
  234. static int __init
  235. acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
  236. {
  237. struct acpi_table_lapic_nmi *lapic_nmi = NULL;
  238. lapic_nmi = (struct acpi_table_lapic_nmi *)header;
  239. if (BAD_MADT_ENTRY(lapic_nmi, end))
  240. return -EINVAL;
  241. acpi_table_print_madt_entry(header);
  242. if (lapic_nmi->lint != 1)
  243. printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n");
  244. return 0;
  245. }
  246. #endif /*CONFIG_X86_LOCAL_APIC */
  247. #ifdef CONFIG_X86_IO_APIC
  248. static int __init
  249. acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end)
  250. {
  251. struct acpi_table_ioapic *ioapic = NULL;
  252. ioapic = (struct acpi_table_ioapic *)header;
  253. if (BAD_MADT_ENTRY(ioapic, end))
  254. return -EINVAL;
  255. acpi_table_print_madt_entry(header);
  256. mp_register_ioapic(ioapic->id,
  257. ioapic->address, ioapic->global_irq_base);
  258. return 0;
  259. }
  260. /*
  261. * Parse Interrupt Source Override for the ACPI SCI
  262. */
  263. static void acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
  264. {
  265. if (trigger == 0) /* compatible SCI trigger is level */
  266. trigger = 3;
  267. if (polarity == 0) /* compatible SCI polarity is low */
  268. polarity = 3;
  269. /* Command-line over-ride via acpi_sci= */
  270. if (acpi_sci_flags.trigger)
  271. trigger = acpi_sci_flags.trigger;
  272. if (acpi_sci_flags.polarity)
  273. polarity = acpi_sci_flags.polarity;
  274. /*
  275. * mp_config_acpi_legacy_irqs() already setup IRQs < 16
  276. * If GSI is < 16, this will update its flags,
  277. * else it will create a new mp_irqs[] entry.
  278. */
  279. mp_override_legacy_irq(gsi, polarity, trigger, gsi);
  280. /*
  281. * stash over-ride to indicate we've been here
  282. * and for later update of acpi_fadt
  283. */
  284. acpi_sci_override_gsi = gsi;
  285. return;
  286. }
  287. static int __init
  288. acpi_parse_int_src_ovr(acpi_table_entry_header * header,
  289. const unsigned long end)
  290. {
  291. struct acpi_table_int_src_ovr *intsrc = NULL;
  292. intsrc = (struct acpi_table_int_src_ovr *)header;
  293. if (BAD_MADT_ENTRY(intsrc, end))
  294. return -EINVAL;
  295. acpi_table_print_madt_entry(header);
  296. if (intsrc->bus_irq == acpi_fadt.sci_int) {
  297. acpi_sci_ioapic_setup(intsrc->global_irq,
  298. intsrc->flags.polarity,
  299. intsrc->flags.trigger);
  300. return 0;
  301. }
  302. if (acpi_skip_timer_override &&
  303. intsrc->bus_irq == 0 && intsrc->global_irq == 2) {
  304. printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
  305. return 0;
  306. }
  307. mp_override_legacy_irq(intsrc->bus_irq,
  308. intsrc->flags.polarity,
  309. intsrc->flags.trigger, intsrc->global_irq);
  310. return 0;
  311. }
  312. static int __init
  313. acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
  314. {
  315. struct acpi_table_nmi_src *nmi_src = NULL;
  316. nmi_src = (struct acpi_table_nmi_src *)header;
  317. if (BAD_MADT_ENTRY(nmi_src, end))
  318. return -EINVAL;
  319. acpi_table_print_madt_entry(header);
  320. /* TBD: Support nimsrc entries? */
  321. return 0;
  322. }
  323. #endif /* CONFIG_X86_IO_APIC */
  324. /*
  325. * acpi_pic_sci_set_trigger()
  326. *
  327. * use ELCR to set PIC-mode trigger type for SCI
  328. *
  329. * If a PIC-mode SCI is not recognized or gives spurious IRQ7's
  330. * it may require Edge Trigger -- use "acpi_sci=edge"
  331. *
  332. * Port 0x4d0-4d1 are ECLR1 and ECLR2, the Edge/Level Control Registers
  333. * for the 8259 PIC. bit[n] = 1 means irq[n] is Level, otherwise Edge.
  334. * ECLR1 is IRQ's 0-7 (IRQ 0, 1, 2 must be 0)
  335. * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0)
  336. */
  337. void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
  338. {
  339. unsigned int mask = 1 << irq;
  340. unsigned int old, new;
  341. /* Real old ELCR mask */
  342. old = inb(0x4d0) | (inb(0x4d1) << 8);
  343. /*
  344. * If we use ACPI to set PCI irq's, then we should clear ELCR
  345. * since we will set it correctly as we enable the PCI irq
  346. * routing.
  347. */
  348. new = acpi_noirq ? old : 0;
  349. /*
  350. * Update SCI information in the ELCR, it isn't in the PCI
  351. * routing tables..
  352. */
  353. switch (trigger) {
  354. case 1: /* Edge - clear */
  355. new &= ~mask;
  356. break;
  357. case 3: /* Level - set */
  358. new |= mask;
  359. break;
  360. }
  361. if (old == new)
  362. return;
  363. printk(PREFIX "setting ELCR to %04x (from %04x)\n", new, old);
  364. outb(new, 0x4d0);
  365. outb(new >> 8, 0x4d1);
  366. }
  367. int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
  368. {
  369. #ifdef CONFIG_X86_IO_APIC
  370. if (use_pci_vector() && !platform_legacy_irq(gsi))
  371. *irq = IO_APIC_VECTOR(gsi);
  372. else
  373. #endif
  374. *irq = gsi_irq_sharing(gsi);
  375. return 0;
  376. }
  377. /*
  378. * success: return IRQ number (>=0)
  379. * failure: return < 0
  380. */
  381. int acpi_register_gsi(u32 gsi, int triggering, int polarity)
  382. {
  383. unsigned int irq;
  384. unsigned int plat_gsi = gsi;
  385. #ifdef CONFIG_PCI
  386. /*
  387. * Make sure all (legacy) PCI IRQs are set as level-triggered.
  388. */
  389. if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
  390. extern void eisa_set_level_irq(unsigned int irq);
  391. if (triggering == ACPI_LEVEL_SENSITIVE)
  392. eisa_set_level_irq(gsi);
  393. }
  394. #endif
  395. #ifdef CONFIG_X86_IO_APIC
  396. if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) {
  397. plat_gsi = mp_register_gsi(gsi, triggering, polarity);
  398. }
  399. #endif
  400. acpi_gsi_to_irq(plat_gsi, &irq);
  401. return irq;
  402. }
  403. EXPORT_SYMBOL(acpi_register_gsi);
  404. /*
  405. * ACPI based hotplug support for CPU
  406. */
  407. #ifdef CONFIG_ACPI_HOTPLUG_CPU
  408. int acpi_map_lsapic(acpi_handle handle, int *pcpu)
  409. {
  410. struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
  411. union acpi_object *obj;
  412. struct acpi_table_lapic *lapic;
  413. cpumask_t tmp_map, new_map;
  414. u8 physid;
  415. int cpu;
  416. if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
  417. return -EINVAL;
  418. if (!buffer.length || !buffer.pointer)
  419. return -EINVAL;
  420. obj = buffer.pointer;
  421. if (obj->type != ACPI_TYPE_BUFFER ||
  422. obj->buffer.length < sizeof(*lapic)) {
  423. kfree(buffer.pointer);
  424. return -EINVAL;
  425. }
  426. lapic = (struct acpi_table_lapic *)obj->buffer.pointer;
  427. if ((lapic->header.type != ACPI_MADT_LAPIC) ||
  428. (!lapic->flags.enabled)) {
  429. kfree(buffer.pointer);
  430. return -EINVAL;
  431. }
  432. physid = lapic->id;
  433. kfree(buffer.pointer);
  434. buffer.length = ACPI_ALLOCATE_BUFFER;
  435. buffer.pointer = NULL;
  436. tmp_map = cpu_present_map;
  437. mp_register_lapic(physid, lapic->flags.enabled);
  438. /*
  439. * If mp_register_lapic successfully generates a new logical cpu
  440. * number, then the following will get us exactly what was mapped
  441. */
  442. cpus_andnot(new_map, cpu_present_map, tmp_map);
  443. if (cpus_empty(new_map)) {
  444. printk ("Unable to map lapic to logical cpu number\n");
  445. return -EINVAL;
  446. }
  447. cpu = first_cpu(new_map);
  448. *pcpu = cpu;
  449. return 0;
  450. }
  451. EXPORT_SYMBOL(acpi_map_lsapic);
  452. int acpi_unmap_lsapic(int cpu)
  453. {
  454. int i;
  455. for_each_possible_cpu(i) {
  456. if (x86_acpiid_to_apicid[i] == x86_cpu_to_apicid[cpu]) {
  457. x86_acpiid_to_apicid[i] = -1;
  458. break;
  459. }
  460. }
  461. x86_cpu_to_apicid[cpu] = -1;
  462. cpu_clear(cpu, cpu_present_map);
  463. num_processors--;
  464. return (0);
  465. }
  466. EXPORT_SYMBOL(acpi_unmap_lsapic);
  467. #endif /* CONFIG_ACPI_HOTPLUG_CPU */
  468. int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
  469. {
  470. /* TBD */
  471. return -EINVAL;
  472. }
  473. EXPORT_SYMBOL(acpi_register_ioapic);
  474. int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
  475. {
  476. /* TBD */
  477. return -EINVAL;
  478. }
  479. EXPORT_SYMBOL(acpi_unregister_ioapic);
  480. static unsigned long __init
  481. acpi_scan_rsdp(unsigned long start, unsigned long length)
  482. {
  483. unsigned long offset = 0;
  484. unsigned long sig_len = sizeof("RSD PTR ") - 1;
  485. /*
  486. * Scan all 16-byte boundaries of the physical memory region for the
  487. * RSDP signature.
  488. */
  489. for (offset = 0; offset < length; offset += 16) {
  490. if (strncmp((char *)(phys_to_virt(start) + offset), "RSD PTR ", sig_len))
  491. continue;
  492. return (start + offset);
  493. }
  494. return 0;
  495. }
  496. static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size)
  497. {
  498. struct acpi_table_sbf *sb;
  499. if (!phys_addr || !size)
  500. return -EINVAL;
  501. sb = (struct acpi_table_sbf *)__acpi_map_table(phys_addr, size);
  502. if (!sb) {
  503. printk(KERN_WARNING PREFIX "Unable to map SBF\n");
  504. return -ENODEV;
  505. }
  506. sbf_port = sb->sbf_cmos; /* Save CMOS port */
  507. return 0;
  508. }
  509. #ifdef CONFIG_HPET_TIMER
  510. static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
  511. {
  512. struct acpi_table_hpet *hpet_tbl;
  513. struct resource *hpet_res;
  514. resource_size_t res_start;
  515. if (!phys || !size)
  516. return -EINVAL;
  517. hpet_tbl = (struct acpi_table_hpet *)__acpi_map_table(phys, size);
  518. if (!hpet_tbl) {
  519. printk(KERN_WARNING PREFIX "Unable to map HPET\n");
  520. return -ENODEV;
  521. }
  522. if (hpet_tbl->addr.space_id != ACPI_SPACE_MEM) {
  523. printk(KERN_WARNING PREFIX "HPET timers must be located in "
  524. "memory.\n");
  525. return -1;
  526. }
  527. #define HPET_RESOURCE_NAME_SIZE 9
  528. hpet_res = alloc_bootmem(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE);
  529. if (hpet_res) {
  530. memset(hpet_res, 0, sizeof(*hpet_res));
  531. hpet_res->name = (void *)&hpet_res[1];
  532. hpet_res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
  533. snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE,
  534. "HPET %u", hpet_tbl->number);
  535. hpet_res->end = (1 * 1024) - 1;
  536. }
  537. #ifdef CONFIG_X86_64
  538. vxtime.hpet_address = hpet_tbl->addr.addrl |
  539. ((long)hpet_tbl->addr.addrh << 32);
  540. printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
  541. hpet_tbl->id, vxtime.hpet_address);
  542. res_start = vxtime.hpet_address;
  543. #else /* X86 */
  544. {
  545. extern unsigned long hpet_address;
  546. hpet_address = hpet_tbl->addr.addrl;
  547. printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
  548. hpet_tbl->id, hpet_address);
  549. res_start = hpet_address;
  550. }
  551. #endif /* X86 */
  552. if (hpet_res) {
  553. hpet_res->start = res_start;
  554. hpet_res->end += res_start;
  555. insert_resource(&iomem_resource, hpet_res);
  556. }
  557. return 0;
  558. }
  559. #else
  560. #define acpi_parse_hpet NULL
  561. #endif
  562. #ifdef CONFIG_X86_PM_TIMER
  563. extern u32 pmtmr_ioport;
  564. #endif
  565. static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
  566. {
  567. struct fadt_descriptor *fadt = NULL;
  568. fadt = (struct fadt_descriptor *)__acpi_map_table(phys, size);
  569. if (!fadt) {
  570. printk(KERN_WARNING PREFIX "Unable to map FADT\n");
  571. return 0;
  572. }
  573. /* initialize sci_int early for INT_SRC_OVR MADT parsing */
  574. acpi_fadt.sci_int = fadt->sci_int;
  575. /* initialize rev and apic_phys_dest_mode for x86_64 genapic */
  576. acpi_fadt.revision = fadt->revision;
  577. acpi_fadt.force_apic_physical_destination_mode =
  578. fadt->force_apic_physical_destination_mode;
  579. #ifdef CONFIG_X86_PM_TIMER
  580. /* detect the location of the ACPI PM Timer */
  581. if (fadt->revision >= FADT2_REVISION_ID) {
  582. /* FADT rev. 2 */
  583. if (fadt->xpm_tmr_blk.address_space_id !=
  584. ACPI_ADR_SPACE_SYSTEM_IO)
  585. return 0;
  586. pmtmr_ioport = fadt->xpm_tmr_blk.address;
  587. /*
  588. * "X" fields are optional extensions to the original V1.0
  589. * fields, so we must selectively expand V1.0 fields if the
  590. * corresponding X field is zero.
  591. */
  592. if (!pmtmr_ioport)
  593. pmtmr_ioport = fadt->V1_pm_tmr_blk;
  594. } else {
  595. /* FADT rev. 1 */
  596. pmtmr_ioport = fadt->V1_pm_tmr_blk;
  597. }
  598. if (pmtmr_ioport)
  599. printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
  600. pmtmr_ioport);
  601. #endif
  602. return 0;
  603. }
  604. unsigned long __init acpi_find_rsdp(void)
  605. {
  606. unsigned long rsdp_phys = 0;
  607. if (efi_enabled) {
  608. if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
  609. return efi.acpi20;
  610. else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
  611. return efi.acpi;
  612. }
  613. /*
  614. * Scan memory looking for the RSDP signature. First search EBDA (low
  615. * memory) paragraphs and then search upper memory (E0000-FFFFF).
  616. */
  617. rsdp_phys = acpi_scan_rsdp(0, 0x400);
  618. if (!rsdp_phys)
  619. rsdp_phys = acpi_scan_rsdp(0xE0000, 0x20000);
  620. return rsdp_phys;
  621. }
  622. #ifdef CONFIG_X86_LOCAL_APIC
  623. /*
  624. * Parse LAPIC entries in MADT
  625. * returns 0 on success, < 0 on error
  626. */
  627. static int __init acpi_parse_madt_lapic_entries(void)
  628. {
  629. int count;
  630. if (!cpu_has_apic)
  631. return -ENODEV;
  632. /*
  633. * Note that the LAPIC address is obtained from the MADT (32-bit value)
  634. * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
  635. */
  636. count =
  637. acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
  638. acpi_parse_lapic_addr_ovr, 0);
  639. if (count < 0) {
  640. printk(KERN_ERR PREFIX
  641. "Error parsing LAPIC address override entry\n");
  642. return count;
  643. }
  644. mp_register_lapic_address(acpi_lapic_addr);
  645. count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
  646. MAX_APICS);
  647. if (!count) {
  648. printk(KERN_ERR PREFIX "No LAPIC entries present\n");
  649. /* TBD: Cleanup to allow fallback to MPS */
  650. return -ENODEV;
  651. } else if (count < 0) {
  652. printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
  653. /* TBD: Cleanup to allow fallback to MPS */
  654. return count;
  655. }
  656. count =
  657. acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
  658. if (count < 0) {
  659. printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
  660. /* TBD: Cleanup to allow fallback to MPS */
  661. return count;
  662. }
  663. return 0;
  664. }
  665. #endif /* CONFIG_X86_LOCAL_APIC */
  666. #ifdef CONFIG_X86_IO_APIC
  667. /*
  668. * Parse IOAPIC related entries in MADT
  669. * returns 0 on success, < 0 on error
  670. */
  671. static int __init acpi_parse_madt_ioapic_entries(void)
  672. {
  673. int count;
  674. /*
  675. * ACPI interpreter is required to complete interrupt setup,
  676. * so if it is off, don't enumerate the io-apics with ACPI.
  677. * If MPS is present, it will handle them,
  678. * otherwise the system will stay in PIC mode
  679. */
  680. if (acpi_disabled || acpi_noirq) {
  681. return -ENODEV;
  682. }
  683. if (!cpu_has_apic)
  684. return -ENODEV;
  685. /*
  686. * if "noapic" boot option, don't look for IO-APICs
  687. */
  688. if (skip_ioapic_setup) {
  689. printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
  690. "due to 'noapic' option.\n");
  691. return -ENODEV;
  692. }
  693. count =
  694. acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic,
  695. MAX_IO_APICS);
  696. if (!count) {
  697. printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
  698. return -ENODEV;
  699. } else if (count < 0) {
  700. printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
  701. return count;
  702. }
  703. count =
  704. acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr,
  705. NR_IRQ_VECTORS);
  706. if (count < 0) {
  707. printk(KERN_ERR PREFIX
  708. "Error parsing interrupt source overrides entry\n");
  709. /* TBD: Cleanup to allow fallback to MPS */
  710. return count;
  711. }
  712. /*
  713. * If BIOS did not supply an INT_SRC_OVR for the SCI
  714. * pretend we got one so we can set the SCI flags.
  715. */
  716. if (!acpi_sci_override_gsi)
  717. acpi_sci_ioapic_setup(acpi_fadt.sci_int, 0, 0);
  718. /* Fill in identity legacy mapings where no override */
  719. mp_config_acpi_legacy_irqs();
  720. count =
  721. acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
  722. NR_IRQ_VECTORS);
  723. if (count < 0) {
  724. printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
  725. /* TBD: Cleanup to allow fallback to MPS */
  726. return count;
  727. }
  728. return 0;
  729. }
  730. #else
  731. static inline int acpi_parse_madt_ioapic_entries(void)
  732. {
  733. return -1;
  734. }
  735. #endif /* !CONFIG_X86_IO_APIC */
  736. static void __init acpi_process_madt(void)
  737. {
  738. #ifdef CONFIG_X86_LOCAL_APIC
  739. int count, error;
  740. count = acpi_table_parse(ACPI_APIC, acpi_parse_madt);
  741. if (count >= 1) {
  742. /*
  743. * Parse MADT LAPIC entries
  744. */
  745. error = acpi_parse_madt_lapic_entries();
  746. if (!error) {
  747. acpi_lapic = 1;
  748. #ifdef CONFIG_X86_GENERICARCH
  749. generic_bigsmp_probe();
  750. #endif
  751. /*
  752. * Parse MADT IO-APIC entries
  753. */
  754. error = acpi_parse_madt_ioapic_entries();
  755. if (!error) {
  756. acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
  757. acpi_irq_balance_set(NULL);
  758. acpi_ioapic = 1;
  759. smp_found_config = 1;
  760. clustered_apic_check();
  761. }
  762. }
  763. if (error == -EINVAL) {
  764. /*
  765. * Dell Precision Workstation 410, 610 come here.
  766. */
  767. printk(KERN_ERR PREFIX
  768. "Invalid BIOS MADT, disabling ACPI\n");
  769. disable_acpi();
  770. }
  771. }
  772. #endif
  773. return;
  774. }
  775. #ifdef __i386__
  776. static int __init disable_acpi_irq(struct dmi_system_id *d)
  777. {
  778. if (!acpi_force) {
  779. printk(KERN_NOTICE "%s detected: force use of acpi=noirq\n",
  780. d->ident);
  781. acpi_noirq_set();
  782. }
  783. return 0;
  784. }
  785. static int __init disable_acpi_pci(struct dmi_system_id *d)
  786. {
  787. if (!acpi_force) {
  788. printk(KERN_NOTICE "%s detected: force use of pci=noacpi\n",
  789. d->ident);
  790. acpi_disable_pci();
  791. }
  792. return 0;
  793. }
  794. static int __init dmi_disable_acpi(struct dmi_system_id *d)
  795. {
  796. if (!acpi_force) {
  797. printk(KERN_NOTICE "%s detected: acpi off\n", d->ident);
  798. disable_acpi();
  799. } else {
  800. printk(KERN_NOTICE
  801. "Warning: DMI blacklist says broken, but acpi forced\n");
  802. }
  803. return 0;
  804. }
  805. /*
  806. * Limit ACPI to CPU enumeration for HT
  807. */
  808. static int __init force_acpi_ht(struct dmi_system_id *d)
  809. {
  810. if (!acpi_force) {
  811. printk(KERN_NOTICE "%s detected: force use of acpi=ht\n",
  812. d->ident);
  813. disable_acpi();
  814. acpi_ht = 1;
  815. } else {
  816. printk(KERN_NOTICE
  817. "Warning: acpi=force overrules DMI blacklist: acpi=ht\n");
  818. }
  819. return 0;
  820. }
  821. /*
  822. * If your system is blacklisted here, but you find that acpi=force
  823. * works for you, please contact acpi-devel@sourceforge.net
  824. */
  825. static struct dmi_system_id __initdata acpi_dmi_table[] = {
  826. /*
  827. * Boxes that need ACPI disabled
  828. */
  829. {
  830. .callback = dmi_disable_acpi,
  831. .ident = "IBM Thinkpad",
  832. .matches = {
  833. DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
  834. DMI_MATCH(DMI_BOARD_NAME, "2629H1G"),
  835. },
  836. },
  837. /*
  838. * Boxes that need acpi=ht
  839. */
  840. {
  841. .callback = force_acpi_ht,
  842. .ident = "FSC Primergy T850",
  843. .matches = {
  844. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  845. DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"),
  846. },
  847. },
  848. {
  849. .callback = force_acpi_ht,
  850. .ident = "DELL GX240",
  851. .matches = {
  852. DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"),
  853. DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"),
  854. },
  855. },
  856. {
  857. .callback = force_acpi_ht,
  858. .ident = "HP VISUALIZE NT Workstation",
  859. .matches = {
  860. DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
  861. DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"),
  862. },
  863. },
  864. {
  865. .callback = force_acpi_ht,
  866. .ident = "Compaq Workstation W8000",
  867. .matches = {
  868. DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
  869. DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"),
  870. },
  871. },
  872. {
  873. .callback = force_acpi_ht,
  874. .ident = "ASUS P4B266",
  875. .matches = {
  876. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
  877. DMI_MATCH(DMI_BOARD_NAME, "P4B266"),
  878. },
  879. },
  880. {
  881. .callback = force_acpi_ht,
  882. .ident = "ASUS P2B-DS",
  883. .matches = {
  884. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
  885. DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"),
  886. },
  887. },
  888. {
  889. .callback = force_acpi_ht,
  890. .ident = "ASUS CUR-DLS",
  891. .matches = {
  892. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
  893. DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"),
  894. },
  895. },
  896. {
  897. .callback = force_acpi_ht,
  898. .ident = "ABIT i440BX-W83977",
  899. .matches = {
  900. DMI_MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"),
  901. DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"),
  902. },
  903. },
  904. {
  905. .callback = force_acpi_ht,
  906. .ident = "IBM Bladecenter",
  907. .matches = {
  908. DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
  909. DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"),
  910. },
  911. },
  912. {
  913. .callback = force_acpi_ht,
  914. .ident = "IBM eServer xSeries 360",
  915. .matches = {
  916. DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
  917. DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"),
  918. },
  919. },
  920. {
  921. .callback = force_acpi_ht,
  922. .ident = "IBM eserver xSeries 330",
  923. .matches = {
  924. DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
  925. DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"),
  926. },
  927. },
  928. {
  929. .callback = force_acpi_ht,
  930. .ident = "IBM eserver xSeries 440",
  931. .matches = {
  932. DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
  933. DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"),
  934. },
  935. },
  936. /*
  937. * Boxes that need ACPI PCI IRQ routing disabled
  938. */
  939. {
  940. .callback = disable_acpi_irq,
  941. .ident = "ASUS A7V",
  942. .matches = {
  943. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
  944. DMI_MATCH(DMI_BOARD_NAME, "<A7V>"),
  945. /* newer BIOS, Revision 1011, does work */
  946. DMI_MATCH(DMI_BIOS_VERSION,
  947. "ASUS A7V ACPI BIOS Revision 1007"),
  948. },
  949. },
  950. /*
  951. * Boxes that need ACPI PCI IRQ routing and PCI scan disabled
  952. */
  953. { /* _BBN 0 bug */
  954. .callback = disable_acpi_pci,
  955. .ident = "ASUS PR-DLS",
  956. .matches = {
  957. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
  958. DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"),
  959. DMI_MATCH(DMI_BIOS_VERSION,
  960. "ASUS PR-DLS ACPI BIOS Revision 1010"),
  961. DMI_MATCH(DMI_BIOS_DATE, "03/21/2003")
  962. },
  963. },
  964. {
  965. .callback = disable_acpi_pci,
  966. .ident = "Acer TravelMate 36x Laptop",
  967. .matches = {
  968. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  969. DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
  970. },
  971. },
  972. {}
  973. };
  974. #endif /* __i386__ */
  975. /*
  976. * acpi_boot_table_init() and acpi_boot_init()
  977. * called from setup_arch(), always.
  978. * 1. checksums all tables
  979. * 2. enumerates lapics
  980. * 3. enumerates io-apics
  981. *
  982. * acpi_table_init() is separate to allow reading SRAT without
  983. * other side effects.
  984. *
  985. * side effects of acpi_boot_init:
  986. * acpi_lapic = 1 if LAPIC found
  987. * acpi_ioapic = 1 if IOAPIC found
  988. * if (acpi_lapic && acpi_ioapic) smp_found_config = 1;
  989. * if acpi_blacklisted() acpi_disabled = 1;
  990. * acpi_irq_model=...
  991. * ...
  992. *
  993. * return value: (currently ignored)
  994. * 0: success
  995. * !0: failure
  996. */
  997. int __init acpi_boot_table_init(void)
  998. {
  999. int error;
  1000. #ifdef __i386__
  1001. dmi_check_system(acpi_dmi_table);
  1002. #endif
  1003. /*
  1004. * If acpi_disabled, bail out
  1005. * One exception: acpi=ht continues far enough to enumerate LAPICs
  1006. */
  1007. if (acpi_disabled && !acpi_ht)
  1008. return 1;
  1009. /*
  1010. * Initialize the ACPI boot-time table parser.
  1011. */
  1012. error = acpi_table_init();
  1013. if (error) {
  1014. disable_acpi();
  1015. return error;
  1016. }
  1017. acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
  1018. /*
  1019. * blacklist may disable ACPI entirely
  1020. */
  1021. error = acpi_blacklisted();
  1022. if (error) {
  1023. if (acpi_force) {
  1024. printk(KERN_WARNING PREFIX "acpi=force override\n");
  1025. } else {
  1026. printk(KERN_WARNING PREFIX "Disabling ACPI support\n");
  1027. disable_acpi();
  1028. return error;
  1029. }
  1030. }
  1031. return 0;
  1032. }
  1033. int __init acpi_boot_init(void)
  1034. {
  1035. /*
  1036. * If acpi_disabled, bail out
  1037. * One exception: acpi=ht continues far enough to enumerate LAPICs
  1038. */
  1039. if (acpi_disabled && !acpi_ht)
  1040. return 1;
  1041. acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
  1042. /*
  1043. * set sci_int and PM timer address
  1044. */
  1045. acpi_table_parse(ACPI_FADT, acpi_parse_fadt);
  1046. /*
  1047. * Process the Multiple APIC Description Table (MADT), if present
  1048. */
  1049. acpi_process_madt();
  1050. acpi_table_parse(ACPI_HPET, acpi_parse_hpet);
  1051. return 0;
  1052. }
  1053. static int __init parse_acpi(char *arg)
  1054. {
  1055. if (!arg)
  1056. return -EINVAL;
  1057. /* "acpi=off" disables both ACPI table parsing and interpreter */
  1058. if (strcmp(arg, "off") == 0) {
  1059. disable_acpi();
  1060. }
  1061. /* acpi=force to over-ride black-list */
  1062. else if (strcmp(arg, "force") == 0) {
  1063. acpi_force = 1;
  1064. acpi_ht = 1;
  1065. acpi_disabled = 0;
  1066. }
  1067. /* acpi=strict disables out-of-spec workarounds */
  1068. else if (strcmp(arg, "strict") == 0) {
  1069. acpi_strict = 1;
  1070. }
  1071. /* Limit ACPI just to boot-time to enable HT */
  1072. else if (strcmp(arg, "ht") == 0) {
  1073. if (!acpi_force)
  1074. disable_acpi();
  1075. acpi_ht = 1;
  1076. }
  1077. /* "acpi=noirq" disables ACPI interrupt routing */
  1078. else if (strcmp(arg, "noirq") == 0) {
  1079. acpi_noirq_set();
  1080. } else {
  1081. /* Core will printk when we return error. */
  1082. return -EINVAL;
  1083. }
  1084. return 0;
  1085. }
  1086. early_param("acpi", parse_acpi);
  1087. /* FIXME: Using pci= for an ACPI parameter is a travesty. */
  1088. static int __init parse_pci(char *arg)
  1089. {
  1090. if (arg && strcmp(arg, "noacpi") == 0)
  1091. acpi_disable_pci();
  1092. return 0;
  1093. }
  1094. early_param("pci", parse_pci);
  1095. #ifdef CONFIG_X86_IO_APIC
  1096. static int __init parse_acpi_skip_timer_override(char *arg)
  1097. {
  1098. acpi_skip_timer_override = 1;
  1099. return 0;
  1100. }
  1101. early_param("acpi_skip_timer_override", parse_acpi_skip_timer_override);
  1102. #endif /* CONFIG_X86_IO_APIC */
  1103. static int __init setup_acpi_sci(char *s)
  1104. {
  1105. if (!s)
  1106. return -EINVAL;
  1107. if (!strcmp(s, "edge"))
  1108. acpi_sci_flags.trigger = 1;
  1109. else if (!strcmp(s, "level"))
  1110. acpi_sci_flags.trigger = 3;
  1111. else if (!strcmp(s, "high"))
  1112. acpi_sci_flags.polarity = 1;
  1113. else if (!strcmp(s, "low"))
  1114. acpi_sci_flags.polarity = 3;
  1115. else
  1116. return -EINVAL;
  1117. return 0;
  1118. }
  1119. early_param("acpi_sci", setup_acpi_sci);