[PATCH] efi_loader: replace board_get_usable_ram_top by gd->ram_top

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Jul 18 09:29:46 CEST 2021



On 7/9/21 12:46 PM, Patrick Delaunay wrote:
> As gd->ram_top = board_get_usable_ram_top() in board_r
> the EFI loader don't need to call this function again and after relocation.
>
> This patch avoid issue if board assumed that this function is called
> only one time and before relocation.

Hello Patrick,

Which implementation of board_get_usable_ram_top() assumes that it is
called only once before relocation? Please, mention this in the commit
message.

gd->ram_top is set in multiple places:

arch/arm/mach-rockchip/spl.c:149:       gd->ram_top = gd->ram_base +
get_effective_memsize();
arch/arm/mach-rockchip/spl.c:150:       gd->ram_top =
board_get_usable_ram_top(gd->ram_size);
arch/arm/cpu/armv8/fsl-layerscape/spl.c:114:    gd->ram_top =
gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size;

I guess you refer to:

common/board_f.c:345:   gd->ram_top = gd->ram_base +
get_effective_memsize();
common/board_f.c:346:   gd->ram_top = board_get_usable_ram_top(gd->mon_len);

I would not expect board_get_usable_ram_top(gd->mon_len) and
board_get_usable_ram_top(0) to be the same. So, please, describe in your
patch why you assume that board_get_usable_ram_top(gd->mon_len) is the
value we should use.

Best regards

Heinrich

>
> Signed-off-by: Patrick Delaunay <patrick.delaunay at foss.st.com>
> ---
>
> https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/7399
>
>
>   lib/efi_loader/efi_memory.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> index be2f655dff..f5bc37a20a 100644
> --- a/lib/efi_loader/efi_memory.c
> +++ b/lib/efi_loader/efi_memory.c
> @@ -7,7 +7,6 @@
>
>   #include <common.h>
>   #include <efi_loader.h>
> -#include <init.h>
>   #include <malloc.h>
>   #include <mapmem.h>
>   #include <watchdog.h>
> @@ -731,7 +730,7 @@ efi_status_t efi_add_conventional_memory_map(u64 ram_start, u64 ram_end,
>
>   __weak void efi_add_known_memory(void)
>   {
> -	u64 ram_top = board_get_usable_ram_top(0) & ~EFI_PAGE_MASK;
> +	u64 ram_top = gd->ram_top & ~EFI_PAGE_MASK;
>   	int i;
>
>   	/*
>


More information about the U-Boot mailing list