summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd@collabora.com>2023-01-19 09:38:18 +0100
committerTom Rini <trini@konsulko.com>2023-02-06 12:07:18 -0500
commitc5279ea1c300d52a5cb4b47881f21cf08caec790 (patch)
tree4643c371b11cbd25fbaf04d826a8dd5d95e4a765 /lib
parent007ae5d108a37564905ea1588cb279f3a522cc3d (diff)
downloadu-boot-c5279ea1c300d52a5cb4b47881f21cf08caec790.tar.gz
u-boot-c5279ea1c300d52a5cb4b47881f21cf08caec790.tar.bz2
u-boot-c5279ea1c300d52a5cb4b47881f21cf08caec790.zip
lmb: Set correct lmb flags for EFI memory map entries
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/lmb.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/lmb.c b/lib/lmb.c
index ec790760db..f447c639a6 100644
--- 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);