[Concept,v2,05/22] meminfo: Allow for up to 10 hex digits

Message ID 20250819185900.835939-6-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>

On platforms where most of the memory is above 4GB, the EFI app may find
itself using addresses with 9 or even 10 digits. Expand the width of the
columns to cope with this.

Add some double bars across digits 9 and 8 so that it is easier to make
the value.

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

(no changes since v1)

 cmd/meminfo.c      | 9 +++++----
 test/cmd/meminfo.c | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)
  

Patch

diff --git a/cmd/meminfo.c b/cmd/meminfo.c
index 5e83d61c2dd..2f83ca27537 100644
--- a/cmd/meminfo.c
+++ b/cmd/meminfo.c
@@ -19,9 +19,9 @@  static void print_region(const char *name, ulong base, ulong size, ulong *uptop)
 {
 	ulong end = base + size;
 
-	printf("%-12s %8lx %8lx %8lx", name, base, size, end);
+	printf("%-12s %10lx %10lx %10lx", name, base, size, end);
 	if (*uptop)
-		printf(" %8lx", *uptop - end);
+		printf(" %10lx", *uptop - end);
 	putc('\n');
 	*uptop = base;
 }
@@ -58,9 +58,10 @@  static int do_meminfo(struct cmd_tbl *cmdtp, int flag, int argc,
 	if (!IS_ENABLED(CONFIG_CMD_MEMINFO_MAP))
 		return 0;
 
-	printf("\n%-12s %8s %8s %8s %8s\n", "Region", "Base", "Size", "End",
+	printf("\n%-12s %10s %10s %10s %10s\n", "Region", "||   Base",
+	       "||   Size", "||    End",
 	       "Gap");
-	printf("------------------------------------------------\n");
+	printf("--------------------------------------------------------\n");
 	upto = 0;
 	if (IS_ENABLED(CONFIG_VIDEO))
 		print_region("video", gd_video_bottom(),
diff --git a/test/cmd/meminfo.c b/test/cmd/meminfo.c
index 53b41e3b49e..b2f306d06e2 100644
--- a/test/cmd/meminfo.c
+++ b/test/cmd/meminfo.c
@@ -17,7 +17,7 @@  static int cmd_test_meminfo(struct unit_test_state *uts)
 	ut_assert_nextline("DRAM:  256 MiB");
 	ut_assert_nextline_empty();
 
-	ut_assert_nextline("Region           Base     Size      End      Gap");
+	ut_assert_nextline("Region        ||   Base  ||   Size  ||    End        Gap");
 	ut_assert_nextlinen("-");
 
 	/* For now we don't worry about checking the values */