aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/acpi/boot.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel/acpi/boot.c')
-rw-r--r--arch/i386/kernel/acpi/boot.c249
1 files changed, 98 insertions, 151 deletions
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index cbcb2c27f48b..e5eb97a910ed 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -25,6 +25,7 @@
25 25
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/acpi.h> 27#include <linux/acpi.h>
28#include <linux/acpi_pmtmr.h>
28#include <linux/efi.h> 29#include <linux/efi.h>
29#include <linux/cpumask.h> 30#include <linux/cpumask.h>
30#include <linux/module.h> 31#include <linux/module.h>
@@ -66,7 +67,7 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) { return
66 67
67#define BAD_MADT_ENTRY(entry, end) ( \ 68#define BAD_MADT_ENTRY(entry, end) ( \
68 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ 69 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
69 ((acpi_table_entry_header *)entry)->length < sizeof(*entry)) 70 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
70 71
71#define PREFIX "ACPI: " 72#define PREFIX "ACPI: "
72 73
@@ -79,7 +80,7 @@ int acpi_ioapic;
79int acpi_strict; 80int acpi_strict;
80EXPORT_SYMBOL(acpi_strict); 81EXPORT_SYMBOL(acpi_strict);
81 82
82acpi_interrupt_flags acpi_sci_flags __initdata; 83u8 acpi_sci_flags __initdata;
83int acpi_sci_override_gsi __initdata; 84int acpi_sci_override_gsi __initdata;
84int acpi_skip_timer_override __initdata; 85int acpi_skip_timer_override __initdata;
85int acpi_use_timer_override __initdata; 86int acpi_use_timer_override __initdata;
@@ -92,11 +93,6 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
92#warning ACPI uses CMPXCHG, i486 and later hardware 93#warning ACPI uses CMPXCHG, i486 and later hardware
93#endif 94#endif
94 95
95#define MAX_MADT_ENTRIES 256
96u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
97 {[0 ... MAX_MADT_ENTRIES - 1] = 0xff };
98EXPORT_SYMBOL(x86_acpiid_to_apicid);
99
100/* -------------------------------------------------------------------------- 96/* --------------------------------------------------------------------------
101 Boot-time Configuration 97 Boot-time Configuration
102 -------------------------------------------------------------------------- */ 98 -------------------------------------------------------------------------- */
@@ -166,30 +162,26 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
166 162
167#ifdef CONFIG_PCI_MMCONFIG 163#ifdef CONFIG_PCI_MMCONFIG
168/* The physical address of the MMCONFIG aperture. Set from ACPI tables. */ 164/* The physical address of the MMCONFIG aperture. Set from ACPI tables. */
169struct acpi_table_mcfg_config *pci_mmcfg_config; 165struct acpi_mcfg_allocation *pci_mmcfg_config;
170int pci_mmcfg_config_num; 166int pci_mmcfg_config_num;
171 167
172int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size) 168int __init acpi_parse_mcfg(struct acpi_table_header *header)
173{ 169{
174 struct acpi_table_mcfg *mcfg; 170 struct acpi_table_mcfg *mcfg;
175 unsigned long i; 171 unsigned long i;
176 int config_size; 172 int config_size;
177 173
178 if (!phys_addr || !size) 174 if (!header)
179 return -EINVAL; 175 return -EINVAL;
180 176
181 mcfg = (struct acpi_table_mcfg *)__acpi_map_table(phys_addr, size); 177 mcfg = (struct acpi_table_mcfg *)header;
182 if (!mcfg) {
183 printk(KERN_WARNING PREFIX "Unable to map MCFG\n");
184 return -ENODEV;
185 }
186 178
187 /* how many config structures do we have */ 179 /* how many config structures do we have */
188 pci_mmcfg_config_num = 0; 180 pci_mmcfg_config_num = 0;
189 i = size - sizeof(struct acpi_table_mcfg); 181 i = header->length - sizeof(struct acpi_table_mcfg);
190 while (i >= sizeof(struct acpi_table_mcfg_config)) { 182 while (i >= sizeof(struct acpi_mcfg_allocation)) {
191 ++pci_mmcfg_config_num; 183 ++pci_mmcfg_config_num;
192 i -= sizeof(struct acpi_table_mcfg_config); 184 i -= sizeof(struct acpi_mcfg_allocation);
193 }; 185 };
194 if (pci_mmcfg_config_num == 0) { 186 if (pci_mmcfg_config_num == 0) {
195 printk(KERN_ERR PREFIX "MMCONFIG has no entries\n"); 187 printk(KERN_ERR PREFIX "MMCONFIG has no entries\n");
@@ -204,9 +196,9 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
204 return -ENOMEM; 196 return -ENOMEM;
205 } 197 }
206 198
207 memcpy(pci_mmcfg_config, &mcfg->config, config_size); 199 memcpy(pci_mmcfg_config, &mcfg[1], config_size);
208 for (i = 0; i < pci_mmcfg_config_num; ++i) { 200 for (i = 0; i < pci_mmcfg_config_num; ++i) {
209 if (mcfg->config[i].base_reserved) { 201 if (pci_mmcfg_config[i].address > 0xFFFFFFFF) {
210 printk(KERN_ERR PREFIX 202 printk(KERN_ERR PREFIX
211 "MMCONFIG not in low 4GB of memory\n"); 203 "MMCONFIG not in low 4GB of memory\n");
212 kfree(pci_mmcfg_config); 204 kfree(pci_mmcfg_config);
@@ -220,24 +212,24 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
220#endif /* CONFIG_PCI_MMCONFIG */ 212#endif /* CONFIG_PCI_MMCONFIG */
221 213
222#ifdef CONFIG_X86_LOCAL_APIC 214#ifdef CONFIG_X86_LOCAL_APIC
223static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size) 215static int __init acpi_parse_madt(struct acpi_table_header *table)
224{ 216{
225 struct acpi_table_madt *madt = NULL; 217 struct acpi_table_madt *madt = NULL;
226 218
227 if (!phys_addr || !size || !cpu_has_apic) 219 if (!cpu_has_apic)
228 return -EINVAL; 220 return -EINVAL;
229 221
230 madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size); 222 madt = (struct acpi_table_madt *)table;
231 if (!madt) { 223 if (!madt) {
232 printk(KERN_WARNING PREFIX "Unable to map MADT\n"); 224 printk(KERN_WARNING PREFIX "Unable to map MADT\n");
233 return -ENODEV; 225 return -ENODEV;
234 } 226 }
235 227
236 if (madt->lapic_address) { 228 if (madt->address) {
237 acpi_lapic_addr = (u64) madt->lapic_address; 229 acpi_lapic_addr = (u64) madt->address;
238 230
239 printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n", 231 printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
240 madt->lapic_address); 232 madt->address);
241 } 233 }
242 234
243 acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id); 235 acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
@@ -246,21 +238,17 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
246} 238}
247 239
248static int __init 240static int __init
249acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end) 241acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end)
250{ 242{
251 struct acpi_table_lapic *processor = NULL; 243 struct acpi_madt_local_apic *processor = NULL;
252 244
253 processor = (struct acpi_table_lapic *)header; 245 processor = (struct acpi_madt_local_apic *)header;
254 246
255 if (BAD_MADT_ENTRY(processor, end)) 247 if (BAD_MADT_ENTRY(processor, end))
256 return -EINVAL; 248 return -EINVAL;
257 249
258 acpi_table_print_madt_entry(header); 250 acpi_table_print_madt_entry(header);
259 251
260 /* Record local apic id only when enabled */
261 if (processor->flags.enabled)
262 x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
263
264 /* 252 /*
265 * We need to register disabled CPU as well to permit 253 * We need to register disabled CPU as well to permit
266 * counting disabled CPUs. This allows us to size 254 * counting disabled CPUs. This allows us to size
@@ -269,18 +257,18 @@ acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
269 * when we use CPU hotplug. 257 * when we use CPU hotplug.
270 */ 258 */
271 mp_register_lapic(processor->id, /* APIC ID */ 259 mp_register_lapic(processor->id, /* APIC ID */
272 processor->flags.enabled); /* Enabled? */ 260 processor->lapic_flags & ACPI_MADT_ENABLED); /* Enabled? */
273 261
274 return 0; 262 return 0;
275} 263}
276 264
277static int __init 265static int __init
278acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header, 266acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header,
279 const unsigned long end) 267 const unsigned long end)
280{ 268{
281 struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL; 269 struct acpi_madt_local_apic_override *lapic_addr_ovr = NULL;
282 270
283 lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr *)header; 271 lapic_addr_ovr = (struct acpi_madt_local_apic_override *)header;
284 272
285 if (BAD_MADT_ENTRY(lapic_addr_ovr, end)) 273 if (BAD_MADT_ENTRY(lapic_addr_ovr, end))
286 return -EINVAL; 274 return -EINVAL;
@@ -291,11 +279,11 @@ acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
291} 279}
292 280
293static int __init 281static int __init
294acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end) 282acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end)
295{ 283{
296 struct acpi_table_lapic_nmi *lapic_nmi = NULL; 284 struct acpi_madt_local_apic_nmi *lapic_nmi = NULL;
297 285
298 lapic_nmi = (struct acpi_table_lapic_nmi *)header; 286 lapic_nmi = (struct acpi_madt_local_apic_nmi *)header;
299 287
300 if (BAD_MADT_ENTRY(lapic_nmi, end)) 288 if (BAD_MADT_ENTRY(lapic_nmi, end))
301 return -EINVAL; 289 return -EINVAL;
@@ -313,11 +301,11 @@ acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
313#ifdef CONFIG_X86_IO_APIC 301#ifdef CONFIG_X86_IO_APIC
314 302
315static int __init 303static int __init
316acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end) 304acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end)
317{ 305{
318 struct acpi_table_ioapic *ioapic = NULL; 306 struct acpi_madt_io_apic *ioapic = NULL;
319 307
320 ioapic = (struct acpi_table_ioapic *)header; 308 ioapic = (struct acpi_madt_io_apic *)header;
321 309
322 if (BAD_MADT_ENTRY(ioapic, end)) 310 if (BAD_MADT_ENTRY(ioapic, end))
323 return -EINVAL; 311 return -EINVAL;
@@ -342,11 +330,11 @@ static void __init acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
342 polarity = 3; 330 polarity = 3;
343 331
344 /* Command-line over-ride via acpi_sci= */ 332 /* Command-line over-ride via acpi_sci= */
345 if (acpi_sci_flags.trigger) 333 if (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK)
346 trigger = acpi_sci_flags.trigger; 334 trigger = (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK) >> 2;
347 335
348 if (acpi_sci_flags.polarity) 336 if (acpi_sci_flags & ACPI_MADT_POLARITY_MASK)
349 polarity = acpi_sci_flags.polarity; 337 polarity = acpi_sci_flags & ACPI_MADT_POLARITY_MASK;
350 338
351 /* 339 /*
352 * mp_config_acpi_legacy_irqs() already setup IRQs < 16 340 * mp_config_acpi_legacy_irqs() already setup IRQs < 16
@@ -357,51 +345,52 @@ static void __init acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
357 345
358 /* 346 /*
359 * stash over-ride to indicate we've been here 347 * stash over-ride to indicate we've been here
360 * and for later update of acpi_fadt 348 * and for later update of acpi_gbl_FADT
361 */ 349 */
362 acpi_sci_override_gsi = gsi; 350 acpi_sci_override_gsi = gsi;
363 return; 351 return;
364} 352}
365 353
366static int __init 354static int __init
367acpi_parse_int_src_ovr(acpi_table_entry_header * header, 355acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
368 const unsigned long end) 356 const unsigned long end)
369{ 357{
370 struct acpi_table_int_src_ovr *intsrc = NULL; 358 struct acpi_madt_interrupt_override *intsrc = NULL;
371 359
372 intsrc = (struct acpi_table_int_src_ovr *)header; 360 intsrc = (struct acpi_madt_interrupt_override *)header;
373 361
374 if (BAD_MADT_ENTRY(intsrc, end)) 362 if (BAD_MADT_ENTRY(intsrc, end))
375 return -EINVAL; 363 return -EINVAL;
376 364
377 acpi_table_print_madt_entry(header); 365 acpi_table_print_madt_entry(header);
378 366
379 if (intsrc->bus_irq == acpi_fadt.sci_int) { 367 if (intsrc->source_irq == acpi_gbl_FADT.sci_interrupt) {
380 acpi_sci_ioapic_setup(intsrc->global_irq, 368 acpi_sci_ioapic_setup(intsrc->global_irq,
381 intsrc->flags.polarity, 369 intsrc->inti_flags & ACPI_MADT_POLARITY_MASK,
382 intsrc->flags.trigger); 370 (intsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2);
383 return 0; 371 return 0;
384 } 372 }
385 373
386 if (acpi_skip_timer_override && 374 if (acpi_skip_timer_override &&
387 intsrc->bus_irq == 0 && intsrc->global_irq == 2) { 375 intsrc->source_irq == 0 && intsrc->global_irq == 2) {
388 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); 376 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
389 return 0; 377 return 0;
390 } 378 }
391 379
392 mp_override_legacy_irq(intsrc->bus_irq, 380 mp_override_legacy_irq(intsrc->source_irq,
393 intsrc->flags.polarity, 381 intsrc->inti_flags & ACPI_MADT_POLARITY_MASK,
394 intsrc->flags.trigger, intsrc->global_irq); 382 (intsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2,
383 intsrc->global_irq);
395 384
396 return 0; 385 return 0;
397} 386}
398 387
399static int __init 388static int __init
400acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end) 389acpi_parse_nmi_src(struct acpi_subtable_header * header, const unsigned long end)
401{ 390{
402 struct acpi_table_nmi_src *nmi_src = NULL; 391 struct acpi_madt_nmi_source *nmi_src = NULL;
403 392
404 nmi_src = (struct acpi_table_nmi_src *)header; 393 nmi_src = (struct acpi_madt_nmi_source *)header;
405 394
406 if (BAD_MADT_ENTRY(nmi_src, end)) 395 if (BAD_MADT_ENTRY(nmi_src, end))
407 return -EINVAL; 396 return -EINVAL;
@@ -417,7 +406,7 @@ acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
417 406
418/* 407/*
419 * acpi_pic_sci_set_trigger() 408 * acpi_pic_sci_set_trigger()
420 * 409 *
421 * use ELCR to set PIC-mode trigger type for SCI 410 * use ELCR to set PIC-mode trigger type for SCI
422 * 411 *
423 * If a PIC-mode SCI is not recognized or gives spurious IRQ7's 412 * If a PIC-mode SCI is not recognized or gives spurious IRQ7's
@@ -511,7 +500,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
511{ 500{
512 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 501 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
513 union acpi_object *obj; 502 union acpi_object *obj;
514 struct acpi_table_lapic *lapic; 503 struct acpi_madt_local_apic *lapic;
515 cpumask_t tmp_map, new_map; 504 cpumask_t tmp_map, new_map;
516 u8 physid; 505 u8 physid;
517 int cpu; 506 int cpu;
@@ -529,10 +518,10 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
529 return -EINVAL; 518 return -EINVAL;
530 } 519 }
531 520
532 lapic = (struct acpi_table_lapic *)obj->buffer.pointer; 521 lapic = (struct acpi_madt_local_apic *)obj->buffer.pointer;
533 522
534 if ((lapic->header.type != ACPI_MADT_LAPIC) || 523 if (lapic->header.type != ACPI_MADT_TYPE_LOCAL_APIC ||
535 (!lapic->flags.enabled)) { 524 !(lapic->lapic_flags & ACPI_MADT_ENABLED)) {
536 kfree(buffer.pointer); 525 kfree(buffer.pointer);
537 return -EINVAL; 526 return -EINVAL;
538 } 527 }
@@ -544,7 +533,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
544 buffer.pointer = NULL; 533 buffer.pointer = NULL;
545 534
546 tmp_map = cpu_present_map; 535 tmp_map = cpu_present_map;
547 mp_register_lapic(physid, lapic->flags.enabled); 536 mp_register_lapic(physid, lapic->lapic_flags & ACPI_MADT_ENABLED);
548 537
549 /* 538 /*
550 * If mp_register_lapic successfully generates a new logical cpu 539 * If mp_register_lapic successfully generates a new logical cpu
@@ -566,14 +555,6 @@ EXPORT_SYMBOL(acpi_map_lsapic);
566 555
567int acpi_unmap_lsapic(int cpu) 556int acpi_unmap_lsapic(int cpu)
568{ 557{
569 int i;
570
571 for_each_possible_cpu(i) {
572 if (x86_acpiid_to_apicid[i] == x86_cpu_to_apicid[cpu]) {
573 x86_acpiid_to_apicid[i] = -1;
574 break;
575 }
576 }
577 x86_cpu_to_apicid[cpu] = -1; 558 x86_cpu_to_apicid[cpu] = -1;
578 cpu_clear(cpu, cpu_present_map); 559 cpu_clear(cpu, cpu_present_map);
579 num_processors--; 560 num_processors--;
@@ -619,42 +600,37 @@ acpi_scan_rsdp(unsigned long start, unsigned long length)
619 return 0; 600 return 0;
620} 601}
621 602
622static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size) 603static int __init acpi_parse_sbf(struct acpi_table_header *table)
623{ 604{
624 struct acpi_table_sbf *sb; 605 struct acpi_table_boot *sb;
625
626 if (!phys_addr || !size)
627 return -EINVAL;
628 606
629 sb = (struct acpi_table_sbf *)__acpi_map_table(phys_addr, size); 607 sb = (struct acpi_table_boot *)table;
630 if (!sb) { 608 if (!sb) {
631 printk(KERN_WARNING PREFIX "Unable to map SBF\n"); 609 printk(KERN_WARNING PREFIX "Unable to map SBF\n");
632 return -ENODEV; 610 return -ENODEV;
633 } 611 }
634 612
635 sbf_port = sb->sbf_cmos; /* Save CMOS port */ 613 sbf_port = sb->cmos_index; /* Save CMOS port */
636 614
637 return 0; 615 return 0;
638} 616}
639 617
640#ifdef CONFIG_HPET_TIMER 618#ifdef CONFIG_HPET_TIMER
619#include <asm/hpet.h>
641 620
642static int __init acpi_parse_hpet(unsigned long phys, unsigned long size) 621static int __init acpi_parse_hpet(struct acpi_table_header *table)
643{ 622{
644 struct acpi_table_hpet *hpet_tbl; 623 struct acpi_table_hpet *hpet_tbl;
645 struct resource *hpet_res; 624 struct resource *hpet_res;
646 resource_size_t res_start; 625 resource_size_t res_start;
647 626
648 if (!phys || !size) 627 hpet_tbl = (struct acpi_table_hpet *)table;
649 return -EINVAL;
650
651 hpet_tbl = (struct acpi_table_hpet *)__acpi_map_table(phys, size);
652 if (!hpet_tbl) { 628 if (!hpet_tbl) {
653 printk(KERN_WARNING PREFIX "Unable to map HPET\n"); 629 printk(KERN_WARNING PREFIX "Unable to map HPET\n");
654 return -ENODEV; 630 return -ENODEV;
655 } 631 }
656 632
657 if (hpet_tbl->addr.space_id != ACPI_SPACE_MEM) { 633 if (hpet_tbl->address.space_id != ACPI_SPACE_MEM) {
658 printk(KERN_WARNING PREFIX "HPET timers must be located in " 634 printk(KERN_WARNING PREFIX "HPET timers must be located in "
659 "memory.\n"); 635 "memory.\n");
660 return -1; 636 return -1;
@@ -667,29 +643,15 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
667 hpet_res->name = (void *)&hpet_res[1]; 643 hpet_res->name = (void *)&hpet_res[1];
668 hpet_res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; 644 hpet_res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
669 snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE, 645 snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE,
670 "HPET %u", hpet_tbl->number); 646 "HPET %u", hpet_tbl->sequence);
671 hpet_res->end = (1 * 1024) - 1; 647 hpet_res->end = (1 * 1024) - 1;
672 } 648 }
673 649
674#ifdef CONFIG_X86_64 650 hpet_address = hpet_tbl->address.address;
675 vxtime.hpet_address = hpet_tbl->addr.addrl |
676 ((long)hpet_tbl->addr.addrh << 32);
677
678 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 651 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
679 hpet_tbl->id, vxtime.hpet_address); 652 hpet_tbl->id, hpet_address);
680 653
681 res_start = vxtime.hpet_address; 654 res_start = hpet_address;
682#else /* X86 */
683 {
684 extern unsigned long hpet_address;
685
686 hpet_address = hpet_tbl->addr.addrl;
687 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
688 hpet_tbl->id, hpet_address);
689
690 res_start = hpet_address;
691 }
692#endif /* X86 */
693 655
694 if (hpet_res) { 656 if (hpet_res) {
695 hpet_res->start = res_start; 657 hpet_res->start = res_start;
@@ -703,46 +665,28 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
703#define acpi_parse_hpet NULL 665#define acpi_parse_hpet NULL
704#endif 666#endif
705 667
706#ifdef CONFIG_X86_PM_TIMER 668static int __init acpi_parse_fadt(struct acpi_table_header *table)
707extern u32 pmtmr_ioport;
708#endif
709
710static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
711{ 669{
712 struct fadt_descriptor *fadt = NULL;
713
714 fadt = (struct fadt_descriptor *)__acpi_map_table(phys, size);
715 if (!fadt) {
716 printk(KERN_WARNING PREFIX "Unable to map FADT\n");
717 return 0;
718 }
719 /* initialize sci_int early for INT_SRC_OVR MADT parsing */
720 acpi_fadt.sci_int = fadt->sci_int;
721
722 /* initialize rev and apic_phys_dest_mode for x86_64 genapic */
723 acpi_fadt.revision = fadt->revision;
724 acpi_fadt.force_apic_physical_destination_mode =
725 fadt->force_apic_physical_destination_mode;
726 670
727#ifdef CONFIG_X86_PM_TIMER 671#ifdef CONFIG_X86_PM_TIMER
728 /* detect the location of the ACPI PM Timer */ 672 /* detect the location of the ACPI PM Timer */
729 if (fadt->revision >= FADT2_REVISION_ID) { 673 if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID) {
730 /* FADT rev. 2 */ 674 /* FADT rev. 2 */
731 if (fadt->xpm_tmr_blk.address_space_id != 675 if (acpi_gbl_FADT.xpm_timer_block.space_id !=
732 ACPI_ADR_SPACE_SYSTEM_IO) 676 ACPI_ADR_SPACE_SYSTEM_IO)
733 return 0; 677 return 0;
734 678
735 pmtmr_ioport = fadt->xpm_tmr_blk.address; 679 pmtmr_ioport = acpi_gbl_FADT.xpm_timer_block.address;
736 /* 680 /*
737 * "X" fields are optional extensions to the original V1.0 681 * "X" fields are optional extensions to the original V1.0
738 * fields, so we must selectively expand V1.0 fields if the 682 * fields, so we must selectively expand V1.0 fields if the
739 * corresponding X field is zero. 683 * corresponding X field is zero.
740 */ 684 */
741 if (!pmtmr_ioport) 685 if (!pmtmr_ioport)
742 pmtmr_ioport = fadt->V1_pm_tmr_blk; 686 pmtmr_ioport = acpi_gbl_FADT.pm_timer_block;
743 } else { 687 } else {
744 /* FADT rev. 1 */ 688 /* FADT rev. 1 */
745 pmtmr_ioport = fadt->V1_pm_tmr_blk; 689 pmtmr_ioport = acpi_gbl_FADT.pm_timer_block;
746 } 690 }
747 if (pmtmr_ioport) 691 if (pmtmr_ioport)
748 printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", 692 printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
@@ -784,13 +728,13 @@ static int __init acpi_parse_madt_lapic_entries(void)
784 if (!cpu_has_apic) 728 if (!cpu_has_apic)
785 return -ENODEV; 729 return -ENODEV;
786 730
787 /* 731 /*
788 * Note that the LAPIC address is obtained from the MADT (32-bit value) 732 * Note that the LAPIC address is obtained from the MADT (32-bit value)
789 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). 733 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
790 */ 734 */
791 735
792 count = 736 count =
793 acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, 737 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE,
794 acpi_parse_lapic_addr_ovr, 0); 738 acpi_parse_lapic_addr_ovr, 0);
795 if (count < 0) { 739 if (count < 0) {
796 printk(KERN_ERR PREFIX 740 printk(KERN_ERR PREFIX
@@ -800,7 +744,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
800 744
801 mp_register_lapic_address(acpi_lapic_addr); 745 mp_register_lapic_address(acpi_lapic_addr);
802 746
803 count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic, 747 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC, acpi_parse_lapic,
804 MAX_APICS); 748 MAX_APICS);
805 if (!count) { 749 if (!count) {
806 printk(KERN_ERR PREFIX "No LAPIC entries present\n"); 750 printk(KERN_ERR PREFIX "No LAPIC entries present\n");
@@ -813,7 +757,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
813 } 757 }
814 758
815 count = 759 count =
816 acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0); 760 acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0);
817 if (count < 0) { 761 if (count < 0) {
818 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); 762 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
819 /* TBD: Cleanup to allow fallback to MPS */ 763 /* TBD: Cleanup to allow fallback to MPS */
@@ -842,7 +786,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
842 return -ENODEV; 786 return -ENODEV;
843 } 787 }
844 788
845 if (!cpu_has_apic) 789 if (!cpu_has_apic)
846 return -ENODEV; 790 return -ENODEV;
847 791
848 /* 792 /*
@@ -855,7 +799,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
855 } 799 }
856 800
857 count = 801 count =
858 acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, 802 acpi_table_parse_madt(ACPI_MADT_TYPE_IO_APIC, acpi_parse_ioapic,
859 MAX_IO_APICS); 803 MAX_IO_APICS);
860 if (!count) { 804 if (!count) {
861 printk(KERN_ERR PREFIX "No IOAPIC entries present\n"); 805 printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
@@ -866,7 +810,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
866 } 810 }
867 811
868 count = 812 count =
869 acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 813 acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr,
870 NR_IRQ_VECTORS); 814 NR_IRQ_VECTORS);
871 if (count < 0) { 815 if (count < 0) {
872 printk(KERN_ERR PREFIX 816 printk(KERN_ERR PREFIX
@@ -880,13 +824,13 @@ static int __init acpi_parse_madt_ioapic_entries(void)
880 * pretend we got one so we can set the SCI flags. 824 * pretend we got one so we can set the SCI flags.
881 */ 825 */
882 if (!acpi_sci_override_gsi) 826 if (!acpi_sci_override_gsi)
883 acpi_sci_ioapic_setup(acpi_fadt.sci_int, 0, 0); 827 acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0);
884 828
885 /* Fill in identity legacy mapings where no override */ 829 /* Fill in identity legacy mapings where no override */
886 mp_config_acpi_legacy_irqs(); 830 mp_config_acpi_legacy_irqs();
887 831
888 count = 832 count =
889 acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 833 acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_parse_nmi_src,
890 NR_IRQ_VECTORS); 834 NR_IRQ_VECTORS);
891 if (count < 0) { 835 if (count < 0) {
892 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); 836 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
@@ -906,10 +850,9 @@ static inline int acpi_parse_madt_ioapic_entries(void)
906static void __init acpi_process_madt(void) 850static void __init acpi_process_madt(void)
907{ 851{
908#ifdef CONFIG_X86_LOCAL_APIC 852#ifdef CONFIG_X86_LOCAL_APIC
909 int count, error; 853 int error;
910 854
911 count = acpi_table_parse(ACPI_APIC, acpi_parse_madt); 855 if (!acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)) {
912 if (count >= 1) {
913 856
914 /* 857 /*
915 * Parse MADT LAPIC entries 858 * Parse MADT LAPIC entries
@@ -1195,7 +1138,7 @@ int __init acpi_boot_table_init(void)
1195 if (acpi_disabled && !acpi_ht) 1138 if (acpi_disabled && !acpi_ht)
1196 return 1; 1139 return 1;
1197 1140
1198 /* 1141 /*
1199 * Initialize the ACPI boot-time table parser. 1142 * Initialize the ACPI boot-time table parser.
1200 */ 1143 */
1201 error = acpi_table_init(); 1144 error = acpi_table_init();
@@ -1204,7 +1147,7 @@ int __init acpi_boot_table_init(void)
1204 return error; 1147 return error;
1205 } 1148 }
1206 1149
1207 acpi_table_parse(ACPI_BOOT, acpi_parse_sbf); 1150 acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
1208 1151
1209 /* 1152 /*
1210 * blacklist may disable ACPI entirely 1153 * blacklist may disable ACPI entirely
@@ -1232,19 +1175,19 @@ int __init acpi_boot_init(void)
1232 if (acpi_disabled && !acpi_ht) 1175 if (acpi_disabled && !acpi_ht)
1233 return 1; 1176 return 1;
1234 1177
1235 acpi_table_parse(ACPI_BOOT, acpi_parse_sbf); 1178 acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
1236 1179
1237 /* 1180 /*
1238 * set sci_int and PM timer address 1181 * set sci_int and PM timer address
1239 */ 1182 */
1240 acpi_table_parse(ACPI_FADT, acpi_parse_fadt); 1183 acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt);
1241 1184
1242 /* 1185 /*
1243 * Process the Multiple APIC Description Table (MADT), if present 1186 * Process the Multiple APIC Description Table (MADT), if present
1244 */ 1187 */
1245 acpi_process_madt(); 1188 acpi_process_madt();
1246 1189
1247 acpi_table_parse(ACPI_HPET, acpi_parse_hpet); 1190 acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
1248 1191
1249 return 0; 1192 return 0;
1250} 1193}
@@ -1315,13 +1258,17 @@ static int __init setup_acpi_sci(char *s)
1315 if (!s) 1258 if (!s)
1316 return -EINVAL; 1259 return -EINVAL;
1317 if (!strcmp(s, "edge")) 1260 if (!strcmp(s, "edge"))
1318 acpi_sci_flags.trigger = 1; 1261 acpi_sci_flags = ACPI_MADT_TRIGGER_EDGE |
1262 (acpi_sci_flags & ~ACPI_MADT_TRIGGER_MASK);
1319 else if (!strcmp(s, "level")) 1263 else if (!strcmp(s, "level"))
1320 acpi_sci_flags.trigger = 3; 1264 acpi_sci_flags = ACPI_MADT_TRIGGER_LEVEL |
1265 (acpi_sci_flags & ~ACPI_MADT_TRIGGER_MASK);
1321 else if (!strcmp(s, "high")) 1266 else if (!strcmp(s, "high"))
1322 acpi_sci_flags.polarity = 1; 1267 acpi_sci_flags = ACPI_MADT_POLARITY_ACTIVE_HIGH |
1268 (acpi_sci_flags & ~ACPI_MADT_POLARITY_MASK);
1323 else if (!strcmp(s, "low")) 1269 else if (!strcmp(s, "low"))
1324 acpi_sci_flags.polarity = 3; 1270 acpi_sci_flags = ACPI_MADT_POLARITY_ACTIVE_LOW |
1271 (acpi_sci_flags & ~ACPI_MADT_POLARITY_MASK);
1325 else 1272 else
1326 return -EINVAL; 1273 return -EINVAL;
1327 return 0; 1274 return 0;