lib: fdt: Introduce fdtdec_setup_mem_size_base_lowest()
authorMichal Simek <michal.simek@xilinx.com>
Thu, 9 Jul 2020 12:09:52 +0000 (14:09 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 20 Aug 2020 07:49:20 +0000 (09:49 +0200)
commit7fce7396659c162f55b1747d84599d822b11c6a7
tree716392f8de1c2b51602f47b5d53e4bae12a086ea
parent11b1dcec09f035e3b70a2fc63913ab00991ecba7
lib: fdt: Introduce fdtdec_setup_mem_size_base_lowest()

New function should be called from board dram_init() because it initialized
gd->ram_base/ram_size. It finds the lowest available memory.

On systems with multiple memory nodes finding out the first memory node by
fdtdec_setup_mem_size_base() is not enough because this memory can be above
actual U-Boot VA mapping. Currently only mapping till 39bit is supported
(Full 44bit mapping was removed by commit 7985cdf74b28 ("arm64: Remove
non-full-va map code")).
If DT starts with the first memory node above 39bit address then system can
be unpredictable.

The function is available only when multiple memory bank support is
enabled.

Calling fdtdec_setup_memory_banksize() from dram_init() is not possible
because fdtdec_setup_memory_banksize() is saving dram information to bd
structure which is placed on stack but not initialized at this time. Also
stack is placed at location setup in dram_init().

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
include/fdtdec.h
lib/fdtdec.c