diff options
author | Michael Brown <mcb30@ipxe.org> | 2020-10-01 16:07:23 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2020-10-02 00:36:33 +0100 |
commit | fbb5989fd9a5ddbbde6e273c7bb3ba75ec9f1ebb (patch) | |
tree | 7838dace7b29316d150f04cb10536b2389b152db /src | |
parent | eede697ece879c5f9bba341a155f03235c42f2df (diff) | |
download | ipxe-fbb5989fd9a5ddbbde6e273c7bb3ba75ec9f1ebb.tar.gz |
[efi] Connect controllers after loading an EFI driver
iPXE is already capable of loading EFI drivers on demand (via
e.g. "chain UsbMassStorageDxe.efi") but there is currently no way to
trigger connection of the driver to any preexisting handles.
Add an explicit call to (re)connect all drivers after successfully
loading an image with a code type that indicates a boot services
driver.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/image/efi_image.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/image/efi_image.c b/src/image/efi_image.c index a112a8fcb..942b7aeeb 100644 --- a/src/image/efi_image.c +++ b/src/image/efi_image.c @@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <ipxe/efi/efi_strings.h> #include <ipxe/efi/efi_wrap.h> #include <ipxe/efi/efi_pxe.h> +#include <ipxe/efi/efi_driver.h> #include <ipxe/image.h> #include <ipxe/init.h> #include <ipxe/features.h> @@ -140,6 +141,7 @@ static int efi_image_exec ( struct image *image ) { void *interface; } loaded; EFI_HANDLE handle; + EFI_MEMORY_TYPE type; wchar_t *cmdline; EFI_STATUS efirc; int rc; @@ -231,6 +233,9 @@ static int efi_image_exec ( struct image *image ) { assert ( loaded.image->LoadOptionsSize == 0 ); assert ( loaded.image->LoadOptions == NULL ); + /* Record image code type */ + type = loaded.image->ImageCodeType; + /* Set command line */ loaded.image->LoadOptions = cmdline; loaded.image->LoadOptionsSize = @@ -253,6 +258,12 @@ static int efi_image_exec ( struct image *image ) { goto err_start_image; } + /* If image was a driver, connect it up to anything available */ + if ( type == EfiBootServicesCode ) { + DBGC ( image, "EFIIMAGE %p connecting drivers\n", image ); + efi_driver_reconnect_all(); + } + /* Success */ rc = 0; |