[Concept,10/14] efi: Show component names and other info with efidebug dh

Message ID 20250820144621.1073679-11-sjg@u-boot.org
State New
Headers
Series efi: app: Support booting an OS |

Commit Message

Simon Glass Aug. 20, 2025, 2:46 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

If a component name is available, show it, along with the supported
languages.

Also indicate at the top if the handle is a driver, rather than listing
that protocol at the end.

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

 cmd/efidebug.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)
  

Patch

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index dee0fc7efc2..1515a508e2d 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -488,8 +488,27 @@  static int do_efi_show_handles(struct cmd_tbl *cmdtp, int flag,
 		void *iface;
 
 		printf("\n%p", handle);
-		if (!IS_ENABLED(CONFIG_EFI_APP) && handle->dev)
+		ret = boot->handle_protocol(handle,
+					    &efi_guid_driver_binding_protocol,
+					    &iface);
+		if (!ret)
+			printf(" <driver>");
+		if (IS_ENABLED(CONFIG_EFI_APP)) {
+			struct efi_component_name2_protocol *comp;
+			u16 *name;
+
+			ret = boot->handle_protocol(handle,
+						    &efi_guid_component_name2,
+						    (void **)&comp);
+			if (!ret) {
+				printf(" [langs: %s]", comp->supported_langs);
+				ret = comp->get_driver_name(comp, "en", &name);
+				if (!ret)
+					printf(" (%ls)", name);
+			}
+		} else if (handle->dev) {
 			printf(" (%s)", handle->dev->name);
+		}
 		printf("\n");
 		/* Print device path */
 		ret = boot->handle_protocol(handle, &efi_guid_device_path,
@@ -501,7 +520,9 @@  static int do_efi_show_handles(struct cmd_tbl *cmdtp, int flag,
 		ret = boot->protocols_per_handle(handle, &guid, &count);
 		/* Print other protocols */
 		for (j = 0; j < count; j++) {
-			if (guidcmp(guid[j], &efi_guid_device_path))
+			if (guidcmp(guid[j], &efi_guid_device_path) &&
+			    guidcmp(guid[j], &efi_guid_component_name2) &&
+			    guidcmp(guid[j], &efi_guid_driver_binding_protocol))
 				printf("  %pUs\n", guid[j]);
 		}
 		efi_free_pool(guid);