summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/acpi.c
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2006-12-26 23:58:09 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2006-12-26 23:58:09 +0000
commit3ec9d9f20a5eb8e2025c6a5eba8af1ebae8c222e (patch)
treebbac69a627ad9988c23c4bb304bd82b068e66355 /sys/dev/acpi/acpi.c
parent419e67afcb1e33df77313f59d0ae8b207f0ecf2b (diff)
Add polling to devices that require it such as acpibat and acpitz.
Use the same tsleep/wakeup mechanism as the interrupt code to keep it non- concurrent.
Diffstat (limited to 'sys/dev/acpi/acpi.c')
-rw-r--r--sys/dev/acpi/acpi.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 645fc909f86..a5cf767e4ba 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.73 2006/12/21 19:59:02 deraadt Exp $ */
+/* $OpenBSD: acpi.c,v 1.74 2006/12/26 23:58:08 marco Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -46,6 +46,7 @@
int acpi_debug = 16;
#endif
int acpi_enabled = 0;
+int acpi_poll_enabled = 0;
#define ACPIEN_RETRIES 15
@@ -778,6 +779,9 @@ acpi_attach(struct device *parent, struct device *self, void *aux)
/* Initialize GPE handlers */
acpi_init_gpes(sc);
+ /* some devices require periodic polling */
+ timeout_set(&sc->sc_dev_timeout, acpi_poll, sc);
+
/*
* Take over ACPI control. Note that once we do this, we
* effectively tell the system that we have ownership of
@@ -1605,6 +1609,12 @@ acpi_isr_thread(void *arg)
KNOTE(sc->sc_note, ACPI_EVENT_COMPOSE(ACPI_EV_SLPBTN,
acpi_evindex));
}
+
+ /* handle polling here to keep code non-concurrent*/
+ if (sc->sc_poll) {
+ sc->sc_poll = 0;
+ acpi_poll_notify();
+ }
}
free(thread, M_DEVBUF);