From patchwork Wed Aug 20 11:23:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 60 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755689051; bh=ViA8i3e6yv+F7zYiAK4g9mc/6C5WcFNoVrVuQidqnD4=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=uVjxLOe7+yG143BfKJH1DNJMl/I6cPFZxZxVzUQ0JHBp/sBnITtL85pVaLPC8jZEl tTBK45mGJkzz9CqwQ+V49xpiVRQmT8Eyx55KxCtEGWR+K+aSVf27yi/vTfE0HnoGAW /mCIxUed3dFSXfiMkRHA+PxVYrF8oBkpP3ZconfSGiZxAIsn2PidXFdH+fdK8ZST3v SAZHuQgj0VXW1qK96BL7TzM0tzwKjEsJMuHJTRRYmFXrnbUuMui91ltsPfaqwKJctG OBf9dNw8bhoB3XrYEC6jxztkbGrJMgeUA4h38X8VBpezVPIgeGHym7hVhw3/l4nTLh 4jtjXVbQqtlDw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8AE696767F for ; Wed, 20 Aug 2025 05:24:11 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id BK8kN_raIOhw for ; Wed, 20 Aug 2025 05:24:11 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755689050; bh=ViA8i3e6yv+F7zYiAK4g9mc/6C5WcFNoVrVuQidqnD4=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=SodMUKDZR0+k/207hcUuUzak3JGONbC50uWPxt1E7puPJFjlzFh6rs/cUb9N2h5vG HPBzsLJJn1phva7wpzRbYWifvgHS6yOOyVKfxy/f81uhRh8hEUzrX9DCEcbxw6ySHL zGg2gje2KJBRbVNs55Fn2OYWIv1fJsEFn2xQOWSdQCbGMDvXroRoiwTh0aIEx8MhTd Hlej2tQk6sFwgmduusXTtzCWCnUr4L3banWeDIZmWaFnBXDGm7uXDqj02N9zGib4u9 Hsu5nI9AYeVc4eEaK1R0mq11z5/znr14ejI11LYzPcvVIvVMb/6WUo+edVJ4VP+Y2Q Rp/rSzO7zhQkA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9F66667676 for ; Wed, 20 Aug 2025 05:24:10 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755689048; bh=gSUtWh3IB25etTvCL2+mTkqxujRTc7xbbDd70VzqM4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZAjoGSFK8XW4LQtOxxH7R9UboWeNNC6LV4vbCNe3Q/oF8BRmYAsSWBg9YyvMANO57 cLK0Nln/KqKQxYIFur+55YqC07ZjlTed71FgJTJYR792uhBwBJQjLB6ZMKfPxUCARn AHMbJUq8itLa4AQGDLR8KY0zz/Mnrq8867xC25/m81TQ5dW37GHjMuJR2KS2y0e8wd ELYNbcJk1QW5xtZI0hCapiGXcRm5qf7h0UYA4i0lszlB6WGzWbbefrs4cm8La6Oy6H Tq3TBK/1iiMSHRnGjIX4MTIv9XlspoM1fxKCON7avhkbP93U0yaKC8fVYhD/62qUP3 Sy17FhmPVpkeg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 72DBA67678; Wed, 20 Aug 2025 05:24:08 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 0CFGkuc0LD2d; Wed, 20 Aug 2025 05:24:08 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755689048; bh=z5PwpIZCM+lW3eoEETIpzSU7CU7gMPeou8hPZ5ByHBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=htuahupgpaAEMBe+DbukGCDkn2RBxSU5vih75PZ1F9VjiAIlKBomDysJUo9SWVAFX 96lxgmI7k20IWwEH6n2JAZFtxin0d7BB4PkUw5XbOVx3htSXt2Hp/jkbKSADjkApJD KOx5jI0C9sSwpDRFMpH2H5B/Q4MmBTJt/Nw0CpN096Fbf987prngnBrQeLEwJzvai7 /q9R6eVwmDanS/8MqqHH+xJDYJc0zrU9zh+6t6LwXGAThcyKgwiiMMadUtr9sF+62C UxOg2BbaoU4wZ2dFxH9/cYHwb9fU1veKX/50AGdab+aax8XZto9rQH9UOP++Rb4NrJ 88/yJpfLhcLvQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CB6B367666; Wed, 20 Aug 2025 05:24:07 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Wed, 20 Aug 2025 05:23:16 -0600 Message-ID: <20250820112340.147082-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250820112340.147082-1-sjg@u-boot.org> References: <20250820112340.147082-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UZ3M7N6HI7OBAV5XONPCKCIRBJZG74S5 X-Message-ID-Hash: UZ3M7N6HI7OBAV5XONPCKCIRBJZG74S5 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH v2 04/18] efi: app: Support the efidebug command List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass This command is useful for the app, so enable it. For now most of the subcommands don't work, so provide a message in that case. This seems better than silently pretending that the subcommand doesn't exist. Signed-off-by: Simon Glass --- (no changes since v1) cmd/Kconfig | 5 +++-- cmd/efidebug.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index b7b80cbe59f..fe9fb11ff95 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2228,8 +2228,9 @@ config CMD_CLS config CMD_EFIDEBUG bool "efidebug - display/configure UEFI environment" - depends on EFI_LOADER - select EFI_DEVICE_PATH_TO_TEXT + depends on EFI_LOADER || EFI_APP + default y if EFI_APP + select EFI_DEVICE_PATH_TO_TEXT if EFI_LOADER help Enable the 'efidebug' command which provides a subset of UEFI shell utility with simplified functionality. It will be useful diff --git a/cmd/efidebug.c b/cmd/efidebug.c index f52ba8de279..2e156fef525 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -28,6 +28,16 @@ #define BS systab.boottime +static bool app_not_supported(const char *cmd) +{ + if (!IS_ENABLED(CONFIG_EFI_APP)) + return false; + + printf("Command '%s' is not yet supported in the app\n", cmd); + + return true; +} + #ifdef CONFIG_EFI_HAVE_CAPSULE_SUPPORT /** * do_efi_capsule_update() - process a capsule update @@ -405,6 +415,9 @@ static int do_efi_show_drivers(struct cmd_tbl *cmdtp, int flag, u16 *driver_name, *image_path_text; efi_status_t ret; + if (app_not_supported("show_drivers")) + return CMD_RET_FAILURE; + ret = EFI_CALL(efi_locate_handle_buffer( BY_PROTOCOL, &efi_guid_driver_binding_protocol, NULL, &num, &handles)); @@ -458,6 +471,9 @@ static int do_efi_show_handles(struct cmd_tbl *cmdtp, int flag, efi_uintn_t num, count, i, j; efi_status_t ret; + if (app_not_supported("show_handles")) + return CMD_RET_FAILURE; + ret = EFI_CALL(efi_locate_handle_buffer(ALL_HANDLES, NULL, NULL, &num, &handles)); if (ret != EFI_SUCCESS) @@ -646,6 +662,9 @@ static int do_efi_show_memmap(struct cmd_tbl *cmdtp, int flag, int i; efi_status_t ret; + if (app_not_supported("memmap")) + return CMD_RET_FAILURE; + ret = efi_get_memory_map_alloc(&map_size, &memmap); if (ret != EFI_SUCCESS) return CMD_RET_FAILURE; @@ -698,6 +717,9 @@ static int do_efi_show_memmap(struct cmd_tbl *cmdtp, int flag, static int do_efi_show_tables(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + if (app_not_supported("show tables")) + return CMD_RET_FAILURE; + efi_show_tables(&systab); return CMD_RET_SUCCESS; @@ -893,6 +915,9 @@ static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag, efi_status_t ret; int r = CMD_RET_SUCCESS; + if (app_not_supported("boot add")) + return CMD_RET_FAILURE; + guid = efi_global_variable_guid; /* attributes */ @@ -1073,6 +1098,9 @@ static int do_efi_boot_rm(struct cmd_tbl *cmdtp, int flag, u16 var_name16[9]; efi_status_t ret; + if (app_not_supported("boot rm")) + return CMD_RET_FAILURE; + if (argc == 1) return CMD_RET_USAGE; @@ -1199,6 +1227,9 @@ static int do_efi_boot_dump(struct cmd_tbl *cmdtp, int flag, efi_guid_t guid; efi_status_t ret; + if (app_not_supported("boot dump")) + return CMD_RET_FAILURE; + if (argc > 1) return CMD_RET_USAGE; @@ -1255,6 +1286,9 @@ static int show_efi_boot_order(void) struct efi_load_option lo; efi_status_t ret; + if (app_not_supported("show_boot_order")) + return CMD_RET_FAILURE; + size = 0; ret = efi_get_variable_int(u"BootOrder", &efi_global_variable_guid, NULL, &size, NULL, NULL); @@ -1574,6 +1608,9 @@ static int do_efi_query_info(struct cmd_tbl *cmdtp, int flag, u64 max_variable_size; int i; + if (app_not_supported("query")) + return CMD_RET_FAILURE; + for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-bs")) attr |= EFI_VARIABLE_BOOTSERVICE_ACCESS;