summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2020-08-27 01:08:56 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2020-08-27 01:08:56 +0000
commit5e70975f1dbd77963933a8ee51e28ab702fbaaab (patch)
treebaa61e434459a2454dc849f3cf1a19f73aa332fc /sys/dev
parent02cf7a0cd5101219146185557dae4b3a836e0f39 (diff)
Reorder the acpi attach process so we look at Processor() CPU nodes
after Device() ones, since we should prefer the newer node type. If we see any Device() nodes, don't attach acpicpu(4) to any Processor() nodes if they're also present. This also makes acpitz(4) and acpipwrres(4) devices attach slightly later. ok kettenis@, also tested by jmc@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/acpi.c8
-rw-r--r--sys/dev/acpi/acpicpu.c11
-rw-r--r--sys/dev/acpi/acpivar.h4
3 files changed, 17 insertions, 6 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 5c396175413..93d802507c3 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.390 2020/08/16 16:08:10 gnezdo Exp $ */
+/* $OpenBSD: acpi.c,v 1.391 2020/08/27 01:08:55 jmatthew Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -1213,8 +1213,6 @@ acpi_attach_common(struct acpi_softc *sc, paddr_t base)
/* check if we're running on a sony */
aml_find_node(&aml_root, "GBRT", acpi_foundsony, sc);
- aml_walknodes(&aml_root, AML_WALK_PRE, acpi_add_device, sc);
-
#ifndef SMALL_KERNEL
/* try to find smart battery first */
aml_find_node(&aml_root, "_HID", acpi_foundsbs, sc);
@@ -1223,6 +1221,8 @@ acpi_attach_common(struct acpi_softc *sc, paddr_t base)
/* attach battery, power supply and button devices */
aml_find_node(&aml_root, "_HID", acpi_foundhid, sc);
+ aml_walknodes(&aml_root, AML_WALK_PRE, acpi_add_device, sc);
+
#ifndef SMALL_KERNEL
#if NWD > 0
/* Attach IDE bay */
@@ -2176,6 +2176,8 @@ acpi_add_device(struct aml_node *node, void *arg)
switch (node->value->type) {
case AML_OBJTYPE_PROCESSOR:
+ if (sc->sc_skip_processor != 0)
+ return 0;
if (nacpicpus >= ncpus)
return 0;
if (aml_evalnode(sc, aaa.aaa_node, 0, NULL, &res) == 0) {
diff --git a/sys/dev/acpi/acpicpu.c b/sys/dev/acpi/acpicpu.c
index 7357c149ae4..c8bf64edaa3 100644
--- a/sys/dev/acpi/acpicpu.c
+++ b/sys/dev/acpi/acpicpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpicpu.c,v 1.87 2020/08/26 17:10:49 kettenis Exp $ */
+/* $OpenBSD: acpicpu.c,v 1.88 2020/08/27 01:08:55 jmatthew Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
* Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
@@ -652,9 +652,16 @@ acpicpu_match(struct device *parent, void *match, void *aux)
{
struct acpi_attach_args *aa = aux;
struct cfdata *cf = match;
+ struct acpi_softc *acpi = (struct acpi_softc *)parent;
- if (acpi_matchhids(aa, acpicpu_hids, cf->cf_driver->cd_name))
+ if (acpi_matchhids(aa, acpicpu_hids, cf->cf_driver->cd_name)) {
+ /*
+ * Record that we've seen a Device() CPU object,
+ * so we won't attach any Processor() nodes.
+ */
+ acpi->sc_skip_processor = 1;
return (1);
+ }
/* sanity */
if (aa->aaa_name == NULL ||
diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h
index f8e8f5fdce9..8b81c9e2cbc 100644
--- a/sys/dev/acpi/acpivar.h
+++ b/sys/dev/acpi/acpivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpivar.h,v 1.110 2020/08/16 16:08:10 gnezdo Exp $ */
+/* $OpenBSD: acpivar.h,v 1.111 2020/08/27 01:08:55 jmatthew Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -278,6 +278,8 @@ struct acpi_softc {
int sc_pse; /* passive cooling enabled */
int sc_flags;
+
+ int sc_skip_processor;
};
extern struct acpi_softc *acpi_softc;