
The available ram can be limited by ram_top as that depends on the reserved memory nodes provided by the device-tree (via board_get_usable_ram_top), so make sure to respect ram_top when setting up bootm_size to avoid overlapping reserved memory regions (e.g. memory used by OP-TEE).
The same logic is available in env_get_bootm_size when bootm_size is not defined by the default environment.
Signed-off-by: Ricardo Salveti ricardo@foundries.io --- board/xilinx/common/board.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 78a5d0efa86..4928fab2c96 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -389,6 +389,9 @@ int board_late_init_xilinx(void) if (CONFIG_IS_ENABLED(ARCH_ZYNQ) || CONFIG_IS_ENABLED(MICROBLAZE)) bootm_size = min(bootm_size, (phys_size_t)(SZ_512M + SZ_256M));
+ if (gd->ram_base + bootm_size > gd->ram_top) + bootm_size = gd->ram_top - gd->ram_base; + ret |= env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
ret |= env_set_addr("bootm_low", (void *)gd->ram_base);