summaryrefslogtreecommitdiff
path: root/libfdt/fdt_wip.c
diff options
context:
space:
mode:
authorGerald Van Baren <vanbaren@cideas.com>2007-04-14 22:46:41 -0400
committerGerald Van Baren <vanbaren@cideas.com>2007-04-14 22:46:41 -0400
commit3f9f08cf91c8a6949a5d78a18bd3d8df7b86d888 (patch)
tree1b8be22f97b41128b210f98dc0262d606ce56913 /libfdt/fdt_wip.c
parent64dbbd40c58349b64f43fd33dbb5ca0adb67d642 (diff)
downloadu-boot-imx-3f9f08cf91c8a6949a5d78a18bd3d8df7b86d888.zip
u-boot-imx-3f9f08cf91c8a6949a5d78a18bd3d8df7b86d888.tar.gz
u-boot-imx-3f9f08cf91c8a6949a5d78a18bd3d8df7b86d888.tar.bz2
Add some utilities to manipulate the reserved memory map.
Diffstat (limited to 'libfdt/fdt_wip.c')
-rw-r--r--libfdt/fdt_wip.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libfdt/fdt_wip.c b/libfdt/fdt_wip.c
index 261b9b0..cf81183 100644
--- a/libfdt/fdt_wip.c
+++ b/libfdt/fdt_wip.c
@@ -110,3 +110,29 @@ 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;
+}
+