From 733c107fab3315769778d1248b45bec918e91a82 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Sat, 27 Jun 2009 11:05:19 +0800 Subject: [PATCH] ACPI MADT: Don't use the "Initial APIC ID" in cpu_procinfo(cpuid.1) Some BIOSes seem to reprogram LAPIC ID to a value different from what's in cpu_procinfo. --- sys/platform/pc32/i386/mp_madt.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/sys/platform/pc32/i386/mp_madt.c b/sys/platform/pc32/i386/mp_madt.c index ad8b7513ff..a4d0201816 100644 --- a/sys/platform/pc32/i386/mp_madt.c +++ b/sys/platform/pc32/i386/mp_madt.c @@ -494,8 +494,6 @@ madt_pass2(vm_paddr_t madt_paddr, int bsp_apic_id) struct madt_check_cbarg { int cpu_count; - int bsp_found; - int bsp_apic_id; }; static int @@ -508,16 +506,8 @@ madt_check_callback(void *xarg, const struct acpi_madt_ent *ent) return 0; lapic_ent = (const struct acpi_madt_lapic *)ent; - if (lapic_ent->ml_flags & MADT_LAPIC_ENABLED) { + if (lapic_ent->ml_flags & MADT_LAPIC_ENABLED) arg->cpu_count++; - if (lapic_ent->ml_apic_id == arg->bsp_apic_id) { - if (arg->bsp_found) { - kprintf("madt_check: more than one BSP?\n"); - return EINVAL; - } - arg->bsp_found = 1; - } - } return 0; } @@ -549,16 +539,12 @@ madt_check(vm_paddr_t madt_paddr) } bzero(&arg, sizeof(arg)); - arg.bsp_apic_id = (cpu_procinfo & CPUID_LOCAL_APIC_ID) >> 24; error = madt_iterate_entries(madt, madt_check_callback, &arg); if (!error) { if (arg.cpu_count <= 1) { kprintf("madt_check: less than 2 CPUs is found\n"); error = EOPNOTSUPP; - } else if (!arg.bsp_found) { - kprintf("madt_check: no BSP\n"); - error = EINVAL; } } back: @@ -653,11 +639,11 @@ madt_lapic_enumerate(struct lapic_enumerator *e) if (lapic_addr == 0) panic("madt_lapic_enumerate no local apic\n"); - bsp_apic_id = (cpu_procinfo & CPUID_LOCAL_APIC_ID) >> 24; + lapic_init(lapic_addr); + + bsp_apic_id = APIC_ID(lapic.id); if (madt_pass2(madt_paddr, bsp_apic_id)) panic("mp_enable: madt_pass2 failed\n"); - - lapic_init(lapic_addr); } static struct madt_lapic_enumerator madt_lapic_enumerator = { -- 2.11.4.GIT