summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2011-02-15 19:10:20 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2011-02-15 19:10:20 +0000
commitf053f48489b5623a3dbe20a049d812093e1f74f0 (patch)
tree5aa9b5891f0cb397457188ff108b5b4518c4462a /sys
parent85199e9eb5b37db861964cc18570b6efed7f69ee (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.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_sis.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c
index e423a87eff1..ecf1e986417 100644
--- a/sys/dev/pci/if_sis.c
+++ b/sys/dev/pci/if_sis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sis.c,v 1.101 2010/08/31 17:13:44 deraadt Exp $ */
+/* $OpenBSD: if_sis.c,v 1.102 2011/02/15 19:10:19 kettenis Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@@ -1272,6 +1272,11 @@ sis_newbuf(struct sis_softc *sc, struct sis_desc *c)
c->sis_mbuf = m_new;
c->sis_ptr = htole32(c->map->dm_segs[0].ds_addr);
+
+ bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,
+ ((caddr_t)c - sc->sc_listkva), sizeof(struct sis_desc),
+ BUS_DMASYNC_PREWRITE);
+
c->sis_ctl = htole32(ETHER_MAX_DIX_LEN);
bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,