diff mbox series

[RFC,09/14] common/board_f: init malloc earlier

Message ID 20241124-b4-efistub-arm64-v1-9-3e33f0340071@linaro.org
State New
Headers show
Series efi: implement EFISTUB support for ARM64 and Qualcomm | expand

Commit Message

Caleb Connolly Nov. 24, 2024, 8:27 p.m. UTC
Currently the early malloc initialisation is done partially in
board_init_f_init_reserve() (on arm64 at least), which configures
gd->malloc_base. But it isn't actually usable until initf_malloc() is
called which doesn't happen until after fdtdec_setup().

This causes problems in a few scenarios:

1. when using MULTI_DTB_FIT as this needs a working malloc (especially
   for compressed FIT).
2. Some platforms may need to allocate memory as part of memory map
   initialisation (e.g. Qualcomm will need this to parse the memory map
   from SMEM).

Move the initf_malloc() call earlier so that malloc is available during
fdtdec_setup().

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/common/board_f.c b/common/board_f.c
index 98dc2591e1d0..bddfa6b992b9 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -867,15 +867,15 @@  static int initf_upl(void)
 }
 
 static const init_fnc_t init_sequence_f[] = {
 	setup_mon_len,
+	initf_malloc,
 #ifdef CONFIG_OF_CONTROL
 	fdtdec_setup,
 #endif
 #ifdef CONFIG_TRACE_EARLY
 	trace_early_init,
 #endif
-	initf_malloc,
 	initf_upl,
 	log_init,
 	initf_bootstage,	/* uses its own timer, so does not need DM */
 	event_init,