]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
lmb: Set correct lmb flags for EFI memory map entries
authorSjoerd Simons <sjoerd@collabora.com>
Thu, 19 Jan 2023 08:38:18 +0000 (09:38 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 6 Feb 2023 17:07:18 +0000 (12:07 -0500)
When adding reserved memory areas from the EFI memory map set the NOMAP
flag when applicable. When this isn't done adding "no-map" flagged entries
from the fdt after receiving the same from the EFI memory map fails due
to non-matching flags.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
lib/lmb.c

index ec790760db6586e10c6a71b7b6ad57dfc239b7d4..f447c639a60e956a983582d42995c52bc3206ece 100644 (file)
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -175,11 +175,14 @@ static __maybe_unused int efi_lmb_reserve(struct lmb *lmb)
                return 1;
 
        for (i = 0, map = memmap; i < map_size / sizeof(*map); ++map, ++i) {
-               if (map->type != EFI_CONVENTIONAL_MEMORY)
-                       lmb_reserve(lmb,
-                                   map_to_sysmem((void *)(uintptr_t)
-                                                 map->physical_start),
-                                   map->num_pages * EFI_PAGE_SIZE);
+               if (map->type != EFI_CONVENTIONAL_MEMORY) {
+                       lmb_reserve_flags(lmb,
+                                         map_to_sysmem((void *)(uintptr_t)
+                                                       map->physical_start),
+                                         map->num_pages * EFI_PAGE_SIZE,
+                                         map->type == EFI_RESERVED_MEMORY_TYPE
+                                             ? LMB_NOMAP : LMB_NONE);
+               }
        }
        efi_free_pool(memmap);