Author: hselasky
Date: Mon Jan 13 15:06:03 2014
New Revision: 260588
URL: http://svnweb.freebsd.org/changeset/base/260588

Log:
  Separate I/O errors from reception of STALL PID.
  
  MFC after:    1 week

Modified:
  head/sys/dev/usb/controller/ehci.c
  head/sys/dev/usb/controller/uhci.c

Modified: head/sys/dev/usb/controller/ehci.c
==============================================================================
--- head/sys/dev/usb/controller/ehci.c  Mon Jan 13 13:27:00 2014        
(r260587)
+++ head/sys/dev/usb/controller/ehci.c  Mon Jan 13 15:06:03 2014        
(r260588)
@@ -1198,9 +1198,16 @@ ehci_non_isoc_done_sub(struct usb_xfer *
                    (status & EHCI_QTD_PINGSTATE) ? "[PING]" : "");
        }
 #endif
-
-       return ((status & EHCI_QTD_HALTED) ?
-           USB_ERR_STALLED : USB_ERR_NORMAL_COMPLETION);
+       if (status & EHCI_QTD_HALTED) {
+               if ((xfer->xroot->udev->parent_hs_hub != NULL) ||
+                   (xfer->xroot->udev->address != 0)) {
+                       /* try to separate I/O errors from STALL */
+                       if (EHCI_QTD_GET_CERR(status) == 0)
+                               return (USB_ERR_IOERROR);
+               }
+               return (USB_ERR_STALLED);
+       }
+       return (USB_ERR_NORMAL_COMPLETION);
 }
 
 static void

Modified: head/sys/dev/usb/controller/uhci.c
==============================================================================
--- head/sys/dev/usb/controller/uhci.c  Mon Jan 13 13:27:00 2014        
(r260587)
+++ head/sys/dev/usb/controller/uhci.c  Mon Jan 13 15:06:03 2014        
(r260588)
@@ -1179,8 +1179,13 @@ uhci_non_isoc_done_sub(struct usb_xfer *
                    (status & UHCI_TD_SPD) ? "[SPD]" : "");
        }
 #endif
-       return (status & UHCI_TD_STALLED) ?
-           USB_ERR_STALLED : USB_ERR_NORMAL_COMPLETION;
+       if (status & UHCI_TD_STALLED) {
+               /* try to separate I/O errors from STALL */
+               if (UHCI_TD_GET_ERRCNT(status) == 0)
+                       return (USB_ERR_IOERROR);
+               return (USB_ERR_STALLED);
+       }
+       return (USB_ERR_NORMAL_COMPLETION);
 }
 
 static void
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to