summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-11-24 12:55:17 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-11-24 12:55:17 +0000
commit3d68240482d47520c1d9fb4966cd068fa6f21920 (patch)
tree7246e97b2d56b39678828e10a8ece0e169017630 /sys/dev
parent249d2de492cfb4253ac0e7662fc1dfd85f277ec8 (diff)
In debug mode, print more information when a transfer is aborted and use
a different index value for a chained TRB and a freed one.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/xhci.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c
index b474c057fb6..fb828431ca4 100644
--- a/sys/dev/usb/xhci.c
+++ b/sys/dev/usb/xhci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xhci.c,v 1.42 2014/11/23 10:46:46 mpi Exp $ */
+/* $OpenBSD: xhci.c,v 1.43 2014/11/24 12:55:16 mpi Exp $ */
/*
* Copyright (c) 2014 Martin Pieuchot
@@ -847,9 +847,9 @@ xhci_xfer_done(struct usbd_xfer *xfer)
int ntrb, i;
#ifdef XHCI_DEBUG
- if (xx->index == -1 || xp->pending_xfers[xx->index] == NULL) {
- printf("%s: xfer=%p already done (index=%d)\n", __func__,
- xfer, xx->index);
+ if (xx->index < 0 || xp->pending_xfers[xx->index] == NULL) {
+ printf("%s: xfer=%p done (index=%d, ntrb=%zd)\n", __func__,
+ xfer, xx->index, xx->ntrb);
}
#endif
@@ -1455,7 +1455,7 @@ xhci_xfer_get_trb(struct xhci_softc *sc, struct usbd_xfer* xfer,
xp->pending_xfers[xp->ring.index] = xfer;
xp->free_trbs--;
- xx->index = (last) ? xp->ring.index : -1;
+ xx->index = (last) ? xp->ring.index : -2;
xx->ntrb += 1;
*togglep = xp->ring.toggle;
@@ -1818,23 +1818,25 @@ const usb_hub_descriptor_t xhci_hubd = {
void
xhci_abort_xfer(struct usbd_xfer *xfer, usbd_status status)
{
- int s;
+ splsoftassert(IPL_SOFTUSB);
- DPRINTF(("%s: xfer=%p err=%s\n", __func__, xfer, usbd_errstr(status)));
+ DPRINTF(("%s: xfer=%p status=%s err=%s actlen=%d len=%d index=%d\n",
+ __func__, xfer, usbd_errstr(xfer->status), usbd_errstr(status),
+ xfer->actlen, xfer->length, ((struct xhci_xfer *)xfer)->index));
xfer->status = status;
-
- s = splusb();
xhci_xfer_done(xfer);
- splx(s);
}
void
xhci_timeout(void *addr)
{
struct usbd_xfer *xfer = addr;
+ int s;
+ s = splusb();
xhci_abort_xfer(xfer, USBD_TIMEOUT);
+ splx(s);
}
usbd_status