[PATCH v1 3/4] common: Clean up setup_dest_addr()
Ilias Apalodimas
ilias.apalodimas at linaro.org
Fri Apr 3 11:01:05 CEST 2026
Right now the function does
- Re-adjust the ram_size based on Kconfig options
- Set ram_top
- Set the relocation address
It also does not set the ram_size in case ram_top grew
from it's initial value. But ram_top and ram_size should
always be changed together.
So let's make things a bit cleaner and move the ram calculations
in their own INITCALL
Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
---
common/board_f.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c
index 7df92281c35a..dd5518b60db4 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -337,13 +337,9 @@ static int setup_ram_base(void)
return 0;
}
-static int setup_dest_addr(void)
+static int setup_ram_config(void)
{
debug("Monitor len: %08x\n", gd->mon_len);
- /*
- * Ram is setup, size stored in gd !!
- */
- debug("Ram size: %08llX\n", (unsigned long long)gd->ram_size);
#if CONFIG_VAL(SYS_MEM_TOP_HIDE)
/*
* Subtract specified amount of memory to hide so that it won't
@@ -359,8 +355,17 @@ static int setup_dest_addr(void)
#endif
gd->ram_top = gd->ram_base + get_effective_memsize();
gd->ram_top = board_get_usable_ram_top(gd->mon_len);
- gd->relocaddr = gd->ram_top;
+
debug("Ram top: %08llX\n", (unsigned long long)gd->ram_top);
+ debug("Ram size: %08llX\n", (unsigned long long)gd->ram_size);
+
+ return 0;
+}
+
+static int setup_dest_addr(void)
+{
+ gd->relocaddr = gd->ram_top;
+ debug("Reloc addr: %08llX\n", (unsigned long long)gd->relocaddr);
return arch_setup_dest_addr();
}
@@ -966,6 +971,7 @@ static void initcall_run_f(void)
* - board info struct
*/
INITCALL(setup_ram_base);
+ INITCALL(setup_ram_config);
INITCALL(setup_dest_addr);
#if CONFIG_IS_ENABLED(OF_BOARD_FIXUP) && \
!CONFIG_IS_ENABLED(OF_INITIAL_DTB_READONLY)
--
2.53.0
More information about the U-Boot
mailing list