aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/controller/xhci.c
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2014-10-02 16:56:00 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2014-10-02 16:56:00 +0000
commit8b0569ba8f8836df785a6931a27160bfb07ca5aa (patch)
tree57c1a779372acc1050212087988b9707d0841b84 /sys/dev/usb/controller/xhci.c
parent61220c0d64870f38b7143ce423cec71d9c38a43e (diff)
downloadsrc-8b0569ba8f8836df785a6931a27160bfb07ca5aa.tar.gz
src-8b0569ba8f8836df785a6931a27160bfb07ca5aa.zip
Make sure we always set the maximum number of valid contexts.
MFC after: 3 days
Notes
Notes: svn path=/head/; revision=272422
Diffstat (limited to 'sys/dev/usb/controller/xhci.c')
-rw-r--r--sys/dev/usb/controller/xhci.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c
index 90acb5c3d6f3..8676c0f73d54 100644
--- a/sys/dev/usb/controller/xhci.c
+++ b/sys/dev/usb/controller/xhci.c
@@ -2271,14 +2271,17 @@ xhci_configure_mask(struct usb_device *udev, uint32_t mask, uint8_t drop)
/* adjust */
x--;
- /* figure out maximum */
- if (x > sc->sc_hw.devs[index].context_num) {
+ /* figure out the maximum number of contexts */
+ if (x > sc->sc_hw.devs[index].context_num)
sc->sc_hw.devs[index].context_num = x;
- temp = xhci_ctx_get_le32(sc, &pinp->ctx_slot.dwSctx0);
- temp &= ~XHCI_SCTX_0_CTX_NUM_SET(31);
- temp |= XHCI_SCTX_0_CTX_NUM_SET(x + 1);
- xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx0, temp);
- }
+ else
+ x = sc->sc_hw.devs[index].context_num;
+
+ /* update number of contexts */
+ temp = xhci_ctx_get_le32(sc, &pinp->ctx_slot.dwSctx0);
+ temp &= ~XHCI_SCTX_0_CTX_NUM_SET(31);
+ temp |= XHCI_SCTX_0_CTX_NUM_SET(x + 1);
+ xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx0, temp);
}
return (0);
}