16#define FDT_FIRST_SUPPORTED_VERSION 0x02
17#define FDT_LAST_COMPATIBLE_VERSION 0x10
18#define FDT_LAST_SUPPORTED_VERSION 0x11
21#define FDT_ERR_NOTFOUND 1
23#define FDT_ERR_EXISTS 2
26#define FDT_ERR_NOSPACE 3
33#define FDT_ERR_BADOFFSET 4
37#define FDT_ERR_BADPATH 5
41#define FDT_ERR_BADPHANDLE 6
46#define FDT_ERR_BADSTATE 7
52#define FDT_ERR_TRUNCATED 8
56#define FDT_ERR_BADMAGIC 9
60#define FDT_ERR_BADVERSION 10
65#define FDT_ERR_BADSTRUCTURE 11
69#define FDT_ERR_BADLAYOUT 12
77#define FDT_ERR_INTERNAL 13
83#define FDT_ERR_BADNCELLS 14
87#define FDT_ERR_BADVALUE 15
92#define FDT_ERR_BADOVERLAY 16
97#define FDT_ERR_NOPHANDLES 17
101#define FDT_ERR_BADFLAGS 18
105#define FDT_ERR_ALIGNMENT 19
109#define FDT_ERR_MAX 19
112#define FDT_MAX_PHANDLE 0xfffffffe
120const void *
fdt_offset_ptr(
const void *fdt,
int offset,
unsigned int checklen);
138 return ((
uint16_t)bp[0] << 8) | bp[1];
156 bp[1] = (value >> 16) & 0xff;
157 bp[2] = (value >> 8) & 0xff;
158 bp[3] = value & 0xff;
180 bp[1] = (value >> 48) & 0xff;
181 bp[2] = (value >> 40) & 0xff;
182 bp[3] = (value >> 32) & 0xff;
183 bp[4] = (value >> 24) & 0xff;
184 bp[5] = (value >> 16) & 0xff;
185 bp[6] = (value >> 8) & 0xff;
186 bp[7] = value & 0xff;
239#define fdt_for_each_subnode(node, fdt, parent) \
240 for (node = fdt_first_subnode(fdt, parent); \
242 node = fdt_next_subnode(fdt, node))
247#define fdt_get_header(fdt, field) \
248 (fdt32_ld(&((const struct fdt_header *)(fdt))->field))
249#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
250#define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize))
251#define fdt_off_dt_struct(fdt) (fdt_get_header(fdt, off_dt_struct))
252#define fdt_off_dt_strings(fdt) (fdt_get_header(fdt, off_dt_strings))
253#define fdt_off_mem_rsvmap(fdt) (fdt_get_header(fdt, off_mem_rsvmap))
254#define fdt_version(fdt) (fdt_get_header(fdt, version))
255#define fdt_last_comp_version(fdt) (fdt_get_header(fdt, last_comp_version))
256#define fdt_boot_cpuid_phys(fdt) (fdt_get_header(fdt, boot_cpuid_phys))
257#define fdt_size_dt_strings(fdt) (fdt_get_header(fdt, size_dt_strings))
258#define fdt_size_dt_struct(fdt) (fdt_get_header(fdt, size_dt_struct))
260#define fdt_set_hdr_(name) \
261 static inline void fdt_set_##name(void *fdt, uint32_t val) \
263 struct fdt_header *fdth = (struct fdt_header *)fdt; \
264 fdth->name = cpu_to_fdt32(val); \
331int fdt_move(
const void *fdt,
void *buf,
int bufsize);
353const char *
fdt_get_string(
const void *fdt,
int stroffset,
int *lenp);
367const char *
fdt_string(
const void *fdt,
int stroffset);
472 const char *
name,
int namelen);
563const char *
fdt_get_name(
const void *fdt,
int nodeoffset,
int *lenp);
628#define fdt_for_each_property_offset(property, fdt, node) \
629 for (property = fdt_first_property_offset(fdt, node); \
631 property = fdt_next_property_offset(fdt, property))
689 int namelen,
int *lenp);
721 const char *
name,
int *lenp);
763 const char **namep,
int *lenp);
781 const char *
name,
int namelen,
int *lenp);
783 const char *
name,
int namelen,
819const void *
fdt_getprop(
const void *fdt,
int nodeoffset,
820 const char *
name,
int *lenp);
822 const char *
name,
int *lenp)
855 const char *
name,
int namelen);
897int fdt_get_path(
const void *fdt,
int nodeoffset,
char *buf,
int buflen);
930 int supernodedepth,
int *nodedepth);
1015 const char *propname,
1016 const void *propval,
int proplen);
1061 const char *compatible);
1098 const char *compatible);
1147 const char *
string);
1174 const char *property,
int index,
1190#define FDT_MAX_NCELLS 4
1258 const char *
name,
int namelen,
1293 const void *val,
int len);
1437#define FDT_CREATE_FLAG_NO_NAME_DEDUP 0x1
1442#define FDT_CREATE_FLAGS_ALL (FDT_CREATE_FLAG_NO_NAME_DEDUP)
1475int fdt_resize(
void *fdt,
void *buf,
int bufsize);
1513#define fdt_property_string(fdt, name, str) \
1514 fdt_property(fdt, name, str, strlen(str)+1)
1630 const void *val,
int len);
1661 int len,
void **prop_data);
1778#define fdt_setprop_string(fdt, nodeoffset, name, str) \
1779 fdt_setprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
1808#define fdt_setprop_empty(fdt, nodeoffset, name) \
1809 fdt_setprop((fdt), (nodeoffset), (name), NULL, 0)
1839 const void *val,
int len);
1955#define fdt_appendprop_string(fdt, nodeoffset, name, str) \
1956 fdt_appendprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
2036 const char *
name,
int namelen);
2142 int fragment_offset,
char const **pathp);
int fdt_add_subnode(void *fdt, int parentoffset, const char *name)
static uint16_t fdt16_ld(const fdt16_t *p)
int fdt_finish_reservemap(void *fdt)
uint32_t fdt_get_phandle(const void *fdt, int nodeoffset)
int fdt_create_with_flags(void *buf, int bufsize, uint32_t flags)
int fdt_first_subnode(const void *fdt, int offset)
int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property, const char *string)
int fdt_move(const void *fdt, void *buf, int bufsize)
const char * fdt_stringlist_get(const void *fdt, int nodeoffset, const char *property, int index, int *lenp)
const char * fdt_get_alias_namelen(const void *fdt, const char *name, int namelen)
int fdt_path_offset(const void *fdt, const char *path)
int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name)
int fdt_check_header(const void *fdt)
int fdt_stringlist_contains(const char *strlist, int listlen, const char *str)
uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset)
int fdt_appendprop(void *fdt, int nodeoffset, const char *name, const void *val, int len)
static void * fdt_offset_ptr_w(void *fdt, int offset, int checklen)
int fdt_parent_offset(const void *fdt, int nodeoffset)
int fdt_node_depth(const void *fdt, int nodeoffset)
const void * fdt_getprop_namelen(const void *fdt, int nodeoffset, const char *name, int namelen, int *lenp)
static int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, uint32_t val)
static struct fdt_property * fdt_get_property_w(void *fdt, int nodeoffset, const char *name, int *lenp)
int fdt_size_cells(const void *fdt, int nodeoffset)
static int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, const char *name, uint32_t val)
int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size)
int fdt_del_mem_rsv(void *fdt, int n)
static int fdt_appendprop_u32(void *fdt, int nodeoffset, const char *name, uint32_t val)
static void fdt64_st(void *property, uint64_t value)
static int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, uint32_t val)
static int fdt_property_u64(void *fdt, const char *name, uint64_t val)
int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
int fdt_create(void *buf, int bufsize)
int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle)
int fdt_property(void *fdt, const char *name, const void *val, int len)
const char * fdt_get_alias(const void *fdt, const char *name)
int fdt_find_max_phandle(const void *fdt, uint32_t *phandle)
static int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, uint64_t val)
int fdt_appendprop_addrrange(void *fdt, int parent, int nodeoffset, const char *name, uint64_t addr, uint64_t size)
int fdt_delprop(void *fdt, int nodeoffset, const char *name)
const char * fdt_get_string(const void *fdt, int stroffset, int *lenp)
int fdt_finish(void *fdt)
static struct fdt_property * fdt_get_property_by_offset_w(void *fdt, int offset, int *lenp)
int fdt_next_node(const void *fdt, int offset, int *depth)
int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name, const void *val, int len)
int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, int supernodedepth, int *nodedepth)
const void * fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen)
int fdt_begin_node(void *fdt, const char *name)
const struct fdt_property * fdt_get_property_namelen(const void *fdt, int nodeoffset, const char *name, int namelen, int *lenp)
int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name, int len, void **prop_data)
static int fdt_appendprop_cell(void *fdt, int nodeoffset, const char *name, uint32_t val)
int fdt_num_mem_rsv(const void *fdt)
int fdt_generate_phandle(const void *fdt, uint32_t *phandle)
int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
const struct fdt_property * fdt_get_property(const void *fdt, int nodeoffset, const char *name, int *lenp)
int fdt_node_offset_by_compatible(const void *fdt, int startoffset, const char *compatible)
int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp)
const void * fdt_getprop(const void *fdt, int nodeoffset, const char *name, int *lenp)
int fdt_subnode_offset_namelen(const void *fdt, int parentoffset, const char *name, int namelen)
static uint64_t fdt64_ld(const fdt64_t *p)
int fdt_node_offset_by_prop_value(const void *fdt, int startoffset, const char *propname, const void *propval, int proplen)
static void * fdt_getprop_namelen_w(void *fdt, int nodeoffset, const char *name, int namelen, int *lenp)
int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property)
int fdt_check_full(const void *fdt, size_t bufsize)
int fdt_add_subnode_namelen(void *fdt, int parentoffset, const char *name, int namelen)
static int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, const char *name, uint32_t val)
int fdt_overlay_target_offset(const void *fdt, const void *fdto, int fragment_offset, char const **pathp)
int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size)
int fdt_open_into(const void *fdt, void *buf, int bufsize)
const struct fdt_property * fdt_get_property_by_offset(const void *fdt, int offset, int *lenp)
int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen)
const char * fdt_get_name(const void *fdt, int nodeoffset, int *lenp)
const char * fdt_string(const void *fdt, int stroffset)
static int fdt_appendprop_u64(void *fdt, int nodeoffset, const char *name, uint64_t val)
#define fdt_set_hdr_(name)
static void fdt32_st(void *property, uint32_t value)
int fdt_first_property_offset(const void *fdt, int nodeoffset)
static int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, const char *name, uint64_t val)
int fdt_address_cells(const void *fdt, int nodeoffset)
static uint32_t fdt32_ld(const fdt32_t *p)
int fdt_create_empty_tree(void *buf, int bufsize)
int fdt_resize(void *fdt, void *buf, int bufsize)
size_t fdt_header_size_(uint32_t version)
int fdt_nop_node(void *fdt, int nodeoffset)
int fdt_end_node(void *fdt)
int fdt_next_subnode(const void *fdt, int offset)
int fdt_nop_property(void *fdt, int nodeoffset, const char *name)
int fdt_overlay_apply(void *fdt, void *fdto)
int fdt_next_property_offset(const void *fdt, int offset)
int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset, const char *name, int namelen, uint32_t idx, const void *val, int len)
const void * fdt_getprop_by_offset(const void *fdt, int offset, const char **namep, int *lenp)
int fdt_del_node(void *fdt, int nodeoffset)
int fdt_set_name(void *fdt, int nodeoffset, const char *name)
const char * fdt_strerror(int errval)
int fdt_node_check_compatible(const void *fdt, int nodeoffset, const char *compatible)
static int fdt_property_cell(void *fdt, const char *name, uint32_t val)
static int fdt_property_u32(void *fdt, const char *name, uint32_t val)
int fdt_setprop(void *fdt, int nodeoffset, const char *name, const void *val, int len)
static uint32_t fdt_get_max_phandle(const void *fdt)
static void * fdt_getprop_w(void *fdt, int nodeoffset, const char *name, int *lenp)
size_t fdt_header_size(const void *fdt)
static fdt32_t cpu_to_fdt32(uint32_t x)
static fdt64_t cpu_to_fdt64(uint64_t x)
unsigned long long uint64_t