On Mon, 3 Aug 2026 at 00:35, Marek Vasut
<[email protected]> wrote:
>
> Make verbose DRAM layout print on boot configurable via newly introduced
> CONFIG_DISPLAY_DRAM_CONFIG_VERBOSE Kconfig option. This reuses existing
> DRAM layout debug print, but with additional rework to place the output
> at the end of DRAM size listing, print both bank start and end addresses,
> and skip empty banks. In case DEBUG is defined, the DRAM layout print is
> triggered unconditionally.
>
> The original debug print looked as follows, which puts the layout print
> between DRAM: size announcement (1) and duplicate DRAM: size print (2),
> does not skip empty banks (3), and does not print DRAM bank end (4).
>
> "
> Model: Renesas Ironhide board based on r8a78000
> DRAM:  <----------------------------------------------------------- (1)
> RAM Configuration:
> Bank #0: 1080000000 2 GiB
> Bank #1: 1200000000 4 GiB <---------------------------------------- (4)
> ...
> Bank #8: 40000000 2 GiB
> Bank #9: 0 0 Bytes <----------------------------------------------- (3)
> ...
> Bank #15: 0 0 Bytes
>
> DRAM:  2 GiB (total 32 GiB) <-------------------------------------- (2)
> Core:  68 devices, 26 uclasses, devicetree: separate
> "
>
> The new debug print and optionally verbose print looks as follows, the
> duplicate DRAM: prefix is removed (1), the layout is printed after the
> DRAM size print (3), the DRAM end address is printed (3) and there are
> no more empty banks printed (4):
>
> "
> Model: Renesas Ironhide board based on r8a78000
> DRAM:  2 GiB (total 32 GiB) <-------------------------------------- (1)
> RAM Configuration: <----------------------------------------------- (2)
> Bank #0: 0x1080000000 - 0x10ffffffff, 2 GiB <---------------------- (4)
> Bank #1: 0x1200000000 - 0x12ffffffff, 4 GiB
> Bank #2: 0x1400000000 - 0x14ffffffff, 4 GiB
> Bank #3: 0x1600000000 - 0x16ffffffff, 4 GiB
> Bank #4: 0x1800000000 - 0x18ffffffff, 4 GiB
> Bank #5: 0x1a00000000 - 0x1affffffff, 4 GiB
> Bank #6: 0x1c00000000 - 0x1cffffffff, 4 GiB
> Bank #7: 0x1e00000000 - 0x1effffffff, 4 GiB
> Bank #8: 0x40000000 - 0xbfffffff, 2 GiB <-------------------------- (3)
> Core:  68 devices, 26 uclasses, devicetree: separate
> "
>
> Signed-off-by: Marek Vasut <[email protected]>
> ---
Reviewed-by: Ilias Apalodimas <[email protected]>


> Cc: Aristo Chen <[email protected]>
> Cc: Ilias Apalodimas <[email protected]>
> Cc: Johan Jonker <[email protected]>
> Cc: Nobuhiro Iwamatsu <[email protected]>
> Cc: Peng Fan <[email protected]>
> Cc: Quentin Schulz <[email protected]>
> Cc: Simon Glass <[email protected]>
> Cc: Tom Rini <[email protected]>
> Cc: [email protected]
> ---
>  common/Kconfig   |  6 ++++++
>  common/board_f.c | 33 ++++++++++++++++++++++++---------
>  2 files changed, 30 insertions(+), 9 deletions(-)
>
> diff --git a/common/Kconfig b/common/Kconfig
> index 345be4b8ca1..869493c979d 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -615,6 +615,12 @@ config DISPLAY_BOARDINFO_LATE
>           the relocation phase. The board function checkboard() is called to 
> do
>           this.
>
> +config DISPLAY_DRAM_CONFIG_VERBOSE
> +       bool "Display additional information about DRAM layout"
> +       help
> +         Display additional information about the board DRAM layout, 
> including
> +         each bank start address, end address and size.
> +
>  menu "Start-up hooks"
>
>  config CYCLIC
> diff --git a/common/board_f.c b/common/board_f.c
> index 9efcd9499a9..f886774e82b 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -217,21 +217,34 @@ static int sizes_near(unsigned long long size1, 
> unsigned long long size2)
>         return size1_scale == size2_scale && size1_val == size2_val;
>  }
>
> +static void show_dram_config_verbose(void)
> +{
> +       int i;
> +
> +#ifndef DEBUG
> +       if (!CONFIG_IS_ENABLED(DISPLAY_DRAM_CONFIG_VERBOSE))
> +               return;
> +#endif
> +
> +       printf("RAM Configuration:\n");
> +       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
> +               if (!gd->dram[i].size)
> +                       break;
> +
> +               printf("Bank #%d: 0x%llx - 0x%llx, ", i,
> +                      (unsigned long long)(gd->dram[i].start),
> +                      (unsigned long long)(gd->dram[i].start + 
> gd->dram[i].size - 1));
> +               print_size(gd->dram[i].size, "\n");
> +       }
> +}
> +
>  static int show_dram_config(void)
>  {
>         unsigned long long size;
>         int i;
>
> -       debug("\nRAM Configuration:\n");
> -       for (i = size = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
> +       for (i = size = 0; i < CONFIG_NR_DRAM_BANKS; i++)
>                 size += gd->dram[i].size;
> -               debug("Bank #%d: %llx ", i,
> -                     (unsigned long long)(gd->dram[i].start));
> -#ifdef DEBUG
> -               print_size(gd->dram[i].size, "\n");
> -#endif
> -       }
> -       debug("\nDRAM:  ");
>
>         print_size(gd->ram_size, "");
>         if (!sizes_near(gd->ram_size, size)) {
> @@ -241,6 +254,8 @@ static int show_dram_config(void)
>         board_add_ram_info(0);
>         putc('\n');
>
> +       show_dram_config_verbose();
> +
>         return 0;
>  }
>
> --
> 2.53.0
>

Reply via email to