14 const char *s,
int len)
23 if (
memcmp(p, s, len) != 0)
28 else if (!
memchr(s,
'@', len) && (p[len] ==
'@'))
56 if (absoffset >= (
unsigned)totalsize)
58 len = totalsize - absoffset;
70 unsigned int sw_stroffset = -stroffset;
72 if ((stroffset >= 0) ||
75 if (sw_stroffset < len)
82 s = (
const char *)fdt + absoffset;
106 const char *s,
int len)
111 return p && (slen == len) && (
memcmp(p, s, len) == 0);
226 const char *
name,
int namelen)
233 (offset >= 0) && (depth >= 0);
252 const char *end = path + namelen;
253 const char *p = path;
260 const char *q =
memchr(path,
'/', end - p);
281 q =
memchr(p,
'/', end - p);
428 int namelen,
int *lenp)
445 const char *
name,
int *lenp)
452 const char *
name,
int namelen,
int *lenp)
464 (poffset +
sizeof(*prop)) % 8 &&
fdt32_ld_(&prop->
len) >= 8)
465 return prop->
data + 4;
470 const char **namep,
int *lenp)
497 (offset +
sizeof(*prop)) % 8 &&
fdt32_ld_(&prop->
len) >= 8)
498 return prop->
data + 4;
503 const char *
name,
int *lenp)
516 if (!php || (
len !=
sizeof(*php))) {
518 if (!php || (
len !=
sizeof(*php)))
526 const char *
name,
int namelen)
542int fdt_get_path(
const void *fdt,
int nodeoffset,
char *buf,
int buflen)
544 int pdepth = 0, p = 0;
545 int offset, depth, namelen;
553 for (offset = 0, depth = 0;
554 (offset >= 0) && (offset <= nodeoffset);
556 while (pdepth > depth) {
559 }
while (buf[p-1] !=
'/');
563 if (pdepth >= depth) {
567 if ((p + namelen + 1) <= buflen) {
575 if (offset == nodeoffset) {
576 if (pdepth < (depth + 1))
595 int supernodedepth,
int *nodedepth)
602 if (supernodedepth < 0)
605 for (offset = 0, depth = 0;
606 (offset >= 0) && (offset <= nodeoffset);
608 if (depth == supernodedepth)
609 supernodeoffset = offset;
611 if (offset == nodeoffset) {
615 if (supernodedepth > depth)
618 return supernodeoffset;
639 return (
can_assume(LIBFDT_FLAWLESS) || err < 0) ? err :
651 nodedepth - 1,
NULL);
655 const char *propname,
656 const void *propval,
int proplen)
673 if (val && (
len == proplen)
685 if ((phandle == 0) || (phandle == ~0U))
711 while (listlen >=
len) {
714 p =
memchr(strlist,
'\0', listlen);
717 listlen -= (p-strlist) + 1;
725 const char *list, *end;
726 int length, count = 0;
728 list =
fdt_getprop(fdt, nodeoffset, property, &length);
735 length =
strnlen(list, end - list) + 1;
738 if (list + length > end)
751 int length,
len, idx = 0;
752 const char *list, *end;
754 list =
fdt_getprop(fdt, nodeoffset, property, &length);
762 length =
strnlen(list, end - list) + 1;
765 if (list + length > end)
768 if (length ==
len &&
memcmp(list,
string, length) == 0)
779 const char *property,
int idx,
782 const char *list, *end;
785 list =
fdt_getprop(fdt, nodeoffset, property, &length);
796 length =
strnlen(list, end - list) + 1;
799 if (list + length > end) {
824 const char *compatible)
837 const char *compatible)
int fdt_check_prop_offset_(const void *fdt, int offset)
int fdt_next_node(const void *fdt, int offset, int *depth)
int32_t fdt_ro_probe_(const void *fdt)
int fdt_check_node_offset_(const void *fdt, int offset)
uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset)
uint32_t fdt_get_phandle(const void *fdt, int nodeoffset)
static int nextprop_(const void *fdt, int offset)
int fdt_stringlist_search(const void *fdt, int nodeoffset, const char *property, const char *string)
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_stringlist_contains(const char *strlist, int listlen, const char *str)
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_nodename_eq_(const void *fdt, int offset, const char *s, int len)
static const struct fdt_reserve_entry * fdt_mem_rsv(const void *fdt, int n)
const char * fdt_get_name(const void *fdt, int nodeoffset, int *len)
static int fdt_string_eq_(const void *fdt, int stroffset, const char *s, int len)
int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
const struct fdt_property * fdt_get_property_namelen(const void *fdt, int offset, const char *name, int namelen, int *lenp)
int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle)
int fdt_subnode_offset_namelen(const void *fdt, int offset, const char *name, int namelen)
const char * fdt_get_alias(const void *fdt, const char *name)
int fdt_find_max_phandle(const void *fdt, uint32_t *phandle)
const char * fdt_get_string(const void *fdt, int stroffset, int *lenp)
int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, int supernodedepth, int *nodedepth)
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)
const void * fdt_getprop(const void *fdt, int nodeoffset, const char *name, int *lenp)
int fdt_node_offset_by_prop_value(const void *fdt, int startoffset, const char *propname, const void *propval, int proplen)
const char * fdt_stringlist_get(const void *fdt, int nodeoffset, const char *property, int idx, int *lenp)
static const struct fdt_property * fdt_get_property_namelen_(const void *fdt, int offset, const char *name, int namelen, int *lenp, int *poffset)
int fdt_stringlist_count(const void *fdt, int nodeoffset, const char *property)
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_string(const void *fdt, int stroffset)
int fdt_first_property_offset(const void *fdt, int nodeoffset)
int fdt_next_property_offset(const void *fdt, int offset)
const void * fdt_getprop_by_offset(const void *fdt, int offset, const char **namep, int *lenp)
static const struct fdt_property * fdt_get_property_by_offset_(const void *fdt, int offset, int *lenp)
int fdt_node_check_compatible(const void *fdt, int nodeoffset, const char *compatible)
MOSAPI void * memchr(const void *m, int c, size_t n)
MOSAPI char * strrchr(const char *s, int c)
MOSAPI int memcmp(const void *s1, const void *s2, size_t n)
MOSAPI size_t strnlen(const char *, size_t)
#define FDT_ERR_BADPHANDLE
#define fdt_totalsize(fdt)
#define FDT_ERR_TRUNCATED
#define FDT_ERR_BADOFFSET
#define FDT_ERR_NOPHANDLES
#define fdt_off_dt_strings(fdt)
#define fdt_size_dt_strings(fdt)
#define FDT_ERR_BADVERSION
#define fdt_off_mem_rsvmap(fdt)
#define FDT_ERR_BADSTRUCTURE
static uint32_t fdt32_ld_(const fdt32_t *p)
static const void * fdt_offset_ptr_(const void *fdt, int offset)
#define FDT_RO_PROBE(fdt)
static const struct fdt_reserve_entry * fdt_mem_rsv_(const void *fdt, int n)
#define can_assume(_assume)
static uint64_t fdt64_ld_(const fdt64_t *p)
static void * memcpy(void *s1, const void *s2, size_t n)
static size_t strlen(const char *s)
unsigned long long uint64_t