On 11/1/24 16:26, Simon Glass wrote:
Add an 'efidebug filename' command to report the default filename and
PXE architecture.

Signed-off-by: Simon Glass <s...@chromium.org>
---

(no changes since v9)

Changes in v9:
- Split out into its own patch

Changes in v8:
- Add new patch to report host default-filename in native mode

  cmd/efidebug.c | 25 +++++++++++++++++++++++++
  1 file changed, 25 insertions(+)

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index bba984b2b75..ff6d118876d 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -536,6 +536,27 @@ static int do_efi_show_log(struct cmd_tbl *cmdtp, int flag,
                return CMD_RET_FAILURE;
        }

+       return 0;
+}
+
+/**
+ * do_efi_show_defaults() - show UEFI default filename and PXE architecture
+ *
+ * @cmdtp:     Command table
+ * @flag:      Command flag
+ * @argc:      Number of arguments
+ * @argv:      Argument array
+ * Return:     CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure
+ *
+ * Implement efidebug "defaults" sub-command.
+ * Shows the default EFI filename and PXE architecture
+ */
+static int do_efi_show_defaults(struct cmd_tbl *cmdtp, int flag,
+                               int argc, char *const argv[])
+{
+       printf("Default boot path: EFI\\BOOT\\%s\n", efi_get_basename());
+       printf("PXE arch: 0x%02x\n", efi_get_pxe_arch());
+
        return CMD_RET_SUCCESS;
  }

This should not be guarded by
#ifdef CONFIG_EFI_HAVE_CAPSULE_SUPPORT
Otherwise build errors occur on some platforms.

I will move that function behind the corresponding #endif.

Best regards

Heinrich


@@ -1589,6 +1610,8 @@ static struct cmd_tbl cmd_efidebug_sub[] = {
                         "", ""),
        U_BOOT_CMD_MKENT(dh, CONFIG_SYS_MAXARGS, 1, do_efi_show_handles,
                         "", ""),
+       U_BOOT_CMD_MKENT(defaults, CONFIG_SYS_MAXARGS, 1, do_efi_show_defaults,
+                        "", ""),
        U_BOOT_CMD_MKENT(images, CONFIG_SYS_MAXARGS, 1, do_efi_show_images,
                         "", ""),
        U_BOOT_CMD_MKENT(log, CONFIG_SYS_MAXARGS, 1, do_efi_show_log, "", ""),
@@ -1688,6 +1711,8 @@ U_BOOT_LONGHELP(efidebug,
        "  - show UEFI drivers\n"
        "efidebug dh\n"
        "  - show UEFI handles\n"
+       "efidebug defaults\n"
+       "  - show default EFI filename and PXE architecture\n"
        "efidebug images\n"
        "  - show loaded images\n"
        "efidebug log\n"

Reply via email to