The size of free memory should be $lmb_base - $ram_base. Signed-off-by: Shiji Yang <yangshij...@outlook.com> ---
Before: => meminfo DRAM: 64 MiB Region Base Size End Gap ------------------------------------------------ code 83fa0000 5fdf8 83fffdf8 malloc 83e90000 110000 83fa0000 0 board_info 83e8ffd0 30 83e90000 0 global_data 83e8ff10 b4 83e8ffc4 c devicetree 83e8e690 186d 83e8fefd 13 stack 82e8e000 1000000 83e8e000 690 lmb 82e8e000 1172000 84000000 fee8e000 free 80000000 82e8e000 2e8e000 80000000 After: => meminfo DRAM: 64 MiB Region Base Size End Gap ------------------------------------------------ code 83fa0000 5f260 83fff260 malloc 83e90000 110000 83fa0000 0 board_info 83e8ffd0 30 83e90000 0 global_data 83e8ff10 b4 83e8ffc4 c devicetree 83e8e690 186d 83e8fefd 13 stack 82e8e000 1000000 83e8e000 690 lmb 82e8e000 1172000 84000000 fee8e000 free 80000000 2e8e000 82e8e000 0 cmd/meminfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/meminfo.c b/cmd/meminfo.c index acdb38dcba0..aa3b5bafe17 100644 --- a/cmd/meminfo.c +++ b/cmd/meminfo.c @@ -93,7 +93,7 @@ static int do_meminfo(struct cmd_tbl *cmdtp, int flag, int argc, print_region("stack", stk_bot, CONFIG_STACK_SIZE, &upto); if (IS_ENABLED(CONFIG_LMB)) show_lmb(lmb_get(), &upto); - print_region("free", gd->ram_base, upto, &upto); + print_region("free", gd->ram_base, upto - gd->ram_base, &upto); return 0; } -- 2.50.0