[Concept,11/20] boot: Show the underlying bootflow device in the app

Message ID 20250828020732.981415-12-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>

Within the app all media devices are 'efi' so it isn't useful to show
that as the media. Look up the media-type of the underlying device, e.g.
'usb' or 'nvme'. This is a lot more helpful, and can make it easy to see
which bootflows relates to internal media and which to external, for
example.

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

 cmd/bootflow.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
  

Patch

diff --git a/cmd/bootflow.c b/cmd/bootflow.c
index ae692cf521b..20fc04bdda3 100644
--- a/cmd/bootflow.c
+++ b/cmd/bootflow.c
@@ -70,11 +70,26 @@  static void report_bootflow_err(struct bootflow *bflow, int err)
  */
 static void show_bootflow(int index, struct bootflow *bflow, bool errors)
 {
+	const char *name = NULL;
+
+	if (IS_ENABLED(CONFIG_EFI_APP)) {
+		struct efi_device_path *dp;
+		enum uclass_id id;
+		int ret;
+
+		ret = efi_dp_from_bootflow(bflow, &dp, NULL);
+		if (!ret)
+			name = efi_dp_guess_uclass(dp, &id);
+	} else if (bflow->dev) {
+		name = dev_get_uclass_name(dev_get_parent(bflow->dev));
+	}
+	if (!name)
+		name = "(none)";
+
 	printf("%3x  %-11s  %-6s  %-9.9s %4x  %-25.25s %s\n", index,
 	       bflow->method ? bflow->method->name : "(none)",
-	       bootflow_state_get_name(bflow->state),
-	       bflow->dev ? dev_get_uclass_name(dev_get_parent(bflow->dev)) :
-	       "(none)", bflow->part, bflow->name, bflow->fname ?: "");
+	       bootflow_state_get_name(bflow->state), name, bflow->part,
+	       bflow->name, bflow->fname ?: "");
 	if (errors)
 		report_bootflow_err(bflow, bflow->err);
 }