diff mbox series

[RFC,v2,39/48] add a function to check if an address is in RAM memory

Message ID 20240704073544.670249-40-sughosh.ganu@linaro.org
State Superseded
Headers show
Series Make U-Boot memory reservations coherent | expand

Commit Message

Sughosh Ganu July 4, 2024, 7:35 a.m. UTC
Add a function to check if a given address falls within the RAM
address used by U-Boot. This will be used to notify other modules if
the address gets allocated, so as to not get re-allocated by some
other module.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
Changes since V1:
* Have a common weak function for all platforms, sandbox included.

 common/board_r.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/common/board_r.c b/common/board_r.c
index 1a5bb98218..427688168c 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -72,6 +72,11 @@  DECLARE_GLOBAL_DATA_PTR;
 
 ulong monitor_flash_len;
 
+__weak bool __maybe_unused is_addr_in_ram(uintptr_t addr)
+{
+	return addr >= gd->ram_base && addr <= gd->ram_top;
+}
+
 __weak int board_flash_wp_on(void)
 {
 	/*