Module Name:    src
Committed By:   skrll
Date:           Fri Jan 11 15:43:51 UTC 2019

Modified Files:
        src/sys/dev/usb: xhci.c

Log Message:
Add a bs_barrier to make ThunderX xhci work.  Not sure why this is needed,
but I'll work it out later.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/usb/xhci.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/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.102 src/sys/dev/usb/xhci.c:1.103
--- src/sys/dev/usb/xhci.c:1.102	Fri Jan 11 15:39:24 2019
+++ src/sys/dev/usb/xhci.c	Fri Jan 11 15:43:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.102 2019/01/11 15:39:24 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.103 2019/01/11 15:43:51 skrll Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.102 2019/01/11 15:39:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.103 2019/01/11 15:43:51 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -345,6 +345,13 @@ xhci_op_write_8(const struct xhci_softc 
 	}
 }
 
+static inline void
+xhci_op_barrier(const struct xhci_softc * const sc, bus_size_t offset,
+    bus_size_t len, int flags)
+{
+	bus_space_barrier(sc->sc_iot, sc->sc_obh, offset, len, flags);
+}
+
 static inline uint32_t
 xhci_rt_read_4(const struct xhci_softc * const sc, bus_size_t offset)
 {
@@ -1190,10 +1197,13 @@ xhci_init(struct xhci_softc *sc)
 	xhci_rt_write_8(sc, XHCI_ERSTBA(0), DMAADDR(&sc->sc_eventst_dma, 0));
 	xhci_rt_write_8(sc, XHCI_ERDP(0), xhci_ring_trbp(&sc->sc_er, 0) |
 	    XHCI_ERDP_LO_BUSY);
+
 	xhci_op_write_8(sc, XHCI_DCBAAP, DMAADDR(&sc->sc_dcbaa_dma, 0));
 	xhci_op_write_8(sc, XHCI_CRCR, xhci_ring_trbp(&sc->sc_cr, 0) |
 	    sc->sc_cr.xr_cs);
 
+	xhci_op_barrier(sc, 0, 4, BUS_SPACE_BARRIER_WRITE);
+
 	HEXDUMP("eventst", KERNADDR(&sc->sc_eventst_dma, 0),
 	    XHCI_ERSTE_SIZE * XHCI_EVENT_RING_SEGMENTS);
 

Reply via email to