Skip to content

Commit

Permalink
[efi] Do not attempt EFI_USB_IO_PROTOCOL transfers during shutdown
Browse files Browse the repository at this point in the history
On at least some platforms (observed with a Raspberry Pi), any attempt
to perform USB transfers via EFI_USB_IO_PROTOCOL during EFI shutdown
will lock up the system.  This is quite probably due to the already
documented failure of all EFI timers when ExitBootServices() is
called: see e.g. commit 5cf5ffe "[efi] Work around temporal anomaly
encountered during ExitBootServices()".

Work around this problem by refusing to poll endpoints if shutdown is
in progress, and by immediately failing any attempts to enqueue new
transfers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Sep 15, 2019
1 parent 4c87213 commit 41a9a5c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/drivers/usb/usbio.c
Expand Up @@ -972,6 +972,10 @@ static int usbio_endpoint_enqueue ( struct usb_endpoint *ep,
unsigned int fill;
unsigned int index;

/* Fail if shutdown is in progress */
if ( efi_shutdown_in_progress )
return -ECANCELED;

/* Fail if transfer ring is full */
fill = ( endpoint->prod - endpoint->cons );
if ( fill >= USBIO_RING_COUNT )
Expand Down Expand Up @@ -1026,6 +1030,10 @@ static int usbio_endpoint_stream ( struct usb_endpoint *ep,
*/
static void usbio_endpoint_poll ( struct usbio_endpoint *endpoint ) {

/* Do nothing if shutdown is in progress */
if ( efi_shutdown_in_progress )
return;

/* Poll endpoint */
endpoint->op->poll ( endpoint );
}
Expand Down

0 comments on commit 41a9a5c

Please sign in to comment.