summaryrefslogtreecommitdiff
path: root/libfdt/fdt_wip.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2007-04-18 17:47:39 +0200
committerWolfgang Denk <wd@denx.de>2007-04-18 17:47:39 +0200
commit5cca4092bd23d255ed304b8f76cd18ac11adb785 (patch)
tree0159b09bbed29dab7b44fc76fd54f8ce7906fec6 /libfdt/fdt_wip.c
parentfd094c6379e2ef8a4d0ceb5640b24cb0c8d04449 (diff)
parentf35a53fc7b0c79fcfe7bdc01163c4b34aaba1460 (diff)
downloadu-boot-imx-5cca4092bd23d255ed304b8f76cd18ac11adb785.zip
u-boot-imx-5cca4092bd23d255ed304b8f76cd18ac11adb785.tar.gz
u-boot-imx-5cca4092bd23d255ed304b8f76cd18ac11adb785.tar.bz2
Merge with /home/wd/git/u-boot/custodian/u-boot-fdt
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;
+}
+