aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass2023-03-20 08:30:15 +1300
committerHeinrich Schuchardt2023-03-25 11:07:22 +0100
commit1d32eee4faedc11d98a342c92aa7d139d9b204cc (patch)
tree8ac0b99cc5de2784546a6f76156bc1f4fb111dcb
parent041840eeeb129ab979cbc05d6c5fb80162f50add (diff)
efi: Support showing tables
Add a command (for the app and payload) to display the tables provided by EFI. Note that for the payload the tables should always be present, so an error message is unnecessary and would bloat the code. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--cmd/Makefile2
-rw-r--r--cmd/efi.c31
-rw-r--r--doc/usage/cmd/efi.rst22
3 files changed, 53 insertions, 2 deletions
diff --git a/cmd/Makefile b/cmd/Makefile
index 62f50e2b1cc..d95833b2de0 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..6cd5361aca5 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,34 @@ 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) /* this should not happen */
+ return CMD_RET_FAILURE;
+ }
+
+ efi_show_tables(systab);
+
+ return 0;
+}
+
static struct cmd_tbl efi_commands[] = {
U_BOOT_CMD_MKENT(mem, 1, 1, do_efi_mem, "", ""),
+ U_BOOT_CMD_MKENT(tables, 1, 1, do_efi_tables, "", ""),
};
static int do_efi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
@@ -298,5 +326,6 @@ static int do_efi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
U_BOOT_CMD(
efi, 3, 1, do_efi,
"EFI access",
- "mem [all] Dump memory information [include boot services]"
+ "mem [all] Dump memory information [include boot services]\n"
+ "tables Dump tables"
);
diff --git a/doc/usage/cmd/efi.rst b/doc/usage/cmd/efi.rst
index c029c423879..ef37ff2f4c1 100644
--- a/doc/usage/cmd/efi.rst
+++ b/doc/usage/cmd/efi.rst
@@ -10,6 +10,7 @@ Synopsis
::
efi mem [all]
+ efi tables
Description
-----------
@@ -54,6 +55,14 @@ Attributes
Shows a code for memory attributes. The key for this is shown below the
table.
+efi tables
+~~~~~~~~~~
+
+This shows a list of the EFI tables provided in the system table. These use
+GUIDs so it is not possible in general to show the name of a table. But some
+effort is made to provide a useful table, where the GUID is known by U-Boot.
+
+
Example
-------
@@ -195,3 +204,16 @@ Example
f: uncached, write-coalescing, write-through, write-back
rf: uncached, write-coalescing, write-through, write-back, needs runtime mapping
1: uncached
+
+
+ => efi tables
+ 000000001f8edf98 ee4e5898-3914-4259-9d6e-dc7bd79403cf EFI_LZMA_COMPRESSED
+ 000000001ff2ace0 05ad34ba-6f02-4214-952e-4da0398e2bb9 EFI_DXE_SERVICES
+ 000000001f8ea018 7739f24c-93d7-11d4-9a3a-0090273fc14d EFI_HOB_LIST
+ 000000001ff2bac0 4c19049f-4137-4dd3-9c10-8b97a83ffdfa EFI_MEMORY_TYPE
+ 000000001ff2cb10 49152e77-1ada-4764-b7a2-7afefed95e8b (unknown)
+ 000000001f9ac018 060cc026-4c0d-4dda-8f41-595fef00a502 EFI_MEM_STATUS_CODE_REC
+ 000000001f9ab000 eb9d2d31-2d88-11d3-9a16-0090273fc14d SMBIOS table
+ 000000001fb7e000 eb9d2d30-2d88-11d3-9a16-0090273fc14d EFI_GUID_EFI_ACPI1
+ 000000001fb7e014 8868e871-e4f1-11d3-bc22-0080c73c8881 ACPI table
+ 000000001e654018 dcfa911d-26eb-469f-a220-38b7dc461220 (unknown)