Module Name: src
Committed By: skrll
Date: Sun Dec 29 09:17:51 UTC 2019
Modified Files:
src/sys/dev/usb: xhci.c
Log Message:
Acquire bus lock (if not polling) when changing xfer status, resetting
the timeout and ringing the doorbell in the start methods.
To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 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.114 src/sys/dev/usb/xhci.c:1.115
--- src/sys/dev/usb/xhci.c:1.114 Sun Sep 8 18:58:38 2019
+++ src/sys/dev/usb/xhci.c Sun Dec 29 09:17:51 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.114 2019/09/08 18:58:38 mrg Exp $ */
+/* $NetBSD: xhci.c,v 1.115 2019/12/29 09:17: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.114 2019/09/08 18:58:38 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.115 2019/12/29 09:17:51 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -3897,7 +3897,6 @@ xhci_device_ctrl_start(struct usbd_xfer
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 @@ xhci_device_ctrl_start(struct usbd_xfer
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 @@ xhci_device_bulk_start(struct usbd_xfer
(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 @@ xhci_device_bulk_start(struct usbd_xfer
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 @@ xhci_device_intr_start(struct usbd_xfer
(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 @@ xhci_device_intr_start(struct usbd_xfer
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;
}