[PATCHv4 6/6] memory: reserve from start_addr_sp to initial_relocaddr

Simon Glass sjg at chromium.org
Tue Apr 21 22:42:33 CEST 2026


Hi Randolph,

On 2026-04-20T19:25:18, Randolph Sapp <rs at ti.com> wrote:
> memory: reserve from start_addr_sp to initial_relocaddr
>
> Add a new global data struct member called initial_relocaddr. This
> stores the original value of relocaddr, directly from setup_dest_addr.
> This is specifically to avoid any adjustments made by other init
> functions.
>
> Reserve the memory from gd->start_addr_sp - CONFIG_STACK_SIZE to
> gd->initial_relocaddr instead of gd->ram_top. This allows platform
> specific relocation addresses to work without unnecessarily painting
> over a large range.
>
> Since PRAM comes out of this initial area up to initial_relocaddr, we no
> longer need to account for it separately.
>
> Signed-off-by: Randolph Sapp <rs at ti.com>
>
> common/board_f.c                  |  9 ++++++++-
>  include/asm-generic/global_data.h |  7 +++++++
>  lib/efi_loader/efi_memory.c       |  9 ++++++---
>  lib/lmb.c                         | 39 ++++++---------------------------------
>  4 files changed, 27 insertions(+), 37 deletions(-)

> diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> @@ -868,9 +868,12 @@ static void add_u_boot_and_runtime(void)
> +     uboot_start = ((uintptr_t)map_sysmem(gd->start_addr_sp, 0) -
> +                    uboot_stack_size) &
> +                   ~EFI_PAGE_MASK;
> +     uboot_pages = (((uintptr_t)map_sysmem(gd->initial_relocaddr, 0) -
> +                     uboot_start) +
> +                    EFI_PAGE_MASK) >>
> +                   EFI_PAGE_SHIFT;

The reformatting makes the code harder to read. Please can you keep
the original formatting style and just change the variable reference?
Something like:

uboot_pages = ((uintptr_t)map_sysmem(gd->initial_relocaddr, 0) -
               uboot_start + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;

Regards,
Simon


More information about the U-Boot mailing list