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 CSR_WRITE_FLUSH, not bus_space_barrier.



details:   https://anonhg.NetBSD.org/src/rev/a6d21c1ab738
branches:  trunk
changeset: 368561:a6d21c1ab738
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Jul 19 08:22:34 2022 +0000

description:
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@

diffstat:

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

diffs (28 lines):

diff -r 0f84d455d646 -r a6d21c1ab738 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Tue Jul 19 08:21:02 2022 +0000
+++ b/sys/dev/pci/if_wm.c       Tue Jul 19 08:22:34 2022 +0000
@@ -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 @@
 
        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);



Home | Main Index | Thread Index | Old Index