diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-08-10 09:59:56 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-08-10 09:59:56 +0000 |
commit | b9965e8301c44569c117ea44387cf91ed4ce95ff (patch) | |
tree | a990c1ea721beb7c8394818a7fdaa731adb910d6 /sys/dev/acpi | |
parent | c9dedb03025fdb43082aaa5e12dbe3e8bd888fcd (diff) |
Don't assume the first LAPIC in the table corresponds to the boot processor.
Mark the processor we're running on as the boot processor instead.
ok marco@, art@
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r-- | sys/dev/acpi/acpimadt.c | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/sys/dev/acpi/acpimadt.c b/sys/dev/acpi/acpimadt.c index 40547f8d4a4..a0454056e7e 100644 --- a/sys/dev/acpi/acpimadt.c +++ b/sys/dev/acpi/acpimadt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpimadt.c,v 1.19 2008/06/11 04:42:09 marco Exp $ */ +/* $OpenBSD: acpimadt.c,v 1.20 2008/08/10 09:59:55 kettenis Exp $ */ /* * Copyright (c) 2006 Mark Kettenis <kettenis@openbsd.org> * @@ -126,7 +126,6 @@ acpimadt_attach(struct device *parent, struct device *self, void *aux) struct aml_value arg; struct mp_intr_map *map; struct ioapic_softc *apic; - int cpu_role = CPU_ROLE_BP; int nlapic_nmis = 0; int pin; @@ -151,6 +150,8 @@ acpimadt_attach(struct device *parent, struct device *self, void *aux) /* 1st pass, get CPUs and IOAPICs */ while (addr < (caddr_t)madt + madt->hdr.length) { union acpi_madt_entry *entry = (union acpi_madt_entry *)addr; + struct cpu_attach_args caa; + struct apic_attach_args aaa; switch (entry->madt_lapic.apic_type) { case ACPI_MADT_LAPIC: @@ -164,33 +165,30 @@ acpimadt_attach(struct device *parent, struct device *self, void *aux) acpi_lapic_flags[entry->madt_lapic.acpi_proc_id] = entry->madt_lapic.flags; - { - struct cpu_attach_args caa; - - if ((entry->madt_lapic.flags & ACPI_PROC_ENABLE) == 0) - break; + if ((entry->madt_lapic.flags & ACPI_PROC_ENABLE) == 0) + break; - memset(&caa, 0, sizeof(struct cpu_attach_args)); - caa.cpu_role = cpu_role; - caa.caa_name = "cpu"; - caa.cpu_number = entry->madt_lapic.apic_id; - caa.cpu_func = &mp_cpu_funcs; + memset(&caa, 0, sizeof(struct cpu_attach_args)); + if (lapic_cpu_number() == entry->madt_lapic.apic_id) + caa.cpu_role = CPU_ROLE_BP; + else + caa.cpu_role = CPU_ROLE_AP; + caa.caa_name = "cpu"; + caa.cpu_number = entry->madt_lapic.apic_id; + caa.cpu_func = &mp_cpu_funcs; #ifdef __i386__ - /* - * XXX utterly wrong. These are the - * cpu_feature/cpu_id from the BSP cpu, - * now being given to another cpu. - * This is bullshit. - */ - extern int cpu_id, cpu_feature; - caa.cpu_signature = cpu_id; - caa.feature_flags = cpu_feature; + /* + * XXX utterly wrong. These are the + * cpu_feature/cpu_id from the BSP cpu, now + * being given to another cpu. This is + * bullshit. + */ + extern int cpu_id, cpu_feature; + caa.cpu_signature = cpu_id; + caa.feature_flags = cpu_feature; #endif - config_found(mainbus, &caa, acpimadt_print); - - cpu_role = CPU_ROLE_AP; - } + config_found(mainbus, &caa, acpimadt_print); break; case ACPI_MADT_IOAPIC: dprintf("%s: IOAPIC: acpi_ioapic_id %x, address 0x%x, global_int_base 0x%x\n", @@ -198,17 +196,13 @@ acpimadt_attach(struct device *parent, struct device *self, void *aux) entry->madt_ioapic.address, entry->madt_ioapic.global_int_base); - { - struct apic_attach_args aaa; - - memset(&aaa, 0, sizeof(struct apic_attach_args)); - aaa.aaa_name = "ioapic"; - aaa.apic_id = entry->madt_ioapic.acpi_ioapic_id; - aaa.apic_address = entry->madt_ioapic.address; - aaa.apic_vecbase = entry->madt_ioapic.global_int_base; + memset(&aaa, 0, sizeof(struct apic_attach_args)); + aaa.aaa_name = "ioapic"; + aaa.apic_id = entry->madt_ioapic.acpi_ioapic_id; + aaa.apic_address = entry->madt_ioapic.address; + aaa.apic_vecbase = entry->madt_ioapic.global_int_base; - config_found(mainbus, &aaa, acpimadt_print); - } + config_found(mainbus, &aaa, acpimadt_print); break; case ACPI_MADT_LAPIC_NMI: nlapic_nmis++; |