boot.c 30 KB

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