summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/gem.c16
-rw-r--r--sys/dev/ic/gemvar.h15
2 files changed, 16 insertions, 15 deletions
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c
index 514c6fb2476..eefb6410649 100644
--- a/sys/dev/ic/gem.c
+++ b/sys/dev/ic/gem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gem.c,v 1.101 2013/08/08 16:01:34 kettenis Exp $ */
+/* $OpenBSD: gem.c,v 1.102 2014/03/14 11:04:24 dlg Exp $ */
/* $NetBSD: gem.c,v 1.1 2001/09/16 00:11:43 eeh Exp $ */
/*
@@ -1056,7 +1056,7 @@ gem_rint(struct gem_softc *sc)
GEM_CDRXSYNC(sc, i,
BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
- rxstat = GEM_DMA_READ(sc, sc->sc_rxdescs[i].gd_flags);
+ rxstat = GEM_DMA_READ(sc, &sc->sc_rxdescs[i].gd_flags);
if (rxstat & GEM_RD_OWN) {
/* We have processed all of the receive buffers. */
@@ -1086,9 +1086,9 @@ gem_rint(struct gem_softc *sc)
if (ifp->if_flags & IFF_DEBUG) {
printf(" rxsoft %p descriptor %d: ", rxs, i);
printf("gd_flags: 0x%016llx\t", (long long)
- GEM_DMA_READ(sc, sc->sc_rxdescs[i].gd_flags));
+ GEM_DMA_READ(sc, &sc->sc_rxdescs[i].gd_flags));
printf("gd_addr: 0x%016llx\n", (long long)
- GEM_DMA_READ(sc, sc->sc_rxdescs[i].gd_addr));
+ GEM_DMA_READ(sc, &sc->sc_rxdescs[i].gd_addr));
}
#endif
@@ -1811,15 +1811,15 @@ gem_start(struct ifnet *ifp)
BUS_DMASYNC_PREWRITE);
for (i = 0; i < map->dm_nsegs; i++) {
- sc->sc_txdescs[frag].gd_addr =
- GEM_DMA_WRITE(sc, map->dm_segs[i].ds_addr);
+ GEM_DMA_WRITE(sc, &sc->sc_txdescs[frag].gd_addr,
+ map->dm_segs[i].ds_addr);
flags = map->dm_segs[i].ds_len & GEM_TD_BUFSIZE;
if (i == 0)
flags |= GEM_TD_START_OF_PACKET;
if (i == (map->dm_nsegs - 1))
flags |= GEM_TD_END_OF_PACKET;
- sc->sc_txdescs[frag].gd_flags =
- GEM_DMA_WRITE(sc, flags);
+ GEM_DMA_WRITE(sc, &sc->sc_txdescs[frag].gd_flags,
+ flags);
bus_dmamap_sync(sc->sc_dmatag, sc->sc_cddmamap,
GEM_CDTXOFF(frag), sizeof(struct gem_desc),
BUS_DMASYNC_PREWRITE);
diff --git a/sys/dev/ic/gemvar.h b/sys/dev/ic/gemvar.h
index 05ed2b3711f..12fc0ae897d 100644
--- a/sys/dev/ic/gemvar.h
+++ b/sys/dev/ic/gemvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: gemvar.h,v 1.27 2013/03/09 17:57:00 mpi Exp $ */
+/* $OpenBSD: gemvar.h,v 1.28 2014/03/14 11:04:24 dlg Exp $ */
/* $NetBSD: gemvar.h,v 1.1 2001/09/16 00:11:43 eeh Exp $ */
/*
@@ -208,8 +208,10 @@ struct gem_softc {
void (*sc_hwinit)(struct gem_softc *);
};
-#define GEM_DMA_READ(sc, v) (((sc)->sc_pci) ? letoh64(v) : betoh64(v))
-#define GEM_DMA_WRITE(sc, v) (((sc)->sc_pci) ? htole64(v) : htobe64(v))
+#define GEM_DMA_READ(_sc, _a) \
+ (((_sc)->sc_pci) ? lemtoh64(_a) : bemtoh64(_a))
+#define GEM_DMA_WRITE(_sc, _a, _v) \
+ (((_sc)->sc_pci) ? htolem64((_a), (_v)) : htobem64((_a), (_v)))
/*
* This macro returns the current media entry for *non-MII* media.
@@ -266,10 +268,9 @@ do { \
struct gem_desc *__rxd = &sc->sc_rxdescs[(x)]; \
struct mbuf *__m = __rxs->rxs_mbuf; \
\
- __rxd->gd_addr = \
- GEM_DMA_WRITE((sc), __rxs->rxs_dmamap->dm_segs[0].ds_addr); \
- __rxd->gd_flags = \
- GEM_DMA_WRITE((sc), \
+ GEM_DMA_WRITE((sc), &__rxd->gd_addr, \
+ __rxs->rxs_dmamap->dm_segs[0].ds_addr); \
+ GEM_DMA_WRITE((sc), &__rxd->gd_flags, \
(((__m->m_ext.ext_size)<<GEM_RD_BUFSHIFT) \
& GEM_RD_BUFSIZE) | GEM_RD_OWN); \
GEM_CDRXSYNC((sc), (x), BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); \