- /* Convert from sandbox address space. */
- addr = (uintptr_t)map_sysmem(addr, 0);
-
- pages = efi_size_in_pages(size + (addr & EFI_PAGE_MASK));
- addr &= ~EFI_PAGE_MASK;
- if (efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE,
- false) != EFI_SUCCESS)
- printf("FDT memrsv map %d: Failed to add to map\n", i);
+ /* process reserved-memory */
+ nodeoffset = fdt_subnode_offset(fdt, 0, "reserved-memory");
+ if (nodeoffset >= 0) {
+ subnode = fdt_first_subnode(fdt, nodeoffset);
+ while (subnode >= 0) {
+ /* check if this subnode has a reg property */
+ addr = fdtdec_get_addr_size(fdt, subnode, "reg",
+ (fdt_size_t *)&size);
+ /*
+ * The /reserved-memory node may have children with
+ * a size instead of a reg property.
+ */
+ if (addr != FDT_ADDR_T_NONE &&
+ fdtdec_get_is_enabled(fdt, subnode))
+ efi_reserve_memory(addr, size);
+ subnode = fdt_next_subnode(fdt, subnode);
+ }