debuggers.hg

view xen/arch/x86/acpi/boot.c @ 21038:92984e102687

x86/acpi: Add a missing CR in printk

Signed-off-by: Wei Gang <gang.wei@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 02 13:43:48 2010 +0000 (2010-03-02)
parents f6d7b66fdb80
children fedab6367c9a
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 <asm/processor.h>
40 #ifdef CONFIG_HPET_TIMER
41 #include <asm/hpet.h> /* for hpet_address */
42 #endif
43 #include <mach_apic.h>
44 #include <mach_mpparse.h>
46 int sbf_port;
47 #define CONFIG_ACPI_PCI
49 #define BAD_MADT_ENTRY(entry, end) ( \
50 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
51 ((struct acpi_subtable_header *)entry)->length != sizeof(*entry))
53 #define PREFIX "ACPI: "
55 #ifdef CONFIG_ACPI_PCI
56 int acpi_noirq __initdata; /* skip ACPI IRQ initialization */
57 int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */
58 #else
59 int acpi_noirq __initdata = 1;
60 int acpi_pci_disabled __initdata = 1;
61 #endif
62 int acpi_ht __initdata = 1; /* enable HT */
64 int acpi_lapic;
65 int acpi_ioapic;
66 int acpi_strict;
67 EXPORT_SYMBOL(acpi_strict);
69 u8 acpi_sci_flags __initdata;
70 int acpi_sci_override_gsi __initdata;
71 int acpi_skip_timer_override __initdata;
73 #ifdef CONFIG_X86_LOCAL_APIC
74 static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
75 #endif
77 u32 acpi_smi_cmd;
78 u8 acpi_enable_value, acpi_disable_value;
80 #ifndef __HAVE_ARCH_CMPXCHG
81 #warning ACPI uses CMPXCHG, i486 and later hardware
82 #endif
84 u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
85 {[0 ... MAX_MADT_ENTRIES - 1] = 0xff };
86 EXPORT_SYMBOL(x86_acpiid_to_apicid);
88 /* --------------------------------------------------------------------------
89 Boot-time Configuration
90 -------------------------------------------------------------------------- */
92 /*
93 * The default interrupt routing model is PIC (8259). This gets
94 * overriden if IOAPICs are enumerated (below).
95 */
96 enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
98 /*
99 * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
100 * to map the target physical address. The problem is that set_fixmap()
101 * provides a single page, and it is possible that the page is not
102 * sufficient.
103 * By using this area, we can map up to MAX_IO_APICS pages temporarily,
104 * i.e. until the next __va_range() call.
105 *
106 * Important Safety Note: The fixed I/O APIC page numbers are *subtracted*
107 * from the fixed base. That's why we start at FIX_IO_APIC_BASE_END and
108 * count idx down while incrementing the phys address.
109 */
110 char *__acpi_map_table(unsigned long phys, unsigned long size)
111 {
112 unsigned long base, offset, mapped_size;
113 int idx;
115 /* XEN: RAM holes above 1MB are not permanently mapped. */
116 if ((phys + size) <= (1 * 1024 * 1024))
117 return __va(phys);
119 offset = phys & (PAGE_SIZE - 1);
120 mapped_size = PAGE_SIZE - offset;
121 set_fixmap(FIX_ACPI_END, phys);
122 base = fix_to_virt(FIX_ACPI_END);
124 /*
125 * Most cases can be covered by the below.
126 */
127 idx = FIX_ACPI_END;
128 while (mapped_size < size) {
129 if (--idx < FIX_ACPI_BEGIN)
130 return NULL; /* cannot handle this */
131 phys += PAGE_SIZE;
132 set_fixmap(idx, phys);
133 mapped_size += PAGE_SIZE;
134 }
136 return ((char *) base + offset);
137 }
139 #ifdef CONFIG_X86_LOCAL_APIC
140 static int __init acpi_parse_madt(struct acpi_table_header *table)
141 {
142 struct acpi_table_madt *madt;
144 madt = (struct acpi_table_madt *)table;
146 if (madt->address) {
147 acpi_lapic_addr = (u64) madt->address;
149 printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
150 madt->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(struct acpi_subtable_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(struct acpi_subtable_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(struct acpi_subtable_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(struct acpi_subtable_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(struct acpi_subtable_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(struct acpi_subtable_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 int __init acpi_parse_sbf(struct acpi_table_header *table)
289 {
290 struct acpi_table_boot *sb;
292 sb = (struct acpi_table_boot *)table;
293 if (!sb) {
294 printk(KERN_WARNING PREFIX "Unable to map SBF\n");
295 return -ENODEV;
296 }
298 sbf_port = sb->cmos_index; /* Save CMOS port */
300 return 0;
301 }
303 #ifdef CONFIG_HPET_TIMER
305 static int __init acpi_parse_hpet(struct acpi_table_header *table)
306 {
307 struct acpi_table_hpet *hpet_tbl = (struct acpi_table_hpet *)table;
309 if (hpet_tbl->address.space_id != ACPI_SPACE_MEM) {
310 printk(KERN_WARNING PREFIX "HPET timers must be located in "
311 "memory.\n");
312 return -1;
313 }
315 #if 0/*def CONFIG_X86_64*/
316 vxtime.hpet_address = hpet_tbl->address.address;
318 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
319 hpet_tbl->id, vxtime.hpet_address);
320 #else /* X86 */
321 {
322 hpet_address = hpet_tbl->address.address;
323 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
324 hpet_tbl->id, hpet_address);
325 }
326 #endif /* X86 */
328 return 0;
329 }
330 #else
331 #define acpi_parse_hpet NULL
332 #endif
334 #ifdef CONFIG_ACPI_SLEEP
335 #define acpi_fadt_copy_address(dst, src, len) do { \
336 if (fadt->header.revision >= FADT2_REVISION_ID) \
337 acpi_sinfo.dst##_blk = fadt->x##src##_block; \
338 if (!acpi_sinfo.dst##_blk.address) { \
339 acpi_sinfo.dst##_blk.address = fadt->src##_block; \
340 acpi_sinfo.dst##_blk.space_id = ACPI_ADR_SPACE_SYSTEM_IO; \
341 acpi_sinfo.dst##_blk.bit_width = fadt->len##_length << 3; \
342 acpi_sinfo.dst##_blk.bit_offset = 0; \
343 acpi_sinfo.dst##_blk.access_width = 0; \
344 } \
345 } while (0)
347 /* Get pm1x_cnt and pm1x_evt information for ACPI sleep */
348 static void __init
349 acpi_fadt_parse_sleep_info(struct acpi_table_fadt *fadt)
350 {
351 struct acpi_table_facs *facs = NULL;
352 uint64_t facs_pa;
354 acpi_fadt_copy_address(pm1a_cnt, pm1a_control, pm1_control);
355 acpi_fadt_copy_address(pm1b_cnt, pm1b_control, pm1_control);
356 acpi_fadt_copy_address(pm1a_evt, pm1a_event, pm1_event);
357 acpi_fadt_copy_address(pm1b_evt, pm1b_event, pm1_event);
359 printk(KERN_INFO PREFIX
360 "ACPI SLEEP INFO: pm1x_cnt[%"PRIx64",%"PRIx64"], "
361 "pm1x_evt[%"PRIx64",%"PRIx64"]\n",
362 acpi_sinfo.pm1a_cnt_blk.address,
363 acpi_sinfo.pm1b_cnt_blk.address,
364 acpi_sinfo.pm1a_evt_blk.address,
365 acpi_sinfo.pm1b_evt_blk.address);
367 /* Now FACS... */
368 facs_pa = ((fadt->header.revision >= FADT2_REVISION_ID)
369 ? fadt->Xfacs : (uint64_t)fadt->facs);
370 if (fadt->facs && ((uint64_t)fadt->facs != facs_pa)) {
371 printk(KERN_WARNING PREFIX
372 "32/64X FACS address mismatch in FADT - "
373 "%08x/%016"PRIx64", using 32\n",
374 fadt->facs, facs_pa);
375 facs_pa = (uint64_t)fadt->facs;
376 }
378 facs = (struct acpi_table_facs *)
379 __acpi_map_table(facs_pa, sizeof(struct acpi_table_facs));
380 if (!facs)
381 goto bad;
383 if (strncmp(facs->signature, "FACS", 4)) {
384 printk(KERN_ERR PREFIX "Invalid FACS signature %.4s\n",
385 facs->signature);
386 goto bad;
387 }
389 if (facs->length < 24) {
390 printk(KERN_ERR PREFIX "Invalid FACS table length: 0x%x",
391 facs->length);
392 goto bad;
393 }
395 if (facs->length < 64)
396 printk(KERN_WARNING PREFIX
397 "FACS is shorter than ACPI spec allow: 0x%x",
398 facs->length);
400 acpi_sinfo.wakeup_vector = facs_pa +
401 offsetof(struct acpi_table_facs, firmware_waking_vector);
402 acpi_sinfo.vector_width = 32;
404 printk(KERN_INFO PREFIX
405 " wakeup_vec[%"PRIx64"], vec_size[%x]\n",
406 acpi_sinfo.wakeup_vector, acpi_sinfo.vector_width);
407 return;
408 bad:
409 memset(&acpi_sinfo, 0, sizeof(acpi_sinfo));
410 }
411 #endif
413 static int __init acpi_parse_fadt(struct acpi_table_header *table)
414 {
415 struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table;
417 #ifdef CONFIG_ACPI_INTERPRETER
418 /* initialize sci_int early for INT_SRC_OVR MADT parsing */
419 acpi_fadt.sci_int = fadt->sci_int;
421 /* initialize rev and apic_phys_dest_mode for x86_64 genapic */
422 acpi_fadt.revision = fadt->revision;
423 acpi_fadt.force_apic_physical_destination_mode =
424 fadt->force_apic_physical_destination_mode;
425 #endif
427 #ifdef CONFIG_X86_PM_TIMER
428 /* detect the location of the ACPI PM Timer */
429 if (fadt->header.revision >= FADT2_REVISION_ID) {
430 /* FADT rev. 2 */
431 if (fadt->xpm_timer_block.space_id ==
432 ACPI_ADR_SPACE_SYSTEM_IO)
433 pmtmr_ioport = fadt->xpm_timer_block.address;
434 /*
435 * "X" fields are optional extensions to the original V1.0
436 * fields, so we must selectively expand V1.0 fields if the
437 * corresponding X field is zero.
438 */
439 if (!pmtmr_ioport)
440 pmtmr_ioport = fadt->pm_timer_block;
441 } else {
442 /* FADT rev. 1 */
443 pmtmr_ioport = fadt->pm_timer_block;
444 }
445 if (pmtmr_ioport)
446 printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
447 pmtmr_ioport);
448 #endif
450 acpi_smi_cmd = fadt->smi_command;
451 acpi_enable_value = fadt->acpi_enable;
452 acpi_disable_value = fadt->acpi_disable;
454 #ifdef CONFIG_ACPI_SLEEP
455 acpi_fadt_parse_sleep_info(fadt);
456 #endif
458 return 0;
459 }
461 #ifdef CONFIG_X86_LOCAL_APIC
462 /*
463 * Parse LAPIC entries in MADT
464 * returns 0 on success, < 0 on error
465 */
466 static int __init acpi_parse_madt_lapic_entries(void)
467 {
468 int count;
470 if (!cpu_has_apic)
471 return -ENODEV;
473 /*
474 * Note that the LAPIC address is obtained from the MADT (32-bit value)
475 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
476 */
478 count =
479 acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
480 acpi_parse_lapic_addr_ovr, 0);
481 if (count < 0) {
482 printk(KERN_ERR PREFIX
483 "Error parsing LAPIC address override entry\n");
484 return count;
485 }
487 mp_register_lapic_address(acpi_lapic_addr);
489 count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
490 MAX_APICS);
491 if (!count) {
492 printk(KERN_ERR PREFIX "No LAPIC entries present\n");
493 /* TBD: Cleanup to allow fallback to MPS */
494 return -ENODEV;
495 } else if (count < 0) {
496 printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
497 /* TBD: Cleanup to allow fallback to MPS */
498 return count;
499 }
501 count =
502 acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
503 if (count < 0) {
504 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
505 /* TBD: Cleanup to allow fallback to MPS */
506 return count;
507 }
508 return 0;
509 }
510 #endif /* CONFIG_X86_LOCAL_APIC */
512 #if defined(CONFIG_X86_IO_APIC) /*&& defined(CONFIG_ACPI_INTERPRETER)*/
513 /*
514 * Parse IOAPIC related entries in MADT
515 * returns 0 on success, < 0 on error
516 */
517 static int __init acpi_parse_madt_ioapic_entries(void)
518 {
519 int count;
521 /*
522 * ACPI interpreter is required to complete interrupt setup,
523 * so if it is off, don't enumerate the io-apics with ACPI.
524 * If MPS is present, it will handle them,
525 * otherwise the system will stay in PIC mode
526 */
527 if (acpi_disabled || acpi_noirq) {
528 return -ENODEV;
529 }
531 if (!cpu_has_apic)
532 return -ENODEV;
534 /*
535 * if "noapic" boot option, don't look for IO-APICs
536 */
537 if (skip_ioapic_setup) {
538 printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
539 "due to 'noapic' option.\n");
540 return -ENODEV;
541 }
543 count =
544 acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic,
545 MAX_IO_APICS);
546 if (!count) {
547 printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
548 return -ENODEV;
549 } else if (count < 0) {
550 printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
551 return count;
552 }
554 count =
555 acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr,
556 MAX_IRQ_SOURCES);
557 if (count < 0) {
558 printk(KERN_ERR PREFIX
559 "Error parsing interrupt source overrides entry\n");
560 /* TBD: Cleanup to allow fallback to MPS */
561 return count;
562 }
564 #ifdef CONFIG_ACPI_INTERPRETER
565 /*
566 * If BIOS did not supply an INT_SRC_OVR for the SCI
567 * pretend we got one so we can set the SCI flags.
568 */
569 if (!acpi_sci_override_gsi)
570 acpi_sci_ioapic_setup(acpi_fadt.sci_int, 0, 0);
571 #endif
573 /* Fill in identity legacy mapings where no override */
574 mp_config_acpi_legacy_irqs();
576 count =
577 acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
578 MAX_IRQ_SOURCES);
579 if (count < 0) {
580 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
581 /* TBD: Cleanup to allow fallback to MPS */
582 return count;
583 }
585 return 0;
586 }
587 #else
588 static inline int acpi_parse_madt_ioapic_entries(void)
589 {
590 return -1;
591 }
592 #endif /* !(CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER) */
595 static void __init acpi_process_madt(void)
596 {
597 #ifdef CONFIG_X86_LOCAL_APIC
598 int error;
600 if (!acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)) {
602 /*
603 * Parse MADT LAPIC entries
604 */
605 error = acpi_parse_madt_lapic_entries();
606 if (!error) {
607 acpi_lapic = 1;
608 generic_bigsmp_probe();
610 /*
611 * Parse MADT IO-APIC entries
612 */
613 error = acpi_parse_madt_ioapic_entries();
614 if (!error) {
615 acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
616 acpi_irq_balance_set(NULL);
617 acpi_ioapic = 1;
619 smp_found_config = 1;
620 clustered_apic_check();
621 }
622 }
623 if (error == -EINVAL) {
624 /*
625 * Dell Precision Workstation 410, 610 come here.
626 */
627 printk(KERN_ERR PREFIX
628 "Invalid BIOS MADT, disabling ACPI\n");
629 disable_acpi();
630 }
631 }
632 #endif
633 return;
634 }
636 extern int acpi_force;
638 #ifdef __i386__
640 static int __init disable_acpi_irq(struct dmi_system_id *d)
641 {
642 if (!acpi_force) {
643 printk(KERN_NOTICE "%s detected: force use of acpi=noirq\n",
644 d->ident);
645 acpi_noirq_set();
646 }
647 return 0;
648 }
650 static int __init disable_acpi_pci(struct dmi_system_id *d)
651 {
652 if (!acpi_force) {
653 printk(KERN_NOTICE "%s detected: force use of pci=noacpi\n",
654 d->ident);
655 /*acpi_disable_pci();*/
656 }
657 return 0;
658 }
660 static int __init dmi_disable_acpi(struct dmi_system_id *d)
661 {
662 if (!acpi_force) {
663 printk(KERN_NOTICE "%s detected: acpi off\n", d->ident);
664 disable_acpi();
665 } else {
666 printk(KERN_NOTICE
667 "Warning: DMI blacklist says broken, but acpi forced\n");
668 }
669 return 0;
670 }
672 /*
673 * Limit ACPI to CPU enumeration for HT
674 */
675 static int __init force_acpi_ht(struct dmi_system_id *d)
676 {
677 if (!acpi_force) {
678 printk(KERN_NOTICE "%s detected: force use of acpi=ht\n",
679 d->ident);
680 disable_acpi();
681 acpi_ht = 1;
682 } else {
683 printk(KERN_NOTICE
684 "Warning: acpi=force overrules DMI blacklist: acpi=ht\n");
685 }
686 return 0;
687 }
689 /*
690 * If your system is blacklisted here, but you find that acpi=force
691 * works for you, please contact acpi-devel@sourceforge.net
692 */
693 static struct dmi_system_id __initdata acpi_dmi_table[] = {
694 /*
695 * Boxes that need ACPI disabled
696 */
697 {
698 .callback = dmi_disable_acpi,
699 .ident = "IBM Thinkpad",
700 .matches = {
701 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
702 DMI_MATCH(DMI_BOARD_NAME, "2629H1G"),
703 },
704 },
706 /*
707 * Boxes that need acpi=ht
708 */
709 {
710 .callback = force_acpi_ht,
711 .ident = "FSC Primergy T850",
712 .matches = {
713 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
714 DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"),
715 },
716 },
717 {
718 .callback = force_acpi_ht,
719 .ident = "DELL GX240",
720 .matches = {
721 DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"),
722 DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"),
723 },
724 },
725 {
726 .callback = force_acpi_ht,
727 .ident = "HP VISUALIZE NT Workstation",
728 .matches = {
729 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
730 DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"),
731 },
732 },
733 {
734 .callback = force_acpi_ht,
735 .ident = "Compaq Workstation W8000",
736 .matches = {
737 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
738 DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"),
739 },
740 },
741 {
742 .callback = force_acpi_ht,
743 .ident = "ASUS P4B266",
744 .matches = {
745 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
746 DMI_MATCH(DMI_BOARD_NAME, "P4B266"),
747 },
748 },
749 {
750 .callback = force_acpi_ht,
751 .ident = "ASUS P2B-DS",
752 .matches = {
753 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
754 DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"),
755 },
756 },
757 {
758 .callback = force_acpi_ht,
759 .ident = "ASUS CUR-DLS",
760 .matches = {
761 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
762 DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"),
763 },
764 },
765 {
766 .callback = force_acpi_ht,
767 .ident = "ABIT i440BX-W83977",
768 .matches = {
769 DMI_MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"),
770 DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"),
771 },
772 },
773 {
774 .callback = force_acpi_ht,
775 .ident = "IBM Bladecenter",
776 .matches = {
777 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
778 DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"),
779 },
780 },
781 {
782 .callback = force_acpi_ht,
783 .ident = "IBM eServer xSeries 360",
784 .matches = {
785 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
786 DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"),
787 },
788 },
789 {
790 .callback = force_acpi_ht,
791 .ident = "IBM eserver xSeries 330",
792 .matches = {
793 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
794 DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"),
795 },
796 },
797 {
798 .callback = force_acpi_ht,
799 .ident = "IBM eserver xSeries 440",
800 .matches = {
801 DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
802 DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"),
803 },
804 },
806 /*
807 * Boxes that need ACPI PCI IRQ routing disabled
808 */
809 {
810 .callback = disable_acpi_irq,
811 .ident = "ASUS A7V",
812 .matches = {
813 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
814 DMI_MATCH(DMI_BOARD_NAME, "<A7V>"),
815 /* newer BIOS, Revision 1011, does work */
816 DMI_MATCH(DMI_BIOS_VERSION,
817 "ASUS A7V ACPI BIOS Revision 1007"),
818 },
819 },
821 /*
822 * Boxes that need ACPI PCI IRQ routing and PCI scan disabled
823 */
824 { /* _BBN 0 bug */
825 .callback = disable_acpi_pci,
826 .ident = "ASUS PR-DLS",
827 .matches = {
828 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
829 DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"),
830 DMI_MATCH(DMI_BIOS_VERSION,
831 "ASUS PR-DLS ACPI BIOS Revision 1010"),
832 DMI_MATCH(DMI_BIOS_DATE, "03/21/2003")
833 },
834 },
835 {
836 .callback = disable_acpi_pci,
837 .ident = "Acer TravelMate 36x Laptop",
838 .matches = {
839 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
840 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
841 },
842 },
843 {}
844 };
846 #endif /* __i386__ */
848 /*
849 * acpi_boot_table_init() and acpi_boot_init()
850 * called from setup_arch(), always.
851 * 1. checksums all tables
852 * 2. enumerates lapics
853 * 3. enumerates io-apics
854 *
855 * acpi_table_init() is separate to allow reading SRAT without
856 * other side effects.
857 *
858 * side effects of acpi_boot_init:
859 * acpi_lapic = 1 if LAPIC found
860 * acpi_ioapic = 1 if IOAPIC found
861 * if (acpi_lapic && acpi_ioapic) smp_found_config = 1;
862 * if acpi_blacklisted() acpi_disabled = 1;
863 * acpi_irq_model=...
864 * ...
865 *
866 * return value: (currently ignored)
867 * 0: success
868 * !0: failure
869 */
871 int __init acpi_boot_table_init(void)
872 {
873 int error;
875 #ifdef __i386__
876 dmi_check_system(acpi_dmi_table);
877 #endif
879 /*
880 * If acpi_disabled, bail out
881 * One exception: acpi=ht continues far enough to enumerate LAPICs
882 */
883 if (acpi_disabled && !acpi_ht)
884 return 1;
886 /*
887 * Initialize the ACPI boot-time table parser.
888 */
889 error = acpi_table_init();
890 if (error) {
891 disable_acpi();
892 return error;
893 }
895 acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
897 /*
898 * blacklist may disable ACPI entirely
899 */
900 error = acpi_blacklisted();
901 if (error) {
902 if (acpi_force) {
903 printk(KERN_WARNING PREFIX "acpi=force override\n");
904 } else {
905 printk(KERN_WARNING PREFIX "Disabling ACPI support\n");
906 disable_acpi();
907 return error;
908 }
909 }
911 return 0;
912 }
914 int __init acpi_boot_init(void)
915 {
916 /*
917 * If acpi_disabled, bail out
918 * One exception: acpi=ht continues far enough to enumerate LAPICs
919 */
920 if (acpi_disabled && !acpi_ht)
921 return 1;
923 acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
925 /*
926 * set sci_int and PM timer address
927 */
928 acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt);
930 /*
931 * Process the Multiple APIC Description Table (MADT), if present
932 */
933 acpi_process_madt();
935 acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
937 acpi_dmar_init();
939 acpi_mmcfg_init();
941 return 0;
942 }
944 unsigned int acpi_get_processor_id(unsigned int cpu)
945 {
946 unsigned int acpiid, apicid;
948 if ((apicid = x86_cpu_to_apicid[cpu]) == 0xff)
949 return 0xff;
951 for (acpiid = 0; acpiid < ARRAY_SIZE(x86_acpiid_to_apicid); acpiid++)
952 if (x86_acpiid_to_apicid[acpiid] == apicid)
953 return acpiid;
955 return 0xff;
956 }