[Concept,v2,10/22] efi: app: Show only a summary of disks and partitions

Message ID 20250819185900.835939-11-sjg@u-boot.org
State New
Headers
Series efi: Improvements for the EFI app on ARM |

Commit Message

Simon Glass Aug. 19, 2025, 6:58 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

The EFI app shows a list of every disk and partition it can find. On
Qualcomm x1e laptops this can fill the screen. The information is not
that useful, so just show a summary.

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

(no changes since v1)

 lib/efi_client/efi_app_init.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
  

Patch

diff --git a/lib/efi_client/efi_app_init.c b/lib/efi_client/efi_app_init.c
index 938b16d14ab..7d30e79528f 100644
--- a/lib/efi_client/efi_app_init.c
+++ b/lib/efi_client/efi_app_init.c
@@ -128,6 +128,7 @@  static int setup_block(void)
 	struct efi_device_path_to_text_protocol *text;
 	struct efi_device_path *path;
 	struct efi_block_io *blkio;
+	int num_disks, num_parts;
 	efi_uintn_t num_handles;
 	efi_handle_t *handle;
 	int ret, i;
@@ -150,7 +151,7 @@  static int setup_block(void)
 	if (ret)
 		return log_msg_ret("text", -ENOTSUPP);
 
-	for (i = 0; i < num_handles; i++) {
+	for (num_disks = 0, num_parts = 0, i = 0; i < num_handles; i++) {
 		struct udevice *dev;
 		const u16 *name;
 		bool is_part;
@@ -174,6 +175,7 @@  static int setup_block(void)
 		is_part = devpath_is_partition(path);
 
 		if (!is_part) {
+			num_disks++;
 			len = util->get_device_path_size(path);
 			ret = efi_bind_block(handle[i], blkio, path, len, &dev);
 			if (ret) {
@@ -183,15 +185,17 @@  static int setup_block(void)
 			}
 		} else {
 			dev = NULL;
+			num_parts++;
 		}
 
 		/*
 		 * Show the device name if we created one. Otherwise indicate
 		 * that it is a partition.
 		 */
-		printf("%2d: %-12s %ls\n", i, dev ? dev->name : "<partition>",
-		       name);
+		log_debug("%2d: %-12s %ls\n", i,
+			  dev ? dev->name : "<partition>", name);
 	}
+	log_info("EFI:   disks %d, partitions %d\n", num_disks, num_parts);
 	boot->free_pool(handle);
 
 	return 0;