From 4f6500aa1a62a80e8df2ffdf16fe4c3eabd99f1c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 8 May 2022 04:39:27 -0600 Subject: dm: spl: Allow SPL to show memory usage Add an option to tell SPL to show memory usage for driver model just before it boots into the next phase. Signed-off-by: Simon Glass --- common/spl/spl.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'common') diff --git a/common/spl/spl.c b/common/spl/spl.c index 2a69a7c9324..dff4eef7071 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -780,6 +781,14 @@ void board_init_r(gd_t *dummy1, ulong dummy2) bootcount_inc(); + /* Dump driver model states to aid analysis */ + if (CONFIG_IS_ENABLED(DM_STATS)) { + struct dm_stats mem; + + dm_get_mem(&mem); + dm_dump_mem(&mem); + } + memset(&spl_image, '\0', sizeof(spl_image)); #ifdef CONFIG_SYS_SPL_ARGS_ADDR spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR; -- cgit v1.2.3