aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHeinrich Schuchardt2018-09-23 17:21:51 +0200
committerAlexander Graf2018-09-23 21:55:31 +0200
commitc982874e930d5d673501cd94df07bcbd215d5883 (patch)
tree83538d2ee2c50b61a6dca207d3c5f5c60fd2ebeb /include
parenta47c1b5b87fcbd2bdb2e297d3c41d41c0c663967 (diff)
efi_loader: refactor efi_setup_loaded_image()
Create the handle of loaded images and the EFI_LOADED_IMAGE_PROTOCOL inside efi_setup_loaded_image(). Do not use local variables. Currently we expect the loaded image handle to point to the loaded image protocol. Additionally we have appended private fields to the protocol. With the patch the handle points to a loaded image object and the private fields are added here. This matches how we handle the net and the gop object. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/efi_api.h8
-rw-r--r--include/efi_loader.h27
2 files changed, 20 insertions, 15 deletions
diff --git a/include/efi_api.h b/include/efi_api.h
index d423521d0da..bea19a5a123 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -339,14 +339,6 @@ struct efi_loaded_image {
unsigned int image_code_type;
unsigned int image_data_type;
unsigned long unload;
-
- /* Below are efi loader private fields */
-#ifdef CONFIG_EFI_LOADER
- void *reloc_base;
- aligned_u64 reloc_size;
- efi_status_t exit_status;
- struct jmp_buf_data exit_jmp;
-#endif
};
#define DEVICE_PATH_GUID \
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 5d522f133ec..34e44c6677c 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -184,6 +184,20 @@ struct efi_object {
};
/**
+ * struct efi_loaded_image_obj - handle of a loaded image
+ */
+struct efi_loaded_image_obj {
+ /* Generic EFI object parent class data */
+ struct efi_object parent;
+ void *reloc_base;
+ aligned_u64 reloc_size;
+ efi_status_t exit_status;
+ struct jmp_buf_data exit_jmp;
+ EFIAPI efi_status_t (*entry)(efi_handle_t image_handle,
+ struct efi_system_table *st);
+};
+
+/**
* struct efi_event
*
* @link: Link to list of all events
@@ -264,7 +278,8 @@ efi_status_t efi_set_watchdog(unsigned long timeout);
/* Called from places to check whether a timer expired */
void efi_timer_check(void);
/* PE loader implementation */
-void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info);
+void *efi_load_pe(struct efi_loaded_image_obj *handle, void *efi,
+ struct efi_loaded_image *loaded_image_info);
/* Called once to store the pristine gd pointer */
void efi_save_gd(void);
/* Special case handler for error/abort that just tries to dtrt to get
@@ -345,14 +360,12 @@ int efi_memory_init(void);
/* Adds new or overrides configuration table entry to the system table */
efi_status_t efi_install_configuration_table(const efi_guid_t *guid, void *table);
/* Sets up a loaded image */
-efi_status_t efi_setup_loaded_image(
- struct efi_loaded_image *info, struct efi_object *obj,
- struct efi_device_path *device_path,
- struct efi_device_path *file_path);
+efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path,
+ struct efi_device_path *file_path,
+ struct efi_loaded_image_obj **handle_ptr,
+ struct efi_loaded_image **info_ptr);
efi_status_t efi_load_image_from_path(struct efi_device_path *file_path,
void **buffer);
-/* Print information about a loaded image */
-efi_status_t efi_print_image_info(struct efi_loaded_image *image, void *pc);
/* Print information about all loaded images */
void efi_print_image_infos(void *pc);