diff options
author | 2016-08-23 18:26:21 +0000 | |
---|---|---|
committer | 2016-08-23 18:26:21 +0000 | |
commit | ff4af42e392e52181118a15bc64987f139cf4504 (patch) | |
tree | d9e5a1bf9b5192d89df98beb0397f908d55bcac8 | |
parent | The device trees for sun8i and sun9i no longer include an address in the (diff) | |
download | wireguard-openbsd-ff4af42e392e52181118a15bc64987f139cf4504.tar.xz wireguard-openbsd-ff4af42e392e52181118a15bc64987f139cf4504.zip |
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
-rw-r--r-- | sys/dev/acpi/acpiec.c | 14 |
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; } |