summaryrefslogtreecommitdiff
path: root/board/xilinx
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2021-05-31 12:03:19 +0300
committerMichal Simek <michal.simek@xilinx.com>2021-06-23 10:48:35 +0300
commitce39ee28ec31b04c5c4e50d57a852ef8c1b2b26f (patch)
tree199779ef182d28413687beaaf008dea6648207c2 /board/xilinx
parent43ef4c82fe4d9a4790b358b82de336f4dd5bf681 (diff)
downloadu-boot-ce39ee28ec31b04c5c4e50d57a852ef8c1b2b26f.tar.xz
zynqmp: Do not place u-boot to reserved memory location
TF-A and SecureOS can allocate the part of DDR for self but U-Boot is not handling this configuration that the part of memory is reserved and shouldn't be used by U-Boot. That's why read all reserved memory locations and don't use it. The code was taken from commit 4a1b975dac02 ("board: stm32mp1: reserve memory for OP-TEE in device tree") and commit 1419e5b5167e ("stm32mp: update MMU config before the relocation") which is used by stm32 and does the job properly. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'board/xilinx')
-rw-r--r--board/xilinx/zynqmp/zynqmp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 208eadef45..7177c5a5a8 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -11,6 +11,8 @@
#include <env.h>
#include <env_internal.h>
#include <init.h>
+#include <image.h>
+#include <lmb.h>
#include <log.h>
#include <net.h>
#include <sata.h>
@@ -453,6 +455,25 @@ int dram_init(void)
return 0;
}
+
+ulong board_get_usable_ram_top(ulong total_size)
+{
+ phys_size_t size;
+ phys_addr_t reg;
+ struct lmb lmb;
+
+ /* found enough not-reserved memory to relocated U-Boot */
+ lmb_init(&lmb);
+ lmb_add(&lmb, gd->ram_base, gd->ram_size);
+ boot_fdt_add_mem_rsv_regions(&lmb, (void *)gd->fdt_blob);
+ size = ALIGN(CONFIG_SYS_MALLOC_LEN + total_size, MMU_SECTION_SIZE),
+ reg = lmb_alloc(&lmb, size, MMU_SECTION_SIZE);
+
+ if (!reg)
+ reg = gd->ram_top - size;
+
+ return reg + size;
+}
#else
int dram_init_banksize(void)
{