]> git.baikalelectronics.ru Git - uboot.git/commit
image: fdt: Fix DT relocation handling with multiple DRAM banks with gap
authorMarek Vasut <marex@denx.de>
Fri, 8 Apr 2022 00:09:19 +0000 (02:09 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 20 Apr 2022 15:14:39 +0000 (11:14 -0400)
commit786d57ce21d938c93ee2f8394480d5c9f6272d01
treea98e3d91a0f435ca0e331c43bf2625943a9bcd9d
parent88d8f4067320dce219c6e81af1a48174656cbe13
image: fdt: Fix DT relocation handling with multiple DRAM banks with gap

The current implementation of boot_relocate_fdt() places DT at the
highest usable DRAM address, which is calculated as:
  env_get_bootm_low() + env_get_bootm_mapsize()
which by default becomes gd->ram_base + gd->ram_size.

Systems like i.MX53 can have multiple DRAM banks with gap between them,
e.g. have DRAM at 0x70000000-0x8fffffff and 0xb0000000-0xcfffffff , so
for them the calculated highest DRAM address is 0xafffffff, which is
exactly in the gap and thus not usable.

Fix this by iterating over all DRAM banks and tracking the remaining
amount of the total mapping size obtained from env_get_bootm_mapsize().
Limit the maximum LMB area size to each bank, to avoid using nonexistent
DRAM.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
boot/image-fdt.c