summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2020-07-02 03:51:58 +0200
committerMichael Brown2020-07-02 04:06:50 +0200
commit5d6fb7282966e3b77e6bb187d171511e8348c3c9 (patch)
tree2c718322b3017cf9c485a79fc56bd4c82e7100e1 /src
parent[axge] Handle non-gigabit link speeds (diff)
downloadipxe-5d6fb7282966e3b77e6bb187d171511e8348c3c9.tar.gz
ipxe-5d6fb7282966e3b77e6bb187d171511e8348c3c9.tar.xz
ipxe-5d6fb7282966e3b77e6bb187d171511e8348c3c9.zip
[usb] Clear device endpoint halt before resetting host endpoint
Resetting the host endpoint may immediately restart any pending transfers for that endpoint. If the device endpoint halt has not yet been cleared, then this will probably result in a second failed transfer. This second failure may be detected within usb_endpoint_reset() while waiting for usb_clear_feature() to complete. The endpoint will subsequently be removed from the list of halted endpoints, causing the second failure to be effectively ignored and leaving the host endpoint in a permanently halted state. Fix by deferring the host endpoint reset until after the device endpoint is ready to accept new transfers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/bus/usb.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/drivers/bus/usb.c b/src/drivers/bus/usb.c
index d8db3849a..d18751c66 100644
--- a/src/drivers/bus/usb.c
+++ b/src/drivers/bus/usb.c
@@ -405,13 +405,6 @@ static int usb_endpoint_reset ( struct usb_endpoint *ep ) {
/* Sanity check */
assert ( ! list_empty ( &ep->halted ) );
- /* Reset endpoint */
- if ( ( rc = ep->host->reset ( ep ) ) != 0 ) {
- DBGC ( usb, "USB %s %s could not reset: %s\n",
- usb->name, usb_endpoint_name ( ep ), strerror ( rc ) );
- return rc;
- }
-
/* Clear transaction translator, if applicable */
if ( ( rc = usb_endpoint_clear_tt ( ep ) ) != 0 )
return rc;
@@ -427,6 +420,13 @@ static int usb_endpoint_reset ( struct usb_endpoint *ep ) {
return rc;
}
+ /* Reset endpoint */
+ if ( ( rc = ep->host->reset ( ep ) ) != 0 ) {
+ DBGC ( usb, "USB %s %s could not reset: %s\n",
+ usb->name, usb_endpoint_name ( ep ), strerror ( rc ) );
+ return rc;
+ }
+
/* Remove from list of halted endpoints */
list_del ( &ep->halted );
INIT_LIST_HEAD ( &ep->halted );