1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

spl: add fixed memory node in target fdt also when loading ATF

In a loading chain SPL -> ATF (->OP-TEE) -> U-Boot, ATF and a subsequent
OP-TEE will re-use the same fdt as the U-Boot target and may need the
information about usable memory ranges.

Especially OP-TEE needs this to initialize dynamic shared memory
(the only type U-Boot implements when talking to OP-TEE).

So allow spl_fixup_fdt() to take a fdt_blob argument, falling back to
the existing CONFIG_SYS_SPL_ARGS_ADDR if needed and call it from the
ATF path as well.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
This commit is contained in:
Heiko Stuebner
2020-05-25 19:57:25 +02:00
committed by Kever Yang
parent b6740fb116
commit a343b4fe73

View File

@@ -61,7 +61,8 @@ static bd_t bdata __attribute__ ((section(".data")));
*/ */
__weak void show_boot_progress(int val) {} __weak void show_boot_progress(int val) {}
#if defined(CONFIG_SPL_OS_BOOT) || CONFIG_IS_ENABLED(HANDOFF) #if defined(CONFIG_SPL_OS_BOOT) || CONFIG_IS_ENABLED(HANDOFF) || \
defined(CONFIG_SPL_ATF)
/* weak, default platform-specific function to initialize dram banks */ /* weak, default platform-specific function to initialize dram banks */
__weak int dram_init_banksize(void) __weak int dram_init_banksize(void)
{ {
@@ -103,12 +104,14 @@ void __weak spl_perform_fixups(struct spl_image_info *spl_image)
{ {
} }
void spl_fixup_fdt(void) void spl_fixup_fdt(void *fdt_blob)
{ {
#if defined(CONFIG_SPL_OF_LIBFDT) && defined(CONFIG_SYS_SPL_ARGS_ADDR) #if defined(CONFIG_SPL_OF_LIBFDT)
void *fdt_blob = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
int err; int err;
if (!fdt_blob)
return;
err = fdt_check_header(fdt_blob); err = fdt_check_header(fdt_blob);
if (err < 0) { if (err < 0) {
printf("fdt_root: %s\n", fdt_strerror(err)); printf("fdt_root: %s\n", fdt_strerror(err));
@@ -640,7 +643,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
initr_watchdog(); initr_watchdog();
#endif #endif
if (IS_ENABLED(CONFIG_SPL_OS_BOOT) || CONFIG_IS_ENABLED(HANDOFF)) if (IS_ENABLED(CONFIG_SPL_OS_BOOT) || CONFIG_IS_ENABLED(HANDOFF) ||
IS_ENABLED(CONFIG_SPL_ATF))
dram_init_banksize(); dram_init_banksize();
bootcount_inc(); bootcount_inc();
@@ -682,6 +686,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
#if CONFIG_IS_ENABLED(ATF) #if CONFIG_IS_ENABLED(ATF)
case IH_OS_ARM_TRUSTED_FIRMWARE: case IH_OS_ARM_TRUSTED_FIRMWARE:
debug("Jumping to U-Boot via ARM Trusted Firmware\n"); debug("Jumping to U-Boot via ARM Trusted Firmware\n");
spl_fixup_fdt(spl_image.fdt_addr);
spl_invoke_atf(&spl_image); spl_invoke_atf(&spl_image);
break; break;
#endif #endif
@@ -701,7 +706,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
#ifdef CONFIG_SPL_OS_BOOT #ifdef CONFIG_SPL_OS_BOOT
case IH_OS_LINUX: case IH_OS_LINUX:
debug("Jumping to Linux\n"); debug("Jumping to Linux\n");
spl_fixup_fdt(); #if defined(CONFIG_SYS_SPL_ARGS_ADDR)
spl_fixup_fdt((void *)CONFIG_SYS_SPL_ARGS_ADDR);
#endif
spl_board_prepare_for_linux(); spl_board_prepare_for_linux();
jump_to_image_linux(&spl_image); jump_to_image_linux(&spl_image);
#endif #endif