
Hi Heinrich,
On Mon, 20 Mar 2023 at 05:43, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
On 3/10/23 21:49, Simon Glass wrote:
Add a command (for the app and payload) to display the tables provided by EFI.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
Make use of common code
cmd/Makefile | 2 +- cmd/efi.c | 33 ++++++++++++++++++++++++++++++++- doc/usage/cmd/efi.rst | 22 ++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/cmd/Makefile b/cmd/Makefile index 1c5c6f3c00c..a0bfa2acefe 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -62,7 +62,7 @@ obj-$(CONFIG_CMD_EXTENSION) += extension_board.o obj-$(CONFIG_CMD_ECHO) += echo.o obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o obj-$(CONFIG_CMD_EEPROM) += eeprom.o -obj-$(CONFIG_EFI) += efi.o +obj-$(CONFIG_EFI) += efi.o efi_common.o obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o efi_common.o obj-$(CONFIG_CMD_EFICONFIG) += eficonfig.o ifdef CONFIG_CMD_EFICONFIG diff --git a/cmd/efi.c b/cmd/efi.c index c0384e0db28..4d0edfa7f27 100644 --- a/cmd/efi.c +++ b/cmd/efi.c @@ -7,10 +7,12 @@ #include <common.h> #include <command.h> #include <efi.h> +#include <efi_api.h> #include <errno.h> #include <log.h> #include <malloc.h> #include <sort.h> +#include <uuid.h> #include <asm/global_data.h>
DECLARE_GLOBAL_DATA_PTR; @@ -273,8 +275,36 @@ done: return ret ? CMD_RET_FAILURE : 0; }
+static int do_efi_tables(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
+{
struct efi_system_table *systab;
if (IS_ENABLED(CONFIG_EFI_APP)) {
systab = efi_get_sys_table();
if (!systab) {
printf("Cannot read system table\n");
return CMD_RET_FAILURE;
}
} else {
int size;
int ret;
ret = efi_info_get(EFIET_SYS_TABLE, (void **)&systab, &size);
if (ret) {
printf("Cannot find EFI system table (err=%d)\n", ret);
return CMD_RET_FAILURE;
Wouldn't U-Boot have failed earlier if there is no system table?
This is catching the case where we didn't add it to the list by calling add_entry_addr() in the stub. I agree it can't happen with the current code. How about I just drop the message, but still return failure?
Regards, Simon