57 #define FDT_FIRST_SUPPORTED_VERSION 0x10
58 #define FDT_LAST_SUPPORTED_VERSION 0x11
61 #define FDT_ERR_NOTFOUND 1
63 #define FDT_ERR_EXISTS 2
66 #define FDT_ERR_NOSPACE 3
73 #define FDT_ERR_BADOFFSET 4
77 #define FDT_ERR_BADPATH 5
81 #define FDT_ERR_BADPHANDLE 6
84 #define FDT_ERR_BADSTATE 7
90 #define FDT_ERR_TRUNCATED 8
93 #define FDT_ERR_BADMAGIC 9
97 #define FDT_ERR_BADVERSION 10
102 #define FDT_ERR_BADSTRUCTURE 11
106 #define FDT_ERR_BADLAYOUT 12
114 #define FDT_ERR_INTERNAL 13
119 #define FDT_ERR_MAX 13
126 static inline void *fdt_offset_ptr_w(
void *fdt,
int offset,
int checklen)
143 #define fdt_get_header(fdt, field) \
144 (fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
145 #define fdt_magic(fdt) (fdt_get_header(fdt, magic))
146 #define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize))
147 #define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct))
148 #define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings))
149 #define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap))
150 #define fdt_version(fdt) (fdt_get_header(fdt, version))
151 #define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
152 #define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
153 #define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
154 #define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct))
156 #define __fdt_set_hdr(name) \
157 static inline void fdt_set_##name(void *fdt, uint32_t val) \
159 struct fdt_header *fdth = (struct fdt_header*)fdt; \
160 fdth->name = cpu_to_fdt32(val); \
227 const char *
fdt_string(
const void *fdt,
int stroffset);
343 const char *
fdt_get_name(
const void *fdt,
int nodeoffset,
int *lenp);
458 const char *
name,
int *lenp);
459 static inline struct fdt_property *fdt_get_property_w(
void *fdt,
int nodeoffset,
499 const char **namep,
int *lenp);
513 const char *name,
int namelen,
int *lenp);
542 const void *
fdt_getprop(
const void *fdt,
int nodeoffset,
543 const char *name,
int *lenp);
544 static inline void *fdt_getprop_w(
void *fdt,
int nodeoffset,
545 const char *name,
int *lenp)
574 const char *name,
int namelen);
588 const char *
fdt_get_alias(
const void *fdt,
const char *name);
648 int supernodedepth,
int *nodedepth);
733 const char *propname,
734 const void *propval,
int proplen);
852 const void *
val,
int len);
882 static inline int fdt_setprop_inplace_u32(
void *fdt,
int nodeoffset,
917 static inline int fdt_setprop_inplace_u64(
void *fdt,
int nodeoffset,
929 static inline int fdt_setprop_inplace_cell(
void *fdt,
int nodeoffset,
932 return fdt_setprop_inplace_u32(fdt, nodeoffset, name, val);
993 int fdt_property(
void *fdt,
const char *name,
const void *val,
int len);
994 static inline int fdt_property_u32(
void *fdt,
const char *name,
uint32_t val)
999 static inline int fdt_property_u64(
void *fdt,
const char *name,
uint64_t val)
1004 static inline int fdt_property_cell(
void *fdt,
const char *name,
uint32_t val)
1006 return fdt_property_u32(fdt, name, val);
1008 #define fdt_property_string(fdt, name, str) \
1009 fdt_property(fdt, name, str, strlen(str)+1)
1093 int fdt_set_name(
void *fdt,
int nodeoffset,
const char *name);
1123 int fdt_setprop(
void *fdt,
int nodeoffset,
const char *name,
1124 const void *val,
int len);
1154 static inline int fdt_setprop_u32(
void *fdt,
int nodeoffset,
const char *name,
1158 return fdt_setprop(fdt, nodeoffset, name, &val,
sizeof(val));
1189 static inline int fdt_setprop_u64(
void *fdt,
int nodeoffset,
const char *name,
1193 return fdt_setprop(fdt, nodeoffset, name, &val,
sizeof(val));
1201 static inline int fdt_setprop_cell(
void *fdt,
int nodeoffset,
const char *name,
1204 return fdt_setprop_u32(fdt, nodeoffset, name, val);
1235 #define fdt_setprop_string(fdt, nodeoffset, name, str) \
1236 fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
1266 const void *val,
int len);
1296 static inline int fdt_appendprop_u32(
void *fdt,
int nodeoffset,
1331 static inline int fdt_appendprop_u64(
void *fdt,
int nodeoffset,
1343 static inline int fdt_appendprop_cell(
void *fdt,
int nodeoffset,
1346 return fdt_appendprop_u32(fdt, nodeoffset, name, val);
1376 #define fdt_appendprop_string(fdt, nodeoffset, name, str) \
1377 fdt_appendprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
1401 int fdt_delprop(
void *fdt,
int nodeoffset,
const char *name);
1416 const char *name,
int namelen);