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);
}
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 */
* 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);
}
}