[PATCH v5 4/7] rpi: Add a local get_effective_memsize()

Ilias Apalodimas ilias.apalodimas at linaro.org
Thu Jun 4 09:37:09 CEST 2026


We are about to change the place we call dram_init_banksize().
The goal is to have all the information we need to pick a proper
relocation address in gd->dram[].

However, the RPI boards, and specifically the tested rpi4, seems
to hang if we relocate anywhere above the address returned from
bcm2835_mbox_call_prop().
So store that address and return it on get_effective_memsize()
which is used to calculate ram_top.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
---
 board/raspberrypi/rpi/rpi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 885c660a289b..1da5df92351c 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -39,6 +39,8 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 unsigned long __section(".data") fw_dtb_pointer;
 
+static phys_addr_t discovered_ram_size;
+
 /* TODO(sjg at chromium.org): Move these to the msg.c file */
 struct msg_get_arm_mem {
 	struct bcm2835_mbox_hdr hdr;
@@ -335,10 +337,16 @@ int dram_init(void)
 	 * the u-boot's memory setup.
 	 */
 	gd->ram_size &= ~MMU_SECTION_SIZE;
+	discovered_ram_size = gd->ram_size;
 
 	return 0;
 }
 
+phys_size_t get_effective_memsize(void)
+{
+	return discovered_ram_size;
+}
+
 #ifdef CONFIG_OF_BOARD
 int dram_init_banksize(void)
 {
-- 
2.53.0



More information about the U-Boot mailing list