Where the bloblist is located in internal memory and TF-A's BL31 blob
removes access to this memory, the best option seems to be to relocate
the bloblist just before running TF-A.

Do this at the end of SPL.

Signed-off-by: Simon Glass <s...@chromium.org>
Suggested-by: Raymond Mao <raymond....@linaro.org>
---

Changes in v2:
- Move this logic into board-specific code

 arch/arm/mach-rockchip/spl.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
index 305373a161c..64f056c27e9 100644
--- a/arch/arm/mach-rockchip/spl.c
+++ b/arch/arm/mach-rockchip/spl.c
@@ -3,6 +3,7 @@
  * (C) Copyright 2019 Rockchip Electronics Co., Ltd
  */
 
+#include <bloblist.h>
 #include <cpu_func.h>
 #include <debug_uart.h>
 #include <dm.h>
@@ -133,6 +134,19 @@ void board_init_f(ulong dummy)
 
 void spl_board_prepare_for_boot(void)
 {
+       /*
+        * On RK3399, TF-A is executed after SPL and before U-Boot. It removes
+        * our access to the IRAM. So move the bloblist to RAM.
+        */
+       if (xpl_phase() == PHASE_SPL && IS_ENABLED(CONFIG_VPL)) {
+               ulong addr = CONFIG_IF_ENABLED_INT(BLOBLIST_RELOC,
+                                                  BLOBLIST_RELOC_ADDR);
+
+               log_debug("Relocating bloblist %p to %lx\n", gd_bloblist(),
+                         addr);
+               bloblist_reloc(map_sysmem(addr, 0), bloblist_get_total_size());
+       }
+
        if (!IS_ENABLED(CONFIG_ARM64) || CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
                return;
 
-- 
2.43.0

Reply via email to