boot.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329
  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. #endif /* X86 */
  55. #define BAD_MADT_ENTRY(entry, end) ( \
  56. (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
  57. ((acpi_table_entry_header *)entry)->length < sizeof(*entry))
  58. #define PREFIX "ACPI: "
  59. int acpi_noirq; /* skip ACPI IRQ initialization */
  60. int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */
  61. int acpi_ht __initdata = 1; /* enable HT */
  62. int acpi_lapic;
  63. int acpi_ioapic;
  64. int acpi_strict;
  65. EXPORT_SYMBOL(acpi_strict);
  66. acpi_interrupt_flags acpi_sci_flags __initdata;
  67. int acpi_sci_override_gsi __initdata;
  68. int acpi_skip_timer_override __initdata;
  69. int acpi_use_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. *irq = gsi;
  370. return 0;
  371. }
  372. /*
  373. * success: return IRQ number (>=0)
  374. * failure: return < 0
  375. */
  376. int acpi_register_gsi(u32 gsi, int triggering, int polarity)
  377. {
  378. unsigned int irq;
  379. unsigned int plat_gsi = gsi;
  380. #ifdef CONFIG_PCI
  381. /*
  382. * Make sure all (legacy) PCI IRQs are set as level-triggered.
  383. */
  384. if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
  385. extern void eisa_set_level_irq(unsigned int irq);
  386. if (triggering == ACPI_LEVEL_SENSITIVE)
  387. eisa_set_level_irq(gsi);
  388. }
  389. #endif
  390. #ifdef CONFIG_X86_IO_APIC
  391. if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) {
  392. plat_gsi = mp_register_gsi(gsi, triggering, polarity);
  393. }
  394. #endif
  395. acpi_gsi_to_irq(plat_gsi, &irq);
  396. return irq;
  397. }
  398. EXPORT_SYMBOL(acpi_register_gsi);
  399. /*
  400. * ACPI based hotplug support for CPU
  401. */
  402. #ifdef CONFIG_ACPI_HOTPLUG_CPU
  403. int acpi_map_lsapic(acpi_handle handle, int *pcpu)
  404. {
  405. struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
  406. union acpi_object *obj;
  407. struct acpi_table_lapic *lapic;
  408. cpumask_t tmp_map, new_map;
  409. u8 physid;
  410. int cpu;
  411. if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
  412. return -EINVAL;
  413. if (!buffer.length || !buffer.pointer)
  414. return -EINVAL;
  415. obj = buffer.pointer;
  416. if (obj->type != ACPI_TYPE_BUFFER ||
  417. obj->buffer.length < sizeof(*lapic)) {
  418. kfree(buffer.pointer);
  419. return -EINVAL;
  420. }
  421. lapic = (struct acpi_table_lapic *)obj->buffer.pointer;
  422. if ((lapic->header.type != ACPI_MADT_LAPIC) ||
  423. (!lapic->flags.enabled)) {
  424. kfree(buffer.pointer);
  425. return -EINVAL;
  426. }
  427. physid = lapic->id;
  428. kfree(buffer.pointer);
  429. buffer.length = ACPI_ALLOCATE_BUFFER;
  430. buffer.pointer = NULL;
  431. tmp_map = cpu_present_map;
  432. mp_register_lapic(physid, lapic->flags.enabled);
  433. /*
  434. * If mp_register_lapic successfully generates a new logical cpu
  435. * number, then the following will get us exactly what was mapped
  436. */
  437. cpus_andnot(new_map, cpu_present_map, tmp_map);
  438. if (cpus_empty(new_map)) {
  439. printk ("Unable to map lapic to logical cpu number\n");
  440. return -EINVAL;
  441. }
  442. cpu = first_cpu(new_map);
  443. *pcpu = cpu;
  444. return 0;
  445. }
  446. EXPORT_SYMBOL(acpi_map_lsapic);
  447. int acpi_unmap_lsapic(int cpu)
  448. {
  449. int i;
  450. for_each_possible_cpu(i) {
  451. if (x86_acpiid_to_apicid[i] == x86_cpu_to_apicid[cpu]) {
  452. x86_acpiid_to_apicid[i] = -1;
  453. break;
  454. }
  455. }
  456. x86_cpu_to_apicid[cpu] = -1;
  457. cpu_clear(cpu, cpu_present_map);
  458. num_processors--;
  459. return (0);
  460. }
  461. EXPORT_SYMBOL(acpi_unmap_lsapic);
  462. #endif /* CONFIG_ACPI_HOTPLUG_CPU */
  463. int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
  464. {
  465. /* TBD */
  466. return -EINVAL;
  467. }
  468. EXPORT_SYMBOL(acpi_register_ioapic);
  469. int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
  470. {
  471. /* TBD */
  472. return -EINVAL;
  473. }
  474. EXPORT_SYMBOL(acpi_unregister_ioapic);
  475. static unsigned long __init
  476. acpi_scan_rsdp(unsigned long start, unsigned long length)
  477. {
  478. unsigned long offset = 0;
  479. unsigned long sig_len = sizeof("RSD PTR ") - 1;
  480. /*
  481. * Scan all 16-byte boundaries of the physical memory region for the
  482. * RSDP signature.
  483. */
  484. for (offset = 0; offset < length; offset += 16) {
  485. if (strncmp((char *)(phys_to_virt(start) + offset), "RSD PTR ", sig_len))
  486. continue;
  487. return (start + offset);
  488. }
  489. return 0;
  490. }
  491. static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size)
  492. {
  493. struct acpi_table_sbf *sb;
  494. if (!phys_addr || !size)
  495. return -EINVAL;
  496. sb = (struct acpi_table_sbf *)__acpi_map_table(phys_addr, size);
  497. if (!sb) {
  498. printk(KERN_WARNING PREFIX "Unable to map SBF\n");
  499. return -ENODEV;
  500. }
  501. sbf_port = sb->sbf_cmos; /* Save CMOS port */
  502. return 0;
  503. }
  504. #ifdef CONFIG_HPET_TIMER
  505. static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
  506. {
  507. struct acpi_table_hpet *hpet_tbl;
  508. struct resource *hpet_res;
  509. resource_size_t res_start;
  510. if (!phys || !size)
  511. return -EINVAL;
  512. hpet_tbl = (struct acpi_table_hpet *)__acpi_map_table(phys, size);
  513. if (!hpet_tbl) {
  514. printk(KERN_WARNING PREFIX "Unable to map HPET\n");
  515. return -ENODEV;
  516. }
  517. if (hpet_tbl->addr.space_id != ACPI_SPACE_MEM) {
  518. printk(KERN_WARNING PREFIX "HPET timers must be located in "
  519. "memory.\n");
  520. return -1;
  521. }
  522. #define HPET_RESOURCE_NAME_SIZE 9
  523. hpet_res = alloc_bootmem(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE);
  524. if (hpet_res) {
  525. memset(hpet_res, 0, sizeof(*hpet_res));
  526. hpet_res->name = (void *)&hpet_res[1];
  527. hpet_res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
  528. snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE,
  529. "HPET %u", hpet_tbl->number);
  530. hpet_res->end = (1 * 1024) - 1;
  531. }
  532. #ifdef CONFIG_X86_64
  533. vxtime.hpet_address = hpet_tbl->addr.addrl |
  534. ((long)hpet_tbl->addr.addrh << 32);
  535. printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
  536. hpet_tbl->id, vxtime.hpet_address);
  537. res_start = vxtime.hpet_address;
  538. #else /* X86 */
  539. {
  540. extern unsigned long hpet_address;
  541. hpet_address = hpet_tbl->addr.addrl;
  542. printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
  543. hpet_tbl->id, hpet_address);
  544. res_start = hpet_address;
  545. }
  546. #endif /* X86 */
  547. if (hpet_res) {
  548. hpet_res->start = res_start;
  549. hpet_res->end += res_start;
  550. insert_resource(&iomem_resource, hpet_res);
  551. }
  552. return 0;
  553. }
  554. #else
  555. #define acpi_parse_hpet NULL
  556. #endif
  557. #ifdef CONFIG_X86_PM_TIMER
  558. extern u32 pmtmr_ioport;
  559. #endif
  560. static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
  561. {
  562. struct fadt_descriptor *fadt = NULL;
  563. fadt = (struct fadt_descriptor *)__acpi_map_table(phys, size);
  564. if (!fadt) {
  565. printk(KERN_WARNING PREFIX "Unable to map FADT\n");
  566. return 0;
  567. }
  568. /* initialize sci_int early for INT_SRC_OVR MADT parsing */
  569. acpi_fadt.sci_int = fadt->sci_int;
  570. /* initialize rev and apic_phys_dest_mode for x86_64 genapic */
  571. acpi_fadt.revision = fadt->revision;
  572. acpi_fadt.force_apic_physical_destination_mode =
  573. fadt->force_apic_physical_destination_mode;
  574. #ifdef CONFIG_X86_PM_TIMER
  575. /* detect the location of the ACPI PM Timer */
  576. if (fadt->revision >= FADT2_REVISION_ID) {
  577. /* FADT rev. 2 */
  578. if (fadt->xpm_tmr_blk.address_space_id !=
  579. ACPI_ADR_SPACE_SYSTEM_IO)
  580. return 0;
  581. pmtmr_ioport = fadt->xpm_tmr_blk.address;
  582. /*
  583. * "X" fields are optional extensions to the original V1.0
  584. * fields, so we must selectively expand V1.0 fields if the
  585. * corresponding X field is zero.
  586. */
  587. if (!pmtmr_ioport)
  588. pmtmr_ioport = fadt->V1_pm_tmr_blk;
  589. } else {
  590. /* FADT rev. 1 */
  591. pmtmr_ioport = fadt->V1_pm_tmr_blk;
  592. }
  593. if (pmtmr_ioport)
  594. printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
  595. pmtmr_ioport);
  596. #endif
  597. return 0;
  598. }
  599. unsigned long __init acpi_find_rsdp(void)
  600. {
  601. unsigned long rsdp_phys = 0;
  602. if (efi_enabled) {
  603. if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
  604. return efi.acpi20;
  605. else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
  606. return efi.acpi;
  607. }
  608. /*
  609. * Scan memory looking for the RSDP signature. First search EBDA (low
  610. * memory) paragraphs and then search upper memory (E0000-FFFFF).
  611. */
  612. rsdp_phys = acpi_scan_rsdp(0, 0x400);
  613. if (!rsdp_phys)
  614. rsdp_phys = acpi_scan_rsdp(0xE0000, 0x20000);
  615. return rsdp_phys;
  616. }
  617. #ifdef CONFIG_X86_LOCAL_APIC
  618. /*
  619. * Parse LAPIC entries in MADT
  620. * returns 0 on success, < 0 on error
  621. */
  622. static int __init acpi_parse_madt_lapic_entries(void)
  623. {
  624. int count;
  625. if (!cpu_has_apic)
  626. return -ENODEV;
  627. /*
  628. * Note that the LAPIC address is obtained from the MADT (32-bit value)
  629. * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
  630. */
  631. count =
  632. acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
  633. acpi_parse_lapic_addr_ovr, 0);
  634. if (count < 0) {
  635. printk(KERN_ERR PREFIX
  636. "Error parsing LAPIC address override entry\n");
  637. return count;
  638. }
  639. mp_register_lapic_address(acpi_lapic_addr);
  640. count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
  641. MAX_APICS);
  642. if (!count) {
  643. printk(KERN_ERR PREFIX "No LAPIC entries present\n");
  644. /* TBD: Cleanup to allow fallback to MPS */
  645. return -ENODEV;
  646. } else if (count < 0) {
  647. printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
  648. /* TBD: Cleanup to allow fallback to MPS */
  649. return count;
  650. }
  651. count =
  652. acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
  653. if (count < 0) {
  654. printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
  655. /* TBD: Cleanup to allow fallback to MPS */
  656. return count;
  657. }
  658. return 0;
  659. }
  660. #endif /* CONFIG_X86_LOCAL_APIC */
  661. #ifdef CONFIG_X86_IO_APIC
  662. /*
  663. * Parse IOAPIC related entries in MADT
  664. * returns 0 on success, < 0 on error
  665. */
  666. static int __init acpi_parse_madt_ioapic_entries(void)
  667. {
  668. int count;
  669. /*
  670. * ACPI interpreter is required to complete interrupt setup,
  671. * so if it is off, don't enumerate the io-apics with ACPI.
  672. * If MPS is present, it will handle them,
  673. * otherwise the system will stay in PIC mode
  674. */
  675. if (acpi_disabled || acpi_noirq) {
  676. return -ENODEV;
  677. }
  678. if (!cpu_has_apic)
  679. return -ENODEV;
  680. /*
  681. * if "noapic" boot option, don't look for IO-APICs
  682. */
  683. if (skip_ioapic_setup) {
  684. printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
  685. "due to 'noapic' option.\n");
  686. return -ENODEV;
  687. }
  688. count =
  689. acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic,
  690. MAX_IO_APICS);
  691. if (!count) {
  692. printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
  693. return -ENODEV;
  694. } else if (count < 0) {
  695. printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
  696. return count;
  697. }
  698. count =
  699. acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr,
  700. NR_IRQ_VECTORS);
  701. if (count < 0) {
  702. printk(KERN_ERR PREFIX
  703. "Error parsing interrupt source overrides entry\n");
  704. /* TBD: Cleanup to allow fallback to MPS */
  705. return count;
  706. }
  707. /*
  708. * If BIOS did not supply an INT_SRC_OVR for the SCI
  709. * pretend we got one so we can set the SCI flags.
  710. */
  711. if (!acpi_sci_override_gsi)
  712. acpi_sci_ioapic_setup(acpi_fadt.sci_int, 0, 0);
  713. /* Fill in identity legacy mapings where no override */
  714. mp_config_acpi_legacy_irqs();
  715. count =
  716. acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
  717. NR_IRQ_VECTORS);
  718. if (count < 0) {
  719. printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
  720. /* TBD: Cleanup to allow fallback to MPS */
  721. return count;
  722. }
  723. return 0;
  724. }
  725. #else
  726. static inline int acpi_parse_madt_ioapic_entries(void)
  727. {
  728. return -1;
  729. }
  730. #endif /* !CONFIG_X86_IO_APIC */
  731. static void __init acpi_process_madt(void)
  732. {
  733. #ifdef CONFIG_X86_LOCAL_APIC
  734. int count, error;
  735. count = acpi_table_parse(ACPI_APIC, acpi_parse_madt);
  736. if (count >= 1) {
  737. /*
  738. * Parse MADT LAPIC entries
  739. */
  740. error = acpi_parse_madt_lapic_entries();
  741. if (!error) {
  742. acpi_lapic = 1;
  743. #ifdef CONFIG_X86_GENERICARCH
  744. generic_bigsmp_probe();
  745. #endif
  746. /*
  747. * Parse MADT IO-APIC entries
  748. */
  749. error = acpi_parse_madt_ioapic_entries();
  750. if (!error) {
  751. acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
  752. acpi_irq_balance_set(NULL);
  753. acpi_ioapic = 1;
  754. smp_found_config = 1;
  755. clustered_apic_check();
  756. }
  757. }
  758. if (error == -EINVAL) {
  759. /*
  760. * Dell Precision Workstation 410, 610 come here.
  761. */
  762. printk(KERN_ERR PREFIX
  763. "Invalid BIOS MADT, disabling ACPI\n");
  764. disable_acpi();
  765. }
  766. }
  767. #endif
  768. return;
  769. }
  770. #ifdef __i386__
  771. static int __init disable_acpi_irq(struct dmi_system_id *d)
  772. {
  773. if (!acpi_force) {
  774. printk(KERN_NOTICE "%s detected: force use of acpi=noirq\n",
  775. d->ident);
  776. acpi_noirq_set();
  777. }
  778. return 0;
  779. }
  780. static int __init disable_acpi_pci(struct dmi_system_id *d)
  781. {
  782. if (!acpi_force) {
  783. printk(KERN_NOTICE "%s detected: force use of pci=noacpi\n",
  784. d->ident);
  785. acpi_disable_pci();
  786. }
  787. return 0;
  788. }
  789. static int __init dmi_disable_acpi(struct dmi_system_id *d)
  790. {
  791. if (!acpi_force) {
  792. printk(KERN_NOTICE "%s detected: acpi off\n", d->ident);
  793. disable_acpi();
  794. } else {
  795. printk(KERN_NOTICE
  796. "Warning: DMI blacklist says broken, but acpi forced\n");
  797. }
  798. return 0;
  799. }
  800. /*
  801. * Limit ACPI to CPU enumeration for HT
  802. */
  803. static int __init force_acpi_ht(struct dmi_system_id *d)
  804. {
  805. if (!acpi_force) {
  806. printk(KERN_NOTICE "%s detected: force use of acpi=ht\n",
  807. d->ident);
  808. disable_acpi();
  809. acpi_ht = 1;
  810. } else {
  811. printk(KERN_NOTICE
  812. "Warning: acpi=force overrules DMI blacklist: acpi=ht\n");
  813. }
  814. return 0;
  815. }
  816. /*
  817. * If your system is blacklisted here, but you find that acpi=force
  818. * works for you, please contact acpi-devel@sourceforge.net
  819. */
  820. static struct dmi_system_id __initdata acpi_dmi_table[] = {
  821. /*
  822. * Boxes that need ACPI disabled
  823. */
  824. {
  825. .callback = dmi_disable_acpi,
  826. .ident = "IBM Thinkpad",
  827. .matches = {
  828. DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
  829. DMI_MATCH(DMI_BOARD_NAME, "2629H1G"),
  830. },
  831. },
  832. /*
  833. * Boxes that need acpi=ht
  834. */
  835. {
  836. .callback = force_acpi_ht,
  837. .ident = "FSC Primergy T850",
  838. .matches = {
  839. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  840. DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"),
  841. },
  842. },
  843. {
  844. .callback = force_acpi_ht,
  845. .ident = "DELL GX240",
  846. .matches = {
  847. DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"),
  848. DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"),
  849. },
  850. },
  851. {
  852. .callback = force_acpi_ht,
  853. .ident = "HP VISUALIZE NT Workstation",
  854. .matches = {
  855. DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
  856. DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"),
  857. },
  858. },
  859. {
  860. .callback = force_acpi_ht,
  861. .ident = "Compaq Workstation W8000",
  862. .matches = {
  863. DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
  864. DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"),
  865. },
  866. },
  867. {
  868. .callback = force_acpi_ht,
  869. .ident = "ASUS P4B266",
  870. .matches = {
  871. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
  872. DMI_MATCH(DMI_BOARD_NAME, "P4B266"),
  873. },
  874. },
  875. {
  876. .callback = force_acpi_ht,
  877. .ident = "ASUS P2B-DS",
  878. .matches = {
  879. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
  880. DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"),
  881. },
  882. },
  883. {
  884. .callback = force_acpi_ht,
  885. .ident = "ASUS CUR-DLS",
  886. .matches = {
  887. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
  888. DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"),
  889. },
  890. },
  891. {
  892. .callback = force_acpi_ht,
  893. .ident = "ABIT i440BX-W83977",
  894. .matches = {
  895. DMI_MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"),
  896. DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"),
  897. },
  898. },
  899. {
  900. .callback = force_acpi_ht,
  901. .ident = "IBM Bladecenter",
  902. .matches = {
  903. DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
  904. DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"),
  905. },
  906. },
  907. {
  908. .callback = force_acpi_ht,
  909. .ident = "IBM eServer xSeries 360",
  910. .matches = {
  911. DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
  912. DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"),
  913. },
  914. },
  915. {
  916. .callback = force_acpi_ht,
  917. .ident = "IBM eserver xSeries 330",
  918. .matches = {
  919. DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
  920. DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"),
  921. },
  922. },
  923. {
  924. .callback = force_acpi_ht,
  925. .ident = "IBM eserver xSeries 440",
  926. .matches = {
  927. DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
  928. DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"),
  929. },
  930. },
  931. /*
  932. * Boxes that need ACPI PCI IRQ routing disabled
  933. */
  934. {
  935. .callback = disable_acpi_irq,
  936. .ident = "ASUS A7V",
  937. .matches = {
  938. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
  939. DMI_MATCH(DMI_BOARD_NAME, "<A7V>"),
  940. /* newer BIOS, Revision 1011, does work */
  941. DMI_MATCH(DMI_BIOS_VERSION,
  942. "ASUS A7V ACPI BIOS Revision 1007"),
  943. },
  944. },
  945. /*
  946. * Boxes that need ACPI PCI IRQ routing and PCI scan disabled
  947. */
  948. { /* _BBN 0 bug */
  949. .callback = disable_acpi_pci,
  950. .ident = "ASUS PR-DLS",
  951. .matches = {
  952. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
  953. DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"),
  954. DMI_MATCH(DMI_BIOS_VERSION,
  955. "ASUS PR-DLS ACPI BIOS Revision 1010"),
  956. DMI_MATCH(DMI_BIOS_DATE, "03/21/2003")
  957. },
  958. },
  959. {
  960. .callback = disable_acpi_pci,
  961. .ident = "Acer TravelMate 36x Laptop",
  962. .matches = {
  963. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  964. DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
  965. },
  966. },
  967. {}
  968. };
  969. #endif /* __i386__ */
  970. /*
  971. * acpi_boot_table_init() and acpi_boot_init()
  972. * called from setup_arch(), always.
  973. * 1. checksums all tables
  974. * 2. enumerates lapics
  975. * 3. enumerates io-apics
  976. *
  977. * acpi_table_init() is separate to allow reading SRAT without
  978. * other side effects.
  979. *
  980. * side effects of acpi_boot_init:
  981. * acpi_lapic = 1 if LAPIC found
  982. * acpi_ioapic = 1 if IOAPIC found
  983. * if (acpi_lapic && acpi_ioapic) smp_found_config = 1;
  984. * if acpi_blacklisted() acpi_disabled = 1;
  985. * acpi_irq_model=...
  986. * ...
  987. *
  988. * return value: (currently ignored)
  989. * 0: success
  990. * !0: failure
  991. */
  992. int __init acpi_boot_table_init(void)
  993. {
  994. int error;
  995. #ifdef __i386__
  996. dmi_check_system(acpi_dmi_table);
  997. #endif
  998. /*
  999. * If acpi_disabled, bail out
  1000. * One exception: acpi=ht continues far enough to enumerate LAPICs
  1001. */
  1002. if (acpi_disabled && !acpi_ht)
  1003. return 1;
  1004. /*
  1005. * Initialize the ACPI boot-time table parser.
  1006. */
  1007. error = acpi_table_init();
  1008. if (error) {
  1009. disable_acpi();
  1010. return error;
  1011. }
  1012. acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
  1013. /*
  1014. * blacklist may disable ACPI entirely
  1015. */
  1016. error = acpi_blacklisted();
  1017. if (error) {
  1018. if (acpi_force) {
  1019. printk(KERN_WARNING PREFIX "acpi=force override\n");
  1020. } else {
  1021. printk(KERN_WARNING PREFIX "Disabling ACPI support\n");
  1022. disable_acpi();
  1023. return error;
  1024. }
  1025. }
  1026. return 0;
  1027. }
  1028. int __init acpi_boot_init(void)
  1029. {
  1030. /*
  1031. * If acpi_disabled, bail out
  1032. * One exception: acpi=ht continues far enough to enumerate LAPICs
  1033. */
  1034. if (acpi_disabled && !acpi_ht)
  1035. return 1;
  1036. acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
  1037. /*
  1038. * set sci_int and PM timer address
  1039. */
  1040. acpi_table_parse(ACPI_FADT, acpi_parse_fadt);
  1041. /*
  1042. * Process the Multiple APIC Description Table (MADT), if present
  1043. */
  1044. acpi_process_madt();
  1045. acpi_table_parse(ACPI_HPET, acpi_parse_hpet);
  1046. return 0;
  1047. }
  1048. static int __init parse_acpi(char *arg)
  1049. {
  1050. if (!arg)
  1051. return -EINVAL;
  1052. /* "acpi=off" disables both ACPI table parsing and interpreter */
  1053. if (strcmp(arg, "off") == 0) {
  1054. disable_acpi();
  1055. }
  1056. /* acpi=force to over-ride black-list */
  1057. else if (strcmp(arg, "force") == 0) {
  1058. acpi_force = 1;
  1059. acpi_ht = 1;
  1060. acpi_disabled = 0;
  1061. }
  1062. /* acpi=strict disables out-of-spec workarounds */
  1063. else if (strcmp(arg, "strict") == 0) {
  1064. acpi_strict = 1;
  1065. }
  1066. /* Limit ACPI just to boot-time to enable HT */
  1067. else if (strcmp(arg, "ht") == 0) {
  1068. if (!acpi_force)
  1069. disable_acpi();
  1070. acpi_ht = 1;
  1071. }
  1072. /* "acpi=noirq" disables ACPI interrupt routing */
  1073. else if (strcmp(arg, "noirq") == 0) {
  1074. acpi_noirq_set();
  1075. } else {
  1076. /* Core will printk when we return error. */
  1077. return -EINVAL;
  1078. }
  1079. return 0;
  1080. }
  1081. early_param("acpi", parse_acpi);
  1082. /* FIXME: Using pci= for an ACPI parameter is a travesty. */
  1083. static int __init parse_pci(char *arg)
  1084. {
  1085. if (arg && strcmp(arg, "noacpi") == 0)
  1086. acpi_disable_pci();
  1087. return 0;
  1088. }
  1089. early_param("pci", parse_pci);
  1090. #ifdef CONFIG_X86_IO_APIC
  1091. static int __init parse_acpi_skip_timer_override(char *arg)
  1092. {
  1093. acpi_skip_timer_override = 1;
  1094. return 0;
  1095. }
  1096. early_param("acpi_skip_timer_override", parse_acpi_skip_timer_override);
  1097. static int __init parse_acpi_use_timer_override(char *arg)
  1098. {
  1099. acpi_use_timer_override = 1;
  1100. return 0;
  1101. }
  1102. early_param("acpi_use_timer_override", parse_acpi_use_timer_override);
  1103. #endif /* CONFIG_X86_IO_APIC */
  1104. static int __init setup_acpi_sci(char *s)
  1105. {
  1106. if (!s)
  1107. return -EINVAL;
  1108. if (!strcmp(s, "edge"))
  1109. acpi_sci_flags.trigger = 1;
  1110. else if (!strcmp(s, "level"))
  1111. acpi_sci_flags.trigger = 3;
  1112. else if (!strcmp(s, "high"))
  1113. acpi_sci_flags.polarity = 1;
  1114. else if (!strcmp(s, "low"))
  1115. acpi_sci_flags.polarity = 3;
  1116. else
  1117. return -EINVAL;
  1118. return 0;
  1119. }
  1120. early_param("acpi_sci", setup_acpi_sci);