summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2010-10-31 21:52:47 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2010-10-31 21:52:47 +0000
commit309e1bf308e775652e3eb2d761bb13e243be697b (patch)
tree1c7cd7ae9b86f3ea7e3d59205c59dc4db23738be /sys
parentfec34148e26bacd2c817793652dc56bf6f375f0c (diff)
Revert last commit: it breaks resume on Thinkpads
"then please back it out" deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpi/acpi.c80
-rw-r--r--sys/dev/acpi/acpivar.h12
-rw-r--r--sys/dev/acpi/dsdt.c30
3 files changed, 18 insertions, 104 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 465bda0e3ac..55d17e39a29 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.220 2010/10/26 20:51:35 jordan Exp $ */
+/* $OpenBSD: acpi.c,v 1.221 2010/10/31 21:52:46 guenther Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -86,8 +86,6 @@ struct acpi_q *acpi_maptable(struct acpi_softc *, paddr_t, const char *,
void acpi_init_states(struct acpi_softc *);
-void acpi_gpe_task(void *, int);
-
#ifndef SMALL_KERNEL
int acpi_thinkpad_enabled;
@@ -1206,54 +1204,6 @@ acpi_init_states(struct acpi_softc *sc)
}
}
-/* ACPI Workqueue support */
-SIMPLEQ_HEAD(,acpi_taskq) acpi_taskq =
- SIMPLEQ_HEAD_INITIALIZER(acpi_taskq);
-
-void
-acpi_addtask(struct acpi_softc *sc, void (*handler)(void *, int),
- void *arg0, int arg1)
-{
- struct acpi_taskq *wq;
- int s;
-
- wq = malloc(sizeof(*wq), M_DEVBUF, M_ZERO | M_NOWAIT);
- if (wq == NULL)
- return;
- wq->handler = handler;
- wq->arg0 = arg0;
- wq->arg1 = arg1;
-
- s = spltty();
- SIMPLEQ_INSERT_TAIL(&acpi_taskq, wq, next);
- splx(s);
-}
-
-int
-acpi_dotask(struct acpi_softc *sc)
-{
- struct acpi_taskq *wq;
- int s;
-
- s = spltty();
- if (SIMPLEQ_EMPTY(&acpi_taskq)) {
- splx(s);
-
- /* we don't have anything to do */
- return (0);
- }
- wq = SIMPLEQ_FIRST(&acpi_taskq);
- SIMPLEQ_REMOVE_HEAD(&acpi_taskq, next);
- splx(s);
-
- wq->handler(wq->arg0, wq->arg1);
-
- free(wq, M_DEVBUF);
-
- /* We did something */
- return (1);
-}
-
#ifndef SMALL_KERNEL
int
is_ata(struct aml_node *node)
@@ -1396,19 +1346,6 @@ acpi_reset(void)
delay(100000);
}
-void
-acpi_gpe_task(void *arg0, int gpe)
-{
- struct acpi_softc *sc = acpi_softc;
- struct gpe_block *pgpe = &sc->gpe_table[gpe];
-
- dnprintf(10, "handle gpe: %x\n", gpe);
- if (pgpe->handler && pgpe->active) {
- pgpe->active = 0;
- pgpe->handler(sc, gpe, pgpe->arg);
- }
-}
-
int
acpi_interrupt(void *arg)
{
@@ -1429,8 +1366,6 @@ acpi_interrupt(void *arg)
if (en & sts & (1L << jdx)) {
/* Signal this GPE */
sc->gpe_table[idx+jdx].active = 1;
- dnprintf(10, "queue gpe: %x\n", idx+jdx);
- acpi_addtask(sc, acpi_gpe_task, NULL, idx+jdx);
/*
* Edge interrupts need their STS bits
@@ -2082,6 +2017,7 @@ acpi_thread(void *arg)
struct acpi_thread *thread = arg;
struct acpi_softc *sc = thread->sc;
extern int aml_busy;
+ u_int32_t gpe;
int s;
rw_enter_write(&sc->sc_lck);
@@ -2129,10 +2065,16 @@ acpi_thread(void *arg)
continue;
}
- /* Run ACPI taskqueue */
- while(acpi_dotask(acpi_softc))
- ;
+ for (gpe = 0; gpe < sc->sc_lastgpe; gpe++) {
+ struct gpe_block *pgpe = &sc->gpe_table[gpe];
+ if (pgpe->active) {
+ pgpe->active = 0;
+ dnprintf(50, "softgpe: %.2x\n", gpe);
+ if (pgpe->handler)
+ pgpe->handler(sc, gpe, pgpe->arg);
+ }
+ }
if (sc->sc_powerbtn) {
uint16_t en;
diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h
index e01bf914759..1e4752d3407 100644
--- a/sys/dev/acpi/acpivar.h
+++ b/sys/dev/acpi/acpivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpivar.h,v 1.67 2010/10/26 20:51:35 jordan Exp $ */
+/* $OpenBSD: acpivar.h,v 1.68 2010/10/31 21:52:46 guenther Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -82,13 +82,6 @@ struct acpi_q {
u_int8_t q_data[0];
};
-struct acpi_taskq {
- SIMPLEQ_ENTRY(acpi_taskq) next;
- void (*handler)(void *, int);
- void *arg0;
- int arg1;
-};
-
struct acpi_wakeq {
SIMPLEQ_ENTRY(acpi_wakeq) q_next;
struct aml_node *q_node;
@@ -340,9 +333,6 @@ int acpi_matchhids(struct acpi_attach_args *, const char *[], const char *);
int acpi_record_event(struct acpi_softc *, u_int);
-void acpi_addtask(struct acpi_softc *, void (*)(void *, int), void *, int);
-int acpi_dotask(struct acpi_softc *);
-
#endif
#endif /* !_ACPI_WAKECODE */
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index 1044c8df89b..c41ecf6d47e 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.179 2010/10/26 20:51:35 jordan Exp $ */
+/* $OpenBSD: dsdt.c,v 1.180 2010/10/31 21:52:46 guenther Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -104,8 +104,6 @@ void aml_dump(int, u_int8_t *);
void _aml_die(const char *fn, int line, const char *fmt, ...);
#define aml_die(x...) _aml_die(__FUNCTION__, __LINE__, x)
-void aml_notify_task(void *, int);
-
/*
* @@@: Global variables
*/
@@ -532,17 +530,6 @@ acpi_poll(void *arg)
}
void
-aml_notify_task(void *node, int notify_value)
-{
- struct aml_notify_data *pdata = NULL;
-
- dnprintf(10,"run notify: %s %x\n", aml_nodename(node), notify_value);
- SLIST_FOREACH(pdata, &aml_notify_list, link)
- if (pdata->node == node)
- pdata->cbproc(pdata->node, notify_value, pdata->cbarg);
-}
-
-void
aml_register_notify(struct aml_node *node, const char *pnpid,
int (*proc)(struct aml_node *, int, void *), void *arg, int poll)
{
@@ -570,11 +557,14 @@ aml_register_notify(struct aml_node *node, const char *pnpid,
void
aml_notify(struct aml_node *node, int notify_value)
{
+ struct aml_notify_data *pdata = NULL;
+
if (node == NULL)
return;
- dnprintf(10,"queue notify: %s %x\n", aml_nodename(node), notify_value);
- acpi_addtask(acpi_softc, aml_notify_task, node, notify_value);
+ SLIST_FOREACH(pdata, &aml_notify_list, link)
+ if (pdata->node == node)
+ pdata->cbproc(pdata->node, notify_value, pdata->cbarg);
}
#ifndef SMALL_KERNEL
@@ -2482,14 +2472,6 @@ acpi_xmutex_release(struct aml_scope *scope, struct aml_value *mtx)
int
acpi_xevent_wait(struct aml_scope *scope, struct aml_value *evt, int timeout)
{
- /* Wait for event to occur; do work in meantime */
- evt->v_evt.state = 0;
- while (!evt->v_evt.state) {
- if (!acpi_dotask(acpi_softc) && !cold)
- tsleep(evt, PWAIT, "acpievt", 1);
- else
- delay(100);
- }
if (evt->v_evt.state == 1) {
/* Object is signaled */
return (0);