diff mbox

[1/5] Add grub_fdt_set_reg64 macro into fdt.h header file for

Message ID 54931602.9070807@linaro.org
State New
Headers show

Commit Message

Fu Wei Fu Dec. 18, 2014, 5:59 p.m. UTC
inserting "reg" properiy, while #address-cells = <0x2> and #size-cells = <0x2>

Signed-off-by: Fu Wei <fu.wei@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
---
 include/grub/fdt.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox

Patch

diff --git a/include/grub/fdt.h b/include/grub/fdt.h
index 3016998..fdfca75 100644
--- a/include/grub/fdt.h
+++ b/include/grub/fdt.h
@@ -117,4 +117,16 @@  int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
   grub_fdt_set_prop ((fdt), (nodeoffset), (name), &_val, 8);   \
 })
 
+/* Setup "reg" property for
+ * #address-cells = <0x2>
+ * #size-cells = <0x2>
+ */
+#define grub_fdt_set_reg64(fdt, nodeoffset, addr, size)        \
+({ \
+  grub_uint64_t reg_64[2]; \
+  reg_64[0] = grub_cpu_to_be64(addr); \
+  reg_64[1] = grub_cpu_to_be64(size); \
+  grub_fdt_set_prop ((fdt), (nodeoffset), "reg", reg_64, 16);  \
+})
+
 #endif	/* ! GRUB_FDT_HEADER */