Even if the endpoint it reseted before the stack gets informed that a
authormpi <mpi@openbsd.org>
Fri, 8 Aug 2014 14:17:52 +0000 (14:17 +0000)
committermpi <mpi@openbsd.org>
Fri, 8 Aug 2014 14:17:52 +0000 (14:17 +0000)
transfer stalled, report that a stall happen because umass(4) relies
on this behavior...

sys/dev/usb/xhci.c

index 4563d76..38e34b0 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: xhci.c,v 1.16 2014/07/11 16:38:58 pirofti Exp $ */
+/* $OpenBSD: xhci.c,v 1.17 2014/08/08 14:17:52 mpi Exp $ */
 
 /*
  * Copyright (c) 2014 Martin Pieuchot
@@ -674,6 +674,8 @@ xhci_event_xfer(struct xhci_softc *sc, uint64_t paddr, uint32_t status,
                xfer->status = USBD_NORMAL_COMPLETION;
                break;
        case XHCI_CODE_STALL:
+               /* XXX We need to report this condition for umass(4). */
+               xfer->status = USBD_STALLED;
        case XHCI_CODE_BABBLE:
                /*
                 * Since the stack might try to start a new transfer as
@@ -739,7 +741,8 @@ xhci_event_command(struct xhci_softc *sc, uint64_t paddr)
                for (i = 0; i < XHCI_MAX_TRANSFERS; i++) {
                        xfer = xp->pending_xfers[i];
                        if (xfer != NULL && xfer->done == 0) {
-                               xfer->status = USBD_IOERROR;
+                               if (xfer->status != USBD_STALLED)
+                                       xfer->status = USBD_IOERROR;
                                usb_transfer_complete(xfer);
                        }
                        xp->pending_xfers[i] = NULL;