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