summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-07-28 17:56:33 +0200
committerTom Rini <trini@konsulko.com>2020-08-05 08:18:34 -0400
commit5ce2776ae63326807bc504fcfed24997c2a03bb2 (patch)
treecb4b6edc8703db4a20bcf32babe0e369d3648b28 /cmd
parentf2d58f3bdad30ac088f76cce38a2e64a6c640f19 (diff)
cmd: bdinfo: cleanup phys_addr_t output
We currently print the memory size with at least 8 hexadecimal digits. This creates a ragged output on 64 bit boards, e.g. on a Kendryte K210: DRAM bank = 0x0000000000000002 -> start = 0x0000000080600000 -> size = 0x0000000000200000 memstart = 0x0000000000000000 memsize = 0x00000000 flashstart = 0x0000000000000000 flashsize = 0x0000000000000000 flashoffset = 0x0000000000000000 All other numbers are printed with the number of digits needed for the type ulong. So use this value as minimum number of digits (precision) for printing physical addresses. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Heiko Schocher <hs@denx.de> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/bdinfo.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 2a6dd6c67a..9485c40474 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -34,9 +34,10 @@ static void print_eth(int idx)
printf("%-12s= %s\n", name, val);
}
-static void print_lnum(const char *name, unsigned long long value)
+static void print_phys_addr(const char *name, phys_addr_t value)
{
- printf("%-12s= 0x%.8llX\n", name, value);
+ printf("%-12s= 0x%.*llx\n", name, 2 * (int)sizeof(ulong),
+ (unsigned long long)value);
}
void bdinfo_print_mhz(const char *name, unsigned long hz)
@@ -75,7 +76,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
bdinfo_print_num("boot_params", (ulong)bd->bi_boot_params);
print_bi_dram(bd);
bdinfo_print_num("memstart", (ulong)bd->bi_memstart);
- print_lnum("memsize", (u64)bd->bi_memsize);
+ print_phys_addr("memsize", bd->bi_memsize);
bdinfo_print_num("flashstart", (ulong)bd->bi_flashstart);
bdinfo_print_num("flashsize", (ulong)bd->bi_flashsize);
bdinfo_print_num("flashoffset", (ulong)bd->bi_flashoffset);