Browse Source

[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>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
79419a1c69
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      src/image/efi_image.c

+ 7
- 0
src/image/efi_image.c View File

@@ -209,6 +209,13 @@ static int efi_image_exec ( struct image *image ) {
209 209
 		goto err_open_protocol;
210 210
 	}
211 211
 
212
+	/* Some EFI 1.10 implementations seem not to fill in DeviceHandle */
213
+	if ( loaded.image->DeviceHandle == NULL ) {
214
+		DBGC ( image, "EFIIMAGE %p filling in missing DeviceHandle\n",
215
+		       image );
216
+		loaded.image->DeviceHandle = snpdev->handle;
217
+	}
218
+
212 219
 	/* Sanity checks */
213 220
 	assert ( loaded.image->ParentHandle == efi_image_handle );
214 221
 	assert ( loaded.image->DeviceHandle == snpdev->handle );

Loading…
Cancel
Save