diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2007-11-15 22:16:32 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2007-11-15 22:16:32 +0000 |
commit | dd4992934104c50c9952b5b76f65b9fb82a9ca8d (patch) | |
tree | 92a1b01097a647e1a5834c3efbef577157a4768c /sys/dev/acpi | |
parent | e775548fb8328f05ffec72144b720e0a5ac44ec4 (diff) |
Make acpicpu(4) attach to the existing CPUs only.
Problem reported by form@. Fix idea by kettenis@.
Lots of help from deraadt@. Tested by deraadt@, form@ and me.
ok deraadt marco
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r-- | sys/dev/acpi/acpi.c | 16 | ||||
-rw-r--r-- | sys/dev/acpi/acpimadt.c | 6 | ||||
-rw-r--r-- | sys/dev/acpi/acpivar.h | 7 |
3 files changed, 26 insertions, 3 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 327cc5febff..80d27bd17e0 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.98 2007/11/14 20:29:06 deraadt Exp $ */ +/* $OpenBSD: acpi.c,v 1.99 2007/11/15 22:16:31 mikeb Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -358,6 +358,8 @@ acpi_add_device(struct aml_node *node, void *arg) struct device *self = arg; struct acpi_softc *sc = arg; struct acpi_attach_args aaa; + struct aml_value res; + int proc_id = 0; memset(&aaa, 0, sizeof(aaa)); aaa.aaa_node = node; @@ -369,6 +371,18 @@ acpi_add_device(struct aml_node *node, void *arg) switch (node->value->type) { case AML_OBJTYPE_PROCESSOR: + if (aml_evalnode(sc, aaa.aaa_node, 0, NULL, &res) == 0) { + if (res.type == AML_OBJTYPE_PROCESSOR) + proc_id = res.v_processor.proc_id; + aml_freevalue(&res); + } +#ifdef MULTIPROCESSOR + if (proc_id && (proc_id >= LAPIC_MAP_SIZE || + (acpi_lapic_flags[proc_id] & ACPI_PROC_ENABLE) == 0)) +#else + if (proc_id > 1) +#endif + return 0; aaa.aaa_name = "acpicpu"; break; case AML_OBJTYPE_THERMZONE: diff --git a/sys/dev/acpi/acpimadt.c b/sys/dev/acpi/acpimadt.c index 5ab8dd69d53..9a4ac7a3b61 100644 --- a/sys/dev/acpi/acpimadt.c +++ b/sys/dev/acpi/acpimadt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpimadt.c,v 1.11 2007/10/08 04:15:15 krw Exp $ */ +/* $OpenBSD: acpimadt.c,v 1.12 2007/11/15 22:16:31 mikeb Exp $ */ /* * Copyright (c) 2006 Mark Kettenis <kettenis@openbsd.org> * @@ -42,6 +42,8 @@ #define mp_nintrs mp_nintr #endif +u_int8_t acpi_lapic_flags[LAPIC_MAP_SIZE]; + int acpimadt_match(struct device *, void *, void *); void acpimadt_attach(struct device *, struct device *, void *); @@ -165,6 +167,8 @@ acpimadt_attach(struct device *parent, struct device *self, void *aux) lapic_map[entry->madt_lapic.acpi_proc_id] = entry->madt_lapic.apic_id; + acpi_lapic_flags[entry->madt_lapic.acpi_proc_id] = + entry->madt_lapic.flags; { struct cpu_attach_args caa; diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index a05c2d1828e..121ae61fafa 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivar.h,v 1.38 2007/11/12 21:58:43 deraadt Exp $ */ +/* $OpenBSD: acpivar.h,v 1.39 2007/11/15 22:16:31 mikeb Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -33,6 +33,11 @@ extern int acpi_debug; extern int acpi_hasprocfvs; +#ifdef MULTIPROCESSOR +#define LAPIC_MAP_SIZE 256 +extern u_int8_t acpi_lapic_flags[LAPIC_MAP_SIZE]; +#endif + struct klist; struct acpiec_softc; |