summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2010-08-03 16:55:07 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2010-08-03 16:55:07 +0000
commit5663581788a2003d8918a355babb71745d7539cf (patch)
treee9fd1d552d03ff9076e09d02f9650b7e11e9f51c /sys
parented57c6450ff65024153da7443b7c39b9bc3e0387 (diff)
Add busy flag so that we don't act on a SCI until a command in progress
completes. Written with jordan. ok deraadt
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpi/acpidev.h4
-rw-r--r--sys/dev/acpi/acpiec.c12
2 files changed, 13 insertions, 3 deletions
diff --git a/sys/dev/acpi/acpidev.h b/sys/dev/acpi/acpidev.h
index a3b2166917f..b0e2d425a3e 100644
--- a/sys/dev/acpi/acpidev.h
+++ b/sys/dev/acpi/acpidev.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpidev.h,v 1.30 2010/07/27 01:21:19 jordan Exp $ */
+/* $OpenBSD: acpidev.h,v 1.31 2010/08/03 16:55:06 marco Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
@@ -317,6 +317,8 @@ struct acpiec_event {
struct acpiec_softc {
struct device sc_dev;
+ int sc_ecbusy;
+
/* command/status register */
bus_space_tag_t sc_cmd_bt;
bus_space_handle_t sc_cmd_bh;
diff --git a/sys/dev/acpi/acpiec.c b/sys/dev/acpi/acpiec.c
index 53f278affe5..87aef517b30 100644
--- a/sys/dev/acpi/acpiec.c
+++ b/sys/dev/acpi/acpiec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpiec.c,v 1.41 2010/08/02 17:13:57 deraadt Exp $ */
+/* $OpenBSD: acpiec.c,v 1.42 2010/08/03 16:55:06 marco Exp $ */
/*
* Copyright (c) 2006 Can Erkin Acar <canacar@openbsd.org>
*
@@ -217,10 +217,14 @@ acpiec_read(struct acpiec_softc *sc, u_int8_t addr, int len, u_int8_t *buffer)
* transaction does not get interrupted.
*/
dnprintf(20, "%s: read %d, %d\n", DEVNAME(sc), (int)addr, len);
+ sc->sc_ecbusy = 1;
acpiec_burst_enable(sc);
for (reg = 0; reg < len; reg++)
buffer[reg] = acpiec_read_1(sc, addr + reg);
acpiec_burst_disable(sc);
+ sc->sc_ecbusy = 0;
+ if (sc->sc_gotsci)
+ acpiec_sci_event(sc);
}
void
@@ -234,10 +238,14 @@ acpiec_write(struct acpiec_softc *sc, u_int8_t addr, int len, u_int8_t *buffer)
* transaction does not get interrupted.
*/
dnprintf(20, "%s: write %d, %d\n", DEVNAME(sc), (int)addr, len);
+ sc->sc_ecbusy = 1;
acpiec_burst_enable(sc);
for (reg = 0; reg < len; reg++)
acpiec_write_1(sc, addr + reg, buffer[reg]);
acpiec_burst_disable(sc);
+ sc->sc_ecbusy = 0;
+ if (sc->sc_gotsci)
+ acpiec_sci_event(sc);
}
int
@@ -316,7 +324,7 @@ acpiec_gpehandler(struct acpi_softc *acpi_sc, int gpe, void *arg)
dnprintf(10, "ACPIEC: got gpe\n");
do {
- if (sc->sc_gotsci)
+ if (sc->sc_gotsci && !sc->sc_ecbusy)
acpiec_sci_event(sc);
stat = acpiec_status(sc);