summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/acpiec.c
diff options
context:
space:
mode:
authorJoshua Stein <jcs@cvs.openbsd.org>2016-08-23 18:26:22 +0000
committerJoshua Stein <jcs@cvs.openbsd.org>2016-08-23 18:26:22 +0000
commitca1266b891a253c74995caa0f24a37ff55997f4b (patch)
tree09a8d34660f1922f68d7c6132382318d073f0cc1 /sys/dev/acpi/acpiec.c
parent22d97a631328b13db6d01d497563b74b6275864b (diff)
don't enter burst mode for single-byte reads and writes.
avoids problems on hardware with broken or unimplemented burst mode and isn't really necessary for such small transactions anyway. matches what linux and freebsd have done for a long time. tested in snaps ok deraadt kettenis
Diffstat (limited to 'sys/dev/acpi/acpiec.c')
-rw-r--r--sys/dev/acpi/acpiec.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/dev/acpi/acpiec.c b/sys/dev/acpi/acpiec.c
index a7627b84e57..ec2e1d58264 100644
--- a/sys/dev/acpi/acpiec.c
+++ b/sys/dev/acpi/acpiec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpiec.c,v 1.53 2016/05/07 18:03:36 kettenis Exp $ */
+/* $OpenBSD: acpiec.c,v 1.54 2016/08/23 18:26:21 jcs Exp $ */
/*
* Copyright (c) 2006 Can Erkin Acar <canacar@openbsd.org>
*
@@ -218,10 +218,12 @@ acpiec_read(struct acpiec_softc *sc, u_int8_t addr, int len, u_int8_t *buffer)
*/
dnprintf(20, "%s: read %d, %d\n", DEVNAME(sc), (int)addr, len);
sc->sc_ecbusy = 1;
- acpiec_burst_enable(sc);
+ if (len > 1)
+ acpiec_burst_enable(sc);
for (reg = 0; reg < len; reg++)
buffer[reg] = acpiec_read_1(sc, addr + reg);
- acpiec_burst_disable(sc);
+ if (len > 1)
+ acpiec_burst_disable(sc);
sc->sc_ecbusy = 0;
}
@@ -237,10 +239,12 @@ acpiec_write(struct acpiec_softc *sc, u_int8_t addr, int len, u_int8_t *buffer)
*/
dnprintf(20, "%s: write %d, %d\n", DEVNAME(sc), (int)addr, len);
sc->sc_ecbusy = 1;
- acpiec_burst_enable(sc);
+ if (len > 1)
+ acpiec_burst_enable(sc);
for (reg = 0; reg < len; reg++)
acpiec_write_1(sc, addr + reg, buffer[reg]);
- acpiec_burst_disable(sc);
+ if (len > 1)
+ acpiec_burst_disable(sc);
sc->sc_ecbusy = 0;
}