summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-10-15 21:56:50 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-10-15 21:56:50 +0000
commit9f3cc60fee5a5f049a9a326de1117db3b44d5f2b (patch)
treec039bd1491355f1c8a501557651060ddad949495 /sys/dev
parent463c0940a14cca14f498009fabde4439d091bc0d (diff)
Place bus_dmamap_sync() around malo_send_cmd this should help porting to
other archs later. OK mglocker@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/malo.c20
1 files changed, 17 insertions, 3 deletions
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 <claudio@openbsd.org>
@@ -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);