From patchwork Thu Aug 28 02:07:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 147 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=1756346877; bh=W1QJr7d/OTKMNABky2M+ApgIWjSVzhm2SUTl6a5Qvi4=; 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=s5kdbWFbAGEXROE0X9q/yZmP74Fveegj+xaQ/Ix428DW9xLst4CTaOpt847quB/X+ qy893yv3yDBoOkgL6DZREbV8qpS1t7dUVSORecAvKHi0ebY8iNGjGtDJ8yRRtVbPXk NMksdka1q2HHvjUsRjJ4FmpIp/UvSFy4rhtsZ9n0zN757I2ApK7qh9kQ6uXLVMpEPO HDSUqravAieMf9+7+jwEST7Z5J6F/XF/zKgOsU7CLeoitpBPQt+q2PFQ2QtZLuOWZv d3VSHxvNrGMFGqfMbWDLaakHOQYBlG6Bx2bEGOOceexPWpXYkRrC2xpcSEXziaSmmy CsR6hB4ezB6Fg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3D67D677CB for ; Wed, 27 Aug 2025 20:07:57 -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 ykifhaAK4H_A for ; Wed, 27 Aug 2025 20:07:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756346876; bh=W1QJr7d/OTKMNABky2M+ApgIWjSVzhm2SUTl6a5Qvi4=; 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=YFYzXMVQDcNtBjqZh+0SaXtzj0qDni6q/VT2i5gTHMywL55QvIzYP25m4D/JcOQcz 9RB3P9EoaDM7QlAr9G8/vVpxl4+m75NoRqePFGpv5+25b/K9mrJjO1afUt2C131CxJ VRRB8TUWdWJuLcJjWCH5/M9X2rCg9PQghHPbQU2+zGp1VIdddun1zhiXyRKSmOQSZd SdSiyrmsYmd1FUtXtqS5V60mD6wXG0UNKhR9YKV+nn2E6AlJO9umLGZ8c6C/M67e3a YjL1B2gTX5yWTv/8yZG5EZh3buxP2Xx/kKaIMmnRAaSqJXm22S+DKhVx0e3Gi291e2 rDawtiKD7j8+Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0BFD567823 for ; Wed, 27 Aug 2025 20:07:56 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756346874; bh=LVPVIBwQUqIs1vzQxro/iDIIuFSTUpHih7mHzrF6vEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PlNZh1xNm98rFY8CNwo60Dr4qaLPlHMulET7GjMis6Ij9mf7edueFYN+b+pQgJzXH eKOn40mn7uAVwgoHonGPMLdMMK/OPJdeG7a9L24qhP0za8EelMCjENp4S/f4Fo7Fw8 PQB/+jVSzHjbVxxGwl+VZ6ewVByMz9Cv1M2hEbSvxM56cX2zhzl8D1f2hDyBy03Sbj EcW2RSz5ri/vAd3BzKKu+QNMix+IpiW8r8ZXV0ZvHhZ7VMtjareUCIVsFAPGKTADTi ycRuBRsFuev8CmQ/gbS5enKljGdGkd7vBgsdmoBdscFlwvelO8F+zsrpnVpo0goVSX nTq+JCO5Ut7iw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 775956780C; Wed, 27 Aug 2025 20:07:54 -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 499y9MrE-VV3; Wed, 27 Aug 2025 20:07:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756346873; bh=SavHrHsLUAuVBkbW+IJ6yfDTWpNDpU8uiHjYWPXrWsc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FR5r265Gn48gRvUp8nT7uhpfI3oU6G8iHP9ecwBvR6bYmH2w8cJmDwF8sQVEqwo55 1V+fTHdsKuhZmhVr/ny3va+XwaPivlR6Q8VhTdyI2j+bnrwJsii9XOxeThmubqhwfF U204LE0IhY9lhb/fgnz5lfkovGQdeMwTwEMNyiSW1pOgPiYkyDtRhUnQtFzfl7wiG5 LLyMMYwLdWbuq98ACk8bFRfByfIPAdHcCrW+yR+BhWtRG30rV8KrMHTs8TF38F4DbR bJkHYKK+/DDTA9wd8Hu2CVwGL2KFsktXXYCKAHFdL0Z98X1so+JneItQc3YmutPzOq RYGsf7mIuZgSg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E216C6743E; Wed, 27 Aug 2025 20:07:52 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Wed, 27 Aug 2025 20:07:07 -0600 Message-ID: <20250828020732.981415-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250828020732.981415-1-sjg@u-boot.org> References: <20250828020732.981415-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: KWHINNP3QYKNVCFBC2JBZIX2EHMJZ54R X-Message-ID-Hash: KWHINNP3QYKNVCFBC2JBZIX2EHMJZ54R 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/20] efi: Add a way to show media devices 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 Add a new 'efidebug media' subcommand to show media devices and their device-paths. Signed-off-by: Simon Glass --- cmd/efidebug.c | 43 ++++++++++++++++++++++++++++++++++++++ doc/usage/cmd/efidebug.rst | 21 ++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 1515a508e2d..1d943113054 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include #include #include @@ -1604,6 +1606,43 @@ static int do_efi_test(struct cmd_tbl *cmdtp, int flag, return cp->cmd(cmdtp, flag, argc, argv); } +/** + * do_efi_show_media() - show EFI media devices + * + * @cmdtp: Command table + * @flag: Command flag + * @argc: Number of arguments + * @argv: Argument array + * Return: CMD_RET_SUCCESS on success, CMD_RET_FAILURE on failure + * + * Implement efidebug "media" sub-command. + * Show all EFI media devices and their device paths. + */ +static int do_efi_show_media(struct cmd_tbl *cmdtp, int flag, + int argc, char *const argv[]) +{ + struct udevice *dev; + struct uclass *uc; + int ret; + + ret = uclass_get(UCLASS_EFI_MEDIA, &uc); + if (ret) { + printf("Cannot get EFI media uclass: (err=%dE)\n", ret); + return CMD_RET_FAILURE; + } + + printf("Device Device Path\n"); + printf("------------------- -----------\n"); + + uclass_foreach_dev(dev, uc) { + struct efi_media_plat *plat = dev_get_plat(dev); + + printf("%-20s %pD\n", dev->name, plat->device_path); + } + + return CMD_RET_SUCCESS; +} + /** * do_efi_query_info() - QueryVariableInfo EFI service * @@ -1670,6 +1709,8 @@ static struct cmd_tbl cmd_efidebug_sub[] = { 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, "", ""), + U_BOOT_CMD_MKENT(media, CONFIG_SYS_MAXARGS, 1, do_efi_show_media, + "", ""), U_BOOT_CMD_MKENT(memmap, CONFIG_SYS_MAXARGS, 1, do_efi_show_memmap, "", ""), U_BOOT_CMD_MKENT(tables, CONFIG_SYS_MAXARGS, 1, do_efi_show_tables, @@ -1772,6 +1813,8 @@ U_BOOT_LONGHELP(efidebug, " - show loaded images\n" "efidebug log\n" " - show UEFI log\n" + "efidebug media\n" + " - show EFI media devices\n" "efidebug memmap\n" " - show UEFI memory map\n" "efidebug tables\n" diff --git a/doc/usage/cmd/efidebug.rst b/doc/usage/cmd/efidebug.rst index 5eca4079f82..90e0b9c4546 100644 --- a/doc/usage/cmd/efidebug.rst +++ b/doc/usage/cmd/efidebug.rst @@ -14,6 +14,7 @@ Synopsis :: efidebug log + efidebug media Description ----------- @@ -21,7 +22,7 @@ Description The *efidebug* command provides access to debugging features for the EFI-loader subsystem. -Only one of the subcommands are documented at present. +Only two of the subcommands are documented at present. efidebug log ~~~~~~~~~~~~ @@ -30,10 +31,28 @@ This shows a log of EFI boot-services calls which have been handled since U-Boot started. This can be useful to see what the app is doing, or even what U-Boot itself has called. +efidebug media +~~~~~~~~~~~~~~ + +This shows a list of all EFI media devices and their corresponding device paths. +Each EFI media device represents a block device that was discovered through EFI +boot services, such as hard drives, USB storage, or other bootable media. The +device path shows the EFI device path for each device, which can be useful for +debugging boot issues or understanding the system topology. + Example ------- +This shows checking the EFI media devices:: + + => efidebug media + Device Device Path + ------ ----------- + efi_media_1 PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0) + efi_media_2 PciRoot(0x0)/Pci(0x5,0x0) + + This shows checking the log, then using 'efidebug tables' to fully set up the EFI-loader subsystem, then checking the log again::