[U-Boot] [PATCH 1/6] fdtdec: Add cpu_to_fdt_{addr,size}() macros

Thierry Reding thierry.reding at gmail.com
Fri Mar 8 20:11:35 UTC 2019


From: Thierry Reding <treding at nvidia.com>

These macros are useful for converting the endianness of variables of
type fdt_addr_t and fdt_size_t.

Signed-off-by: Thierry Reding <treding at nvidia.com>
---
 include/fdtdec.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index b7e35cd87c55..a965c33157c9 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -27,11 +27,15 @@ typedef phys_size_t fdt_size_t;
 #define FDT_ADDR_T_NONE (-1U)
 #define fdt_addr_to_cpu(reg) be64_to_cpu(reg)
 #define fdt_size_to_cpu(reg) be64_to_cpu(reg)
+#define cpu_to_fdt_addr(reg) cpu_to_be64(reg)
+#define cpu_to_fdt_size(reg) cpu_to_be64(reg)
 typedef fdt64_t fdt_val_t;
 #else
 #define FDT_ADDR_T_NONE (-1U)
 #define fdt_addr_to_cpu(reg) be32_to_cpu(reg)
 #define fdt_size_to_cpu(reg) be32_to_cpu(reg)
+#define cpu_to_fdt_addr(reg) cpu_to_be32(reg)
+#define cpu_to_fdt_size(reg) cpu_to_be32(reg)
 typedef fdt32_t fdt_val_t;
 #endif
 
-- 
2.20.1



More information about the U-Boot mailing list