diff mbox series

[v3,05/15] add a function to check if an address is in RAM memory

Message ID 20241013105522.391414-6-sughosh.ganu@linaro.org
State New
Headers show
Series Make EFI memory allocations synchronous with LMB | expand

Commit Message

Sughosh Ganu Oct. 13, 2024, 10:55 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 V2: None

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

Comments

Simon Glass Oct. 14, 2024, 3:50 p.m. UTC | #1
Hi Sughosh,

On Sun, 13 Oct 2024 at 04:55, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> 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.

Can you be a bit more specific about this one? Why is it a weak
function? Also, can you please add it to init.h with a full function
comment?

>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
> Changes since V2: None
>
>  common/board_r.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/common/board_r.c b/common/board_r.c
> index 1acad069d9..4694f49a43 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -73,6 +73,11 @@ DECLARE_GLOBAL_DATA_PTR;
>
>  ulong monitor_flash_len;
>
> +__weak bool __maybe_unused is_addr_in_ram(uintptr_t addr)

ulong in U-Boot, please avoid uintptr_t as it is confusing for people
to see both

> +{
> +       return addr >= gd->ram_base && addr <= gd->ram_top;
> +}
> +
>  __weak int board_flash_wp_on(void)
>  {
>         /*
> --
> 2.34.1
>

Regards,
Simon
diff mbox series

Patch

diff --git a/common/board_r.c b/common/board_r.c
index 1acad069d9..4694f49a43 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -73,6 +73,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)
 {
 	/*