ia64/xen-unstable

view xen/arch/x86/acpi/boot.c @ 15745:66a262700cf7

x86: Trivial clean up of debug output.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Aug 10 17:23:33 2007 +0100 (2007-08-10)
parents 484848f240e8
children 45548c83daef
line source
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 */
26 #include <xen/config.h>
27 #include <xen/errno.h>
28 #include <xen/init.h>
29 #include <xen/acpi.h>
30 #include <xen/irq.h>
31 #include <xen/dmi.h>
32 #include <asm/fixmap.h>
33 #include <asm/page.h>
34 #include <asm/apic.h>
35 #include <asm/io_apic.h>
36 #include <asm/apic.h>
37 #include <asm/io.h>
38 #include <asm/mpspec.h>
39 #include <mach_apic.h>
40 #include <mach_mpparse.h>
42 int sbf_port;
43 #define CONFIG_ACPI_PCI
45 #define BAD_MADT_ENTRY(entry, end) ( \
46 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
47 ((acpi_table_entry_header *)entry)->length != sizeof(*entry))
49 #define PREFIX "ACPI: "
51 #ifdef CONFIG_ACPI_PCI
52 int acpi_noirq __initdata; /* skip ACPI IRQ initialization */
53 int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */
54 #else
55 int acpi_noirq __initdata = 1;
56 int acpi_pci_disabled __initdata = 1;
57 #endif
58 int acpi_ht __initdata = 1; /* enable HT */
60 int acpi_lapic;
61 int acpi_ioapic;
62 int acpi_strict;
63 EXPORT_SYMBOL(acpi_strict);
65 acpi_interrupt_flags acpi_sci_flags __initdata;
66 int acpi_sci_override_gsi __initdata;
67 int acpi_skip_timer_override __initdata;
69 #ifdef CONFIG_X86_LOCAL_APIC
70 static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
71 #endif
73 #ifndef __HAVE_ARCH_CMPXCHG
74 #warning ACPI uses CMPXCHG, i486 and later hardware
75 #endif
77 #define MAX_MADT_ENTRIES 256
78 u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
79 {[0 ... MAX_MADT_ENTRIES - 1] = 0xff };
80 EXPORT_SYMBOL(x86_acpiid_to_apicid);
82 /* --------------------------------------------------------------------------
83 Boot-time Configuration
84 -------------------------------------------------------------------------- */
86 /*
87 * The default interrupt routing model is PIC (8259). This gets
88 * overriden if IOAPICs are enumerated (below).
89 */
90 enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
92 /*
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
96 * sufficient.
97 * By using this area, we can map up to MAX_IO_APICS pages temporarily,
98 * i.e. until the next __va_range() call.
99 *
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.
103 */
104 char *__acpi_map_table(unsigned long phys, unsigned long size)
105 {
106 unsigned long base, offset, mapped_size;
107 int idx;
109 if (phys + size < 8 * 1024 * 1024)
110 return __va(phys);
112 offset = phys & (PAGE_SIZE - 1);
113 mapped_size = PAGE_SIZE - offset;
114 set_fixmap(FIX_ACPI_END, phys);
115 base = fix_to_virt(FIX_ACPI_END);
117 /*
118 * Most cases can be covered by the below.
119 */
120 idx = FIX_ACPI_END;
121 while (mapped_size < size) {
122 if (--idx < FIX_ACPI_BEGIN)
123 return NULL; /* cannot handle this */
124 phys += PAGE_SIZE;
125 set_fixmap(idx, phys);
126 mapped_size += PAGE_SIZE;
127 }
129 return ((char *) base + offset);
130 }
132 #ifdef CONFIG_X86_LOCAL_APIC
133 static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
134 {
135 struct acpi_table_madt *madt = NULL;
137 if (!phys_addr || !size)
138 return -EINVAL;
140 madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size);
141 if (!madt) {
142 printk(KERN_WARNING PREFIX "Unable to map MADT\n");
143 return -ENODEV;
144 }
146 if (madt->lapic_address) {
147 acpi_lapic_addr = (u64) madt->lapic_address;
149 printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
150 madt->lapic_address);
151 }
153 acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
155 return 0;
156 }
158 static int __init
159 acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
160 {
161 struct acpi_table_lapic *processor = NULL;
163 processor = (struct acpi_table_lapic *)header;
165 if (BAD_MADT_ENTRY(processor, end))
166 return -EINVAL;
168 acpi_table_print_madt_entry(header);
170 /* Record local apic id only when enabled */
171 if (processor->flags.enabled)
172 x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
174 /*
175 * We need to register disabled CPU as well to permit
176 * counting disabled CPUs. This allows us to size
177 * cpus_possible_map more accurately, to permit
178 * to not preallocating memory for all NR_CPUS
179 * when we use CPU hotplug.
180 */
181 mp_register_lapic(processor->id, /* APIC ID */
182 processor->flags.enabled); /* Enabled? */
184 return 0;
185 }
187 static int __init
188 acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
189 const unsigned long end)
190 {
191 struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL;
193 lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr *)header;
195 if (BAD_MADT_ENTRY(lapic_addr_ovr, end))
196 return -EINVAL;
198 acpi_lapic_addr = lapic_addr_ovr->address;
200 return 0;
201 }
203 static int __init
204 acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
205 {
206 struct acpi_table_lapic_nmi *lapic_nmi = NULL;
208 lapic_nmi = (struct acpi_table_lapic_nmi *)header;
210 if (BAD_MADT_ENTRY(lapic_nmi, end))
211 return -EINVAL;
213 acpi_table_print_madt_entry(header);
215 if (lapic_nmi->lint != 1)
216 printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n");
218 return 0;
219 }
221 #endif /*CONFIG_X86_LOCAL_APIC */
223 #if defined(CONFIG_X86_IO_APIC) /*&& defined(CONFIG_ACPI_INTERPRETER)*/
225 static int __init
226 acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end)
227 {
228 struct acpi_table_ioapic *ioapic = NULL;
230 ioapic = (struct acpi_table_ioapic *)header;
232 if (BAD_MADT_ENTRY(ioapic, end))
233 return -EINVAL;
235 acpi_table_print_madt_entry(header);
237 mp_register_ioapic(ioapic->id,
238 ioapic->address, ioapic->global_irq_base);
240 return 0;
241 }
243 static int __init
244 acpi_parse_int_src_ovr(acpi_table_entry_header * header,
245 const unsigned long end)
246 {
247 struct acpi_table_int_src_ovr *intsrc = NULL;
249 intsrc = (struct acpi_table_int_src_ovr *)header;
251 if (BAD_MADT_ENTRY(intsrc, end))
252 return -EINVAL;
254 acpi_table_print_madt_entry(header);
256 if (acpi_skip_timer_override &&
257 intsrc->bus_irq == 0 && intsrc->global_irq == 2) {
258 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
259 return 0;
260 }
262 mp_override_legacy_irq(intsrc->bus_irq,
263 intsrc->flags.polarity,
264 intsrc->flags.trigger, intsrc->global_irq);
266 return 0;
267 }
269 static int __init
270 acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
271 {
272 struct acpi_table_nmi_src *nmi_src = NULL;
274 nmi_src = (struct acpi_table_nmi_src *)header;
276 if (BAD_MADT_ENTRY(nmi_src, end))
277 return -EINVAL;
279 acpi_table_print_madt_entry(header);
281 /* TBD: Support nimsrc entries? */
283 return 0;
284 }
286 #endif /* CONFIG_X86_IO_APIC */
288 static unsigned long __init
289 acpi_scan_rsdp(unsigned long start, unsigned long length)
290 {
291 unsigned long offset = 0;
292 unsigned long sig_len = sizeof("RSD PTR ") - 1;
294 /*
295 * Scan all 16-byte boundaries of the physical memory region for the
296 * RSDP signature.
297 */
298 for (offset = 0; offset < length; offset += 16) {
299 if (strncmp((char *)(start + offset), "RSD PTR ", sig_len))
300 continue;
301 return (start + offset);
302 }
304 return 0;
305 }
307 static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size)
308 {
309 struct acpi_table_sbf *sb;
311 if (!phys_addr || !size)
312 return -EINVAL;
314 sb = (struct acpi_table_sbf *)__acpi_map_table(phys_addr, size);
315 if (!sb) {
316 printk(KERN_WARNING PREFIX "Unable to map SBF\n");
317 return -ENODEV;
318 }
320 sbf_port = sb->sbf_cmos; /* Save CMOS port */
322 return 0;
323 }
325 #ifdef CONFIG_HPET_TIMER
327 static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
328 {
329 struct acpi_table_hpet *hpet_tbl;
331 if (!phys || !size)
332 return -EINVAL;
334 hpet_tbl = (struct acpi_table_hpet *)__acpi_map_table(phys, size);
335 if (!hpet_tbl) {
336 printk(KERN_WARNING PREFIX "Unable to map HPET\n");
337 return -ENODEV;
338 }
340 if (hpet_tbl->addr.space_id != ACPI_SPACE_MEM) {
341 printk(KERN_WARNING PREFIX "HPET timers must be located in "
342 "memory.\n");
343 return -1;
344 }
346 #if 0/*def CONFIG_X86_64*/
347 vxtime.hpet_address = hpet_tbl->addr.addrl |
348 ((long) hpet_tbl->addr.addrh << 32);
350 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
351 hpet_tbl->id, vxtime.hpet_address);
352 #else /* X86 */
353 {
354 extern unsigned long hpet_address;
356 hpet_address = hpet_tbl->addr.addrl;
357 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
358 hpet_tbl->id, hpet_address);
359 }
360 #endif /* X86 */
362 return 0;
363 }
364 #else
365 #define acpi_parse_hpet NULL
366 #endif
368 #ifdef CONFIG_X86_PM_TIMER
369 extern u32 pmtmr_ioport;
370 #endif
372 #ifdef CONFIG_ACPI_SLEEP
373 /* Get pm1x_cnt and pm1x_evt information for ACPI sleep */
374 static void __init
375 acpi_fadt_parse_sleep_info(struct fadt_descriptor_rev2 *fadt)
376 {
377 struct acpi_table_rsdp *rsdp;
378 unsigned long rsdp_phys;
379 struct facs_descriptor_rev2 *facs = NULL;
380 uint64_t facs_pa;
382 rsdp_phys = acpi_find_rsdp();
383 if (!rsdp_phys || acpi_disabled)
384 goto bad;
385 rsdp = __va(rsdp_phys);
387 if (fadt->revision >= FADT2_REVISION_ID) {
388 /* Sanity check on FADT Rev. 2 */
389 if ((fadt->xpm1a_cnt_blk.address_space_id !=
390 ACPI_ADR_SPACE_SYSTEM_IO) ||
391 (fadt->xpm1b_cnt_blk.address_space_id !=
392 ACPI_ADR_SPACE_SYSTEM_IO) ||
393 (fadt->xpm1a_evt_blk.address_space_id !=
394 ACPI_ADR_SPACE_SYSTEM_IO) ||
395 (fadt->xpm1b_evt_blk.address_space_id !=
396 ACPI_ADR_SPACE_SYSTEM_IO))
397 goto bad;
399 acpi_sinfo.pm1a_cnt = (uint16_t)fadt->xpm1a_cnt_blk.address;
400 acpi_sinfo.pm1b_cnt = (uint16_t)fadt->xpm1b_cnt_blk.address;
401 acpi_sinfo.pm1a_evt = (uint16_t)fadt->xpm1a_evt_blk.address;
402 acpi_sinfo.pm1b_evt = (uint16_t)fadt->xpm1b_evt_blk.address;
403 }
405 if (!acpi_sinfo.pm1a_cnt)
406 acpi_sinfo.pm1a_cnt = (uint16_t)fadt->V1_pm1a_cnt_blk;
407 if (!acpi_sinfo.pm1b_cnt)
408 acpi_sinfo.pm1b_cnt = (uint16_t)fadt->V1_pm1b_cnt_blk;
409 if (!acpi_sinfo.pm1a_evt)
410 acpi_sinfo.pm1a_evt = (uint16_t)fadt->V1_pm1a_evt_blk;
411 if (!acpi_sinfo.pm1b_evt)
412 acpi_sinfo.pm1b_evt = (uint16_t)fadt->V1_pm1b_evt_blk;
414 /* Now FACS... */
415 if (fadt->revision >= FADT2_REVISION_ID)
416 facs_pa = fadt->xfirmware_ctrl;
417 else
418 facs_pa = (uint64_t)fadt->V1_firmware_ctrl;
420 facs = (struct facs_descriptor_rev2 *)
421 __acpi_map_table(facs_pa, sizeof(struct facs_descriptor_rev2));
422 if (!facs)
423 goto bad;
425 if (strncmp(facs->signature, "FACS", 4)) {
426 printk(KERN_ERR PREFIX "Invalid FACS signature %.4s\n",
427 facs->signature);
428 goto bad;
429 }
431 if (facs->length < 24) {
432 printk(KERN_ERR PREFIX "Invalid FACS table length: 0x%x",
433 facs->length);
434 goto bad;
435 }
437 if (facs->length < 64)
438 printk(KERN_WARNING PREFIX
439 "FACS is shorter than ACPI spec allow: 0x%x",
440 facs->length);
442 if ((rsdp->revision < 2) || (facs->length < 32)) {
443 acpi_sinfo.wakeup_vector = facs_pa +
444 offsetof(struct facs_descriptor_rev2,
445 firmware_waking_vector);
446 acpi_sinfo.vector_width = 32;
447 } else {
448 acpi_sinfo.wakeup_vector = facs_pa +
449 offsetof(struct facs_descriptor_rev2,
450 xfirmware_waking_vector);
451 acpi_sinfo.vector_width = 64;
452 }
454 printk(KERN_INFO PREFIX
455 "ACPI SLEEP INFO: pm1x_cnt[%x,%x], pm1x_evt[%x,%x]\n",
456 acpi_sinfo.pm1a_cnt, acpi_sinfo.pm1b_cnt,
457 acpi_sinfo.pm1a_evt, acpi_sinfo.pm1b_cnt);
458 printk(KERN_INFO PREFIX
459 " wakeup_vec[%"PRIx64"], vec_size[%x]\n",
460 acpi_sinfo.wakeup_vector, acpi_sinfo.vector_width);
461 return;
462 bad:
463 memset(&acpi_sinfo, 0, sizeof(acpi_sinfo));
464 }
465 #endif
467 static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
468 {
469 struct fadt_descriptor_rev2 *fadt = NULL;
471 fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size);
472 if (!fadt) {
473 printk(KERN_WARNING PREFIX "Unable to map FADT\n");
474 return 0;
475 }
477 #ifdef CONFIG_ACPI_INTERPRETER
478 /* initialize sci_int early for INT_SRC_OVR MADT parsing */
479 acpi_fadt.sci_int = fadt->sci_int;
481 /* initialize rev and apic_phys_dest_mode for x86_64 genapic */
482 acpi_fadt.revision = fadt->revision;
483 acpi_fadt.force_apic_physical_destination_mode =
484 fadt->force_apic_physical_destination_mode;
485 #endif
487 #ifdef CONFIG_X86_PM_TIMER
488 /* detect the location of the ACPI PM Timer */
489 if (fadt->revision >= FADT2_REVISION_ID) {
490 /* FADT rev. 2 */
491 if (fadt->xpm_tmr_blk.address_space_id !=
492 ACPI_ADR_SPACE_SYSTEM_IO)
493 return 0;
495 pmtmr_ioport = fadt->xpm_tmr_blk.address;
496 /*
497 * "X" fields are optional extensions to the original V1.0
498 * fields, so we must selectively expand V1.0 fields if the
499 * corresponding X field is zero.
500 */
501 if (!pmtmr_ioport)
502 pmtmr_ioport = fadt->V1_pm_tmr_blk;
503 } else {
504 /* FADT rev. 1 */
505 pmtmr_ioport = fadt->V1_pm_tmr_blk;
506 }
507 if (pmtmr_ioport)
508 printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
509 pmtmr_ioport);
510 #endif
512 #ifdef CONFIG_ACPI_SLEEP
513 acpi_fadt_parse_sleep_info(fadt);
514 #endif
515 return 0;
516 }
518 unsigned long __init acpi_find_rsdp(void)
519 {
520 unsigned long rsdp_phys = 0;
522 #if 0
523 if (efi_enabled) {
524 if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
525 return efi.acpi20;
526 else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
527 return efi.acpi;
528 }
529 #endif
530 /*
531 * Scan memory looking for the RSDP signature. First search EBDA (low
532 * memory) paragraphs and then search upper memory (E0000-FFFFF).
533 */
534 rsdp_phys = acpi_scan_rsdp(0, 0x400);
535 if (!rsdp_phys)
536 rsdp_phys = acpi_scan_rsdp(0xE0000, 0x20000);
538 return rsdp_phys;
539 }
541 #ifdef CONFIG_X86_LOCAL_APIC
542 /*
543 * Parse LAPIC entries in MADT
544 * returns 0 on success, < 0 on error
545 */
546 static int __init acpi_parse_madt_lapic_entries(void)
547 {
548 int count;
550 if (!cpu_has_apic)
551 return -ENODEV;
553 /*
554 * Note that the LAPIC address is obtained from the MADT (32-bit value)
555 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
556 */
558 count =
559 acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
560 acpi_parse_lapic_addr_ovr, 0);
561 if (count < 0) {
562 printk(KERN_ERR PREFIX
563 "Error parsing LAPIC address override entry\n");
564 return count;
565 }
567 mp_register_lapic_address(acpi_lapic_addr);
569 count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
570 MAX_APICS);
571 if (!count) {
572 printk(KERN_ERR PREFIX "No LAPIC entries present\n");
573 /* TBD: Cleanup to allow fallback to MPS */
574 return -ENODEV;
575 } else if (count < 0) {
576 printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
577 /* TBD: Cleanup to allow fallback to MPS */
578 return count;
579 }
581 count =
582 acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
583 if (count < 0) {
584 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
585 /* TBD: Cleanup to allow fallback to MPS */
586 return count;
587 }
588 return 0;
589 }
590 #endif /* CONFIG_X86_LOCAL_APIC */
592 #if defined(CONFIG_X86_IO_APIC) /*&& defined(CONFIG_ACPI_INTERPRETER)*/
593 /*
594 * Parse IOAPIC related entries in MADT
595 * returns 0 on success, < 0 on error
596 */
597 static int __init acpi_parse_madt_ioapic_entries(void)
598 {
599 int count;
601 /*
602 * ACPI interpreter is required to complete interrupt setup,
603 * so if it is off, don't enumerate the io-apics with ACPI.
604 * If MPS is present, it will handle them,
605 * otherwise the system will stay in PIC mode
606 */
607 if (acpi_disabled || acpi_noirq) {
608 return -ENODEV;
609 }
611 if (!cpu_has_apic)
612 return -ENODEV;
614 /*
615 * if "noapic" boot option, don't look for IO-APICs
616 */
617 if (skip_ioapic_setup) {
618 printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
619 "due to 'noapic' option.\n");
620 return -ENODEV;
621 }
623 count =
624 acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic,
625 MAX_IO_APICS);
626 if (!count) {
627 printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
628 return -ENODEV;
629 } else if (count < 0) {
630 printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
631 return count;
632 }
634 count =
635 acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr,
636 NR_IRQ_VECTORS);
637 if (count < 0) {
638 printk(KERN_ERR PREFIX
639 "Error parsing interrupt source overrides entry\n");
640 /* TBD: Cleanup to allow fallback to MPS */
641 return count;
642 }
644 #ifdef CONFIG_ACPI_INTERPRETER
645 /*
646 * If BIOS did not supply an INT_SRC_OVR for the SCI
647 * pretend we got one so we can set the SCI flags.
648 */
649 if (!acpi_sci_override_gsi)
650 acpi_sci_ioapic_setup(acpi_fadt.sci_int, 0, 0);
651 #endif
653 /* Fill in identity legacy mapings where no override */
654 mp_config_acpi_legacy_irqs();
656 count =
657 acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
658 NR_IRQ_VECTORS);
659 if (count < 0) {
660 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
661 /* TBD: Cleanup to allow fallback to MPS */
662 return count;
663 }
665 return 0;
666 }
667 #else
668 static inline int acpi_parse_madt_ioapic_entries(void)
669 {
670 return -1;
671 }
672 #endif /* !(CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER) */
675 static void __init acpi_process_madt(void)
676 {
677 #ifdef CONFIG_X86_LOCAL_APIC
678 int count, error;
680 count = acpi_table_parse(ACPI_APIC, acpi_parse_madt);
681 if (count >= 1) {
683 /*
684 * Parse MADT LAPIC entries
685 */
686 error = acpi_parse_madt_lapic_entries();
687 if (!error) {
688 acpi_lapic = 1;
689 generic_bigsmp_probe();
691 /*
692 * Parse MADT IO-APIC entries
693 */
694 error = acpi_parse_madt_ioapic_entries();
695 if (!error) {
696 acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
697 acpi_irq_balance_set(NULL);
698 acpi_ioapic = 1;
700 smp_found_config = 1;
701 clustered_apic_check();
702 }
703 }
704 if (error == -EINVAL) {
705 /*
706 * Dell Precision Workstation 410, 610 come here.
707 */
708 printk(KERN_ERR PREFIX
709 "Invalid BIOS MADT, disabling ACPI\n");
710 disable_acpi();
711 }
712 }
713 #endif
714 return;
715 }
717 extern int acpi_force;
719 #ifdef __i386__
721 static int __init disable_acpi_irq(struct dmi_system_id *d)
722 {
723 if (!acpi_force) {
724 printk(KERN_NOTICE "%s detected: force use of acpi=noirq\n",
725 d->ident);
726 acpi_noirq_set();
727 }
728 return 0;
729 }
731 static int __init disable_acpi_pci(struct dmi_system_id *d)
732 {
733 if (!acpi_force) {
734 printk(KERN_NOTICE "%s detected: force use of pci=noacpi\n",
735 d->ident);
736 /*acpi_disable_pci();*/
737 }
738 return 0;
739 }
741 static int __init dmi_disable_acpi(struct dmi_system_id *d)
742 {
743 if (!acpi_force) {
744 printk(KERN_NOTICE "%s detected: acpi off\n", d->ident);
745 disable_acpi();
746 } else {
747 printk(KERN_NOTICE
748 "Warning: DMI blacklist says broken, but acpi forced\n");
749 }
750 return 0;
751 }
753 /*
754 * Limit ACPI to CPU enumeration for HT
755 */
756 static int __init force_acpi_ht(struct dmi_system_id *d)
757 {
758 if (!acpi_force) {
759 printk(KERN_NOTICE "%s detected: force use of acpi=ht\n",
760 d->ident);
761 disable_acpi();
762 acpi_ht = 1;
763 } else {
764 printk(KERN_NOTICE
765 "Warning: acpi=force overrules DMI blacklist: acpi=ht\n");
766 }
767 return 0;
768 }
770 /*
771 * If your system is blacklisted here, but you find that acpi=force
772 * works for you, please contact acpi-devel@sourceforge.net
773 */
774 static struct dmi_system_id __initdata acpi_dmi_table[] = {
775 /*
776 * Boxes that need ACPI disabled
777 */
778 {
779 .callback = dmi_disable_acpi,
780 .ident = "IBM Thinkpad",
781 .matches = {
782 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
783 DMI_MATCH(DMI_BOARD_NAME, "2629H1G"),
784 },
785 },
787 /*
788 * Boxes that need acpi=ht
789 */
790 {
791 .callback = force_acpi_ht,
792 .ident = "FSC Primergy T850",
793 .matches = {
794 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
795 DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"),
796 },
797 },
798 {
799 .callback = force_acpi_ht,
800 .ident = "DELL GX240",
801 .matches = {
802 DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"),
803 DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"),
804 },
805 },
806 {
807 .callback = force_acpi_ht,
808 .ident = "HP VISUALIZE NT Workstation",
809 .matches = {
810 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
811 DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"),
812 },
813 },
814 {
815 .callback = force_acpi_ht,
816 .ident = "Compaq Workstation W8000",
817 .matches = {
818 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
819 DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"),
820 },
821 },
822 {
823 .callback = force_acpi_ht,
824 .ident = "ASUS P4B266",
825 .matches = {
826 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
827 DMI_MATCH(DMI_BOARD_NAME, "P4B266"),
828 },
829 },
830 {
831 .callback = force_acpi_ht,
832 .ident = "ASUS P2B-DS",
833 .matches = {
834 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
835 DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"),
836 },
837 },
838 {
839 .callback = force_acpi_ht,
840 .ident = "ASUS CUR-DLS",
841 .matches = {
842 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
843 DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"),
844 },
845 },
846 {
847 .callback = force_acpi_ht,
848 .ident = "ABIT i440BX-W83977",
849 .matches = {
850 DMI_MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"),
851 DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"),
852 },
853 },
854 {
855 .callback = force_acpi_ht,
856 .ident = "IBM Bladecenter",
857 .matches = {
858 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
859 DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"),
860 },
861 },
862 {
863 .callback = force_acpi_ht,
864 .ident = "IBM eServer xSeries 360",
865 .matches = {
866 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
867 DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"),
868 },
869 },
870 {
871 .callback = force_acpi_ht,
872 .ident = "IBM eserver xSeries 330",
873 .matches = {
874 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
875 DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"),
876 },
877 },
878 {
879 .callback = force_acpi_ht,
880 .ident = "IBM eserver xSeries 440",
881 .matches = {
882 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
883 DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"),
884 },
885 },
887 /*
888 * Boxes that need ACPI PCI IRQ routing disabled
889 */
890 {
891 .callback = disable_acpi_irq,
892 .ident = "ASUS A7V",
893 .matches = {
894 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
895 DMI_MATCH(DMI_BOARD_NAME, "<A7V>"),
896 /* newer BIOS, Revision 1011, does work */
897 DMI_MATCH(DMI_BIOS_VERSION,
898 "ASUS A7V ACPI BIOS Revision 1007"),
899 },
900 },
902 /*
903 * Boxes that need ACPI PCI IRQ routing and PCI scan disabled
904 */
905 { /* _BBN 0 bug */
906 .callback = disable_acpi_pci,
907 .ident = "ASUS PR-DLS",
908 .matches = {
909 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
910 DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"),
911 DMI_MATCH(DMI_BIOS_VERSION,
912 "ASUS PR-DLS ACPI BIOS Revision 1010"),
913 DMI_MATCH(DMI_BIOS_DATE, "03/21/2003")
914 },
915 },
916 {
917 .callback = disable_acpi_pci,
918 .ident = "Acer TravelMate 36x Laptop",
919 .matches = {
920 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
921 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
922 },
923 },
924 {}
925 };
927 #endif /* __i386__ */
929 /*
930 * acpi_boot_table_init() and acpi_boot_init()
931 * called from setup_arch(), always.
932 * 1. checksums all tables
933 * 2. enumerates lapics
934 * 3. enumerates io-apics
935 *
936 * acpi_table_init() is separate to allow reading SRAT without
937 * other side effects.
938 *
939 * side effects of acpi_boot_init:
940 * acpi_lapic = 1 if LAPIC found
941 * acpi_ioapic = 1 if IOAPIC found
942 * if (acpi_lapic && acpi_ioapic) smp_found_config = 1;
943 * if acpi_blacklisted() acpi_disabled = 1;
944 * acpi_irq_model=...
945 * ...
946 *
947 * return value: (currently ignored)
948 * 0: success
949 * !0: failure
950 */
952 int __init acpi_boot_table_init(void)
953 {
954 int error;
956 #ifdef __i386__
957 dmi_check_system(acpi_dmi_table);
958 #endif
960 /*
961 * If acpi_disabled, bail out
962 * One exception: acpi=ht continues far enough to enumerate LAPICs
963 */
964 if (acpi_disabled && !acpi_ht)
965 return 1;
967 /*
968 * Initialize the ACPI boot-time table parser.
969 */
970 error = acpi_table_init();
971 if (error) {
972 disable_acpi();
973 return error;
974 }
976 acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
978 /*
979 * blacklist may disable ACPI entirely
980 */
981 error = acpi_blacklisted();
982 if (error) {
983 extern int acpi_force;
985 if (acpi_force) {
986 printk(KERN_WARNING PREFIX "acpi=force override\n");
987 } else {
988 printk(KERN_WARNING PREFIX "Disabling ACPI support\n");
989 disable_acpi();
990 return error;
991 }
992 }
994 return 0;
995 }
997 int __init acpi_boot_init(void)
998 {
999 /*
1000 * If acpi_disabled, bail out
1001 * One exception: acpi=ht continues far enough to enumerate LAPICs
1002 */
1003 if (acpi_disabled && !acpi_ht)
1004 return 1;
1006 acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
1008 /*
1009 * set sci_int and PM timer address
1010 */
1011 acpi_table_parse(ACPI_FADT, acpi_parse_fadt);
1013 /*
1014 * Process the Multiple APIC Description Table (MADT), if present
1015 */
1016 acpi_process_madt();
1018 acpi_table_parse(ACPI_HPET, acpi_parse_hpet);
1020 return 0;