[PATCH V2] cmd: mem: fix to display wrong memory information
Jaehoon Chung
jh80.chung at samsung.com
Thu Jan 28 03:35:31 CET 2021
When run meminfo command, it's displayed wrong memory information.
Because some boards are that gd->ram_size is reassigned to other value
in board file.
Additionally, display a memory bank information.
On 4G RPI4 target
- Before
U-Boot> meminfo
DRAM: 948MiB
- After
U-Boot> meminfo
Bank #0: 0 948 MiB
Bank #1: 40000000 2.9 GiB
Bank #2: 0 0 Bytes
Bank #3: 0 0 Bytes
DRAM: 3.9GiB
Signed-off-by: Jaehoon Chung <jh80.chung at samsung.com>
---
Changes in v2:
- Change patch subject prefix from "common: board_f" to "cmd: mem"
- Update commit-msg
- Revert common/board_f.c modification. Instead, add codes in mem.c
---
cmd/mem.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/cmd/mem.c b/cmd/mem.c
index 1d4f2bab2f9a..86f48a6e121a 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -1387,8 +1387,22 @@ U_BOOT_CMD(
static int do_mem_info(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
+ unsigned long long size;
+
+#ifdef CONFIG_NR_DRAM_BANKS
+ int i;
+
+ for (i = size = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+ size += gd->bd->bi_dram[i].size;
+ printf("Bank #%d: %llx ", i,
+ (unsigned long long)(gd->bd->bi_dram[i].start));
+ print_size(gd->bd->bi_dram[i].size, "\n");
+ }
+#else
+ size = gd->ram_size;
+#endif
puts("DRAM: ");
- print_size(gd->ram_size, "\n");
+ print_size(size, "\n");
return 0;
}
--
2.29.0
More information about the U-Boot
mailing list