Module Name:    src
Committed By:   riastradh
Date:           Tue Jul 19 08:22:34 UTC 2022

Modified Files:
        src/sys/dev/pci: if_wm.c

Log Message:
wm(4): Use CSR_WRITE_FLUSH, not bus_space_barrier.

The bus space is mapped non-prefetchable and non-cacheable, so there
is no need for bus_space_barrier and it might not even have any
effect -- bus_space_read/write are totally ordered for non-
prefetchable, non-cacheable mappings anyway.  Presumably the intent
here was to wait for acknowledgment of the write from the device --
which bus_space_barrier does not guarantee, and which I expect
requires a read transaction as CSR_WRITE_FLUSH performs.

ok msaitoh@, knakahara@


To generate a diff of this commit:
cvs rdiff -u -r1.744 -r1.745 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.744 src/sys/dev/pci/if_wm.c:1.745
--- src/sys/dev/pci/if_wm.c:1.744	Tue Jul 19 08:21:02 2022
+++ src/sys/dev/pci/if_wm.c	Tue Jul 19 08:22:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.744 2022/07/19 08:21:02 riastradh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.745 2022/07/19 08:22:34 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.744 2022/07/19 08:21:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.745 2022/07/19 08:22:34 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4923,8 +4923,7 @@ wm_flush_desc_rings(struct wm_softc *sc)
 
 	txq->txq_next = WM_NEXTTX(txq, txq->txq_next);
 	CSR_WRITE(sc, WMREG_TDT(0), txq->txq_next);
-	bus_space_barrier(sc->sc_st, sc->sc_sh, 0, 0,
-	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+	CSR_WRITE_FLUSH(sc);
 	delay(250);
 
 	preg = pci_conf_read(sc->sc_pc, sc->sc_pcitag, WM_PCI_DESCRING_STATUS);

Reply via email to