efi_loader: fix EFI entry counting
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 9 Feb 2019 13:10:39 +0000 (14:10 +0100)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 16 Feb 2019 14:42:20 +0000 (15:42 +0100)
`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
lib/efi_loader/efi_boottime.c

index a2d3825..e1eba46 100644 (file)
@@ -437,7 +437,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
index 45ed367..bd8b8a1 100644 (file)
@@ -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;