]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Report any USB errors as EFI_USB_ERR_SYSTEM
authorMichael Brown <mcb30@ipxe.org>
Tue, 29 Sep 2020 13:32:57 +0000 (14:32 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 29 Sep 2020 13:32:57 +0000 (14:32 +0100)
Some UEFI USB drivers (e.g. the UsbKbDxe driver in EDK2) will react to
a reported EFI_USB_ERR_STALL by attempting to clear the endpoint halt.
This is redundant with iPXE's EFI_USB_IO_PROTOCOL implementation,
since endpoint stalls are cleared automatically by the USB core as
needed.

The UEFI USB driver's attempt to clear the endpoint halt can introduce
an unwanted 5 second delay per endpoint if the USB error was the
result of a device being physically removed, since the control
transfer will always time out.

Fix by reporting all USB errors as EFI_USB_ERR_SYSTEM instead of
EFI_USB_ERR_STALL.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_usb.c

index da8ae8f3ebdfd7a4408551027a0898175a8017a0..f280a681b005c86e4ff8dd52b882c44fe1ffbee8 100644 (file)
@@ -412,7 +412,7 @@ static void efi_usb_async_complete ( struct usb_endpoint *ep,
                goto drop;
 
        /* Construct status */
-       status = ( ( rc == 0 ) ? 0 : EFI_USB_ERR_STALL );
+       status = ( ( rc == 0 ) ? 0 : EFI_USB_ERR_SYSTEM );
 
        /* Report completion */
        usbep->callback ( iobuf->data, iob_len ( iobuf ), usbep->context,
@@ -600,8 +600,7 @@ efi_usb_control_transfer ( EFI_USB_IO_PROTOCOL *usbio,
                       "failed: %s\n", usbintf->name, request, value, index,
                       le16_to_cpu ( packet->Length ), data, ( ( size_t ) len ),
                       strerror ( rc ) );
-               /* Assume that any error represents a stall */
-               *status = EFI_USB_ERR_STALL;
+               *status = EFI_USB_ERR_SYSTEM;
                goto err_control;
        }