[U-Boot,1/1] efi_loader: fix EFI entry counting

Message ID 20190210001158.31824-1-xypron.glpk@gmx.de
State Accepted
Commit 914df75b0c97b6e9774025500c061231db1cc6b4
Delegated to: Alexander Graf
Headers show
Series
  • [U-Boot,1/1] efi_loader: fix EFI entry counting
Related show

Commit Message

Heinrich Schuchardt Feb. 10, 2019, 12:11 a.m.
`bootefi selftest` fails on qemu-x86_defconfig if efi_selftest() is not
invoked using EFI_CALL().

Likewise we call the entry point of EFI payloads with
EFI_CALL(efi_start_image()).

entry_count indicates if we are in U-Boot (1) or in EFI payload code (0).
As we start in U-Boot code the initial value has to be 1.

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

Comments

Heinrich Schuchardt Feb. 11, 2019, 5:46 p.m. | #1
On 2/10/19 1:11 AM, Heinrich Schuchardt wrote:
> `bootefi selftest` fails on qemu-x86_defconfig if efi_selftest() is not
> invoked using EFI_CALL().
> 
> Likewise we call the entry point of EFI payloads with
> EFI_CALL(efi_start_image()).
> 
> entry_count indicates if we are in U-Boot (1) or in EFI payload code (0).
> As we start in U-Boot code the initial value has to be 1.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Hello Alex,

you just merged this patch into your efi-next tree.

It depends on

efi_loader: use efi_start_image() for bootefi
https://lists.denx.de/pipermail/u-boot/2019-February/358045.html

So, please, either remove the patch from your efi-next queue or put the
"efi_loader: rework loading and starting of images" patch series in
before this patch.

Best regards

Heinrich

> ---
>  cmd/bootefi.c                 | 2 +-
>  lib/efi_loader/efi_boottime.c | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> index 9d9ccdd31a..3619a20e64 100644
> --- a/cmd/bootefi.c
> +++ b/cmd/bootefi.c
> @@ -445,7 +445,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  			return CMD_RET_FAILURE;
>  
>  		/* Execute the test */
> -		r = efi_selftest(&image_obj->header, &systab);
> +		r = EFI_CALL(efi_selftest(&image_obj->header, &systab));
>  		bootefi_run_finish(image_obj, loaded_image_info);
>  		return r != EFI_SUCCESS;
>  	} else
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index 0b13c79b76..ed0e926646 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -44,7 +44,8 @@ static bool efi_is_direct_boot = true;
>  static volatile void *efi_gd, *app_gd;
>  #endif
>  
> -static int entry_count;
> +/* 1 if inside U-Boot code, 0 if inside EFI payload code */
> +static int entry_count = 1;
>  static int nesting_level;
>  /* GUID of the device tree table */
>  const efi_guid_t efi_guid_fdt = EFI_FDT_GUID;
>
Alexander Graf Feb. 11, 2019, 9:06 p.m. | #2
On 11.02.19 18:46, Heinrich Schuchardt wrote:
> On 2/10/19 1:11 AM, Heinrich Schuchardt wrote:
>> `bootefi selftest` fails on qemu-x86_defconfig if efi_selftest() is not
>> invoked using EFI_CALL().
>>
>> Likewise we call the entry point of EFI payloads with
>> EFI_CALL(efi_start_image()).
>>
>> entry_count indicates if we are in U-Boot (1) or in EFI payload code (0).
>> As we start in U-Boot code the initial value has to be 1.
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> 
> Hello Alex,
> 
> you just merged this patch into your efi-next tree.

Yes, I figured that a "Fix" patch is reasonably important for this cycle.

> 
> It depends on
> 
> efi_loader: use efi_start_image() for bootefi
> https://lists.denx.de/pipermail/u-boot/2019-February/358045.html

Please indicate that properly in the patch next time.

> 
> So, please, either remove the patch from your efi-next queue or put the
> "efi_loader: rework loading and starting of images" patch series in
> before this patch.

I've removed it from there queue again.

Thanks for the report!


Alex

Patch

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 9d9ccdd31a..3619a20e64 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -445,7 +445,7 @@  static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			return CMD_RET_FAILURE;
 
 		/* Execute the test */
-		r = efi_selftest(&image_obj->header, &systab);
+		r = EFI_CALL(efi_selftest(&image_obj->header, &systab));
 		bootefi_run_finish(image_obj, loaded_image_info);
 		return r != EFI_SUCCESS;
 	} else
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 0b13c79b76..ed0e926646 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -44,7 +44,8 @@  static bool efi_is_direct_boot = true;
 static volatile void *efi_gd, *app_gd;
 #endif
 
-static int entry_count;
+/* 1 if inside U-Boot code, 0 if inside EFI payload code */
+static int entry_count = 1;
 static int nesting_level;
 /* GUID of the device tree table */
 const efi_guid_t efi_guid_fdt = EFI_FDT_GUID;