aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/acpi/boot.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/acpi/boot.c')
-rw-r--r--arch/x86/kernel/acpi/boot.c67
1 files changed, 57 insertions, 10 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 2cdc9de9371d..057ccf1d5ad4 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -39,6 +39,11 @@
39#include <asm/apic.h> 39#include <asm/apic.h>
40#include <asm/io.h> 40#include <asm/io.h>
41#include <asm/mpspec.h> 41#include <asm/mpspec.h>
42#include <asm/smp.h>
43
44#ifdef CONFIG_X86_LOCAL_APIC
45# include <mach_apic.h>
46#endif
42 47
43static int __initdata acpi_force = 0; 48static int __initdata acpi_force = 0;
44 49
@@ -52,9 +57,7 @@ EXPORT_SYMBOL(acpi_disabled);
52#ifdef CONFIG_X86_64 57#ifdef CONFIG_X86_64
53 58
54#include <asm/proto.h> 59#include <asm/proto.h>
55 60#include <asm/genapic.h>
56static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) { return 0; }
57
58 61
59#else /* X86 */ 62#else /* X86 */
60 63
@@ -111,7 +114,7 @@ char *__init __acpi_map_table(unsigned long phys_addr, unsigned long size)
111 if (!phys_addr || !size) 114 if (!phys_addr || !size)
112 return NULL; 115 return NULL;
113 116
114 if (phys_addr+size <= (end_pfn_map << PAGE_SHIFT) + PAGE_SIZE) 117 if (phys_addr+size <= (max_pfn_mapped << PAGE_SHIFT) + PAGE_SIZE)
115 return __va(phys_addr); 118 return __va(phys_addr);
116 119
117 return NULL; 120 return NULL;
@@ -237,6 +240,16 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
237 return 0; 240 return 0;
238} 241}
239 242
243static void __cpuinit acpi_register_lapic(int id, u8 enabled)
244{
245 if (!enabled) {
246 ++disabled_cpus;
247 return;
248 }
249
250 generic_processor_info(id, 0);
251}
252
240static int __init 253static int __init
241acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end) 254acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end)
242{ 255{
@@ -256,8 +269,26 @@ acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end)
256 * to not preallocating memory for all NR_CPUS 269 * to not preallocating memory for all NR_CPUS
257 * when we use CPU hotplug. 270 * when we use CPU hotplug.
258 */ 271 */
259 mp_register_lapic(processor->id, /* APIC ID */ 272 acpi_register_lapic(processor->id, /* APIC ID */
260 processor->lapic_flags & ACPI_MADT_ENABLED); /* Enabled? */ 273 processor->lapic_flags & ACPI_MADT_ENABLED);
274
275 return 0;
276}
277
278static int __init
279acpi_parse_sapic(struct acpi_subtable_header *header, const unsigned long end)
280{
281 struct acpi_madt_local_sapic *processor = NULL;
282
283 processor = (struct acpi_madt_local_sapic *)header;
284
285 if (BAD_MADT_ENTRY(processor, end))
286 return -EINVAL;
287
288 acpi_table_print_madt_entry(header);
289
290 acpi_register_lapic((processor->id << 8) | processor->eid,/* APIC ID */
291 processor->lapic_flags & ACPI_MADT_ENABLED);
261 292
262 return 0; 293 return 0;
263} 294}
@@ -300,6 +331,8 @@ acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long e
300 331
301#ifdef CONFIG_X86_IO_APIC 332#ifdef CONFIG_X86_IO_APIC
302 333
334struct mp_ioapic_routing mp_ioapic_routing[MAX_IO_APICS];
335
303static int __init 336static int __init
304acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) 337acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end)
305{ 338{
@@ -532,7 +565,7 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
532 buffer.pointer = NULL; 565 buffer.pointer = NULL;
533 566
534 tmp_map = cpu_present_map; 567 tmp_map = cpu_present_map;
535 mp_register_lapic(physid, lapic->lapic_flags & ACPI_MADT_ENABLED); 568 acpi_register_lapic(physid, lapic->lapic_flags & ACPI_MADT_ENABLED);
536 569
537 /* 570 /*
538 * If mp_register_lapic successfully generates a new logical cpu 571 * If mp_register_lapic successfully generates a new logical cpu
@@ -732,6 +765,16 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
732 * Parse LAPIC entries in MADT 765 * Parse LAPIC entries in MADT
733 * returns 0 on success, < 0 on error 766 * returns 0 on success, < 0 on error
734 */ 767 */
768
769static void __init acpi_register_lapic_address(unsigned long address)
770{
771 mp_lapic_addr = address;
772
773 set_fixmap_nocache(FIX_APIC_BASE, address);
774 if (boot_cpu_physical_apicid == -1U)
775 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
776}
777
735static int __init acpi_parse_madt_lapic_entries(void) 778static int __init acpi_parse_madt_lapic_entries(void)
736{ 779{
737 int count; 780 int count;
@@ -753,10 +796,14 @@ static int __init acpi_parse_madt_lapic_entries(void)
753 return count; 796 return count;
754 } 797 }
755 798
756 mp_register_lapic_address(acpi_lapic_addr); 799 acpi_register_lapic_address(acpi_lapic_addr);
800
801 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC,
802 acpi_parse_sapic, MAX_APICS);
757 803
758 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC, acpi_parse_lapic, 804 if (!count)
759 MAX_APICS); 805 count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC,
806 acpi_parse_lapic, MAX_APICS);
760 if (!count) { 807 if (!count) {
761 printk(KERN_ERR PREFIX "No LAPIC entries present\n"); 808 printk(KERN_ERR PREFIX "No LAPIC entries present\n");
762 /* TBD: Cleanup to allow fallback to MPS */ 809 /* TBD: Cleanup to allow fallback to MPS */