diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2006-12-26 23:58:09 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2006-12-26 23:58:09 +0000 |
commit | 3ec9d9f20a5eb8e2025c6a5eba8af1ebae8c222e (patch) | |
tree | bbac69a627ad9988c23c4bb304bd82b068e66355 /sys/dev/acpi/dsdt.c | |
parent | 419e67afcb1e33df77313f59d0ae8b207f0ecf2b (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/dsdt.c')
-rw-r--r-- | sys/dev/acpi/dsdt.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c index a6a5ff6d64d..7897d74f774 100644 --- a/sys/dev/acpi/dsdt.c +++ b/sys/dev/acpi/dsdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsdt.c,v 1.73 2006/12/23 17:19:06 canacar Exp $ */ +/* $OpenBSD: dsdt.c,v 1.74 2006/12/26 23:58:08 marco Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -348,6 +348,7 @@ struct aml_notify_data { char pnpid[20]; void *cbarg; int (*cbproc)(struct aml_node *, int, void *); + int poll; SLIST_ENTRY(aml_notify_data) link; }; @@ -547,12 +548,22 @@ aml_gasio(struct acpi_softc *sc, int type, uint64_t base, uint64_t length, /* * @@@: Notify functions */ +void +acpi_poll(void *arg) +{ + dsdt_softc->sc_poll = 1; + dsdt_softc->sc_wakeup = 0; + wakeup(dsdt_softc); + + timeout_add(&dsdt_softc->sc_dev_timeout, 10 * hz); +} void aml_register_notify(struct aml_node *node, const char *pnpid, - int (*proc)(struct aml_node *, int, void *), void *arg) + int (*proc)(struct aml_node *, int, void *), void *arg, int poll) { struct aml_notify_data *pdata; + extern int acpi_poll_enabled; dnprintf(10, "aml_register_notify: %s %s %x\n", node->name, pnpid ? pnpid : "", proc); @@ -561,11 +572,15 @@ aml_register_notify(struct aml_node *node, const char *pnpid, pdata->node = node; pdata->cbarg = arg; pdata->cbproc = proc; + pdata->poll = poll; if (pnpid) strlcpy(pdata->pnpid, pnpid, sizeof(pdata->pnpid)); SLIST_INSERT_HEAD(&aml_notify_list, pdata, link); + + if (poll && !acpi_poll_enabled) + timeout_add(&dsdt_softc->sc_dev_timeout, 10 * hz); } void @@ -594,6 +609,15 @@ aml_notify_dev(const char *pnpid, int notify_value) pdata->cbproc(pdata->node, notify_value, pdata->cbarg); } +void acpi_poll_notify(void) +{ + struct aml_notify_data *pdata = NULL; + + SLIST_FOREACH(pdata, &aml_notify_list, link) + if (pdata->cbproc && pdata->poll) + pdata->cbproc(pdata->node, 0, pdata->cbarg); +} + /* * @@@: Namespace functions */ |