diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-01-05 18:26:31 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-01-05 18:26:31 +0000 |
commit | 6c0b30c9946e12c84a089b8fc05d2449c28bad8a (patch) | |
tree | b385ccbe2861129a0e1a09d0787935ff051cf858 | |
parent | 2a0eec3d922ea9fda272a0a239ac6eb30cadc40b (diff) |
Never attach more acpicpu(4) devices than cpu(4) devices. Always attach
the first acpicpu(4) device on non-MULTIPROCESSOR kernels, regardless of its
ACPI processor ID.
ok mikeb@
-rw-r--r-- | sys/dev/acpi/acpi.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 9c860bb2646..fcab2fefb15 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.111 2007/12/05 19:17:13 deraadt Exp $ */ +/* $OpenBSD: acpi.c,v 1.112 2008/01/05 18:26:30 kettenis Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -352,11 +352,14 @@ int acpi_add_device(struct aml_node *node, void *arg); int acpi_add_device(struct aml_node *node, void *arg) { + static int nacpicpus = 0; struct device *self = arg; struct acpi_softc *sc = arg; struct acpi_attach_args aaa; +#ifdef MULTIPROCESSOR struct aml_value res; - int proc_id = 0; + int proc_id = -1; +#endif memset(&aaa, 0, sizeof(aaa)); aaa.aaa_node = node; @@ -368,18 +371,20 @@ acpi_add_device(struct aml_node *node, void *arg) switch (node->value->type) { case AML_OBJTYPE_PROCESSOR: + if (nacpicpus >= ncpus) + return 0; +#ifdef MULTIPROCESSOR 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 > 0) -#endif + if (proc_id < -1 || proc_id >= LAPIC_MAP_SIZE || + (acpi_lapic_flags[proc_id] & ACPI_PROC_ENABLE) == 0) return 0; +#endif + nacpicpus++; + aaa.aaa_name = "acpicpu"; break; case AML_OBJTYPE_THERMZONE: |