diff options
author | Michael Brown | 2014-07-30 17:16:10 +0200 |
---|---|---|
committer | Michael Brown | 2014-07-30 17:16:10 +0200 |
commit | 79419a1c69c13c854148021ce4203c0dd6908b2a (patch) | |
tree | 9d3fc2c949266c542e360b55b01a3317e2b19548 /src/image | |
parent | [efi] Unload started images only on failure (diff) | |
download | ipxe-79419a1c69c13c854148021ce4203c0dd6908b2a.tar.gz ipxe-79419a1c69c13c854148021ce4203c0dd6908b2a.tar.xz ipxe-79419a1c69c13c854148021ce4203c0dd6908b2a.zip |
[efi] Fill in loaded image's DeviceHandle if firmware fails to do so
Some EFI 1.10 implementations (observed with a mid-2011 iMac) seem to
fail to fill in the DeviceHandle for our loaded images. It is
plausible that these implementations fill in the DeviceHandle only if
loading the image from a device path (rather than directly from a
memory buffer).
Work around this problem by filling in DeviceHandle if the firmware
leaves it empty.
We cannot sensibly fill in FilePath, because we have no way of knowing
whether or not the firmware will treat this as a pointer to be freed
when the image returns.
Reported-by: Curtis Larsen <larsen@dixie.edu>
Tested-by: Curtis Larsen <larsen@dixie.edu>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/efi_image.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/image/efi_image.c b/src/image/efi_image.c index 51805c9b..02ff8b2f 100644 --- a/src/image/efi_image.c +++ b/src/image/efi_image.c @@ -209,6 +209,13 @@ static int efi_image_exec ( struct image *image ) { goto err_open_protocol; } + /* Some EFI 1.10 implementations seem not to fill in DeviceHandle */ + if ( loaded.image->DeviceHandle == NULL ) { + DBGC ( image, "EFIIMAGE %p filling in missing DeviceHandle\n", + image ); + loaded.image->DeviceHandle = snpdev->handle; + } + /* Sanity checks */ assert ( loaded.image->ParentHandle == efi_image_handle ); assert ( loaded.image->DeviceHandle == snpdev->handle ); |