From patchwork Wed Aug 20 00:40:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 42 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=1755650476; bh=iNwF/Uqvw2unBIIIqS3MsSWm91O+3/BygmB15SE6Llc=; 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=YyNtviHPVMmTmT0x4H0q/x+/upK5TClMJpSPPIq2T5UG31vLwRtOLDuYOkwNAQRfW VXUvFO1NViTGVWksJrtBdJezX2TgOs02x7/5C3Zk8HsJYsw7r3Uq2FnMMUM7PHHQtB q3mBIwIyahhtM1EfjKb40AHfGI1jKLvo8hyTwfjHBjzKyNnm3Bq/2Qes0oHO0e4PId Biv+aUGQ08Xi3WKbLK/jL7wu82bHDrxEGoIk0kRjqbypxy+k5/w9loTldY/vH/YV+U Rh0s3JwX5M3PApV8z204vtlhg9l+EdKlgvC95sy8UNQXWgK2UGqHN8YFsse+mcyEQP zd5/dI+JX03Zw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4EB256764B for ; Tue, 19 Aug 2025 18:41:16 -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 99v0z309eDGD for ; Tue, 19 Aug 2025 18:41:16 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755650476; bh=iNwF/Uqvw2unBIIIqS3MsSWm91O+3/BygmB15SE6Llc=; 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=YyNtviHPVMmTmT0x4H0q/x+/upK5TClMJpSPPIq2T5UG31vLwRtOLDuYOkwNAQRfW VXUvFO1NViTGVWksJrtBdJezX2TgOs02x7/5C3Zk8HsJYsw7r3Uq2FnMMUM7PHHQtB q3mBIwIyahhtM1EfjKb40AHfGI1jKLvo8hyTwfjHBjzKyNnm3Bq/2Qes0oHO0e4PId Biv+aUGQ08Xi3WKbLK/jL7wu82bHDrxEGoIk0kRjqbypxy+k5/w9loTldY/vH/YV+U Rh0s3JwX5M3PApV8z204vtlhg9l+EdKlgvC95sy8UNQXWgK2UGqHN8YFsse+mcyEQP zd5/dI+JX03Zw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3CC09675DE for ; Tue, 19 Aug 2025 18:41:16 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755650474; bh=7tzQ7aPKo2HzMHc6UhCBYDTxvWT6yQZus2nlQLSNEcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AtYPq4G6RnGjhwQS5V+23BDA8ZfFEt1zdkkJeTqWyhlr+7gAa5L+ebCIhCdmEeq3I 9CKj9WGShDgHBVklDKw5sjCIO4Fba+8adlgeC+9M452kxVF5UBsJ9vXIpSd2nR2eDJ 0zmZkQ2t9ve9rB8US8TtxxFuQbXPLJ2/KkFTC0PqfbC5YL3pBrnOGr4EENbGq3qV2+ jlG8UjmJnckOciodG9NluXofrnJdoJTTmg1a6kSoT+fPCNjNySOApyHxM+hQxzON7+ jR3qM0fRLQJCqxeaBcaJSloi9MxuaM+J0KGOnEre0t/DnsZOxlnNm+jj0lOt6UjAGO ALAIpmCU4Cp8w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 387C66728E; Tue, 19 Aug 2025 18:41:14 -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 yuVDTINT2YgB; Tue, 19 Aug 2025 18:41:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1755650470; bh=tSlL2eGRlvae5UGP1IgSx/PrB0Irk5rBakbiIHyR5wQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oSXsCEnlgopinktQ8rTAadVPWjLxh35vpNzdCp09rv4tYQnZ7e1fuE1IjJBStUR8S nyot5QTYwcdUAK8779keT8C87RXu2ZERWBe+mLXZWsfR5PsMMYHzyhYZnq6WrD00h8 2456ATY11Jde5zlVMs3KZ26Q/MrHwGMvJvcaBt+8rQq2kKrrLcv8K8c/j0BoYop9Zj Gk1llsOqIjIukVBVQz7+LELAQIisfnBRJe7SiGc9aunCMiKv25OvKQUR67Z/NrkZsx p+sVRzd92KP4DP7MSUNZFpRh7lo+U3BJ68R88GVe4nL9+Z94ZY3aSdyMk3SKx6ko7O SQ13tCPNWAGoA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B509267659; Tue, 19 Aug 2025 18:41:09 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 19 Aug 2025 18:40:18 -0600 Message-ID: <20250820004039.3920254-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250820004039.3920254-1-sjg@u-boot.org> References: <20250820004039.3920254-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZUK5ZKBYH4NBR2W2KJW4INMQKO6L5JKE X-Message-ID-Hash: ZUK5ZKBYH4NBR2W2KJW4INMQKO6L5JKE 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 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 --- 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;