From b62da5e220802e2a6246d8dba794998d908860ff Mon Sep 17 00:00:00 2001 From: kettenis Date: Sun, 10 Jul 2016 20:41:19 +0000 Subject: [PATCH] Pay attention to Processor Local X2APIC structures. ACPI 6.0 allows these even for APIC ID values less than 255. Makes secondary CPUs attach on the HP DL360 gen 9. tested by jung@ ok guenther@ --- sys/dev/acpi/acpimadt.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/sys/dev/acpi/acpimadt.c b/sys/dev/acpi/acpimadt.c index eb4c3d98e3a..7c3ce723cf9 100644 --- a/sys/dev/acpi/acpimadt.c +++ b/sys/dev/acpi/acpimadt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpimadt.c,v 1.33 2015/08/25 07:00:11 deraadt Exp $ */ +/* $OpenBSD: acpimadt.c,v 1.34 2016/07/10 20:41:19 kettenis Exp $ */ /* * Copyright (c) 2006 Mark Kettenis * @@ -290,6 +290,42 @@ acpimadt_attach(struct device *parent, struct device *self, void *aux) case ACPI_MADT_LAPIC_NMI: nlapic_nmis++; break; + case ACPI_MADT_X2APIC: + dprintf("%s: X2APIC: acpi_proc_uid %x, apic_id %x, flags 0x%x\n", + self->dv_xname, entry->madt_x2apic.acpi_proc_uid, + entry->madt_x2apic.apic_id, + entry->madt_x2apic.flags); + + if (entry->madt_x2apic.apic_id > 255 || + (entry->madt_x2apic.flags & ACPI_PROC_ENABLE) == 0) + break; + + memset(&caa, 0, sizeof(struct cpu_attach_args)); + if (lapic_cpu_number() == entry->madt_x2apic.apic_id) + caa.cpu_role = CPU_ROLE_BP; + else { + caa.cpu_role = CPU_ROLE_AP; + ncpusfound++; + } + caa.caa_name = "cpu"; + caa.cpu_number = entry->madt_x2apic.apic_id; +#ifdef MULTIPROCESSOR + caa.cpu_func = &mp_cpu_funcs; +#endif +#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; +#endif + + config_found(mainbus, &caa, acpimadt_print); + break; } addr += entry->madt_lapic.length; } -- 2.20.1