58#define FDT_FIRST_SUPPORTED_VERSION 0x10
59#define FDT_LAST_SUPPORTED_VERSION 0x11
62#define FDT_ERR_NOTFOUND 1
64#define FDT_ERR_EXISTS 2
68#define FDT_ERR_NOSPACE 3
76#define FDT_ERR_BADOFFSET 4
81#define FDT_ERR_BADPATH 5
86#define FDT_ERR_BADPHANDLE 6
92#define FDT_ERR_BADSTATE 7
99#define FDT_ERR_TRUNCATED 8
103#define FDT_ERR_BADMAGIC 9
108#define FDT_ERR_BADVERSION 10
114#define FDT_ERR_BADSTRUCTURE 11
119#define FDT_ERR_BADLAYOUT 12
128#define FDT_ERR_INTERNAL 13
135#define FDT_ERR_BADNCELLS 14
140#define FDT_ERR_BADVALUE 15
146#define FDT_ERR_BADOVERLAY 16
152#define FDT_ERR_NOPHANDLES 17
157#define FDT_ERR_MAX 17
168 unsigned int checklen
179 return (
void *)(uintptr_t)fdt_offset_ptr (fdt, offset, checklen);
253#define fdt_for_each_subnode(node, fdt, parent) \
254 for (node = fdt_first_subnode(fdt, parent); \
256 node = fdt_next_subnode(fdt, node))
261#define fdt_get_header(fdt, field) \
262 (fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
263#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
264#define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize))
265#define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct))
266#define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings))
267#define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap))
268#define fdt_version(fdt) (fdt_get_header(fdt, version))
269#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
270#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
271#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
272#define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct))
274#define __fdt_set_hdr(name) \
275 static inline void fdt_set_##name(void *fdt, uint32_t val) \
277 struct fdt_header *fdth = (struct fdt_header *)fdt; \
278 fdth->name = cpu_to_fdt32(val); \
280__fdt_set_hdr (magic);
281__fdt_set_hdr (totalsize);
282__fdt_set_hdr (off_dt_struct);
283__fdt_set_hdr (off_dt_strings);
284__fdt_set_hdr (off_mem_rsvmap);
285__fdt_set_hdr (version);
286__fdt_set_hdr (last_comp_version);
287__fdt_set_hdr (boot_cpuid_phys);
288__fdt_set_hdr (size_dt_strings);
289__fdt_set_hdr (size_dt_struct);
430fdt_subnode_offset_namelen (
481fdt_path_offset_namelen (
567fdt_first_property_offset (
592fdt_next_property_offset (
619#define fdt_for_each_property_offset(property, fdt, node) \
620 for (property = fdt_first_property_offset(fdt, node); \
622 property = fdt_next_property_offset(fdt, property))
649fdt_get_property_by_offset (
668fdt_get_property_namelen (
723 fdt_get_property (fdt, nodeoffset, name, lenp);
759fdt_getprop_by_offset (
790fdt_getprop_namelen_w (
798 return (
void *)(uintptr_t)fdt_getprop_namelen (
853 return (
void *)(uintptr_t)fdt_getprop (fdt, nodeoffset, name, lenp);
885fdt_get_alias_namelen (
975fdt_supernode_atdepth_offset (
1073fdt_node_offset_by_prop_value (
1076 const char *propname,
1077 const void *propval,
1101fdt_node_offset_by_phandle (
1129fdt_node_check_compatible (
1132 const char *compatible
1170fdt_node_offset_by_compatible (
1173 const char *compatible
1189fdt_stringlist_contains (
1190 const char *strlist,
1206fdt_stringlist_count (
1209 const char *property
1232fdt_stringlist_search (
1235 const char *property,
1267 const char *property,
1285#define FDT_MAX_NCELLS 4
1358fdt_setprop_inplace_namelen_partial (
1400fdt_setprop_inplace (
1439fdt_setprop_inplace_u32 (
1446 fdt32_t tmp = cpu_to_fdt32 (val);
1448 return fdt_setprop_inplace (fdt, nodeoffset, name, &tmp,
sizeof (tmp));
1480fdt_setprop_inplace_u64 (
1487 fdt64_t tmp = cpu_to_fdt64 (val);
1489 return fdt_setprop_inplace (fdt, nodeoffset, name, &tmp,
sizeof (tmp));
1498fdt_setprop_inplace_cell (
1505 return fdt_setprop_inplace_u32 (fdt, nodeoffset, name, val);
1585fdt_add_reservemap_entry (
1592fdt_finish_reservemap (
1617 fdt32_t tmp = cpu_to_fdt32 (val);
1629 fdt64_t tmp = cpu_to_fdt64 (val);
1641 return fdt_property_u32 (fdt, name, val);
1658fdt_property_placeholder (
1665#define fdt_property_string(fdt, name, str) \
1666 fdt_property(fdt, name, str, strlen(str)+1)
1682fdt_create_empty_tree (
1853fdt_setprop_placeholder (
1897 fdt32_t tmp = cpu_to_fdt32 (val);
1899 return fdt_setprop (fdt, nodeoffset, name, &tmp,
sizeof (tmp));
1938 fdt64_t tmp = cpu_to_fdt64 (val);
1940 return fdt_setprop (fdt, nodeoffset, name, &tmp,
sizeof (tmp));
1956 return fdt_setprop_u32 (fdt, nodeoffset, name, val);
1987#define fdt_setprop_string(fdt, nodeoffset, name, str) \
1988 fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
2016#define fdt_setprop_empty(fdt, nodeoffset, name) \
2017 fdt_setprop((fdt), (nodeoffset), (name), NULL, 0)
2091 fdt32_t tmp = cpu_to_fdt32 (val);
2093 return fdt_appendprop (fdt, nodeoffset, name, &tmp,
sizeof (tmp));
2132 fdt64_t tmp = cpu_to_fdt64 (val);
2134 return fdt_appendprop (fdt, nodeoffset, name, &tmp,
sizeof (tmp));
2143fdt_appendprop_cell (
2150 return fdt_appendprop_u32 (fdt, nodeoffset, name, val);
2180#define fdt_appendprop_string(fdt, nodeoffset, name, str) \
2181 fdt_appendprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
2226fdt_add_subnode_namelen (