[RFC 5/8] cmd/meminfo: display of addresses above 4 GiB

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Sun Dec 21 02:58:56 CET 2025


Addresses above 4 GiB don't fit into 8 digits.
Use 13 digits which encompass up to 15 TiB.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 cmd/meminfo.c      | 8 ++++----
 test/cmd/meminfo.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cmd/meminfo.c b/cmd/meminfo.c
index aa3b5bafe17..b731280d106 100644
--- a/cmd/meminfo.c
+++ b/cmd/meminfo.c
@@ -23,9 +23,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 %13lx %13lx %13lx", name, base, size, end);
 	if (*uptop)
-		printf(" %8lx", *uptop - end);
+		printf(" %13lx", *uptop - end);
 	putc('\n');
 	*uptop = base;
 }
@@ -64,9 +64,9 @@ static int do_meminfo(struct cmd_tbl *cmdtp, int flag, int argc,
 
 	arch_dump_mem_attrs();
 
-	printf("\n%-12s %8s %8s %8s %8s\n", "Region", "Base", "Size", "End",
+	printf("\n%-12s %13s %13s %13s %13s\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 40c3520496e..9224b9589f3 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_nextlinen("DRAM:  ");
 	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 */
-- 
2.51.0



More information about the U-Boot mailing list