summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2015-01-27 19:40:15 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2015-01-27 19:40:15 +0000
commitbcfdc3c0d8339d14db9d53f86687da953ea14c1f (patch)
tree0a11552a725e3ddab4ee666bfd65d682bc629bfe /sys
parentc7c7eb8603c93f7acf96a4a50d8919b6270997f1 (diff)
Ignore buttons for which _STA indicates they're not present, enabled or
functioning. Fixes suspend/resume on a Dell PowerEdge T20. ok mlarkin@, sthen@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpi/acpibtn.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/sys/dev/acpi/acpibtn.c b/sys/dev/acpi/acpibtn.c
index d19b0db525d..dada815d555 100644
--- a/sys/dev/acpi/acpibtn.c
+++ b/sys/dev/acpi/acpibtn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpibtn.c,v 1.40 2014/11/24 03:54:06 deraadt Exp $ */
+/* $OpenBSD: acpibtn.c,v 1.41 2015/01/27 19:40:14 kettenis Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@@ -55,7 +55,6 @@ struct acpibtn_softc {
#define ACPIBTN_SLEEP 3
};
-int acpibtn_getsta(struct acpibtn_softc *);
int acpibtn_setpsw(struct acpibtn_softc *, int);
struct acpi_lid {
@@ -157,10 +156,19 @@ acpibtn_attach(struct device *parent, struct device *self, void *aux)
struct acpi_attach_args *aa = aux;
struct acpi_lid *lid;
int64_t lid_open;
+ int64_t st;
sc->sc_acpi = (struct acpi_softc *)parent;
sc->sc_devnode = aa->aaa_node;
+ printf(": %s\n", sc->sc_devnode->name);
+
+ if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "_STA", 0, NULL, &st))
+ st = STA_PRESENT | STA_ENABLED | STA_DEV_OK;
+ if ((st & (STA_PRESENT | STA_ENABLED | STA_DEV_OK)) !=
+ (STA_PRESENT | STA_ENABLED | STA_DEV_OK))
+ return;
+
if (!strcmp(aa->aaa_dev, ACPI_DEV_LD)) {
sc->sc_btn_type = ACPIBTN_LID;
@@ -174,10 +182,6 @@ acpibtn_attach(struct device *parent, struct device *self, void *aux)
else if (!strcmp(aa->aaa_dev, ACPI_DEV_SBD))
sc->sc_btn_type = ACPIBTN_SLEEP;
- acpibtn_getsta(sc);
-
- printf(": %s\n", sc->sc_devnode->name);
-
if (sc->sc_btn_type == ACPIBTN_LID) {
strlcpy(sc->sc_sensdev.xname, DEVNAME(sc),
sizeof(sc->sc_sensdev.xname));
@@ -197,17 +201,6 @@ acpibtn_attach(struct device *parent, struct device *self, void *aux)
}
int
-acpibtn_getsta(struct acpibtn_softc *sc)
-{
- if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_STA", 0, NULL, NULL) != 0) {
- dnprintf(20, "%s: no _STA\n", DEVNAME(sc));
- /* XXX not all buttons have _STA so FALLTROUGH */
- }
-
- return (0);
-}
-
-int
acpibtn_notify(struct aml_node *node, int notify_type, void *arg)
{
struct acpibtn_softc *sc = arg;