summaryrefslogtreecommitdiffstats
path: root/src/image/efi_image.c
diff options
context:
space:
mode:
authorMichael Brown2011-03-07 01:37:50 +0100
committerMichael Brown2011-03-07 01:37:50 +0100
commit34b6ecb2f1d7940a0065cbabd6f9dcd439b4c841 (patch)
treeea583bf6fde26b2ed12ee3c6b117055e555555d9 /src/image/efi_image.c
parent[spi] Reset device on each access (diff)
downloadipxe-34b6ecb2f1d7940a0065cbabd6f9dcd439b4c841.tar.gz
ipxe-34b6ecb2f1d7940a0065cbabd6f9dcd439b4c841.tar.xz
ipxe-34b6ecb2f1d7940a0065cbabd6f9dcd439b4c841.zip
[image] Simplify image management
Refactor the {load,exec} image operations as {probe,exec}. This makes the probe mechanism cleaner, eliminates some forward declarations, avoids holding magic state in image->priv, eliminates the possibility of screwing up between the "load" and "exec" stages, and makes the documentation simpler since the concept of "loading" (as distinct from "executing") no longer needs to be explained. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/image/efi_image.c')
-rw-r--r--src/image/efi_image.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/image/efi_image.c b/src/image/efi_image.c
index bf2e6f4a..ac54fdf6 100644
--- a/src/image/efi_image.c
+++ b/src/image/efi_image.c
@@ -26,8 +26,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
FEATURE ( FEATURE_IMAGE, "EFI", DHCP_EB_FEATURE_EFI, 1 );
-struct image_type efi_image_type __image_type ( PROBE_NORMAL );
-
/** Event used to signal shutdown */
static EFI_EVENT efi_shutdown_event;
@@ -99,12 +97,12 @@ done:
}
/**
- * Load EFI image into memory
+ * Probe EFI image
*
* @v image EFI file
* @ret rc Return status code
*/
-static int efi_image_load ( struct image *image ) {
+static int efi_image_probe ( struct image *image ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE handle;
EFI_STATUS efirc;
@@ -119,10 +117,6 @@ static int efi_image_load ( struct image *image ) {
return -ENOEXEC;
}
- /* This is an EFI image */
- if ( ! image->type )
- image->type = &efi_image_type;
-
/* Unload the image. We can't leave it loaded, because we
* have no "unload" operation.
*/
@@ -134,6 +128,6 @@ static int efi_image_load ( struct image *image ) {
/** EFI image type */
struct image_type efi_image_type __image_type ( PROBE_NORMAL ) = {
.name = "EFI",
- .load = efi_image_load,
+ .probe = efi_image_probe,
.exec = efi_image_exec,
};