2 * boot.c - Architecture-Specific Low-Level ACPI Boot Support
4 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
5 * Copyright (C) 2001 Jun Nakajima <jun.nakajima@intel.com>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
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.
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
23 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26 #include <linux/init.h>
27 #include <linux/acpi.h>
28 #include <linux/acpi_pmtmr.h>
29 #include <linux/efi.h>
30 #include <linux/cpumask.h>
31 #include <linux/module.h>
32 #include <linux/dmi.h>
33 #include <linux/irq.h>
34 #include <linux/bootmem.h>
35 #include <linux/ioport.h>
37 #include <asm/pgtable.h>
38 #include <asm/io_apic.h>
41 #include <asm/mpspec.h>
44 static int __initdata acpi_force = 0;
47 EXPORT_SYMBOL(acpi_disabled);
50 # include <asm/proto.h>
53 #define BAD_MADT_ENTRY(entry, end) ( \
54 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
55 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
57 #define PREFIX "ACPI: "
59 int acpi_noirq; /* skip ACPI IRQ initialization */
60 int acpi_pci_disabled; /* skip ACPI PCI scan and IRQ initialization */
61 EXPORT_SYMBOL(acpi_pci_disabled);
62 int acpi_ht __initdata = 1; /* enable HT */
68 u8 acpi_sci_flags __initdata;
69 int acpi_sci_override_gsi __initdata;
70 int acpi_skip_timer_override __initdata;
71 int acpi_use_timer_override __initdata;
73 #ifdef CONFIG_X86_LOCAL_APIC
74 static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
77 #ifndef __HAVE_ARCH_CMPXCHG
78 #warning ACPI uses CMPXCHG, i486 and later hardware
81 /* --------------------------------------------------------------------------
82 Boot-time Configuration
83 -------------------------------------------------------------------------- */
86 * The default interrupt routing model is PIC (8259). This gets
87 * overridden if IOAPICs are enumerated (below).
89 enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
93 * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
94 * to map the target physical address. The problem is that set_fixmap()
95 * provides a single page, and it is possible that the page is not
97 * By using this area, we can map up to MAX_IO_APICS pages temporarily,
98 * i.e. until the next __va_range() call.
100 * Important Safety Note: The fixed I/O APIC page numbers are *subtracted*
101 * from the fixed base. That's why we start at FIX_IO_APIC_BASE_END and
102 * count idx down while incrementing the phys address.
104 char *__init __acpi_map_table(unsigned long phys, unsigned long size)
110 return early_ioremap(phys, size);
112 void __init __acpi_unmap_table(char *map, unsigned long size)
117 early_iounmap(map, size);
120 #ifdef CONFIG_PCI_MMCONFIG
122 static int acpi_mcfg_64bit_base_addr __initdata = FALSE;
124 /* The physical address of the MMCONFIG aperture. Set from ACPI tables. */
125 struct acpi_mcfg_allocation *pci_mmcfg_config;
126 int pci_mmcfg_config_num;
128 static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg)
130 if (!strcmp(mcfg->header.oem_id, "SGI"))
131 acpi_mcfg_64bit_base_addr = TRUE;
136 int __init acpi_parse_mcfg(struct acpi_table_header *header)
138 struct acpi_table_mcfg *mcfg;
145 mcfg = (struct acpi_table_mcfg *)header;
147 /* how many config structures do we have */
148 pci_mmcfg_config_num = 0;
149 i = header->length - sizeof(struct acpi_table_mcfg);
150 while (i >= sizeof(struct acpi_mcfg_allocation)) {
151 ++pci_mmcfg_config_num;
152 i -= sizeof(struct acpi_mcfg_allocation);
154 if (pci_mmcfg_config_num == 0) {
155 printk(KERN_ERR PREFIX "MMCONFIG has no entries\n");
159 config_size = pci_mmcfg_config_num * sizeof(*pci_mmcfg_config);
160 pci_mmcfg_config = kmalloc(config_size, GFP_KERNEL);
161 if (!pci_mmcfg_config) {
162 printk(KERN_WARNING PREFIX
163 "No memory for MCFG config tables\n");
167 memcpy(pci_mmcfg_config, &mcfg[1], config_size);
169 acpi_mcfg_oem_check(mcfg);
171 for (i = 0; i < pci_mmcfg_config_num; ++i) {
172 if ((pci_mmcfg_config[i].address > 0xFFFFFFFF) &&
173 !acpi_mcfg_64bit_base_addr) {
174 printk(KERN_ERR PREFIX
175 "MMCONFIG not in low 4GB of memory\n");
176 kfree(pci_mmcfg_config);
177 pci_mmcfg_config_num = 0;
184 #endif /* CONFIG_PCI_MMCONFIG */
186 #ifdef CONFIG_X86_LOCAL_APIC
187 static int __init acpi_parse_madt(struct acpi_table_header *table)
189 struct acpi_table_madt *madt = NULL;
194 madt = (struct acpi_table_madt *)table;
196 printk(KERN_WARNING PREFIX "Unable to map MADT\n");
201 acpi_lapic_addr = (u64) madt->address;
203 printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
207 default_acpi_madt_oem_check(madt->header.oem_id,
208 madt->header.oem_table_id);
213 static void __cpuinit acpi_register_lapic(int id, u8 enabled)
215 unsigned int ver = 0;
222 if (boot_cpu_physical_apicid != -1U)
223 ver = apic_version[boot_cpu_physical_apicid];
225 generic_processor_info(id, ver);
229 acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
231 struct acpi_madt_local_x2apic *processor = NULL;
233 processor = (struct acpi_madt_local_x2apic *)header;
235 if (BAD_MADT_ENTRY(processor, end))
238 acpi_table_print_madt_entry(header);
240 #ifdef CONFIG_X86_X2APIC
242 * We need to register disabled CPU as well to permit
243 * counting disabled CPUs. This allows us to size
244 * cpus_possible_map more accurately, to permit
245 * to not preallocating memory for all NR_CPUS
246 * when we use CPU hotplug.
248 acpi_register_lapic(processor->local_apic_id, /* APIC ID */
249 processor->lapic_flags & ACPI_MADT_ENABLED);
251 printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
258 acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end)
260 struct acpi_madt_local_apic *processor = NULL;
262 processor = (struct acpi_madt_local_apic *)header;
264 if (BAD_MADT_ENTRY(processor, end))
267 acpi_table_print_madt_entry(header);
270 * We need to register disabled CPU as well to permit
271 * counting disabled CPUs. This allows us to size
272 * cpus_possible_map more accurately, to permit
273 * to not preallocating memory for all NR_CPUS
274 * when we use CPU hotplug.
276 acpi_register_lapic(processor->id, /* APIC ID */
277 processor->lapic_flags & ACPI_MADT_ENABLED);
283 acpi_parse_sapic(struct acpi_subtable_header *header, const unsigned long end)
285 struct acpi_madt_local_sapic *processor = NULL;
287 processor = (struct acpi_madt_local_sapic *)header;
289 if (BAD_MADT_ENTRY(processor, end))
292 acpi_table_print_madt_entry(header);
294 acpi_register_lapic((processor->id << 8) | processor->eid,/* APIC ID */
295 processor->lapic_flags & ACPI_MADT_ENABLED);
301 acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header,
302 const unsigned long end)
304 struct acpi_madt_local_apic_override *lapic_addr_ovr = NULL;
306 lapic_addr_ovr = (struct acpi_madt_local_apic_override *)header;
308 if (BAD_MADT_ENTRY(lapic_addr_ovr, end))
311 acpi_lapic_addr = lapic_addr_ovr->address;
317 acpi_parse_x2apic_nmi(struct acpi_subtable_header *header,
318 const unsigned long end)
320 struct acpi_madt_local_x2apic_nmi *x2apic_nmi = NULL;
322 x2apic_nmi = (struct acpi_madt_local_x2apic_nmi *)header;
324 if (BAD_MADT_ENTRY(x2apic_nmi, end))
327 acpi_table_print_madt_entry(header);
329 if (x2apic_nmi->lint != 1)
330 printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n");
336 acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end)
338 struct acpi_madt_local_apic_nmi *lapic_nmi = NULL;
340 lapic_nmi = (struct acpi_madt_local_apic_nmi *)header;
342 if (BAD_MADT_ENTRY(lapic_nmi, end))
345 acpi_table_print_madt_entry(header);
347 if (lapic_nmi->lint != 1)
348 printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n");
353 #endif /*CONFIG_X86_LOCAL_APIC */
355 #ifdef CONFIG_X86_IO_APIC
358 acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end)
360 struct acpi_madt_io_apic *ioapic = NULL;
362 ioapic = (struct acpi_madt_io_apic *)header;
364 if (BAD_MADT_ENTRY(ioapic, end))
367 acpi_table_print_madt_entry(header);
369 mp_register_ioapic(ioapic->id,
370 ioapic->address, ioapic->global_irq_base);
376 * Parse Interrupt Source Override for the ACPI SCI
378 static void __init acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
380 if (trigger == 0) /* compatible SCI trigger is level */
383 if (polarity == 0) /* compatible SCI polarity is low */
386 /* Command-line over-ride via acpi_sci= */
387 if (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK)
388 trigger = (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK) >> 2;
390 if (acpi_sci_flags & ACPI_MADT_POLARITY_MASK)
391 polarity = acpi_sci_flags & ACPI_MADT_POLARITY_MASK;
394 * mp_config_acpi_legacy_irqs() already setup IRQs < 16
395 * If GSI is < 16, this will update its flags,
396 * else it will create a new mp_irqs[] entry.
398 mp_override_legacy_irq(gsi, polarity, trigger, gsi);
401 * stash over-ride to indicate we've been here
402 * and for later update of acpi_gbl_FADT
404 acpi_sci_override_gsi = gsi;
409 acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
410 const unsigned long end)
412 struct acpi_madt_interrupt_override *intsrc = NULL;
414 intsrc = (struct acpi_madt_interrupt_override *)header;
416 if (BAD_MADT_ENTRY(intsrc, end))
419 acpi_table_print_madt_entry(header);
421 if (intsrc->source_irq == acpi_gbl_FADT.sci_interrupt) {
422 acpi_sci_ioapic_setup(intsrc->global_irq,
423 intsrc->inti_flags & ACPI_MADT_POLARITY_MASK,
424 (intsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2);
428 if (acpi_skip_timer_override &&
429 intsrc->source_irq == 0 && intsrc->global_irq == 2) {
430 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
434 mp_override_legacy_irq(intsrc->source_irq,
435 intsrc->inti_flags & ACPI_MADT_POLARITY_MASK,
436 (intsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2,
443 acpi_parse_nmi_src(struct acpi_subtable_header * header, const unsigned long end)
445 struct acpi_madt_nmi_source *nmi_src = NULL;
447 nmi_src = (struct acpi_madt_nmi_source *)header;
449 if (BAD_MADT_ENTRY(nmi_src, end))
452 acpi_table_print_madt_entry(header);
454 /* TBD: Support nimsrc entries? */
459 #endif /* CONFIG_X86_IO_APIC */
462 * acpi_pic_sci_set_trigger()
464 * use ELCR to set PIC-mode trigger type for SCI
466 * If a PIC-mode SCI is not recognized or gives spurious IRQ7's
467 * it may require Edge Trigger -- use "acpi_sci=edge"
469 * Port 0x4d0-4d1 are ECLR1 and ECLR2, the Edge/Level Control Registers
470 * for the 8259 PIC. bit[n] = 1 means irq[n] is Level, otherwise Edge.
471 * ECLR1 is IRQs 0-7 (IRQ 0, 1, 2 must be 0)
472 * ECLR2 is IRQs 8-15 (IRQ 8, 13 must be 0)
475 void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
477 unsigned int mask = 1 << irq;
478 unsigned int old, new;
480 /* Real old ELCR mask */
481 old = inb(0x4d0) | (inb(0x4d1) << 8);
484 * If we use ACPI to set PCI IRQs, then we should clear ELCR
485 * since we will set it correctly as we enable the PCI irq
488 new = acpi_noirq ? old : 0;
491 * Update SCI information in the ELCR, it isn't in the PCI
495 case 1: /* Edge - clear */
498 case 3: /* Level - set */
506 printk(PREFIX "setting ELCR to %04x (from %04x)\n", new, old);
508 outb(new >> 8, 0x4d1);
511 int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
518 * success: return IRQ number (>=0)
519 * failure: return < 0
521 int acpi_register_gsi(u32 gsi, int triggering, int polarity)
524 unsigned int plat_gsi = gsi;
528 * Make sure all (legacy) PCI IRQs are set as level-triggered.
530 if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
531 if (triggering == ACPI_LEVEL_SENSITIVE)
532 eisa_set_level_irq(gsi);
536 #ifdef CONFIG_X86_IO_APIC
537 if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) {
538 plat_gsi = mp_register_gsi(gsi, triggering, polarity);
541 acpi_gsi_to_irq(plat_gsi, &irq);
546 * ACPI based hotplug support for CPU
548 #ifdef CONFIG_ACPI_HOTPLUG_CPU
550 static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
552 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
553 union acpi_object *obj;
554 struct acpi_madt_local_apic *lapic;
555 cpumask_var_t tmp_map, new_map;
558 int retval = -ENOMEM;
560 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
563 if (!buffer.length || !buffer.pointer)
566 obj = buffer.pointer;
567 if (obj->type != ACPI_TYPE_BUFFER ||
568 obj->buffer.length < sizeof(*lapic)) {
569 kfree(buffer.pointer);
573 lapic = (struct acpi_madt_local_apic *)obj->buffer.pointer;
575 if (lapic->header.type != ACPI_MADT_TYPE_LOCAL_APIC ||
576 !(lapic->lapic_flags & ACPI_MADT_ENABLED)) {
577 kfree(buffer.pointer);
583 kfree(buffer.pointer);
584 buffer.length = ACPI_ALLOCATE_BUFFER;
585 buffer.pointer = NULL;
587 if (!alloc_cpumask_var(&tmp_map, GFP_KERNEL))
590 if (!alloc_cpumask_var(&new_map, GFP_KERNEL))
593 cpumask_copy(tmp_map, cpu_present_mask);
594 acpi_register_lapic(physid, lapic->lapic_flags & ACPI_MADT_ENABLED);
597 * If mp_register_lapic successfully generates a new logical cpu
598 * number, then the following will get us exactly what was mapped
600 cpumask_andnot(new_map, cpu_present_mask, tmp_map);
601 if (cpumask_empty(new_map)) {
602 printk ("Unable to map lapic to logical cpu number\n");
607 cpu = cpumask_first(new_map);
613 free_cpumask_var(new_map);
615 free_cpumask_var(tmp_map);
620 /* wrapper to silence section mismatch warning */
621 int __ref acpi_map_lsapic(acpi_handle handle, int *pcpu)
623 return _acpi_map_lsapic(handle, pcpu);
625 EXPORT_SYMBOL(acpi_map_lsapic);
627 int acpi_unmap_lsapic(int cpu)
629 per_cpu(x86_cpu_to_apicid, cpu) = -1;
630 set_cpu_present(cpu, false);
636 EXPORT_SYMBOL(acpi_unmap_lsapic);
637 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
639 int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
645 EXPORT_SYMBOL(acpi_register_ioapic);
647 int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
653 EXPORT_SYMBOL(acpi_unregister_ioapic);
655 static int __init acpi_parse_sbf(struct acpi_table_header *table)
657 struct acpi_table_boot *sb;
659 sb = (struct acpi_table_boot *)table;
661 printk(KERN_WARNING PREFIX "Unable to map SBF\n");
665 sbf_port = sb->cmos_index; /* Save CMOS port */
670 #ifdef CONFIG_HPET_TIMER
671 #include <asm/hpet.h>
673 static struct __initdata resource *hpet_res;
675 static int __init acpi_parse_hpet(struct acpi_table_header *table)
677 struct acpi_table_hpet *hpet_tbl;
679 hpet_tbl = (struct acpi_table_hpet *)table;
681 printk(KERN_WARNING PREFIX "Unable to map HPET\n");
685 if (hpet_tbl->address.space_id != ACPI_SPACE_MEM) {
686 printk(KERN_WARNING PREFIX "HPET timers must be located in "
691 hpet_address = hpet_tbl->address.address;
694 * Some broken BIOSes advertise HPET at 0x0. We really do not
695 * want to allocate a resource there.
698 printk(KERN_WARNING PREFIX
699 "HPET id: %#x base: %#lx is invalid\n",
700 hpet_tbl->id, hpet_address);
705 * Some even more broken BIOSes advertise HPET at
706 * 0xfed0000000000000 instead of 0xfed00000. Fix it up and add
709 if (hpet_address == 0xfed0000000000000UL) {
710 if (!hpet_force_user) {
711 printk(KERN_WARNING PREFIX "HPET id: %#x "
712 "base: 0xfed0000000000000 is bogus\n "
713 "try hpet=force on the kernel command line to "
714 "fix it up to 0xfed00000.\n", hpet_tbl->id);
718 printk(KERN_WARNING PREFIX
719 "HPET id: %#x base: 0xfed0000000000000 fixed up "
720 "to 0xfed00000.\n", hpet_tbl->id);
724 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
725 hpet_tbl->id, hpet_address);
728 * Allocate and initialize the HPET firmware resource for adding into
729 * the resource tree during the lateinit timeframe.
731 #define HPET_RESOURCE_NAME_SIZE 9
732 hpet_res = alloc_bootmem(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE);
734 hpet_res->name = (void *)&hpet_res[1];
735 hpet_res->flags = IORESOURCE_MEM;
736 snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE, "HPET %u",
739 hpet_res->start = hpet_address;
740 hpet_res->end = hpet_address + (1 * 1024) - 1;
746 * hpet_insert_resource inserts the HPET resources used into the resource
749 static __init int hpet_insert_resource(void)
754 return insert_resource(&iomem_resource, hpet_res);
757 late_initcall(hpet_insert_resource);
760 #define acpi_parse_hpet NULL
763 static int __init acpi_parse_fadt(struct acpi_table_header *table)
766 #ifdef CONFIG_X86_PM_TIMER
767 /* detect the location of the ACPI PM Timer */
768 if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID) {
770 if (acpi_gbl_FADT.xpm_timer_block.space_id !=
771 ACPI_ADR_SPACE_SYSTEM_IO)
774 pmtmr_ioport = acpi_gbl_FADT.xpm_timer_block.address;
776 * "X" fields are optional extensions to the original V1.0
777 * fields, so we must selectively expand V1.0 fields if the
778 * corresponding X field is zero.
781 pmtmr_ioport = acpi_gbl_FADT.pm_timer_block;
784 pmtmr_ioport = acpi_gbl_FADT.pm_timer_block;
787 printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
793 #ifdef CONFIG_X86_LOCAL_APIC
795 * Parse LAPIC entries in MADT
796 * returns 0 on success, < 0 on error
799 static void __init acpi_register_lapic_address(unsigned long address)
801 mp_lapic_addr = address;
803 set_fixmap_nocache(FIX_APIC_BASE, address);
804 if (boot_cpu_physical_apicid == -1U) {
805 boot_cpu_physical_apicid = read_apic_id();
806 apic_version[boot_cpu_physical_apicid] =
807 GET_APIC_VERSION(apic_read(APIC_LVR));
811 static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
819 * Note that the LAPIC address is obtained from the MADT (32-bit value)
820 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
824 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE,
825 acpi_parse_lapic_addr_ovr, 0);
827 printk(KERN_ERR PREFIX
828 "Error parsing LAPIC address override entry\n");
832 acpi_register_lapic_address(acpi_lapic_addr);
837 static int __init acpi_parse_madt_lapic_entries(void)
846 * Note that the LAPIC address is obtained from the MADT (32-bit value)
847 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
851 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE,
852 acpi_parse_lapic_addr_ovr, 0);
854 printk(KERN_ERR PREFIX
855 "Error parsing LAPIC address override entry\n");
859 acpi_register_lapic_address(acpi_lapic_addr);
861 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC,
862 acpi_parse_sapic, MAX_APICS);
865 x2count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC,
866 acpi_parse_x2apic, MAX_APICS);
867 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC,
868 acpi_parse_lapic, MAX_APICS);
870 if (!count && !x2count) {
871 printk(KERN_ERR PREFIX "No LAPIC entries present\n");
872 /* TBD: Cleanup to allow fallback to MPS */
874 } else if (count < 0 || x2count < 0) {
875 printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
876 /* TBD: Cleanup to allow fallback to MPS */
881 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC_NMI,
882 acpi_parse_x2apic_nmi, 0);
884 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0);
885 if (count < 0 || x2count < 0) {
886 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
887 /* TBD: Cleanup to allow fallback to MPS */
892 #endif /* CONFIG_X86_LOCAL_APIC */
894 #ifdef CONFIG_X86_IO_APIC
897 #ifdef CONFIG_X86_ES7000
898 extern int es7000_plat;
905 DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1);
906 } mp_ioapic_routing[MAX_IO_APICS];
908 int mp_find_ioapic(int gsi)
912 /* Find the IOAPIC that manages this GSI. */
913 for (i = 0; i < nr_ioapics; i++) {
914 if ((gsi >= mp_ioapic_routing[i].gsi_base)
915 && (gsi <= mp_ioapic_routing[i].gsi_end))
919 printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi);
923 int mp_find_ioapic_pin(int ioapic, int gsi)
925 if (WARN_ON(ioapic == -1))
927 if (WARN_ON(gsi > mp_ioapic_routing[ioapic].gsi_end))
930 return gsi - mp_ioapic_routing[ioapic].gsi_base;
933 static u8 __init uniq_ioapic_id(u8 id)
936 if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
937 !APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
938 return io_apic_get_unique_id(nr_ioapics, id);
943 DECLARE_BITMAP(used, 256);
944 bitmap_zero(used, 256);
945 for (i = 0; i < nr_ioapics; i++) {
946 struct mpc_ioapic *ia = &mp_ioapics[i];
947 __set_bit(ia->apicid, used);
949 if (!test_bit(id, used))
951 return find_first_zero_bit(used, 256);
955 static int bad_ioapic(unsigned long address)
957 if (nr_ioapics >= MAX_IO_APICS) {
958 printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded "
959 "(found %d)\n", MAX_IO_APICS, nr_ioapics);
960 panic("Recompile kernel with bigger MAX_IO_APICS!\n");
963 printk(KERN_ERR "WARNING: Bogus (zero) I/O APIC address"
964 " found in table, skipping!\n");
970 void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
974 if (bad_ioapic(address))
979 mp_ioapics[idx].type = MP_IOAPIC;
980 mp_ioapics[idx].flags = MPC_APIC_USABLE;
981 mp_ioapics[idx].apicaddr = address;
983 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
984 mp_ioapics[idx].apicid = uniq_ioapic_id(id);
986 mp_ioapics[idx].apicver = io_apic_get_version(idx);
988 mp_ioapics[idx].apicver = 0;
991 * Build basic GSI lookup table to facilitate gsi->io_apic lookups
992 * and to prevent reprogramming of IOAPIC pins (PCI GSIs).
994 mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].apicid;
995 mp_ioapic_routing[idx].gsi_base = gsi_base;
996 mp_ioapic_routing[idx].gsi_end = gsi_base +
997 io_apic_get_redir_entries(idx);
999 printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, "
1000 "GSI %d-%d\n", idx, mp_ioapics[idx].apicid,
1001 mp_ioapics[idx].apicver, mp_ioapics[idx].apicaddr,
1002 mp_ioapic_routing[idx].gsi_base, mp_ioapic_routing[idx].gsi_end);
1007 int __init acpi_probe_gsi(void)
1020 for (idx = 0; idx < nr_ioapics; idx++) {
1021 gsi = mp_ioapic_routing[idx].gsi_end;
1030 static void assign_to_mp_irq(struct mpc_intsrc *m,
1031 struct mpc_intsrc *mp_irq)
1033 memcpy(mp_irq, m, sizeof(struct mpc_intsrc));
1036 static int mp_irq_cmp(struct mpc_intsrc *mp_irq,
1037 struct mpc_intsrc *m)
1039 return memcmp(mp_irq, m, sizeof(struct mpc_intsrc));
1042 static void save_mp_irq(struct mpc_intsrc *m)
1046 for (i = 0; i < mp_irq_entries; i++) {
1047 if (!mp_irq_cmp(&mp_irqs[i], m))
1051 assign_to_mp_irq(m, &mp_irqs[mp_irq_entries]);
1052 if (++mp_irq_entries == MAX_IRQ_SOURCES)
1053 panic("Max # of irq sources exceeded!!\n");
1056 void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
1060 struct mpc_intsrc mp_irq;
1063 * Convert 'gsi' to 'ioapic.pin'.
1065 ioapic = mp_find_ioapic(gsi);
1068 pin = mp_find_ioapic_pin(ioapic, gsi);
1071 * TBD: This check is for faulty timer entries, where the override
1072 * erroneously sets the trigger to level, resulting in a HUGE
1073 * increase of timer interrupts!
1075 if ((bus_irq == 0) && (trigger == 3))
1078 mp_irq.type = MP_INTSRC;
1079 mp_irq.irqtype = mp_INT;
1080 mp_irq.irqflag = (trigger << 2) | polarity;
1081 mp_irq.srcbus = MP_ISA_BUS;
1082 mp_irq.srcbusirq = bus_irq; /* IRQ */
1083 mp_irq.dstapic = mp_ioapics[ioapic].apicid; /* APIC ID */
1084 mp_irq.dstirq = pin; /* INTIN# */
1086 save_mp_irq(&mp_irq);
1089 void __init mp_config_acpi_legacy_irqs(void)
1093 unsigned int dstapic;
1094 struct mpc_intsrc mp_irq;
1096 #if defined (CONFIG_MCA) || defined (CONFIG_EISA)
1098 * Fabricate the legacy ISA bus (bus #31).
1100 mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA;
1102 set_bit(MP_ISA_BUS, mp_bus_not_pci);
1103 pr_debug("Bus #%d is ISA\n", MP_ISA_BUS);
1105 #ifdef CONFIG_X86_ES7000
1107 * Older generations of ES7000 have no legacy identity mappings
1109 if (es7000_plat == 1)
1114 * Locate the IOAPIC that manages the ISA IRQs (0-15).
1116 ioapic = mp_find_ioapic(0);
1119 dstapic = mp_ioapics[ioapic].apicid;
1122 * Use the default configuration for the IRQs 0-15. Unless
1123 * overridden by (MADT) interrupt source override entries.
1125 for (i = 0; i < 16; i++) {
1128 for (idx = 0; idx < mp_irq_entries; idx++) {
1129 struct mpc_intsrc *irq = mp_irqs + idx;
1131 /* Do we already have a mapping for this ISA IRQ? */
1132 if (irq->srcbus == MP_ISA_BUS && irq->srcbusirq == i)
1135 /* Do we already have a mapping for this IOAPIC pin */
1136 if (irq->dstapic == dstapic && irq->dstirq == i)
1140 if (idx != mp_irq_entries) {
1141 printk(KERN_DEBUG "ACPI: IRQ%d used by override.\n", i);
1142 continue; /* IRQ already used */
1145 mp_irq.type = MP_INTSRC;
1146 mp_irq.irqflag = 0; /* Conforming */
1147 mp_irq.srcbus = MP_ISA_BUS;
1148 mp_irq.dstapic = dstapic;
1149 mp_irq.irqtype = mp_INT;
1150 mp_irq.srcbusirq = i; /* Identity mapped */
1153 save_mp_irq(&mp_irq);
1157 int mp_register_gsi(u32 gsi, int triggering, int polarity)
1161 #ifdef CONFIG_X86_32
1162 #define MAX_GSI_NUM 4096
1163 #define IRQ_COMPRESSION_START 64
1165 static int pci_irq = IRQ_COMPRESSION_START;
1167 * Mapping between Global System Interrupts, which
1168 * represent all possible interrupts, and IRQs
1169 * assigned to actual devices.
1171 static int gsi_to_irq[MAX_GSI_NUM];
1174 if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC)
1178 /* Don't set up the ACPI SCI because it's already set up */
1179 if (acpi_gbl_FADT.sci_interrupt == gsi)
1182 ioapic = mp_find_ioapic(gsi);
1184 printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi);
1188 ioapic_pin = mp_find_ioapic_pin(ioapic, gsi);
1190 #ifdef CONFIG_X86_32
1191 if (ioapic_renumber_irq)
1192 gsi = ioapic_renumber_irq(ioapic, gsi);
1196 * Avoid pin reprogramming. PRTs typically include entries
1197 * with redundant pin->gsi mappings (but unique PCI devices);
1198 * we only program the IOAPIC on the first.
1200 if (ioapic_pin > MP_MAX_IOAPIC_PIN) {
1201 printk(KERN_ERR "Invalid reference to IOAPIC pin "
1202 "%d-%d\n", mp_ioapic_routing[ioapic].apic_id,
1206 if (test_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed)) {
1207 pr_debug("Pin %d-%d already programmed\n",
1208 mp_ioapic_routing[ioapic].apic_id, ioapic_pin);
1209 #ifdef CONFIG_X86_32
1210 return (gsi < IRQ_COMPRESSION_START ? gsi : gsi_to_irq[gsi]);
1216 set_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed);
1217 #ifdef CONFIG_X86_32
1219 * For GSI >= 64, use IRQ compression
1221 if ((gsi >= IRQ_COMPRESSION_START)
1222 && (triggering == ACPI_LEVEL_SENSITIVE)) {
1224 * For PCI devices assign IRQs in order, avoiding gaps
1225 * due to unused I/O APIC pins.
1228 if (gsi < MAX_GSI_NUM) {
1230 * Retain the VIA chipset work-around (gsi > 15), but
1231 * avoid a problem where the 8254 timer (IRQ0) is setup
1232 * via an override (so it's not on pin 0 of the ioapic),
1233 * and at the same time, the pin 0 interrupt is a PCI
1234 * type. The gsi > 15 test could cause these two pins
1235 * to be shared as IRQ0, and they are not shareable.
1236 * So test for this condition, and if necessary, avoid
1237 * the pin collision.
1241 * Don't assign IRQ used by ACPI SCI
1243 if (gsi == acpi_gbl_FADT.sci_interrupt)
1245 gsi_to_irq[irq] = gsi;
1247 printk(KERN_ERR "GSI %u is too high\n", gsi);
1252 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
1253 triggering == ACPI_EDGE_SENSITIVE ? 0 : 1,
1254 polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
1258 int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
1259 u32 gsi, int triggering, int polarity)
1261 #ifdef CONFIG_X86_MPPARSE
1262 struct mpc_intsrc mp_irq;
1268 /* print the entry should happen on mptable identically */
1269 mp_irq.type = MP_INTSRC;
1270 mp_irq.irqtype = mp_INT;
1271 mp_irq.irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) |
1272 (polarity == ACPI_ACTIVE_HIGH ? 1 : 3);
1273 mp_irq.srcbus = number;
1274 mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3);
1275 ioapic = mp_find_ioapic(gsi);
1276 mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id;
1277 mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi);
1279 save_mp_irq(&mp_irq);
1285 * Parse IOAPIC related entries in MADT
1286 * returns 0 on success, < 0 on error
1288 static int __init acpi_parse_madt_ioapic_entries(void)
1293 * ACPI interpreter is required to complete interrupt setup,
1294 * so if it is off, don't enumerate the io-apics with ACPI.
1295 * If MPS is present, it will handle them,
1296 * otherwise the system will stay in PIC mode
1298 if (acpi_disabled || acpi_noirq) {
1306 * if "noapic" boot option, don't look for IO-APICs
1308 if (skip_ioapic_setup) {
1309 printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
1310 "due to 'noapic' option.\n");
1315 acpi_table_parse_madt(ACPI_MADT_TYPE_IO_APIC, acpi_parse_ioapic,
1318 printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
1320 } else if (count < 0) {
1321 printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
1326 acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr,
1329 printk(KERN_ERR PREFIX
1330 "Error parsing interrupt source overrides entry\n");
1331 /* TBD: Cleanup to allow fallback to MPS */
1336 * If BIOS did not supply an INT_SRC_OVR for the SCI
1337 * pretend we got one so we can set the SCI flags.
1339 if (!acpi_sci_override_gsi)
1340 acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0);
1342 /* Fill in identity legacy mapings where no override */
1343 mp_config_acpi_legacy_irqs();
1346 acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_parse_nmi_src,
1349 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
1350 /* TBD: Cleanup to allow fallback to MPS */
1357 static inline int acpi_parse_madt_ioapic_entries(void)
1361 #endif /* !CONFIG_X86_IO_APIC */
1363 static void __init early_acpi_process_madt(void)
1365 #ifdef CONFIG_X86_LOCAL_APIC
1368 if (!acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)) {
1371 * Parse MADT LAPIC entries
1373 error = early_acpi_parse_madt_lapic_addr_ovr();
1376 smp_found_config = 1;
1378 if (error == -EINVAL) {
1380 * Dell Precision Workstation 410, 610 come here.
1382 printk(KERN_ERR PREFIX
1383 "Invalid BIOS MADT, disabling ACPI\n");
1390 static void __init acpi_process_madt(void)
1392 #ifdef CONFIG_X86_LOCAL_APIC
1395 if (!acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)) {
1398 * Parse MADT LAPIC entries
1400 error = acpi_parse_madt_lapic_entries();
1404 #ifdef CONFIG_X86_BIGSMP
1405 generic_bigsmp_probe();
1408 * Parse MADT IO-APIC entries
1410 error = acpi_parse_madt_ioapic_entries();
1412 acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
1415 smp_found_config = 1;
1416 if (apic->setup_apic_routing)
1417 apic->setup_apic_routing();
1420 if (error == -EINVAL) {
1422 * Dell Precision Workstation 410, 610 come here.
1424 printk(KERN_ERR PREFIX
1425 "Invalid BIOS MADT, disabling ACPI\n");
1430 * ACPI found no MADT, and so ACPI wants UP PIC mode.
1431 * In the event an MPS table was found, forget it.
1432 * Boot with "acpi=off" to use MPS on such a system.
1434 if (smp_found_config) {
1435 printk(KERN_WARNING PREFIX
1436 "No APIC-table, disabling MPS\n");
1437 smp_found_config = 0;
1442 * ACPI supports both logical (e.g. Hyper-Threading) and physical
1443 * processors, where MPS only supports physical.
1445 if (acpi_lapic && acpi_ioapic)
1446 printk(KERN_INFO "Using ACPI (MADT) for SMP configuration "
1448 else if (acpi_lapic)
1449 printk(KERN_INFO "Using ACPI for processor (LAPIC) "
1450 "configuration information\n");
1455 static int __init disable_acpi_irq(const struct dmi_system_id *d)
1458 printk(KERN_NOTICE "%s detected: force use of acpi=noirq\n",
1465 static int __init disable_acpi_pci(const struct dmi_system_id *d)
1468 printk(KERN_NOTICE "%s detected: force use of pci=noacpi\n",
1475 static int __init dmi_disable_acpi(const struct dmi_system_id *d)
1478 printk(KERN_NOTICE "%s detected: acpi off\n", d->ident);
1482 "Warning: DMI blacklist says broken, but acpi forced\n");
1488 * Limit ACPI to CPU enumeration for HT
1490 static int __init force_acpi_ht(const struct dmi_system_id *d)
1493 printk(KERN_NOTICE "%s detected: force use of acpi=ht\n",
1499 "Warning: acpi=force overrules DMI blacklist: acpi=ht\n");
1505 * Force ignoring BIOS IRQ0 pin2 override
1507 static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
1510 * The ati_ixp4x0_rev() early PCI quirk should have set
1511 * the acpi_skip_timer_override flag already:
1513 if (!acpi_skip_timer_override) {
1514 WARN(1, KERN_ERR "ati_ixp4x0 quirk not complete.\n");
1515 pr_notice("%s detected: Ignoring BIOS IRQ0 pin2 override\n",
1517 acpi_skip_timer_override = 1;
1523 * If your system is blacklisted here, but you find that acpi=force
1524 * works for you, please contact linux-acpi@vger.kernel.org
1526 static struct dmi_system_id __initdata acpi_dmi_table[] = {
1528 * Boxes that need ACPI disabled
1531 .callback = dmi_disable_acpi,
1532 .ident = "IBM Thinkpad",
1534 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1535 DMI_MATCH(DMI_BOARD_NAME, "2629H1G"),
1540 * Boxes that need acpi=ht
1543 .callback = force_acpi_ht,
1544 .ident = "FSC Primergy T850",
1546 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
1547 DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"),
1551 .callback = force_acpi_ht,
1552 .ident = "HP VISUALIZE NT Workstation",
1554 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
1555 DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"),
1559 .callback = force_acpi_ht,
1560 .ident = "Compaq Workstation W8000",
1562 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
1563 DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"),
1567 .callback = force_acpi_ht,
1568 .ident = "ASUS P4B266",
1570 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
1571 DMI_MATCH(DMI_BOARD_NAME, "P4B266"),
1575 .callback = force_acpi_ht,
1576 .ident = "ASUS P2B-DS",
1578 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
1579 DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"),
1583 .callback = force_acpi_ht,
1584 .ident = "ASUS CUR-DLS",
1586 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
1587 DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"),
1591 .callback = force_acpi_ht,
1592 .ident = "ABIT i440BX-W83977",
1594 DMI_MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"),
1595 DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"),
1599 .callback = force_acpi_ht,
1600 .ident = "IBM Bladecenter",
1602 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1603 DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"),
1607 .callback = force_acpi_ht,
1608 .ident = "IBM eServer xSeries 360",
1610 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1611 DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"),
1615 .callback = force_acpi_ht,
1616 .ident = "IBM eserver xSeries 330",
1618 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1619 DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"),
1623 .callback = force_acpi_ht,
1624 .ident = "IBM eserver xSeries 440",
1626 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1627 DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"),
1632 * Boxes that need ACPI PCI IRQ routing disabled
1635 .callback = disable_acpi_irq,
1636 .ident = "ASUS A7V",
1638 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
1639 DMI_MATCH(DMI_BOARD_NAME, "<A7V>"),
1640 /* newer BIOS, Revision 1011, does work */
1641 DMI_MATCH(DMI_BIOS_VERSION,
1642 "ASUS A7V ACPI BIOS Revision 1007"),
1647 * Latest BIOS for IBM 600E (1.16) has bad pcinum
1648 * for LPC bridge, which is needed for the PCI
1649 * interrupt links to work. DSDT fix is in bug 5966.
1650 * 2645, 2646 model numbers are shared with 600/600E/600X
1652 .callback = disable_acpi_irq,
1653 .ident = "IBM Thinkpad 600 Series 2645",
1655 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1656 DMI_MATCH(DMI_BOARD_NAME, "2645"),
1660 .callback = disable_acpi_irq,
1661 .ident = "IBM Thinkpad 600 Series 2646",
1663 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
1664 DMI_MATCH(DMI_BOARD_NAME, "2646"),
1668 * Boxes that need ACPI PCI IRQ routing and PCI scan disabled
1671 .callback = disable_acpi_pci,
1672 .ident = "ASUS PR-DLS",
1674 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
1675 DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"),
1676 DMI_MATCH(DMI_BIOS_VERSION,
1677 "ASUS PR-DLS ACPI BIOS Revision 1010"),
1678 DMI_MATCH(DMI_BIOS_DATE, "03/21/2003")
1682 .callback = disable_acpi_pci,
1683 .ident = "Acer TravelMate 36x Laptop",
1685 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1686 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
1692 /* second table for DMI checks that should run after early-quirks */
1693 static struct dmi_system_id __initdata acpi_dmi_table_late[] = {
1695 * HP laptops which use a DSDT reporting as HP/SB400/10000,
1696 * which includes some code which overrides all temperature
1697 * trip points to 16C if the INTIN2 input of the I/O APIC
1698 * is enabled. This input is incorrectly designated the
1699 * ISA IRQ 0 via an interrupt source override even though
1700 * it is wired to the output of the master 8259A and INTIN0
1701 * is not connected at all. Force ignoring BIOS IRQ0 pin2
1702 * override in that cases.
1705 .callback = dmi_ignore_irq0_timer_override,
1706 .ident = "HP nx6115 laptop",
1708 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1709 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6115"),
1713 .callback = dmi_ignore_irq0_timer_override,
1714 .ident = "HP NX6125 laptop",
1716 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1717 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6125"),
1721 .callback = dmi_ignore_irq0_timer_override,
1722 .ident = "HP NX6325 laptop",
1724 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1725 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6325"),
1729 .callback = dmi_ignore_irq0_timer_override,
1730 .ident = "HP 6715b laptop",
1732 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1733 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
1740 * acpi_boot_table_init() and acpi_boot_init()
1741 * called from setup_arch(), always.
1742 * 1. checksums all tables
1743 * 2. enumerates lapics
1744 * 3. enumerates io-apics
1746 * acpi_table_init() is separate to allow reading SRAT without
1747 * other side effects.
1749 * side effects of acpi_boot_init:
1750 * acpi_lapic = 1 if LAPIC found
1751 * acpi_ioapic = 1 if IOAPIC found
1752 * if (acpi_lapic && acpi_ioapic) smp_found_config = 1;
1753 * if acpi_blacklisted() acpi_disabled = 1;
1754 * acpi_irq_model=...
1757 * return value: (currently ignored)
1762 int __init acpi_boot_table_init(void)
1766 dmi_check_system(acpi_dmi_table);
1769 * If acpi_disabled, bail out
1770 * One exception: acpi=ht continues far enough to enumerate LAPICs
1772 if (acpi_disabled && !acpi_ht)
1776 * Initialize the ACPI boot-time table parser.
1778 error = acpi_table_init();
1784 acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
1787 * blacklist may disable ACPI entirely
1789 error = acpi_blacklisted();
1792 printk(KERN_WARNING PREFIX "acpi=force override\n");
1794 printk(KERN_WARNING PREFIX "Disabling ACPI support\n");
1803 int __init early_acpi_boot_init(void)
1806 * If acpi_disabled, bail out
1807 * One exception: acpi=ht continues far enough to enumerate LAPICs
1809 if (acpi_disabled && !acpi_ht)
1813 * Process the Multiple APIC Description Table (MADT), if present
1815 early_acpi_process_madt();
1820 int __init acpi_boot_init(void)
1822 /* those are executed after early-quirks are executed */
1823 dmi_check_system(acpi_dmi_table_late);
1826 * If acpi_disabled, bail out
1827 * One exception: acpi=ht continues far enough to enumerate LAPICs
1829 if (acpi_disabled && !acpi_ht)
1832 acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
1835 * set sci_int and PM timer address
1837 acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt);
1840 * Process the Multiple APIC Description Table (MADT), if present
1842 acpi_process_madt();
1844 acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
1849 static int __init parse_acpi(char *arg)
1854 /* "acpi=off" disables both ACPI table parsing and interpreter */
1855 if (strcmp(arg, "off") == 0) {
1858 /* acpi=force to over-ride black-list */
1859 else if (strcmp(arg, "force") == 0) {
1864 /* acpi=strict disables out-of-spec workarounds */
1865 else if (strcmp(arg, "strict") == 0) {
1868 /* Limit ACPI just to boot-time to enable HT */
1869 else if (strcmp(arg, "ht") == 0) {
1874 /* acpi=rsdt use RSDT instead of XSDT */
1875 else if (strcmp(arg, "rsdt") == 0) {
1876 acpi_rsdt_forced = 1;
1878 /* "acpi=noirq" disables ACPI interrupt routing */
1879 else if (strcmp(arg, "noirq") == 0) {
1882 /* Core will printk when we return error. */
1887 early_param("acpi", parse_acpi);
1889 /* FIXME: Using pci= for an ACPI parameter is a travesty. */
1890 static int __init parse_pci(char *arg)
1892 if (arg && strcmp(arg, "noacpi") == 0)
1896 early_param("pci", parse_pci);
1898 int __init acpi_mps_check(void)
1900 #if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_X86_MPPARSE)
1901 /* mptable code is not built-in*/
1902 if (acpi_disabled || acpi_noirq) {
1903 printk(KERN_WARNING "MPS support code is not built-in.\n"
1904 "Using acpi=off or acpi=noirq or pci=noacpi "
1905 "may have problem\n");
1912 #ifdef CONFIG_X86_IO_APIC
1913 static int __init parse_acpi_skip_timer_override(char *arg)
1915 acpi_skip_timer_override = 1;
1918 early_param("acpi_skip_timer_override", parse_acpi_skip_timer_override);
1920 static int __init parse_acpi_use_timer_override(char *arg)
1922 acpi_use_timer_override = 1;
1925 early_param("acpi_use_timer_override", parse_acpi_use_timer_override);
1926 #endif /* CONFIG_X86_IO_APIC */
1928 static int __init setup_acpi_sci(char *s)
1932 if (!strcmp(s, "edge"))
1933 acpi_sci_flags = ACPI_MADT_TRIGGER_EDGE |
1934 (acpi_sci_flags & ~ACPI_MADT_TRIGGER_MASK);
1935 else if (!strcmp(s, "level"))
1936 acpi_sci_flags = ACPI_MADT_TRIGGER_LEVEL |
1937 (acpi_sci_flags & ~ACPI_MADT_TRIGGER_MASK);
1938 else if (!strcmp(s, "high"))
1939 acpi_sci_flags = ACPI_MADT_POLARITY_ACTIVE_HIGH |
1940 (acpi_sci_flags & ~ACPI_MADT_POLARITY_MASK);
1941 else if (!strcmp(s, "low"))
1942 acpi_sci_flags = ACPI_MADT_POLARITY_ACTIVE_LOW |
1943 (acpi_sci_flags & ~ACPI_MADT_POLARITY_MASK);
1948 early_param("acpi_sci", setup_acpi_sci);
1950 int __acpi_acquire_global_lock(unsigned int *lock)
1952 unsigned int old, new, val;
1955 new = (((old & ~0x3) + 2) + ((old >> 1) & 0x1));
1956 val = cmpxchg(lock, old, new);
1957 } while (unlikely (val != old));
1958 return (new < 3) ? -1 : 0;
1961 int __acpi_release_global_lock(unsigned int *lock)
1963 unsigned int old, new, val;
1967 val = cmpxchg(lock, old, new);
1968 } while (unlikely (val != old));