summaryrefslogtreecommitdiff
path: root/libfdt/fdt_wip.c
diff options
context:
space:
mode:
Diffstat (limited to 'libfdt/fdt_wip.c')
-rw-r--r--libfdt/fdt_wip.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libfdt/fdt_wip.c b/libfdt/fdt_wip.c
index 261b9b0..2d2ed37 100644
--- a/libfdt/fdt_wip.c
+++ b/libfdt/fdt_wip.c
@@ -110,3 +110,28 @@ int fdt_nop_node(void *fdt, int nodeoffset)
nop_region(fdt_offset_ptr(fdt, nodeoffset, 0), endoffset - nodeoffset);
return 0;
}
+
+/*
+ * Replace a reserve map entry in the nth slot.
+ */
+int fdt_replace_reservemap_entry(void *fdt, int n, uint64_t addr, uint64_t size)
+{
+ struct fdt_reserve_entry *re;
+ int used;
+ int total;
+ int err;
+
+ err = fdt_num_reservemap(fdt, &used, &total);
+ if (err != 0)
+ return err;
+
+ if (n >= total)
+ return -FDT_ERR_NOSPACE;
+ re = (struct fdt_reserve_entry *)
+ (fdt + fdt_off_mem_rsvmap(fdt) +
+ (n * sizeof(struct fdt_reserve_entry)));
+ re->address = cpu_to_fdt64(addr);
+ re->size = cpu_to_fdt64(size);
+
+ return 0;
+}