diff options
author | 2011-02-15 19:10:19 +0000 | |
---|---|---|
committer | 2011-02-15 19:10:19 +0000 | |
commit | 83af3edbc7d6d46cb56c6727fa40a04fa54697fb (patch) | |
tree | fb4a391945ce12768bfe02bd678958f9083a54ed | |
parent | Copy pasto in comment. Fix by brad@ OK dlg@ (diff) | |
download | wireguard-openbsd-83af3edbc7d6d46cb56c6727fa40a04fa54697fb.tar.xz wireguard-openbsd-83af3edbc7d6d46cb56c6727fa40a04fa54697fb.zip |
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.
-rw-r--r-- | sys/dev/pci/if_sis.c | 7 |
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, |