]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: don't use EFI_LOADER_DATA internally
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 29 Nov 2022 15:00:41 +0000 (16:00 +0100)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 2 Dec 2022 18:17:24 +0000 (19:17 +0100)
EFI_LOADER_DATA/CODE is reserved for EFI applications.
Memory allocated by U-Boot for internal usage should be
EFI_BOOT_SERVICES_DATA or _CODE or EFI_RUNTIME_SERVICES_DATA or _CODE.

Reported-by: François-Frédéric Ozog <ff@ozog.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: François-Frédéric Ozog <ff@ozog.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
cmd/efidebug.c
lib/efi_loader/efi_memory.c

index ef239bb34b4197163e5f3d14e822ea96365eaf3a..64104da130c9d96331878d1e4862efb290da4271 100644 (file)
@@ -600,7 +600,7 @@ static int do_efi_show_memmap(struct cmd_tbl *cmdtp, int flag,
        ret = efi_get_memory_map(&map_size, memmap, NULL, NULL, NULL);
        if (ret == EFI_BUFFER_TOO_SMALL) {
                map_size += sizeof(struct efi_mem_desc); /* for my own */
-               ret = efi_allocate_pool(EFI_LOADER_DATA, map_size,
+               ret = efi_allocate_pool(EFI_BOOT_SERVICES_DATA, map_size,
                                        (void *)&memmap);
                if (ret != EFI_SUCCESS)
                        return CMD_RET_FAILURE;
index a17b426d11f197191f9ae1ba33a5eb4bb4015275..8d347f101f3c6f9eb9d8b27c447f92d4c86ad91c 100644 (file)
@@ -823,7 +823,7 @@ static void add_u_boot_and_runtime(void)
                       uboot_stack_size) & ~EFI_PAGE_MASK;
        uboot_pages = ((uintptr_t)map_sysmem(gd->ram_top - 1, 0) -
                       uboot_start + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
-       efi_add_memory_map_pg(uboot_start, uboot_pages, EFI_LOADER_DATA,
+       efi_add_memory_map_pg(uboot_start, uboot_pages, EFI_BOOT_SERVICES_CODE,
                              false);
 
 #if defined(__aarch64__)
@@ -857,7 +857,7 @@ int efi_memory_init(void)
        /* Request a 32bit 64MB bounce buffer region */
        uint64_t efi_bounce_buffer_addr = 0xffffffff;
 
-       if (efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, EFI_LOADER_DATA,
+       if (efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, EFI_BOOT_SERVICES_DATA,
                               (64 * 1024 * 1024) >> EFI_PAGE_SHIFT,
                               &efi_bounce_buffer_addr) != EFI_SUCCESS)
                return -1;