summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-10-06 08:36:38 -0400
committerTom Rini <trini@konsulko.com>2020-10-06 08:36:38 -0400
commit5dcf7cc590b348f1e730ec38242df64c179f10a8 (patch)
tree7ba5948897352b913338be6cf27061570e96a128 /cmd
parent987ab49366f3fcd25039eab431bf099b587b3265 (diff)
parent4cbb2930bd8c67f40f848528941930cf4c2a1841 (diff)
Merge tag 'efi-2021-01-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Pull request for UEFI sub-system for efi-2021-01-rc1 The following bugs in the UEFI system are resolved: * illegal free in EFI_LOAD_FILE2_PROTOCOL implementation * incorrect documentation of EFI_LOAD_FILE2_PROTOCOL implementation * output of CRC32 as decimal instead hexadecimal in unit test * use EfiReservedMemoryType for no-map reserved memory * avoid unnecessary resets in UEFI unit tests * call EFI bootmgr even without having /EFI/boot
Diffstat (limited to 'cmd')
-rw-r--r--cmd/bootefi.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 40d5ef2b3a..fdf909f8da 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -135,12 +135,29 @@ done:
return ret;
}
-static void efi_reserve_memory(u64 addr, u64 size)
+/**
+ * efi_reserve_memory() - add reserved memory to memory map
+ *
+ * @addr: start address of the reserved memory range
+ * @size: size of the reserved memory range
+ * @nomap: indicates that the memory range shall not be accessed by the
+ * UEFI payload
+ */
+static void efi_reserve_memory(u64 addr, u64 size, bool nomap)
{
+ int type;
+ efi_uintn_t ret;
+
/* Convert from sandbox address space. */
addr = (uintptr_t)map_sysmem(addr, 0);
- if (efi_add_memory_map(addr, size,
- EFI_RESERVED_MEMORY_TYPE) != EFI_SUCCESS)
+
+ if (nomap)
+ type = EFI_RESERVED_MEMORY_TYPE;
+ else
+ type = EFI_BOOT_SERVICES_DATA;
+
+ ret = efi_add_memory_map(addr, size, type);
+ if (ret != EFI_SUCCESS)
log_err("Reserved memory mapping failed addr %llx size %llx\n",
addr, size);
}
@@ -166,7 +183,7 @@ static void efi_carve_out_dt_rsv(void *fdt)
for (i = 0; i < nr_rsv; i++) {
if (fdt_get_mem_rsv(fdt, i, &addr, &size) != 0)
continue;
- efi_reserve_memory(addr, size);
+ efi_reserve_memory(addr, size, false);
}
/* process reserved-memory */
@@ -186,8 +203,13 @@ static void efi_carve_out_dt_rsv(void *fdt)
* a size instead of a reg property.
*/
if (fdt_addr != FDT_ADDR_T_NONE &&
- fdtdec_get_is_enabled(fdt, subnode))
- efi_reserve_memory(fdt_addr, fdt_size);
+ fdtdec_get_is_enabled(fdt, subnode)) {
+ bool nomap;
+
+ nomap = !!fdt_getprop(fdt, subnode, "no-map",
+ NULL);
+ efi_reserve_memory(fdt_addr, fdt_size, nomap);
+ }
subnode = fdt_next_subnode(fdt, subnode);
}
}