diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2018-11-12 18:55:23 +0100 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2018-12-02 21:59:37 +0100 |
commit | 23fd84b3eccb1af51699d49368e257a5b0a78593 (patch) | |
tree | 61bf66a5a94dbbdb8ed8b16d9aff3aee381ed728 /cmd/bootefi.c | |
parent | 4574d1b3d1b1aca761ad48cf67db44f3b97c4d1b (diff) |
efi_loader: carving out memory reservations
The "Devicetree Specification 0.2" does not prescribe that memory
reservations must be EFI page aligned. So let's not make such an
assumption in our code.
Do not carve out the pages for the device tree. This memory area is
already marked as EFI_RUNTIME_SERVICES_DATA.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'cmd/bootefi.c')
-rw-r--r-- | cmd/bootefi.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 8c4049b7db..3e37805ea1 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -275,7 +275,16 @@ static void efi_carve_out_dt_rsv(void *fdt) if (fdt_get_mem_rsv(fdt, i, &addr, &size) != 0) continue; - pages = ALIGN(size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT; + /* + * Do not carve out the device tree. It is already marked as + * EFI_RUNTIME_SERVICES_DATA + */ + if (addr == (uintptr_t)fdt) + continue; + + pages = ALIGN(size + (addr & EFI_PAGE_MASK), EFI_PAGE_SIZE) >> + EFI_PAGE_SHIFT; + addr &= ~EFI_PAGE_MASK; if (!efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE, false)) printf("FDT memrsv map %d: Failed to add to map\n", i); |