summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2007-02-13 04:39:44 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2007-02-13 04:39:44 +0000
commita876310b32e31bbf4f020d53acf7e4a635b71751 (patch)
tree9529ab586023a391d2800af51e48e4ab6c5bfa2c /sys/dev
parent3c3aee39417d6533ff4b40355aa7bd60d9c661ad (diff)
Add smarter _INI code. This helps with some dissapearing devices.
ok kettenis jordan
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/acpi.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 136654cb68b..907a0028ae1 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.77 2007/01/31 23:30:51 gwk Exp $ */
+/* $OpenBSD: acpi.c,v 1.78 2007/02/13 04:39:43 marco Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -497,8 +497,23 @@ void
acpi_inidev(struct aml_node *node, void *arg)
{
struct acpi_softc *sc = (struct acpi_softc *)arg;
+ struct aml_value res;
- aml_evalnode(sc, node, 0, NULL, NULL);
+ /*
+ * XXX per the ACPI spec 6.5.1 only run _INI when device is there
+ * or when there is no _STA.
+ * The tricky bit is that the parent can have a _STA that is disabled
+ * and the children do not have a _STA. In that case the _INI will
+ * execute! This needs to be fixed.
+ */
+
+ memset(&res, 0, sizeof res);
+ if (aml_evalname(sc, node, "_STA", 0, NULL, &res))
+ res.v_integer = STA_PRESENT; /* no _STA, fake it */
+
+ if (res.v_integer & STA_PRESENT)
+ aml_evalnode(sc, node, 0, NULL, NULL);
+ aml_freevalue(&res);
}
void