extern "C" {
const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
{
return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
}
uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
static inline uint16_t fdt16_ld(const fdt16_t *p)
{
const uint8_t *bp = (const uint8_t *)p;
return ((uint16_t)bp[0] << 8) | bp[1];
}
static inline uint32_t fdt32_ld(const fdt32_t *p)
{
return fdt32_to_cpu(*p);
}
static inline void fdt32_st(void *property, uint32_t value)
{
uint8_t *bp = (uint8_t *)property;
bp[0] = value >> 24;
bp[1] = (value >> 16) & 0xff;
bp[2] = (value >> 8) & 0xff;
bp[3] = value & 0xff;
}
static inline uint64_t fdt64_ld(const fdt64_t *p)
{
return fdt64_to_cpu(*p);
}
static inline void fdt64_st(void *property, uint64_t value)
{
uint8_t *bp = (uint8_t *)property;
bp[0] = value >> 56;
bp[1] = (value >> 48) & 0xff;
bp[2] = (value >> 40) & 0xff;
bp[3] = (value >> 32) & 0xff;
bp[4] = (value >> 24) & 0xff;
bp[5] = (value >> 16) & 0xff;
bp[6] = (value >> 8) & 0xff;
bp[7] = value & 0xff;
}
int fdt_next_node(const void *fdt, int offset, int *depth);
int fdt_first_subnode(const void *fdt, int offset);
int fdt_next_subnode(const void *fdt, int offset);
fdt_set_hdr_(magic)
fdt_set_hdr_(totalsize)
fdt_set_hdr_(off_dt_struct)
fdt_set_hdr_(off_dt_strings)
fdt_set_hdr_(off_mem_rsvmap)
fdt_set_hdr_(version)
fdt_set_hdr_(last_comp_version)
fdt_set_hdr_(boot_cpuid_phys)
fdt_set_hdr_(size_dt_strings)
fdt_set_hdr_(size_dt_struct)
size_t fdt_header_size(const void *fdt);
size_t fdt_header_size_(uint32_t version);
int fdt_check_header(const void *fdt);
int fdt_move(const void *fdt, void *buf, int bufsize);
int fdt_check_full(const void *fdt, size_t bufsize);
const char *fdt_get_string(const void *fdt, int stroffset, int *lenp);
const char *fdt_string(const void *fdt, int stroffset);
int fdt_find_max_phandle(const void *fdt, uint32_t *phandle);
static inline uint32_t fdt_get_max_phandle(const void *fdt)
{
uint32_t phandle;
int err;
err = fdt_find_max_phandle(fdt, &phandle);
if (err < 0)
return (uint32_t)-1;
return phandle;
}
int fdt_generate_phandle(const void *fdt, uint32_t *phandle);
int fdt_num_mem_rsv(const void *fdt);
int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
const char *name, int namelen);
int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
int fdt_path_offset(const void *fdt, const char *path);
const char *fdt_get_name(const void *fdt, int nodeoffset, int *lenp);
int fdt_first_property_offset(const void *fdt, int nodeoffset);
int fdt_next_property_offset(const void *fdt, int offset);
const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
int offset,
int *lenp);
static inline struct fdt_property *fdt_get_property_by_offset_w(void *fdt,
int offset,
int *lenp)
{
return (struct fdt_property *)(uintptr_t)
fdt_get_property_by_offset(fdt, offset, lenp);
}
const struct fdt_property *fdt_get_property_namelen(const void *fdt,
int nodeoffset,
const char *name,
int namelen, int *lenp);
static inline struct fdt_property *
fdt_get_property_namelen_w(void *fdt, int nodeoffset, const char *name,
int namelen, int *lenp)
{
return (struct fdt_property *)(uintptr_t)fdt_get_property_namelen(
fdt, nodeoffset, name, namelen, lenp);
}
const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
const char *name, int *lenp);
static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
const char *name,
int *lenp)
{
return (struct fdt_property *)(uintptr_t)
fdt_get_property(fdt, nodeoffset, name, lenp);
}
const void *fdt_getprop_by_offset(const void *fdt, int offset,
const char **namep, int *lenp);
const void *fdt_getprop_namelen(const void *fdt, int nodeoffset,
const char *name, int namelen, int *lenp);
static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
const char *name, int namelen,
int *lenp)
{
return (void *)(uintptr_t)fdt_getprop_namelen(fdt, nodeoffset, name,
namelen, lenp);
}
const void *fdt_getprop(const void *fdt, int nodeoffset,
const char *name, int *lenp);
static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
const char *name, int *lenp)
{
return (void *)(uintptr_t)fdt_getprop(fdt, nodeoffset, name, lenp);
}
uint32_t fdt_get_phandle(const void *fdt, int nodeoffset);
const char *fdt_get_alias_namelen(const void *fdt,
const char *name, int namelen);
const char *fdt_get_alias(const void *fdt, const char *name);
const char *fdt_get_symbol_namelen(const void *fdt,
const char *name, int namelen);
const char *fdt_get_symbol(const void *fdt, const char *name);
int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen);
int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
int supernodedepth, int *nodedepth);
int fdt_node_depth(const void *fdt, int nodeoffset);
int fdt_parent_offset(const void *fdt, int nodeoffset);
int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
const char *propname,
const void *propval, int proplen);
int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle);
int fdt_node_check_compatible(const void *fdt, int nodeoffset,
const char *compatible);
int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
const char *compatible);
int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property);
int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property,
const char *string);
const char *fdt_stringlist_get(const void *fdt, int nodeoffset,
const char *property, int index,
int *lenp);
int fdt_address_cells(const void *fdt, int nodeoffset);
int fdt_size_cells(const void *fdt, int nodeoffset);
int fdt_setprop_inplace_namelen_partial(void *fdt, int nodeoffset,
const char *name, int namelen,
uint32_t idx, const void *val,
int len);
int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
const void *val, int len);
static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset,
const char *name, uint32_t val)
{
fdt32_t tmp = cpu_to_fdt32(val);
return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp));
}
static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset,
const char *name, uint64_t val)
{
fdt64_t tmp = cpu_to_fdt64(val);
return fdt_setprop_inplace(fdt, nodeoffset, name, &tmp, sizeof(tmp));
}
static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
const char *name, uint32_t val)
{
return fdt_setprop_inplace_u32(fdt, nodeoffset, name, val);
}
int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
int fdt_nop_node(void *fdt, int nodeoffset);
int fdt_create_with_flags(void *buf, int bufsize, uint32_t flags);
int fdt_create(void *buf, int bufsize);
int fdt_resize(void *fdt, void *buf, int bufsize);
int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
int fdt_finish_reservemap(void *fdt);
int fdt_begin_node(void *fdt, const char *name);
int fdt_property(void *fdt, const char *name, const void *val, int len);
static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val)
{
fdt32_t tmp = cpu_to_fdt32(val);
return fdt_property(fdt, name, &tmp, sizeof(tmp));
}
static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val)
{
fdt64_t tmp = cpu_to_fdt64(val);
return fdt_property(fdt, name, &tmp, sizeof(tmp));
}
static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
{
return fdt_property_u32(fdt, name, val);
}
int fdt_property_placeholder(void *fdt, const char *name, int len, void **valp);
int fdt_end_node(void *fdt);
int fdt_finish(void *fdt);
int fdt_create_empty_tree(void *buf, int bufsize);
int fdt_open_into(const void *fdt, void *buf, int bufsize);
int fdt_pack(void *fdt);
int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t size);
int fdt_del_mem_rsv(void *fdt, int n);
int fdt_set_name(void *fdt, int nodeoffset, const char *name);
int fdt_setprop_namelen(void *fdt, int nodeoffset, const char *name,
int namelen, const void *val, int len);
static inline int fdt_setprop(void *fdt, int nodeoffset, const char *name,
const void *val, int len)
{
return fdt_setprop_namelen(fdt, nodeoffset, name, strlen(name), val,
len);
}
int fdt_setprop_placeholder_namelen(void *fdt, int nodeoffset, const char *name,
int namelen, int len, void **prop_data);
static inline int fdt_setprop_placeholder(void *fdt, int nodeoffset,
const char *name, int len,
void **prop_data)
{
return fdt_setprop_placeholder_namelen(fdt, nodeoffset, name,
strlen(name), len, prop_data);
}
static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name,
uint32_t val)
{
fdt32_t tmp = cpu_to_fdt32(val);
return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
}
static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name,
uint64_t val)
{
fdt64_t tmp = cpu_to_fdt64(val);
return fdt_setprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
}
static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
uint32_t val)
{
return fdt_setprop_u32(fdt, nodeoffset, name, val);
}
int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
const void *val, int len);
static inline int fdt_appendprop_u32(void *fdt, int nodeoffset,
const char *name, uint32_t val)
{
fdt32_t tmp = cpu_to_fdt32(val);
return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
}
static inline int fdt_appendprop_u64(void *fdt, int nodeoffset,
const char *name, uint64_t val)
{
fdt64_t tmp = cpu_to_fdt64(val);
return fdt_appendprop(fdt, nodeoffset, name, &tmp, sizeof(tmp));
}
static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
const char *name, uint32_t val)
{
return fdt_appendprop_u32(fdt, nodeoffset, name, 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);
int fdt_add_subnode_namelen(void *fdt, int parentoffset,
const char *name, int namelen);
int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
int fdt_del_node(void *fdt, int nodeoffset);
int fdt_overlay_apply(void *fdt, void *fdto);
int fdt_overlay_target_offset(const void *fdt, const void *fdto,
int fragment_offset, char const **pathp);
int fdt_overlay_apply_node(void *fdt, int target, void *fdto, int node);
const char *fdt_strerror(int errval);
}
|