From 9f3cc60fee5a5f049a9a326de1117db3b44d5f2b Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Sun, 15 Oct 2006 21:56:50 +0000 Subject: Place bus_dmamap_sync() around malo_send_cmd this should help porting to other archs later. OK mglocker@ --- sys/dev/ic/malo.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c index fd3cc56c125..cc878db6d1d 100644 --- a/sys/dev/ic/malo.c +++ b/sys/dev/ic/malo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malo.c,v 1.3 2006/10/15 20:33:39 mglocker Exp $ */ +/* $OpenBSD: malo.c,v 1.4 2006/10/15 21:56:49 claudio Exp $ */ /* * Copyright (c) 2006 Claudio Jeker @@ -378,6 +378,8 @@ malo_load_firmware(struct malo_softc *sc) bcopy(ucode + count, data, bsize); + bus_dmamap_sync(sc->sc_dmat, sc->sc_cmd_dmam, 0, PAGE_SIZE, + BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); if (malo_send_cmd(sc, sc->sc_cmd_dmaaddr, 5) != 0) { printf("%s: timeout at firmware upload!\n", sc->sc_dev.dv_xname); @@ -396,6 +398,8 @@ malo_load_firmware(struct malo_softc *sc) hdr->seqnum = htole16(sn++); hdr->result = 0; + bus_dmamap_sync(sc->sc_dmat, sc->sc_cmd_dmam, 0, PAGE_SIZE, + BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); if (malo_send_cmd(sc, sc->sc_cmd_dmaaddr, 0xf0f1f2f4) != 0) { printf("%s: timeout at firmware load!\n", sc->sc_dev.dv_xname); return (ETIMEDOUT); @@ -444,10 +448,15 @@ malo_reset(struct malo_softc *sc) hdr->seqnum = 1; hdr->result = 0; - malo_send_cmd(sc, sc->sc_cmd_dmaaddr, 0); + bus_dmamap_sync(sc->sc_dmat, sc->sc_cmd_dmam, 0, PAGE_SIZE, + BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); + malo_send_cmd(sc, sc->sc_cmd_dmaaddr, 0); tsleep(sc, 0, "malorst", hz); + bus_dmamap_sync(sc->sc_dmat, sc->sc_cmd_dmam, 0, PAGE_SIZE, + BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD); + if (hdr->cmd & MALO_CMD_RESPONSE) return (0); else @@ -473,10 +482,15 @@ malo_get_spec(struct malo_softc *sc) memset(spec->PermanentAddress, 0xff, ETHER_ADDR_LEN); spec->CookiePtr = htole32(sc->sc_cookie_dmaaddr); - malo_send_cmd(sc, sc->sc_cmd_dmaaddr, 0); + bus_dmamap_sync(sc->sc_dmat, sc->sc_cmd_dmam, 0, PAGE_SIZE, + BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); + malo_send_cmd(sc, sc->sc_cmd_dmaaddr, 0); tsleep(sc, 0, "malospc", hz); + bus_dmamap_sync(sc->sc_dmat, sc->sc_cmd_dmam, 0, PAGE_SIZE, + BUS_DMASYNC_POSTWRITE|BUS_DMASYNC_POSTREAD); + if ((hdr->cmd & MALO_CMD_RESPONSE) == 0) return (ETIMEDOUT); -- cgit v1.2.3