aboutsummaryrefslogtreecommitdiff
path: root/cmd/efi_common.c
diff options
context:
space:
mode:
authorSimon Glass2023-03-20 08:30:14 +1300
committerHeinrich Schuchardt2023-03-25 11:07:22 +0100
commit041840eeeb129ab979cbc05d6c5fb80162f50add (patch)
tree81429a88821eb48c03138af7d5f5b84ea76062ee /cmd/efi_common.c
parent30c9646eff1e8559865e3eb6581c15e96660d254 (diff)
efi: Split out table-listing code into a new file
This code is used with EFI_LOADER but is also useful (with some modifications) for the EFI app and payload. Move it into a shared file. Show the address of the table so it can be examined if needed. Also show the table name as unknown if necessary. Our list of GUIDs is fairly small. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd/efi_common.c')
-rw-r--r--cmd/efi_common.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/cmd/efi_common.c b/cmd/efi_common.c
new file mode 100644
index 00000000000..f4056096cd3
--- /dev/null
+++ b/cmd/efi_common.c
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Common code for EFI commands
+ *
+ * Copyright 2023 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <common.h>
+#include <efi.h>
+#include <efi_api.h>
+#include <uuid.h>
+
+void efi_show_tables(struct efi_system_table *systab)
+{
+ int i;
+
+ for (i = 0; i < systab->nr_tables; i++) {
+ struct efi_configuration_table *tab = &systab->tables[i];
+ char guid_str[37];
+
+ uuid_bin_to_str(tab->guid.b, guid_str, 1);
+ printf("%p %pUl %s\n", tab->table, guid_str,
+ uuid_guid_get_str(tab->guid.b) ?: "(unknown)");
+ }
+}