[Concept,07/20] efi: Add a uclass column to efidebug media command

Message ID 20250828020732.981415-8-sjg@u-boot.org
State New
Headers
Series efi: App and devicetree improvements |

Commit Message

Simon Glass Aug. 28, 2025, 2:07 a.m. UTC
  From: Simon Glass <sjg@chromium.org>

Add a new column to the 'efidebug media' command that shows the likely
uclass for each EFI media device based on its device path.

This uses the new efi_dp_guess_uclass() function which looks through an
EFI device-path to determine the corresponding uclass.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 cmd/efidebug.c             | 10 +++++++---
 doc/usage/cmd/efidebug.rst | 21 ++++++++++++---------
 2 files changed, 19 insertions(+), 12 deletions(-)
  

Patch

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 1d943113054..9c0b6b084cb 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -1606,6 +1606,7 @@  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
  *
@@ -1631,13 +1632,16 @@  static int do_efi_show_media(struct cmd_tbl *cmdtp, int flag,
 		return CMD_RET_FAILURE;
 	}
 
-	printf("Device               Device Path\n");
-	printf("-------------------  -----------\n");
+	printf("Device               Media type       Device Path\n");
+	printf("-------------------  ---------------  -----------\n");
 
 	uclass_foreach_dev(dev, uc) {
 		struct efi_media_plat *plat = dev_get_plat(dev);
+		enum uclass_id id;
+		const char *name = efi_dp_guess_uclass(plat->device_path, &id);
 
-		printf("%-20s %pD\n", dev->name, plat->device_path);
+		printf("%-20s %-15s  %pD\n", dev->name, name,
+		       plat->device_path);
 	}
 
 	return CMD_RET_SUCCESS;
diff --git a/doc/usage/cmd/efidebug.rst b/doc/usage/cmd/efidebug.rst
index 90e0b9c4546..903293ad3d8 100644
--- a/doc/usage/cmd/efidebug.rst
+++ b/doc/usage/cmd/efidebug.rst
@@ -34,11 +34,14 @@  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.
+This shows a list of all EFI media devices, their likely U-Boot uclass, 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 U-Boot Class column shows which U-Boot
+driver subsystem would likely handle the device (e.g., "ahci" for SATA drives,
+"usb" for USB storage). 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
@@ -47,10 +50,10 @@  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)
+  Device               U-Boot Class     Device Path
+  -------------------  ---------------  -----------
+    efi_media_1        ahci             PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)
+    efi_media_2        pci              PciRoot(0x0)/Pci(0x5,0x0)
 
 
 This shows checking the log, then using 'efidebug tables' to fully set up the