[efi] Disconnect controllers before uninstalling EFI_USB_IO_PROTOCOL

The call to UninstallMultipleProtocolInterfaces() will implicitly
disconnect any relevant controllers, and there is no specified
requirement to explicitly call DisconnectController() prior to
callling UninstallMultipleProtocolInterfaces().

However, some UEFI implementations (observed with the USB keyboard
driver on a Microsoft Surface Go) will fail to implicitly disconnect
the controller and will consequently fail to uninstall the protocols.

The net effect is that unplugging and replugging a USB keyboard may
leave the keyboard in a non-functional state.

Work around these broken UEFI implementations by including an
unnecessary call to DisconnectController() before the call to
UninstallMultipleProtocolInterfaces().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/154/head
Michael Brown 2020-09-29 21:13:10 +01:00
parent 8eb19a178a
commit 8344803c93
1 changed files with 6 additions and 0 deletions

View File

@ -1193,6 +1193,12 @@ static void efi_usb_uninstall ( struct efi_usb_interface *usbintf ) {
DBGC ( usbdev, "USBDEV %s uninstalling %s\n",
usbintf->name, efi_handle_name ( usbintf->handle ) );
/* Disconnect controllers. This should not be necessary, but
* seems to be required on some platforms to avoid failures
* when uninstalling protocols.
*/
bs->DisconnectController ( usbintf->handle, NULL, NULL );
/* Uninstall protocols */
bs->UninstallMultipleProtocolInterfaces (
usbintf->handle,