summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2016-07-10 20:41:19 +0000
committerkettenis <kettenis@openbsd.org>2016-07-10 20:41:19 +0000
commitb62da5e220802e2a6246d8dba794998d908860ff (patch)
tree3cbf0bcf08f5b30e3e3d024422e1293056b7d43f
parentRename apic_proc_uid field to acpi_proc_uid in the acpi_madt_x2apic struct. (diff)
downloadwireguard-openbsd-b62da5e220802e2a6246d8dba794998d908860ff.tar.xz
wireguard-openbsd-b62da5e220802e2a6246d8dba794998d908860ff.zip
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@
-rw-r--r--sys/dev/acpi/acpimadt.c38
1 files changed, 37 insertions, 1 deletions
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 <kettenis@openbsd.org>
*
@@ -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;
}