[U-Boot,v2,17/18] efi_loader: pass handle of loaded image

Message ID 20171112140247.26532-18-xypron.glpk@gmx.de
State New
Delegated to: Alexander Graf
Headers show
Series
  • manage protocols in a linked list
Related show

Commit Message

Heinrich Schuchardt Nov. 12, 2017, 2:02 p.m.
The handle of a loaded image is the value of the handle
member of the loaded image info object and not the
address of the loaded image info.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v2
	new patch
---
 cmd/bootefi.c                 | 7 ++++---
 lib/efi_loader/efi_boottime.c | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

Comments

Simon Glass Nov. 17, 2017, 2:07 p.m. | #1
On 12 November 2017 at 07:02, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> The handle of a loaded image is the value of the handle
> member of the loaded image info object and not the
> address of the loaded image info.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> v2
>         new patch
> ---
>  cmd/bootefi.c                 | 7 ++++---
>  lib/efi_loader/efi_boottime.c | 2 +-
>  2 files changed, 5 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Patch

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 67855ba685..e6b8ec11d5 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -254,7 +254,8 @@  static efi_status_t do_bootefi_exec(void *efi, void *fdt,
 		dcache_disable();	/* flush cache before switch to EL2 */
 
 		/* Move into EL2 and keep running there */
-		armv8_switch_to_el2((ulong)entry, (ulong)&loaded_image_info,
+		armv8_switch_to_el2((ulong)entry,
+				    (ulong)&loaded_image_info_obj.handle,
 				    (ulong)&systab, 0, (ulong)efi_run_in_el2,
 				    ES_TO_AARCH64);
 
@@ -263,7 +264,7 @@  static efi_status_t do_bootefi_exec(void *efi, void *fdt,
 	}
 #endif
 
-	ret = efi_do_enter(&loaded_image_info, &systab, entry);
+	ret = efi_do_enter(loaded_image_info_obj.handle, &systab, entry);
 
 exit:
 	/* image has returned, loaded-image obj goes *poof*: */
@@ -350,7 +351,7 @@  static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		/* Transfer environment variable efi_selftest as load options */
 		set_load_options(&loaded_image_info, "efi_selftest");
 		/* Execute the test */
-		r = efi_selftest(&loaded_image_info, &systab);
+		r = efi_selftest(loaded_image_info_obj.handle, &systab);
 		efi_restore_gd();
 		free(loaded_image_info.load_options);
 		list_del(&loaded_image_info_obj.link);
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index cee0cb1390..9218379a28 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1317,7 +1317,7 @@  static efi_status_t EFIAPI efi_load_image(bool boot_policy,
 
 	info->system_table = &systab;
 	info->parent_handle = parent_image;
-	*image_handle = info;
+	*image_handle = obj->handle;
 
 	return EFI_EXIT(EFI_SUCCESS);
 }