[U-Boot] [PATCH 1/1] efi_loader: use named constant for memory type

Rob Clark robdclark at gmail.com
Tue Oct 17 16:58:45 UTC 2017


On Tue, Oct 17, 2017 at 12:53 PM, Heinrich Schuchardt
<xypron.glpk at gmx.de> wrote:
> When we call an EFI image from memory a memory device path
> is created. The memory type should use a named constant.
>
> Fixes: bf19273e81e efi_loader: Add mem-mapped for fallback
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  cmd/bootefi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> index b2f6fd486a..140072f044 100644
> --- a/cmd/bootefi.c
> +++ b/cmd/bootefi.c
> @@ -173,7 +173,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt,
>         if (!device_path && !image_path) {
>                 printf("WARNING: using memory device/image path, this may confuse some payloads!\n");
>                 /* actual addresses filled in after efi_load_pe() */
> -               memdp = efi_dp_from_mem(0, 0, 0);
> +               memdp = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, 0, 0);

Note that I actually used '0' because this is a special case where the
real memtype is filled in later.  And the real mem_type is going to be
one of EFI_LOADER_CODE / EFI_BOOT_SERVICES_CODE /
EFI_RUNTIME_SERVICES_CODE depending on type of .efi that is loaded.
So using EFI_RESERVED_MEMORY_TYPE makes things more confusing.

So I think it should stay '0'..  (or maybe '-1' would be more clear,
except that it is an unsigned arg)

BR,
-R

>                 device_path = image_path = memdp;
>         } else {
>                 assert(device_path && image_path);
> --
> 2.14.2
>


More information about the U-Boot mailing list