Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci wm(4): Use bus_dmamap_sync, not bus_space_barrie...



details:   https://anonhg.NetBSD.org/src/rev/0f84d455d646
branches:  trunk
changeset: 368560:0f84d455d646
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Jul 19 08:21:02 2022 +0000

description:
wm(4): Use bus_dmamap_sync, not bus_space_barrier, for tx desc.

The newly written tx descriptor needs to be visible to the device
before the TDT register is set.  There's no bus space mappings that
need any barriers, though -- nothing mapped prefetchable or cacheable
here.  So bus_dmamap_sync (via wm_cdtxsync) is necessary, not
bus_space_barrier.  By accident, bus_space_barrier implies the same
barrier instructions as bus_dmamap_sync on some architectures, but it
wouldn't work at all if we were bouncing.

ok msaitoh@, knakahara@

diffstat:

 sys/dev/pci/if_wm.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r d1ef3a4d906a -r 0f84d455d646 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Tue Jul 19 06:50:34 2022 +0000
+++ b/sys/dev/pci/if_wm.c       Tue Jul 19 08:21:02 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.743 2022/07/19 06:50:34 skrll Exp $        */
+/*     $NetBSD: if_wm.c,v 1.744 2022/07/19 08:21:02 riastradh Exp $    */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.743 2022/07/19 06:50:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.744 2022/07/19 08:21:02 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4918,8 +4918,8 @@
        txd->wtx_fields.wtxu_options = 0;
        txd->wtx_fields.wtxu_vlan = 0;
 
-       bus_space_barrier(sc->sc_st, sc->sc_sh, 0, 0,
-           BUS_SPACE_BARRIER_WRITE);
+       wm_cdtxsync(txq, 0, WM_NTXDESC(txq),
+           BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
        txq->txq_next = WM_NEXTTX(txq, txq->txq_next);
        CSR_WRITE(sc, WMREG_TDT(0), txq->txq_next);



Home | Main Index | Thread Index | Old Index