Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/dev/usb Pull up following revision(s) (requested by t...



details:   https://anonhg.NetBSD.org/src/rev/927ae45cae08
branches:  netbsd-9
changeset: 1001385:927ae45cae08
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jan 21 11:43:27 2020 +0000

description:
Pull up following revision(s) (requested by taca in ticket #625):

        sys/dev/usb/xhci.c: revision 1.115

Acquire bus lock (if not polling) when changing xfer status, resetting
the timeout and ringing the doorbell in the start methods.

diffstat:

 sys/dev/usb/xhci.c |  22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diffs (96 lines):

diff -r 2f6d9c6fae83 -r 927ae45cae08 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Tue Jan 21 11:40:17 2020 +0000
+++ b/sys/dev/usb/xhci.c        Tue Jan 21 11:43:27 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci.c,v 1.107.2.3 2019/09/13 06:32:11 martin Exp $    */
+/*     $NetBSD: xhci.c,v 1.107.2.4 2020/01/21 11:43:27 martin Exp $    */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.3 2019/09/13 06:32:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.4 2020/01/21 11:43:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -3897,7 +3897,6 @@
            XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_STATUS_STAGE) |
            XHCI_TRB_3_IOC_BIT;
        xhci_soft_trb_put(&xx->xx_trb[i++], parameter, status, control);
-       xfer->ux_status = USBD_IN_PROGRESS;
 
        if (!polling)
                mutex_enter(&tr->xr_lock);
@@ -3905,12 +3904,17 @@
        if (!polling)
                mutex_exit(&tr->xr_lock);
 
+       if (!polling)
+               mutex_enter(&sc->sc_lock);
+       xfer->ux_status = USBD_IN_PROGRESS;
        xhci_db_write_4(sc, XHCI_DOORBELL(xs->xs_idx), dci);
 
        if (xfer->ux_timeout && !xhci_polling_p(sc)) {
                callout_reset(&xfer->ux_callout, mstohz(xfer->ux_timeout),
                    xhci_timeout, xfer);
        }
+       if (!polling)
+               mutex_exit(&sc->sc_lock);
 
        return USBD_IN_PROGRESS;
 }
@@ -4017,7 +4021,6 @@
            (usbd_xfer_isread(xfer) ? XHCI_TRB_3_ISP_BIT : 0) |
            XHCI_TRB_3_IOC_BIT;
        xhci_soft_trb_put(&xx->xx_trb[i++], parameter, status, control);
-       xfer->ux_status = USBD_IN_PROGRESS;
 
        if (!polling)
                mutex_enter(&tr->xr_lock);
@@ -4025,12 +4028,17 @@
        if (!polling)
                mutex_exit(&tr->xr_lock);
 
+       if (!polling)
+               mutex_enter(&sc->sc_lock);
+       xfer->ux_status = USBD_IN_PROGRESS;
        xhci_db_write_4(sc, XHCI_DOORBELL(xs->xs_idx), dci);
 
        if (xfer->ux_timeout && !xhci_polling_p(sc)) {
                callout_reset(&xfer->ux_callout, mstohz(xfer->ux_timeout),
                    xhci_timeout, xfer);
        }
+       if (!polling)
+               mutex_exit(&sc->sc_lock);
 
        return USBD_IN_PROGRESS;
 }
@@ -4127,7 +4135,6 @@
            (usbd_xfer_isread(xfer) ? XHCI_TRB_3_ISP_BIT : 0) |
            XHCI_TRB_3_IOC_BIT;
        xhci_soft_trb_put(&xx->xx_trb[i++], parameter, status, control);
-       xfer->ux_status = USBD_IN_PROGRESS;
 
        if (!polling)
                mutex_enter(&tr->xr_lock);
@@ -4135,12 +4142,17 @@
        if (!polling)
                mutex_exit(&tr->xr_lock);
 
+       if (!polling)
+               mutex_enter(&sc->sc_lock);
+       xfer->ux_status = USBD_IN_PROGRESS;
        xhci_db_write_4(sc, XHCI_DOORBELL(xs->xs_idx), dci);
 
        if (xfer->ux_timeout && !polling) {
                callout_reset(&xfer->ux_callout, mstohz(xfer->ux_timeout),
                    xhci_timeout, xfer);
        }
+       if (!polling)
+               mutex_exit(&sc->sc_lock);
 
        return USBD_IN_PROGRESS;
 }



Home | Main Index | Thread Index | Old Index