From eef50e6609ed102a8084d99423cf6a7c5aa548f4 Mon Sep 17 00:00:00 2001 From: stsp Date: Tue, 26 Jul 2016 13:00:28 +0000 Subject: [PATCH] Fix byteswap errors in rtwn(4) and urtwn(4) introduced by me on June 17. Repairs urtwn(4) on macppc. Problem reported by juanfra@. ok millert@ deraadt@ --- sys/dev/ic/rtwn.c | 12 ++++-------- sys/dev/pci/if_rtwn.c | 10 +++++++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/dev/ic/rtwn.c b/sys/dev/ic/rtwn.c index 314819aae1e..ee4e5b37f46 100644 --- a/sys/dev/ic/rtwn.c +++ b/sys/dev/ic/rtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtwn.c,v 1.9 2016/06/17 10:53:55 stsp Exp $ */ +/* $OpenBSD: rtwn.c,v 1.10 2016/07/26 13:00:28 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini @@ -297,14 +297,12 @@ rtwn_write_1(struct rtwn_softc *sc, uint16_t addr, uint8_t val) void rtwn_write_2(struct rtwn_softc *sc, uint16_t addr, uint16_t val) { - val = htole16(val); sc->sc_ops.write_2(sc->sc_ops.cookie, addr, val); } void rtwn_write_4(struct rtwn_softc *sc, uint16_t addr, uint32_t val) { - val = htole32(val); sc->sc_ops.write_4(sc->sc_ops.cookie, addr, val); } @@ -687,13 +685,11 @@ rtwn_ra_init(struct rtwn_softc *sc) /* Configure Automatic Rate Fallback Register. */ if (ic->ic_curmode == IEEE80211_MODE_11B) { if (rates & 0x0c) - rtwn_write_4(sc, R92C_ARFR(0), - htole32(rates & 0x0d)); + rtwn_write_4(sc, R92C_ARFR(0), rates & 0x0d); else - rtwn_write_4(sc, R92C_ARFR(0), - htole32(rates & 0x0f)); + rtwn_write_4(sc, R92C_ARFR(0), rates & 0x0f); } else - rtwn_write_4(sc, R92C_ARFR(0), htole32(rates & 0x0ff5)); + rtwn_write_4(sc, R92C_ARFR(0), rates & 0x0ff5); } if (sc->chip & RTWN_CHIP_88E) diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c index a50eec59b52..93d6abec640 100644 --- a/sys/dev/pci/if_rtwn.c +++ b/sys/dev/pci/if_rtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rtwn.c,v 1.23 2016/07/21 08:38:33 stsp Exp $ */ +/* $OpenBSD: if_rtwn.c,v 1.24 2016/07/26 13:00:28 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini @@ -742,16 +742,20 @@ uint16_t rtwn_pci_read_2(void *cookie, uint16_t addr) { struct rtwn_pci_softc *sc = cookie; + uint16_t val; - return bus_space_read_2(sc->sc_st, sc->sc_sh, addr); + val = bus_space_read_2(sc->sc_st, sc->sc_sh, addr); + return le16toh(val); } uint32_t rtwn_pci_read_4(void *cookie, uint16_t addr) { struct rtwn_pci_softc *sc = cookie; + uint32_t val; - return bus_space_read_4(sc->sc_st, sc->sc_sh, addr); + val = bus_space_read_4(sc->sc_st, sc->sc_sh, addr); + return le32toh(val); } void -- 2.20.1