]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
x86: Show some EFI info with the bdinfo command
authorSimon Glass <sjg@chromium.org>
Sat, 25 Sep 2021 00:30:21 +0000 (18:30 -0600)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 21 Oct 2021 01:46:03 +0000 (03:46 +0200)
It is useful to see some basic EFI info with the command as it forms part
of the information about a board.

Add a hook for this and show the table address as a start.

While here, fix an invalid cast in setup_efi_info(). Note that this
function is using a data structure defined by Linux so we cannot change
it. Also note that ulong is used since this is the standard in U-Boot
(>6k uses), despite there being quite a bit of the more verbose uintptr_t
(930 uses).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
arch/x86/cpu/efi/payload.c
arch/x86/include/asm/efi.h
arch/x86/lib/Makefile
arch/x86/lib/bdinfo.c [new file with mode: 0644]

index 9a73b768e9b819c790460dbc890284e7628aee51..3a9f7d72868863c73c967f7107742f0972cc5b46 100644 (file)
@@ -280,15 +280,24 @@ void setup_efi_info(struct efi_info *efi_info)
        }
        efi_info->efi_memdesc_size = map->desc_size;
        efi_info->efi_memdesc_version = map->version;
-       efi_info->efi_memmap = (u32)(map->desc);
+       efi_info->efi_memmap = (ulong)(map->desc);
        efi_info->efi_memmap_size = size - sizeof(struct efi_entry_memmap);
 
 #ifdef CONFIG_EFI_STUB_64BIT
        efi_info->efi_systab_hi = table->sys_table >> 32;
-       efi_info->efi_memmap_hi = (u64)(u32)(map->desc) >> 32;
+       efi_info->efi_memmap_hi = (u64)(ulong)map->desc >> 32;
        signature = EFI64_LOADER_SIGNATURE;
 #else
        signature = EFI32_LOADER_SIGNATURE;
 #endif
        memcpy(&efi_info->efi_loader_signature, signature, 4);
 }
+
+void efi_show_bdinfo(void)
+{
+       struct efi_entry_systable *table = NULL;
+       int size, ret;
+
+       ret = efi_info_get(EFIET_SYS_TABLE, (void **)&table, &size);
+       bdinfo_print_num_l("efi_table", (ulong)table);
+}
index c1735e4dc5f6e55c7c891b8fc8c6f96a908db054..dfd858b78ba37c575144d7677d5c5f6b8aa571d3 100644 (file)
@@ -29,4 +29,11 @@ void setup_video(struct screen_info *screen_info);
  */
 void setup_efi_info(struct efi_info *efi_info);
 
+/**
+ * efi_show_bdinfo() - Show information about EFI for the 'bdinfo' command
+ *
+ * This looks up the EFI table pointer and shows related info
+ */
+void efi_show_bdinfo(void);
+
 #endif
index 65d9b3bd6a3c53a788e86ccdadb7dbeff44c0b02..18757b29aa96ceedeb4148c0cdddd8bd6bbc3a31 100644 (file)
@@ -3,6 +3,7 @@
 # (C) Copyright 2002-2006
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 
+obj-y  += bdinfo.o
 ifndef CONFIG_X86_64
 ifndef CONFIG_TPL_BUILD
 obj-y += bios.o
diff --git a/arch/x86/lib/bdinfo.c b/arch/x86/lib/bdinfo.c
new file mode 100644 (file)
index 0000000..0cb79b0
--- /dev/null
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * x86-specific information for the 'bd' command
+ *
+ * Copyright 2021 Google LLC
+ */
+
+#include <common.h>
+#include <efi.h>
+#include <init.h>
+#include <asm/efi.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void arch_print_bdinfo(void)
+{
+       bdinfo_print_num_l("prev table", gd->arch.table);
+
+       if (IS_ENABLED(CONFIG_EFI_STUB))
+               efi_show_bdinfo();
+}