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>
42 #include <asm/mpspec.h>
45 static int __initdata acpi_force
= 0;
48 int acpi_disabled
= 0;
50 int acpi_disabled
= 1;
52 EXPORT_SYMBOL(acpi_disabled
);
55 # include <asm/proto.h>
58 #define BAD_MADT_ENTRY(entry, end) ( \
59 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
60 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
62 #define PREFIX "ACPI: "
64 int acpi_noirq
; /* skip ACPI IRQ initialization */
65 int acpi_pci_disabled
; /* skip ACPI PCI scan and IRQ initialization */
66 EXPORT_SYMBOL(acpi_pci_disabled
);
67 int acpi_ht __initdata
= 1; /* enable HT */
73 u8 acpi_sci_flags __initdata
;
74 int acpi_sci_override_gsi __initdata
;
75 int acpi_skip_timer_override __initdata
;
76 int acpi_use_timer_override __initdata
;
78 #ifdef CONFIG_X86_LOCAL_APIC
79 static u64 acpi_lapic_addr __initdata
= APIC_DEFAULT_PHYS_BASE
;
82 #ifndef __HAVE_ARCH_CMPXCHG
83 #warning ACPI uses CMPXCHG, i486 and later hardware
86 /* --------------------------------------------------------------------------
87 Boot-time Configuration
88 -------------------------------------------------------------------------- */
91 * The default interrupt routing model is PIC (8259). This gets
92 * overridden if IOAPICs are enumerated (below).
94 enum acpi_irq_model_id acpi_irq_model
= ACPI_IRQ_MODEL_PIC
;
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
102 * By using this area, we can map up to MAX_IO_APICS pages temporarily,
103 * i.e. until the next __va_range() call.
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.
109 char *__init
__acpi_map_table(unsigned long phys
, unsigned long size
)
115 return early_ioremap(phys
, size
);
117 void __init
__acpi_unmap_table(char *map
, unsigned long size
)
122 early_iounmap(map
, size
);
125 #ifdef CONFIG_PCI_MMCONFIG
127 static int acpi_mcfg_64bit_base_addr __initdata
= FALSE
;
129 /* The physical address of the MMCONFIG aperture. Set from ACPI tables. */
130 struct acpi_mcfg_allocation
*pci_mmcfg_config
;
131 int pci_mmcfg_config_num
;
133 static int __init
acpi_mcfg_oem_check(struct acpi_table_mcfg
*mcfg
)
135 if (!strcmp(mcfg
->header
.oem_id
, "SGI"))
136 acpi_mcfg_64bit_base_addr
= TRUE
;
141 int __init
acpi_parse_mcfg(struct acpi_table_header
*header
)
143 struct acpi_table_mcfg
*mcfg
;
150 mcfg
= (struct acpi_table_mcfg
*)header
;
152 /* how many config structures do we have */
153 pci_mmcfg_config_num
= 0;
154 i
= header
->length
- sizeof(struct acpi_table_mcfg
);
155 while (i
>= sizeof(struct acpi_mcfg_allocation
)) {
156 ++pci_mmcfg_config_num
;
157 i
-= sizeof(struct acpi_mcfg_allocation
);
159 if (pci_mmcfg_config_num
== 0) {
160 printk(KERN_ERR PREFIX
"MMCONFIG has no entries\n");
164 config_size
= pci_mmcfg_config_num
* sizeof(*pci_mmcfg_config
);
165 pci_mmcfg_config
= kmalloc(config_size
, GFP_KERNEL
);
166 if (!pci_mmcfg_config
) {
167 printk(KERN_WARNING PREFIX
168 "No memory for MCFG config tables\n");
172 memcpy(pci_mmcfg_config
, &mcfg
[1], config_size
);
174 acpi_mcfg_oem_check(mcfg
);
176 for (i
= 0; i
< pci_mmcfg_config_num
; ++i
) {
177 if ((pci_mmcfg_config
[i
].address
> 0xFFFFFFFF) &&
178 !acpi_mcfg_64bit_base_addr
) {
179 printk(KERN_ERR PREFIX
180 "MMCONFIG not in low 4GB of memory\n");
181 kfree(pci_mmcfg_config
);
182 pci_mmcfg_config_num
= 0;
189 #endif /* CONFIG_PCI_MMCONFIG */
191 #ifdef CONFIG_X86_LOCAL_APIC
192 static int __init
acpi_parse_madt(struct acpi_table_header
*table
)
194 struct acpi_table_madt
*madt
= NULL
;
199 madt
= (struct acpi_table_madt
*)table
;
201 printk(KERN_WARNING PREFIX
"Unable to map MADT\n");
206 acpi_lapic_addr
= (u64
) madt
->address
;
208 printk(KERN_DEBUG PREFIX
"Local APIC address 0x%08x\n",
212 default_acpi_madt_oem_check(madt
->header
.oem_id
,
213 madt
->header
.oem_table_id
);
218 static void __cpuinit
acpi_register_lapic(int id
, u8 enabled
)
220 unsigned int ver
= 0;
227 if (boot_cpu_physical_apicid
!= -1U)
228 ver
= apic_version
[boot_cpu_physical_apicid
];
230 generic_processor_info(id
, ver
);
234 acpi_parse_lapic(struct acpi_subtable_header
* header
, const unsigned long end
)
236 struct acpi_madt_local_apic
*processor
= NULL
;
238 processor
= (struct acpi_madt_local_apic
*)header
;
240 if (BAD_MADT_ENTRY(processor
, end
))
243 acpi_table_print_madt_entry(header
);
246 * We need to register disabled CPU as well to permit
247 * counting disabled CPUs. This allows us to size
248 * cpus_possible_map more accurately, to permit
249 * to not preallocating memory for all NR_CPUS
250 * when we use CPU hotplug.
252 acpi_register_lapic(processor
->id
, /* APIC ID */
253 processor
->lapic_flags
& ACPI_MADT_ENABLED
);
259 acpi_parse_sapic(struct acpi_subtable_header
*header
, const unsigned long end
)
261 struct acpi_madt_local_sapic
*processor
= NULL
;
263 processor
= (struct acpi_madt_local_sapic
*)header
;
265 if (BAD_MADT_ENTRY(processor
, end
))
268 acpi_table_print_madt_entry(header
);
270 acpi_register_lapic((processor
->id
<< 8) | processor
->eid
,/* APIC ID */
271 processor
->lapic_flags
& ACPI_MADT_ENABLED
);
277 acpi_parse_lapic_addr_ovr(struct acpi_subtable_header
* header
,
278 const unsigned long end
)
280 struct acpi_madt_local_apic_override
*lapic_addr_ovr
= NULL
;
282 lapic_addr_ovr
= (struct acpi_madt_local_apic_override
*)header
;
284 if (BAD_MADT_ENTRY(lapic_addr_ovr
, end
))
287 acpi_lapic_addr
= lapic_addr_ovr
->address
;
293 acpi_parse_lapic_nmi(struct acpi_subtable_header
* header
, const unsigned long end
)
295 struct acpi_madt_local_apic_nmi
*lapic_nmi
= NULL
;
297 lapic_nmi
= (struct acpi_madt_local_apic_nmi
*)header
;
299 if (BAD_MADT_ENTRY(lapic_nmi
, end
))
302 acpi_table_print_madt_entry(header
);
304 if (lapic_nmi
->lint
!= 1)
305 printk(KERN_WARNING PREFIX
"NMI not connected to LINT 1!\n");
310 #endif /*CONFIG_X86_LOCAL_APIC */
312 #ifdef CONFIG_X86_IO_APIC
315 acpi_parse_ioapic(struct acpi_subtable_header
* header
, const unsigned long end
)
317 struct acpi_madt_io_apic
*ioapic
= NULL
;
319 ioapic
= (struct acpi_madt_io_apic
*)header
;
321 if (BAD_MADT_ENTRY(ioapic
, end
))
324 acpi_table_print_madt_entry(header
);
326 mp_register_ioapic(ioapic
->id
,
327 ioapic
->address
, ioapic
->global_irq_base
);
333 * Parse Interrupt Source Override for the ACPI SCI
335 static void __init
acpi_sci_ioapic_setup(u32 gsi
, u16 polarity
, u16 trigger
)
337 if (trigger
== 0) /* compatible SCI trigger is level */
340 if (polarity
== 0) /* compatible SCI polarity is low */
343 /* Command-line over-ride via acpi_sci= */
344 if (acpi_sci_flags
& ACPI_MADT_TRIGGER_MASK
)
345 trigger
= (acpi_sci_flags
& ACPI_MADT_TRIGGER_MASK
) >> 2;
347 if (acpi_sci_flags
& ACPI_MADT_POLARITY_MASK
)
348 polarity
= acpi_sci_flags
& ACPI_MADT_POLARITY_MASK
;
351 * mp_config_acpi_legacy_irqs() already setup IRQs < 16
352 * If GSI is < 16, this will update its flags,
353 * else it will create a new mp_irqs[] entry.
355 mp_override_legacy_irq(gsi
, polarity
, trigger
, gsi
);
358 * stash over-ride to indicate we've been here
359 * and for later update of acpi_gbl_FADT
361 acpi_sci_override_gsi
= gsi
;
366 acpi_parse_int_src_ovr(struct acpi_subtable_header
* header
,
367 const unsigned long end
)
369 struct acpi_madt_interrupt_override
*intsrc
= NULL
;
371 intsrc
= (struct acpi_madt_interrupt_override
*)header
;
373 if (BAD_MADT_ENTRY(intsrc
, end
))
376 acpi_table_print_madt_entry(header
);
378 if (intsrc
->source_irq
== acpi_gbl_FADT
.sci_interrupt
) {
379 acpi_sci_ioapic_setup(intsrc
->global_irq
,
380 intsrc
->inti_flags
& ACPI_MADT_POLARITY_MASK
,
381 (intsrc
->inti_flags
& ACPI_MADT_TRIGGER_MASK
) >> 2);
385 if (acpi_skip_timer_override
&&
386 intsrc
->source_irq
== 0 && intsrc
->global_irq
== 2) {
387 printk(PREFIX
"BIOS IRQ0 pin2 override ignored.\n");
391 mp_override_legacy_irq(intsrc
->source_irq
,
392 intsrc
->inti_flags
& ACPI_MADT_POLARITY_MASK
,
393 (intsrc
->inti_flags
& ACPI_MADT_TRIGGER_MASK
) >> 2,
400 acpi_parse_nmi_src(struct acpi_subtable_header
* header
, const unsigned long end
)
402 struct acpi_madt_nmi_source
*nmi_src
= NULL
;
404 nmi_src
= (struct acpi_madt_nmi_source
*)header
;
406 if (BAD_MADT_ENTRY(nmi_src
, end
))
409 acpi_table_print_madt_entry(header
);
411 /* TBD: Support nimsrc entries? */
416 #endif /* CONFIG_X86_IO_APIC */
419 * acpi_pic_sci_set_trigger()
421 * use ELCR to set PIC-mode trigger type for SCI
423 * If a PIC-mode SCI is not recognized or gives spurious IRQ7's
424 * it may require Edge Trigger -- use "acpi_sci=edge"
426 * Port 0x4d0-4d1 are ECLR1 and ECLR2, the Edge/Level Control Registers
427 * for the 8259 PIC. bit[n] = 1 means irq[n] is Level, otherwise Edge.
428 * ECLR1 is IRQs 0-7 (IRQ 0, 1, 2 must be 0)
429 * ECLR2 is IRQs 8-15 (IRQ 8, 13 must be 0)
432 void __init
acpi_pic_sci_set_trigger(unsigned int irq
, u16 trigger
)
434 unsigned int mask
= 1 << irq
;
435 unsigned int old
, new;
437 /* Real old ELCR mask */
438 old
= inb(0x4d0) | (inb(0x4d1) << 8);
441 * If we use ACPI to set PCI IRQs, then we should clear ELCR
442 * since we will set it correctly as we enable the PCI irq
445 new = acpi_noirq
? old
: 0;
448 * Update SCI information in the ELCR, it isn't in the PCI
452 case 1: /* Edge - clear */
455 case 3: /* Level - set */
463 printk(PREFIX
"setting ELCR to %04x (from %04x)\n", new, old
);
465 outb(new >> 8, 0x4d1);
468 int acpi_gsi_to_irq(u32 gsi
, unsigned int *irq
)
475 * success: return IRQ number (>=0)
476 * failure: return < 0
478 int acpi_register_gsi(u32 gsi
, int triggering
, int polarity
)
481 unsigned int plat_gsi
= gsi
;
485 * Make sure all (legacy) PCI IRQs are set as level-triggered.
487 if (acpi_irq_model
== ACPI_IRQ_MODEL_PIC
) {
488 if (triggering
== ACPI_LEVEL_SENSITIVE
)
489 eisa_set_level_irq(gsi
);
493 #ifdef CONFIG_X86_IO_APIC
494 if (acpi_irq_model
== ACPI_IRQ_MODEL_IOAPIC
) {
495 plat_gsi
= mp_register_gsi(gsi
, triggering
, polarity
);
498 acpi_gsi_to_irq(plat_gsi
, &irq
);
503 * ACPI based hotplug support for CPU
505 #ifdef CONFIG_ACPI_HOTPLUG_CPU
507 static int __cpuinit
_acpi_map_lsapic(acpi_handle handle
, int *pcpu
)
509 struct acpi_buffer buffer
= { ACPI_ALLOCATE_BUFFER
, NULL
};
510 union acpi_object
*obj
;
511 struct acpi_madt_local_apic
*lapic
;
512 cpumask_var_t tmp_map
, new_map
;
515 int retval
= -ENOMEM
;
517 if (ACPI_FAILURE(acpi_evaluate_object(handle
, "_MAT", NULL
, &buffer
)))
520 if (!buffer
.length
|| !buffer
.pointer
)
523 obj
= buffer
.pointer
;
524 if (obj
->type
!= ACPI_TYPE_BUFFER
||
525 obj
->buffer
.length
< sizeof(*lapic
)) {
526 kfree(buffer
.pointer
);
530 lapic
= (struct acpi_madt_local_apic
*)obj
->buffer
.pointer
;
532 if (lapic
->header
.type
!= ACPI_MADT_TYPE_LOCAL_APIC
||
533 !(lapic
->lapic_flags
& ACPI_MADT_ENABLED
)) {
534 kfree(buffer
.pointer
);
540 kfree(buffer
.pointer
);
541 buffer
.length
= ACPI_ALLOCATE_BUFFER
;
542 buffer
.pointer
= NULL
;
544 if (!alloc_cpumask_var(&tmp_map
, GFP_KERNEL
))
547 if (!alloc_cpumask_var(&new_map
, GFP_KERNEL
))
550 cpumask_copy(tmp_map
, cpu_present_mask
);
551 acpi_register_lapic(physid
, lapic
->lapic_flags
& ACPI_MADT_ENABLED
);
554 * If mp_register_lapic successfully generates a new logical cpu
555 * number, then the following will get us exactly what was mapped
557 cpumask_andnot(new_map
, cpu_present_mask
, tmp_map
);
558 if (cpumask_empty(new_map
)) {
559 printk ("Unable to map lapic to logical cpu number\n");
564 cpu
= cpumask_first(new_map
);
570 free_cpumask_var(new_map
);
572 free_cpumask_var(tmp_map
);
577 /* wrapper to silence section mismatch warning */
578 int __ref
acpi_map_lsapic(acpi_handle handle
, int *pcpu
)
580 return _acpi_map_lsapic(handle
, pcpu
);
582 EXPORT_SYMBOL(acpi_map_lsapic
);
584 int acpi_unmap_lsapic(int cpu
)
586 per_cpu(x86_cpu_to_apicid
, cpu
) = -1;
587 set_cpu_present(cpu
, false);
593 EXPORT_SYMBOL(acpi_unmap_lsapic
);
594 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
596 int acpi_register_ioapic(acpi_handle handle
, u64 phys_addr
, u32 gsi_base
)
602 EXPORT_SYMBOL(acpi_register_ioapic
);
604 int acpi_unregister_ioapic(acpi_handle handle
, u32 gsi_base
)
610 EXPORT_SYMBOL(acpi_unregister_ioapic
);
612 static int __init
acpi_parse_sbf(struct acpi_table_header
*table
)
614 struct acpi_table_boot
*sb
;
616 sb
= (struct acpi_table_boot
*)table
;
618 printk(KERN_WARNING PREFIX
"Unable to map SBF\n");
622 sbf_port
= sb
->cmos_index
; /* Save CMOS port */
627 #ifdef CONFIG_HPET_TIMER
628 #include <asm/hpet.h>
630 static struct __initdata resource
*hpet_res
;
632 static int __init
acpi_parse_hpet(struct acpi_table_header
*table
)
634 struct acpi_table_hpet
*hpet_tbl
;
636 hpet_tbl
= (struct acpi_table_hpet
*)table
;
638 printk(KERN_WARNING PREFIX
"Unable to map HPET\n");
642 if (hpet_tbl
->address
.space_id
!= ACPI_SPACE_MEM
) {
643 printk(KERN_WARNING PREFIX
"HPET timers must be located in "
648 hpet_address
= hpet_tbl
->address
.address
;
651 * Some broken BIOSes advertise HPET at 0x0. We really do not
652 * want to allocate a resource there.
655 printk(KERN_WARNING PREFIX
656 "HPET id: %#x base: %#lx is invalid\n",
657 hpet_tbl
->id
, hpet_address
);
662 * Some even more broken BIOSes advertise HPET at
663 * 0xfed0000000000000 instead of 0xfed00000. Fix it up and add
666 if (hpet_address
== 0xfed0000000000000UL
) {
667 if (!hpet_force_user
) {
668 printk(KERN_WARNING PREFIX
"HPET id: %#x "
669 "base: 0xfed0000000000000 is bogus\n "
670 "try hpet=force on the kernel command line to "
671 "fix it up to 0xfed00000.\n", hpet_tbl
->id
);
675 printk(KERN_WARNING PREFIX
676 "HPET id: %#x base: 0xfed0000000000000 fixed up "
677 "to 0xfed00000.\n", hpet_tbl
->id
);
681 printk(KERN_INFO PREFIX
"HPET id: %#x base: %#lx\n",
682 hpet_tbl
->id
, hpet_address
);
685 * Allocate and initialize the HPET firmware resource for adding into
686 * the resource tree during the lateinit timeframe.
688 #define HPET_RESOURCE_NAME_SIZE 9
689 hpet_res
= alloc_bootmem(sizeof(*hpet_res
) + HPET_RESOURCE_NAME_SIZE
);
691 hpet_res
->name
= (void *)&hpet_res
[1];
692 hpet_res
->flags
= IORESOURCE_MEM
;
693 snprintf((char *)hpet_res
->name
, HPET_RESOURCE_NAME_SIZE
, "HPET %u",
696 hpet_res
->start
= hpet_address
;
697 hpet_res
->end
= hpet_address
+ (1 * 1024) - 1;
703 * hpet_insert_resource inserts the HPET resources used into the resource
706 static __init
int hpet_insert_resource(void)
711 return insert_resource(&iomem_resource
, hpet_res
);
714 late_initcall(hpet_insert_resource
);
717 #define acpi_parse_hpet NULL
720 static int __init
acpi_parse_fadt(struct acpi_table_header
*table
)
723 #ifdef CONFIG_X86_PM_TIMER
724 /* detect the location of the ACPI PM Timer */
725 if (acpi_gbl_FADT
.header
.revision
>= FADT2_REVISION_ID
) {
727 if (acpi_gbl_FADT
.xpm_timer_block
.space_id
!=
728 ACPI_ADR_SPACE_SYSTEM_IO
)
731 pmtmr_ioport
= acpi_gbl_FADT
.xpm_timer_block
.address
;
733 * "X" fields are optional extensions to the original V1.0
734 * fields, so we must selectively expand V1.0 fields if the
735 * corresponding X field is zero.
738 pmtmr_ioport
= acpi_gbl_FADT
.pm_timer_block
;
741 pmtmr_ioport
= acpi_gbl_FADT
.pm_timer_block
;
744 printk(KERN_INFO PREFIX
"PM-Timer IO Port: %#x\n",
750 #ifdef CONFIG_X86_LOCAL_APIC
752 * Parse LAPIC entries in MADT
753 * returns 0 on success, < 0 on error
756 static void __init
acpi_register_lapic_address(unsigned long address
)
758 mp_lapic_addr
= address
;
760 set_fixmap_nocache(FIX_APIC_BASE
, address
);
761 if (boot_cpu_physical_apicid
== -1U) {
762 boot_cpu_physical_apicid
= read_apic_id();
763 apic_version
[boot_cpu_physical_apicid
] =
764 GET_APIC_VERSION(apic_read(APIC_LVR
));
768 static int __init
early_acpi_parse_madt_lapic_addr_ovr(void)
776 * Note that the LAPIC address is obtained from the MADT (32-bit value)
777 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
781 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE
,
782 acpi_parse_lapic_addr_ovr
, 0);
784 printk(KERN_ERR PREFIX
785 "Error parsing LAPIC address override entry\n");
789 acpi_register_lapic_address(acpi_lapic_addr
);
794 static int __init
acpi_parse_madt_lapic_entries(void)
802 * Note that the LAPIC address is obtained from the MADT (32-bit value)
803 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
807 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE
,
808 acpi_parse_lapic_addr_ovr
, 0);
810 printk(KERN_ERR PREFIX
811 "Error parsing LAPIC address override entry\n");
815 acpi_register_lapic_address(acpi_lapic_addr
);
817 count
= acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC
,
818 acpi_parse_sapic
, MAX_APICS
);
821 count
= acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC
,
822 acpi_parse_lapic
, MAX_APICS
);
824 printk(KERN_ERR PREFIX
"No LAPIC entries present\n");
825 /* TBD: Cleanup to allow fallback to MPS */
827 } else if (count
< 0) {
828 printk(KERN_ERR PREFIX
"Error parsing LAPIC entry\n");
829 /* TBD: Cleanup to allow fallback to MPS */
834 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI
, acpi_parse_lapic_nmi
, 0);
836 printk(KERN_ERR PREFIX
"Error parsing LAPIC NMI entry\n");
837 /* TBD: Cleanup to allow fallback to MPS */
842 #endif /* CONFIG_X86_LOCAL_APIC */
844 #ifdef CONFIG_X86_IO_APIC
847 #ifdef CONFIG_X86_ES7000
848 extern int es7000_plat
;
855 DECLARE_BITMAP(pin_programmed
, MP_MAX_IOAPIC_PIN
+ 1);
856 } mp_ioapic_routing
[MAX_IO_APICS
];
858 int mp_find_ioapic(int gsi
)
862 /* Find the IOAPIC that manages this GSI. */
863 for (i
= 0; i
< nr_ioapics
; i
++) {
864 if ((gsi
>= mp_ioapic_routing
[i
].gsi_base
)
865 && (gsi
<= mp_ioapic_routing
[i
].gsi_end
))
869 printk(KERN_ERR
"ERROR: Unable to locate IOAPIC for GSI %d\n", gsi
);
873 int mp_find_ioapic_pin(int ioapic
, int gsi
)
875 if (WARN_ON(ioapic
== -1))
877 if (WARN_ON(gsi
> mp_ioapic_routing
[ioapic
].gsi_end
))
880 return gsi
- mp_ioapic_routing
[ioapic
].gsi_base
;
883 static u8 __init
uniq_ioapic_id(u8 id
)
886 if ((boot_cpu_data
.x86_vendor
== X86_VENDOR_INTEL
) &&
887 !APIC_XAPIC(apic_version
[boot_cpu_physical_apicid
]))
888 return io_apic_get_unique_id(nr_ioapics
, id
);
893 DECLARE_BITMAP(used
, 256);
894 bitmap_zero(used
, 256);
895 for (i
= 0; i
< nr_ioapics
; i
++) {
896 struct mpc_ioapic
*ia
= &mp_ioapics
[i
];
897 __set_bit(ia
->apicid
, used
);
899 if (!test_bit(id
, used
))
901 return find_first_zero_bit(used
, 256);
905 static int bad_ioapic(unsigned long address
)
907 if (nr_ioapics
>= MAX_IO_APICS
) {
908 printk(KERN_ERR
"ERROR: Max # of I/O APICs (%d) exceeded "
909 "(found %d)\n", MAX_IO_APICS
, nr_ioapics
);
910 panic("Recompile kernel with bigger MAX_IO_APICS!\n");
913 printk(KERN_ERR
"WARNING: Bogus (zero) I/O APIC address"
914 " found in table, skipping!\n");
920 void __init
mp_register_ioapic(int id
, u32 address
, u32 gsi_base
)
924 if (bad_ioapic(address
))
929 mp_ioapics
[idx
].type
= MP_IOAPIC
;
930 mp_ioapics
[idx
].flags
= MPC_APIC_USABLE
;
931 mp_ioapics
[idx
].apicaddr
= address
;
933 set_fixmap_nocache(FIX_IO_APIC_BASE_0
+ idx
, address
);
934 mp_ioapics
[idx
].apicid
= uniq_ioapic_id(id
);
936 mp_ioapics
[idx
].apicver
= io_apic_get_version(idx
);
938 mp_ioapics
[idx
].apicver
= 0;
941 * Build basic GSI lookup table to facilitate gsi->io_apic lookups
942 * and to prevent reprogramming of IOAPIC pins (PCI GSIs).
944 mp_ioapic_routing
[idx
].apic_id
= mp_ioapics
[idx
].apicid
;
945 mp_ioapic_routing
[idx
].gsi_base
= gsi_base
;
946 mp_ioapic_routing
[idx
].gsi_end
= gsi_base
+
947 io_apic_get_redir_entries(idx
);
949 printk(KERN_INFO
"IOAPIC[%d]: apic_id %d, version %d, address 0x%x, "
950 "GSI %d-%d\n", idx
, mp_ioapics
[idx
].apicid
,
951 mp_ioapics
[idx
].apicver
, mp_ioapics
[idx
].apicaddr
,
952 mp_ioapic_routing
[idx
].gsi_base
, mp_ioapic_routing
[idx
].gsi_end
);
957 int __init
acpi_probe_gsi(void)
970 for (idx
= 0; idx
< nr_ioapics
; idx
++) {
971 gsi
= mp_ioapic_routing
[idx
].gsi_end
;
980 static void assign_to_mp_irq(struct mpc_intsrc
*m
,
981 struct mpc_intsrc
*mp_irq
)
983 memcpy(mp_irq
, m
, sizeof(struct mpc_intsrc
));
986 static int mp_irq_cmp(struct mpc_intsrc
*mp_irq
,
987 struct mpc_intsrc
*m
)
989 return memcmp(mp_irq
, m
, sizeof(struct mpc_intsrc
));
992 static void save_mp_irq(struct mpc_intsrc
*m
)
996 for (i
= 0; i
< mp_irq_entries
; i
++) {
997 if (!mp_irq_cmp(&mp_irqs
[i
], m
))
1001 assign_to_mp_irq(m
, &mp_irqs
[mp_irq_entries
]);
1002 if (++mp_irq_entries
== MAX_IRQ_SOURCES
)
1003 panic("Max # of irq sources exceeded!!\n");
1006 void __init
mp_override_legacy_irq(u8 bus_irq
, u8 polarity
, u8 trigger
, u32 gsi
)
1010 struct mpc_intsrc mp_irq
;
1013 * Convert 'gsi' to 'ioapic.pin'.
1015 ioapic
= mp_find_ioapic(gsi
);
1018 pin
= mp_find_ioapic_pin(ioapic
, gsi
);
1021 * TBD: This check is for faulty timer entries, where the override
1022 * erroneously sets the trigger to level, resulting in a HUGE
1023 * increase of timer interrupts!
1025 if ((bus_irq
== 0) && (trigger
== 3))
1028 mp_irq
.type
= MP_INTSRC
;
1029 mp_irq
.irqtype
= mp_INT
;
1030 mp_irq
.irqflag
= (trigger
<< 2) | polarity
;
1031 mp_irq
.srcbus
= MP_ISA_BUS
;
1032 mp_irq
.srcbusirq
= bus_irq
; /* IRQ */
1033 mp_irq
.dstapic
= mp_ioapics
[ioapic
].apicid
; /* APIC ID */
1034 mp_irq
.dstirq
= pin
; /* INTIN# */
1036 save_mp_irq(&mp_irq
);
1039 void __init
mp_config_acpi_legacy_irqs(void)
1043 unsigned int dstapic
;
1044 struct mpc_intsrc mp_irq
;
1046 #if defined (CONFIG_MCA) || defined (CONFIG_EISA)
1048 * Fabricate the legacy ISA bus (bus #31).
1050 mp_bus_id_to_type
[MP_ISA_BUS
] = MP_BUS_ISA
;
1052 set_bit(MP_ISA_BUS
, mp_bus_not_pci
);
1053 pr_debug("Bus #%d is ISA\n", MP_ISA_BUS
);
1055 #ifdef CONFIG_X86_ES7000
1057 * Older generations of ES7000 have no legacy identity mappings
1059 if (es7000_plat
== 1)
1064 * Locate the IOAPIC that manages the ISA IRQs (0-15).
1066 ioapic
= mp_find_ioapic(0);
1069 dstapic
= mp_ioapics
[ioapic
].apicid
;
1072 * Use the default configuration for the IRQs 0-15. Unless
1073 * overridden by (MADT) interrupt source override entries.
1075 for (i
= 0; i
< 16; i
++) {
1078 for (idx
= 0; idx
< mp_irq_entries
; idx
++) {
1079 struct mpc_intsrc
*irq
= mp_irqs
+ idx
;
1081 /* Do we already have a mapping for this ISA IRQ? */
1082 if (irq
->srcbus
== MP_ISA_BUS
&& irq
->srcbusirq
== i
)
1085 /* Do we already have a mapping for this IOAPIC pin */
1086 if (irq
->dstapic
== dstapic
&& irq
->dstirq
== i
)
1090 if (idx
!= mp_irq_entries
) {
1091 printk(KERN_DEBUG
"ACPI: IRQ%d used by override.\n", i
);
1092 continue; /* IRQ already used */
1095 mp_irq
.type
= MP_INTSRC
;
1096 mp_irq
.irqflag
= 0; /* Conforming */
1097 mp_irq
.srcbus
= MP_ISA_BUS
;
1098 mp_irq
.dstapic
= dstapic
;
1099 mp_irq
.irqtype
= mp_INT
;
1100 mp_irq
.srcbusirq
= i
; /* Identity mapped */
1103 save_mp_irq(&mp_irq
);
1107 int mp_register_gsi(u32 gsi
, int triggering
, int polarity
)
1111 #ifdef CONFIG_X86_32
1112 #define MAX_GSI_NUM 4096
1113 #define IRQ_COMPRESSION_START 64
1115 static int pci_irq
= IRQ_COMPRESSION_START
;
1117 * Mapping between Global System Interrupts, which
1118 * represent all possible interrupts, and IRQs
1119 * assigned to actual devices.
1121 static int gsi_to_irq
[MAX_GSI_NUM
];
1124 if (acpi_irq_model
!= ACPI_IRQ_MODEL_IOAPIC
)
1128 /* Don't set up the ACPI SCI because it's already set up */
1129 if (acpi_gbl_FADT
.sci_interrupt
== gsi
)
1132 ioapic
= mp_find_ioapic(gsi
);
1134 printk(KERN_WARNING
"No IOAPIC for GSI %u\n", gsi
);
1138 ioapic_pin
= mp_find_ioapic_pin(ioapic
, gsi
);
1140 #ifdef CONFIG_X86_32
1141 if (ioapic_renumber_irq
)
1142 gsi
= ioapic_renumber_irq(ioapic
, gsi
);
1146 * Avoid pin reprogramming. PRTs typically include entries
1147 * with redundant pin->gsi mappings (but unique PCI devices);
1148 * we only program the IOAPIC on the first.
1150 if (ioapic_pin
> MP_MAX_IOAPIC_PIN
) {
1151 printk(KERN_ERR
"Invalid reference to IOAPIC pin "
1152 "%d-%d\n", mp_ioapic_routing
[ioapic
].apic_id
,
1156 if (test_bit(ioapic_pin
, mp_ioapic_routing
[ioapic
].pin_programmed
)) {
1157 pr_debug("Pin %d-%d already programmed\n",
1158 mp_ioapic_routing
[ioapic
].apic_id
, ioapic_pin
);
1159 #ifdef CONFIG_X86_32
1160 return (gsi
< IRQ_COMPRESSION_START
? gsi
: gsi_to_irq
[gsi
]);
1166 set_bit(ioapic_pin
, mp_ioapic_routing
[ioapic
].pin_programmed
);
1167 #ifdef CONFIG_X86_32
1169 * For GSI >= 64, use IRQ compression
1171 if ((gsi
>= IRQ_COMPRESSION_START
)
1172 && (triggering
== ACPI_LEVEL_SENSITIVE
)) {
1174 * For PCI devices assign IRQs in order, avoiding gaps
1175 * due to unused I/O APIC pins.
1178 if (gsi
< MAX_GSI_NUM
) {
1180 * Retain the VIA chipset work-around (gsi > 15), but
1181 * avoid a problem where the 8254 timer (IRQ0) is setup
1182 * via an override (so it's not on pin 0 of the ioapic),
1183 * and at the same time, the pin 0 interrupt is a PCI
1184 * type. The gsi > 15 test could cause these two pins
1185 * to be shared as IRQ0, and they are not shareable.
1186 * So test for this condition, and if necessary, avoid
1187 * the pin collision.
1191 * Don't assign IRQ used by ACPI SCI
1193 if (gsi
== acpi_gbl_FADT
.sci_interrupt
)
1195 gsi_to_irq
[irq
] = gsi
;
1197 printk(KERN_ERR
"GSI %u is too high\n", gsi
);
1202 io_apic_set_pci_routing(ioapic
, ioapic_pin
, gsi
,
1203 triggering
== ACPI_EDGE_SENSITIVE
? 0 : 1,
1204 polarity
== ACPI_ACTIVE_HIGH
? 0 : 1);
1208 int mp_config_acpi_gsi(unsigned char number
, unsigned int devfn
, u8 pin
,
1209 u32 gsi
, int triggering
, int polarity
)
1211 #ifdef CONFIG_X86_MPPARSE
1212 struct mpc_intsrc mp_irq
;
1218 /* print the entry should happen on mptable identically */
1219 mp_irq
.type
= MP_INTSRC
;
1220 mp_irq
.irqtype
= mp_INT
;
1221 mp_irq
.irqflag
= (triggering
== ACPI_EDGE_SENSITIVE
? 4 : 0x0c) |
1222 (polarity
== ACPI_ACTIVE_HIGH
? 1 : 3);
1223 mp_irq
.srcbus
= number
;
1224 mp_irq
.srcbusirq
= (((devfn
>> 3) & 0x1f) << 2) | ((pin
- 1) & 3);
1225 ioapic
= mp_find_ioapic(gsi
);
1226 mp_irq
.dstapic
= mp_ioapic_routing
[ioapic
].apic_id
;
1227 mp_irq
.dstirq
= mp_find_ioapic_pin(ioapic
, gsi
);
1229 save_mp_irq(&mp_irq
);
1235 * Parse IOAPIC related entries in MADT
1236 * returns 0 on success, < 0 on error
1238 static int __init
acpi_parse_madt_ioapic_entries(void)
1243 * ACPI interpreter is required to complete interrupt setup,
1244 * so if it is off, don't enumerate the io-apics with ACPI.
1245 * If MPS is present, it will handle them,
1246 * otherwise the system will stay in PIC mode
1248 if (acpi_disabled
|| acpi_noirq
) {
1256 * if "noapic" boot option, don't look for IO-APICs
1258 if (skip_ioapic_setup
) {
1259 printk(KERN_INFO PREFIX
"Skipping IOAPIC probe "
1260 "due to 'noapic' option.\n");
1265 acpi_table_parse_madt(ACPI_MADT_TYPE_IO_APIC
, acpi_parse_ioapic
,
1268 printk(KERN_ERR PREFIX
"No IOAPIC entries present\n");
1270 } else if (count
< 0) {
1271 printk(KERN_ERR PREFIX
"Error parsing IOAPIC entry\n");
1276 acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE
, acpi_parse_int_src_ovr
,
1279 printk(KERN_ERR PREFIX
1280 "Error parsing interrupt source overrides entry\n");
1281 /* TBD: Cleanup to allow fallback to MPS */
1286 * If BIOS did not supply an INT_SRC_OVR for the SCI
1287 * pretend we got one so we can set the SCI flags.
1289 if (!acpi_sci_override_gsi
)
1290 acpi_sci_ioapic_setup(acpi_gbl_FADT
.sci_interrupt
, 0, 0);
1292 /* Fill in identity legacy mapings where no override */
1293 mp_config_acpi_legacy_irqs();
1296 acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE
, acpi_parse_nmi_src
,
1299 printk(KERN_ERR PREFIX
"Error parsing NMI SRC entry\n");
1300 /* TBD: Cleanup to allow fallback to MPS */
1307 static inline int acpi_parse_madt_ioapic_entries(void)
1311 #endif /* !CONFIG_X86_IO_APIC */
1313 static void __init
early_acpi_process_madt(void)
1315 #ifdef CONFIG_X86_LOCAL_APIC
1318 if (!acpi_table_parse(ACPI_SIG_MADT
, acpi_parse_madt
)) {
1321 * Parse MADT LAPIC entries
1323 error
= early_acpi_parse_madt_lapic_addr_ovr();
1326 smp_found_config
= 1;
1328 if (error
== -EINVAL
) {
1330 * Dell Precision Workstation 410, 610 come here.
1332 printk(KERN_ERR PREFIX
1333 "Invalid BIOS MADT, disabling ACPI\n");
1340 static void __init
acpi_process_madt(void)
1342 #ifdef CONFIG_X86_LOCAL_APIC
1345 if (!acpi_table_parse(ACPI_SIG_MADT
, acpi_parse_madt
)) {
1348 * Parse MADT LAPIC entries
1350 error
= acpi_parse_madt_lapic_entries();
1354 #ifdef CONFIG_X86_BIGSMP
1355 generic_bigsmp_probe();
1358 * Parse MADT IO-APIC entries
1360 error
= acpi_parse_madt_ioapic_entries();
1362 acpi_irq_model
= ACPI_IRQ_MODEL_IOAPIC
;
1365 smp_found_config
= 1;
1366 if (apic
->setup_apic_routing
)
1367 apic
->setup_apic_routing();
1370 if (error
== -EINVAL
) {
1372 * Dell Precision Workstation 410, 610 come here.
1374 printk(KERN_ERR PREFIX
1375 "Invalid BIOS MADT, disabling ACPI\n");
1380 * ACPI found no MADT, and so ACPI wants UP PIC mode.
1381 * In the event an MPS table was found, forget it.
1382 * Boot with "acpi=off" to use MPS on such a system.
1384 if (smp_found_config
) {
1385 printk(KERN_WARNING PREFIX
1386 "No APIC-table, disabling MPS\n");
1387 smp_found_config
= 0;
1392 * ACPI supports both logical (e.g. Hyper-Threading) and physical
1393 * processors, where MPS only supports physical.
1395 if (acpi_lapic
&& acpi_ioapic
)
1396 printk(KERN_INFO
"Using ACPI (MADT) for SMP configuration "
1398 else if (acpi_lapic
)
1399 printk(KERN_INFO
"Using ACPI for processor (LAPIC) "
1400 "configuration information\n");
1405 static int __init
disable_acpi_irq(const struct dmi_system_id
*d
)
1408 printk(KERN_NOTICE
"%s detected: force use of acpi=noirq\n",
1415 static int __init
disable_acpi_pci(const struct dmi_system_id
*d
)
1418 printk(KERN_NOTICE
"%s detected: force use of pci=noacpi\n",
1425 static int __init
dmi_disable_acpi(const struct dmi_system_id
*d
)
1428 printk(KERN_NOTICE
"%s detected: acpi off\n", d
->ident
);
1432 "Warning: DMI blacklist says broken, but acpi forced\n");
1438 * Limit ACPI to CPU enumeration for HT
1440 static int __init
force_acpi_ht(const struct dmi_system_id
*d
)
1443 printk(KERN_NOTICE
"%s detected: force use of acpi=ht\n",
1449 "Warning: acpi=force overrules DMI blacklist: acpi=ht\n");
1455 * Force ignoring BIOS IRQ0 pin2 override
1457 static int __init
dmi_ignore_irq0_timer_override(const struct dmi_system_id
*d
)
1460 * The ati_ixp4x0_rev() early PCI quirk should have set
1461 * the acpi_skip_timer_override flag already:
1463 if (!acpi_skip_timer_override
) {
1464 WARN(1, KERN_ERR
"ati_ixp4x0 quirk not complete.\n");
1465 pr_notice("%s detected: Ignoring BIOS IRQ0 pin2 override\n",
1467 acpi_skip_timer_override
= 1;
1473 * If your system is blacklisted here, but you find that acpi=force
1474 * works for you, please contact acpi-devel@sourceforge.net
1476 static struct dmi_system_id __initdata acpi_dmi_table
[] = {
1478 * Boxes that need ACPI disabled
1481 .callback
= dmi_disable_acpi
,
1482 .ident
= "IBM Thinkpad",
1484 DMI_MATCH(DMI_BOARD_VENDOR
, "IBM"),
1485 DMI_MATCH(DMI_BOARD_NAME
, "2629H1G"),
1490 * Boxes that need acpi=ht
1493 .callback
= force_acpi_ht
,
1494 .ident
= "FSC Primergy T850",
1496 DMI_MATCH(DMI_SYS_VENDOR
, "FUJITSU SIEMENS"),
1497 DMI_MATCH(DMI_PRODUCT_NAME
, "PRIMERGY T850"),
1501 .callback
= force_acpi_ht
,
1502 .ident
= "HP VISUALIZE NT Workstation",
1504 DMI_MATCH(DMI_BOARD_VENDOR
, "Hewlett-Packard"),
1505 DMI_MATCH(DMI_PRODUCT_NAME
, "HP VISUALIZE NT Workstation"),
1509 .callback
= force_acpi_ht
,
1510 .ident
= "Compaq Workstation W8000",
1512 DMI_MATCH(DMI_SYS_VENDOR
, "Compaq"),
1513 DMI_MATCH(DMI_PRODUCT_NAME
, "Workstation W8000"),
1517 .callback
= force_acpi_ht
,
1518 .ident
= "ASUS P4B266",
1520 DMI_MATCH(DMI_BOARD_VENDOR
, "ASUSTeK Computer INC."),
1521 DMI_MATCH(DMI_BOARD_NAME
, "P4B266"),
1525 .callback
= force_acpi_ht
,
1526 .ident
= "ASUS P2B-DS",
1528 DMI_MATCH(DMI_BOARD_VENDOR
, "ASUSTeK Computer INC."),
1529 DMI_MATCH(DMI_BOARD_NAME
, "P2B-DS"),
1533 .callback
= force_acpi_ht
,
1534 .ident
= "ASUS CUR-DLS",
1536 DMI_MATCH(DMI_BOARD_VENDOR
, "ASUSTeK Computer INC."),
1537 DMI_MATCH(DMI_BOARD_NAME
, "CUR-DLS"),
1541 .callback
= force_acpi_ht
,
1542 .ident
= "ABIT i440BX-W83977",
1544 DMI_MATCH(DMI_BOARD_VENDOR
, "ABIT <http://www.abit.com>"),
1545 DMI_MATCH(DMI_BOARD_NAME
, "i440BX-W83977 (BP6)"),
1549 .callback
= force_acpi_ht
,
1550 .ident
= "IBM Bladecenter",
1552 DMI_MATCH(DMI_BOARD_VENDOR
, "IBM"),
1553 DMI_MATCH(DMI_BOARD_NAME
, "IBM eServer BladeCenter HS20"),
1557 .callback
= force_acpi_ht
,
1558 .ident
= "IBM eServer xSeries 360",
1560 DMI_MATCH(DMI_BOARD_VENDOR
, "IBM"),
1561 DMI_MATCH(DMI_BOARD_NAME
, "eServer xSeries 360"),
1565 .callback
= force_acpi_ht
,
1566 .ident
= "IBM eserver xSeries 330",
1568 DMI_MATCH(DMI_BOARD_VENDOR
, "IBM"),
1569 DMI_MATCH(DMI_BOARD_NAME
, "eserver xSeries 330"),
1573 .callback
= force_acpi_ht
,
1574 .ident
= "IBM eserver xSeries 440",
1576 DMI_MATCH(DMI_BOARD_VENDOR
, "IBM"),
1577 DMI_MATCH(DMI_PRODUCT_NAME
, "eserver xSeries 440"),
1582 * Boxes that need ACPI PCI IRQ routing disabled
1585 .callback
= disable_acpi_irq
,
1586 .ident
= "ASUS A7V",
1588 DMI_MATCH(DMI_BOARD_VENDOR
, "ASUSTeK Computer INC"),
1589 DMI_MATCH(DMI_BOARD_NAME
, "<A7V>"),
1590 /* newer BIOS, Revision 1011, does work */
1591 DMI_MATCH(DMI_BIOS_VERSION
,
1592 "ASUS A7V ACPI BIOS Revision 1007"),
1597 * Latest BIOS for IBM 600E (1.16) has bad pcinum
1598 * for LPC bridge, which is needed for the PCI
1599 * interrupt links to work. DSDT fix is in bug 5966.
1600 * 2645, 2646 model numbers are shared with 600/600E/600X
1602 .callback
= disable_acpi_irq
,
1603 .ident
= "IBM Thinkpad 600 Series 2645",
1605 DMI_MATCH(DMI_BOARD_VENDOR
, "IBM"),
1606 DMI_MATCH(DMI_BOARD_NAME
, "2645"),
1610 .callback
= disable_acpi_irq
,
1611 .ident
= "IBM Thinkpad 600 Series 2646",
1613 DMI_MATCH(DMI_BOARD_VENDOR
, "IBM"),
1614 DMI_MATCH(DMI_BOARD_NAME
, "2646"),
1618 * Boxes that need ACPI PCI IRQ routing and PCI scan disabled
1621 .callback
= disable_acpi_pci
,
1622 .ident
= "ASUS PR-DLS",
1624 DMI_MATCH(DMI_BOARD_VENDOR
, "ASUSTeK Computer INC."),
1625 DMI_MATCH(DMI_BOARD_NAME
, "PR-DLS"),
1626 DMI_MATCH(DMI_BIOS_VERSION
,
1627 "ASUS PR-DLS ACPI BIOS Revision 1010"),
1628 DMI_MATCH(DMI_BIOS_DATE
, "03/21/2003")
1632 .callback
= disable_acpi_pci
,
1633 .ident
= "Acer TravelMate 36x Laptop",
1635 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
1636 DMI_MATCH(DMI_PRODUCT_NAME
, "TravelMate 360"),
1642 /* second table for DMI checks that should run after early-quirks */
1643 static struct dmi_system_id __initdata acpi_dmi_table_late
[] = {
1645 * HP laptops which use a DSDT reporting as HP/SB400/10000,
1646 * which includes some code which overrides all temperature
1647 * trip points to 16C if the INTIN2 input of the I/O APIC
1648 * is enabled. This input is incorrectly designated the
1649 * ISA IRQ 0 via an interrupt source override even though
1650 * it is wired to the output of the master 8259A and INTIN0
1651 * is not connected at all. Force ignoring BIOS IRQ0 pin2
1652 * override in that cases.
1655 .callback
= dmi_ignore_irq0_timer_override
,
1656 .ident
= "HP nx6115 laptop",
1658 DMI_MATCH(DMI_SYS_VENDOR
, "Hewlett-Packard"),
1659 DMI_MATCH(DMI_PRODUCT_NAME
, "HP Compaq nx6115"),
1663 .callback
= dmi_ignore_irq0_timer_override
,
1664 .ident
= "HP NX6125 laptop",
1666 DMI_MATCH(DMI_SYS_VENDOR
, "Hewlett-Packard"),
1667 DMI_MATCH(DMI_PRODUCT_NAME
, "HP Compaq nx6125"),
1671 .callback
= dmi_ignore_irq0_timer_override
,
1672 .ident
= "HP NX6325 laptop",
1674 DMI_MATCH(DMI_SYS_VENDOR
, "Hewlett-Packard"),
1675 DMI_MATCH(DMI_PRODUCT_NAME
, "HP Compaq nx6325"),
1679 .callback
= dmi_ignore_irq0_timer_override
,
1680 .ident
= "HP 6715b laptop",
1682 DMI_MATCH(DMI_SYS_VENDOR
, "Hewlett-Packard"),
1683 DMI_MATCH(DMI_PRODUCT_NAME
, "HP Compaq 6715b"),
1690 * acpi_boot_table_init() and acpi_boot_init()
1691 * called from setup_arch(), always.
1692 * 1. checksums all tables
1693 * 2. enumerates lapics
1694 * 3. enumerates io-apics
1696 * acpi_table_init() is separate to allow reading SRAT without
1697 * other side effects.
1699 * side effects of acpi_boot_init:
1700 * acpi_lapic = 1 if LAPIC found
1701 * acpi_ioapic = 1 if IOAPIC found
1702 * if (acpi_lapic && acpi_ioapic) smp_found_config = 1;
1703 * if acpi_blacklisted() acpi_disabled = 1;
1704 * acpi_irq_model=...
1707 * return value: (currently ignored)
1712 int __init
acpi_boot_table_init(void)
1716 dmi_check_system(acpi_dmi_table
);
1719 * If acpi_disabled, bail out
1720 * One exception: acpi=ht continues far enough to enumerate LAPICs
1722 if (acpi_disabled
&& !acpi_ht
)
1726 * Initialize the ACPI boot-time table parser.
1728 error
= acpi_table_init();
1734 acpi_table_parse(ACPI_SIG_BOOT
, acpi_parse_sbf
);
1737 * blacklist may disable ACPI entirely
1739 error
= acpi_blacklisted();
1742 printk(KERN_WARNING PREFIX
"acpi=force override\n");
1744 printk(KERN_WARNING PREFIX
"Disabling ACPI support\n");
1753 int __init
early_acpi_boot_init(void)
1756 * If acpi_disabled, bail out
1757 * One exception: acpi=ht continues far enough to enumerate LAPICs
1759 if (acpi_disabled
&& !acpi_ht
)
1763 * Process the Multiple APIC Description Table (MADT), if present
1765 early_acpi_process_madt();
1770 int __init
acpi_boot_init(void)
1772 /* those are executed after early-quirks are executed */
1773 dmi_check_system(acpi_dmi_table_late
);
1776 * If acpi_disabled, bail out
1777 * One exception: acpi=ht continues far enough to enumerate LAPICs
1779 if (acpi_disabled
&& !acpi_ht
)
1782 acpi_table_parse(ACPI_SIG_BOOT
, acpi_parse_sbf
);
1785 * set sci_int and PM timer address
1787 acpi_table_parse(ACPI_SIG_FADT
, acpi_parse_fadt
);
1790 * Process the Multiple APIC Description Table (MADT), if present
1792 acpi_process_madt();
1794 acpi_table_parse(ACPI_SIG_HPET
, acpi_parse_hpet
);
1799 static int __init
parse_acpi(char *arg
)
1804 /* "acpi=off" disables both ACPI table parsing and interpreter */
1805 if (strcmp(arg
, "off") == 0) {
1808 /* acpi=force to over-ride black-list */
1809 else if (strcmp(arg
, "force") == 0) {
1814 /* acpi=strict disables out-of-spec workarounds */
1815 else if (strcmp(arg
, "strict") == 0) {
1818 /* Limit ACPI just to boot-time to enable HT */
1819 else if (strcmp(arg
, "ht") == 0) {
1824 /* acpi=rsdt use RSDT instead of XSDT */
1825 else if (strcmp(arg
, "rsdt") == 0) {
1826 acpi_rsdt_forced
= 1;
1828 /* "acpi=noirq" disables ACPI interrupt routing */
1829 else if (strcmp(arg
, "noirq") == 0) {
1832 /* Core will printk when we return error. */
1837 early_param("acpi", parse_acpi
);
1839 /* FIXME: Using pci= for an ACPI parameter is a travesty. */
1840 static int __init
parse_pci(char *arg
)
1842 if (arg
&& strcmp(arg
, "noacpi") == 0)
1846 early_param("pci", parse_pci
);
1848 int __init
acpi_mps_check(void)
1850 #if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_X86_MPPARSE)
1851 /* mptable code is not built-in*/
1852 if (acpi_disabled
|| acpi_noirq
) {
1853 printk(KERN_WARNING
"MPS support code is not built-in.\n"
1854 "Using acpi=off or acpi=noirq or pci=noacpi "
1855 "may have problem\n");
1862 #ifdef CONFIG_X86_IO_APIC
1863 static int __init
parse_acpi_skip_timer_override(char *arg
)
1865 acpi_skip_timer_override
= 1;
1868 early_param("acpi_skip_timer_override", parse_acpi_skip_timer_override
);
1870 static int __init
parse_acpi_use_timer_override(char *arg
)
1872 acpi_use_timer_override
= 1;
1875 early_param("acpi_use_timer_override", parse_acpi_use_timer_override
);
1876 #endif /* CONFIG_X86_IO_APIC */
1878 static int __init
setup_acpi_sci(char *s
)
1882 if (!strcmp(s
, "edge"))
1883 acpi_sci_flags
= ACPI_MADT_TRIGGER_EDGE
|
1884 (acpi_sci_flags
& ~ACPI_MADT_TRIGGER_MASK
);
1885 else if (!strcmp(s
, "level"))
1886 acpi_sci_flags
= ACPI_MADT_TRIGGER_LEVEL
|
1887 (acpi_sci_flags
& ~ACPI_MADT_TRIGGER_MASK
);
1888 else if (!strcmp(s
, "high"))
1889 acpi_sci_flags
= ACPI_MADT_POLARITY_ACTIVE_HIGH
|
1890 (acpi_sci_flags
& ~ACPI_MADT_POLARITY_MASK
);
1891 else if (!strcmp(s
, "low"))
1892 acpi_sci_flags
= ACPI_MADT_POLARITY_ACTIVE_LOW
|
1893 (acpi_sci_flags
& ~ACPI_MADT_POLARITY_MASK
);
1898 early_param("acpi_sci", setup_acpi_sci
);
1900 int __acpi_acquire_global_lock(unsigned int *lock
)
1902 unsigned int old
, new, val
;
1905 new = (((old
& ~0x3) + 2) + ((old
>> 1) & 0x1));
1906 val
= cmpxchg(lock
, old
, new);
1907 } while (unlikely (val
!= old
));
1908 return (new < 3) ? -1 : 0;
1911 int __acpi_release_global_lock(unsigned int *lock
)
1913 unsigned int old
, new, val
;
1917 val
= cmpxchg(lock
, old
, new);
1918 } while (unlikely (val
!= old
));