diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-09-03 18:14:55 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-09-03 18:14:55 +0000 |
commit | 4b3f9555867bf4b4a960288a42b9868653d464af (patch) | |
tree | 9531f71eb0e8105462cd78bf05ec236b0aec1261 /sys/dev/pci/if_vr.c | |
parent | fd53f5b80a6d05b7407a02ef06784880535c4a21 (diff) |
bus_dmamap_sync() freshly initialized Rx descriptors before flipping the bit
that hands them over to the hardware. This prevents the hardware from seeing
stale contents if the compiler decides to re-order stores or if the hardware
does store-reordering.
There are sme doubts whether the i386/amd64 bus_dmamap_sync() implementation
will be able to convince future compilers that do even more insanely stupid
optimizations from re-ordering stores. That will be addressed in a seperate
patch.
ok matthew@, sthen@, oga@
Diffstat (limited to 'sys/dev/pci/if_vr.c')
-rw-r--r-- | sys/dev/pci/if_vr.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index fb2b03220be..6023d33a07c 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vr.c,v 1.105 2010/05/19 15:27:35 oga Exp $ */ +/* $OpenBSD: if_vr.c,v 1.106 2010/09/03 18:14:54 kettenis Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1562,6 +1562,10 @@ vr_alloc_mbuf(struct vr_softc *sc, struct vr_chain_onefrag *r) d = r->vr_ptr; d->vr_data = htole32(r->vr_map->dm_segs[0].ds_addr); d->vr_ctl = htole32(VR_RXCTL | VR_RXLEN); + + bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, 0, + sc->sc_listmap->dm_mapsize, BUS_DMASYNC_PREWRITE); + d->vr_status = htole32(VR_RXSTAT); bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, 0, |