From ff4af42e392e52181118a15bc64987f139cf4504 Mon Sep 17 00:00:00 2001 From: jcs Date: Tue, 23 Aug 2016 18:26:21 +0000 Subject: [PATCH] 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 --- sys/dev/acpi/acpiec.c | 14 +++++++++----- 1 file 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 * @@ -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; } -- 2.20.1