58 static int _fdt_nodename_eq(
const void *fdt,
int offset,
59 const char *
s,
int len)
67 if (
memcmp(p, s, len) != 0)
72 else if (!
memchr(s,
'@', len) && (p[len] ==
'@'))
83 static int _fdt_string_eq(
const void *fdt,
int stroffset,
84 const char *s,
int len)
108 static int _nextprop(
const void *fdt,
int offset)
140 (offset >= 0) && (depth >= 0);
143 && _fdt_nodename_eq(fdt, offset, name, namelen))
160 const char *p =
path;
167 const char *
q =
strchr(path,
'/');
228 return _nextprop(fdt, offset);
236 return _nextprop(fdt, offset);
252 prop = _fdt_offset_ptr(fdt, offset);
286 const char *
name,
int *lenp)
305 const char **namep,
int *lenp)
318 const char *
name,
int *lenp)
330 php =
fdt_getprop(fdt, nodeoffset,
"phandle", &len);
331 if (!php || (len !=
sizeof(*php))) {
332 php =
fdt_getprop(fdt, nodeoffset,
"linux,phandle", &len);
333 if (!php || (len !=
sizeof(*php)))
359 int pdepth = 0, p = 0;
368 for (offset = 0, depth = 0;
369 (offset >= 0) && (offset <= nodeoffset);
371 while (pdepth > depth) {
374 }
while (buf[p-1] !=
'/');
378 if (pdepth >= depth) {
382 if ((p + namelen + 1) <= buflen) {
383 memcpy(buf + p, name, namelen);
390 if (offset == nodeoffset) {
391 if (pdepth < (depth + 1))
410 int supernodedepth,
int *nodedepth)
417 if (supernodedepth < 0)
420 for (offset = 0, depth = 0;
421 (offset >= 0) && (offset <= nodeoffset);
423 if (depth == supernodedepth)
426 if (offset == nodeoffset) {
430 if (supernodedepth > depth)
433 return supernodeoffset;
463 nodedepth - 1,
NULL);
467 const char *propname,
468 const void *propval,
int proplen)
485 if (val && (len == proplen)
486 && (
memcmp(val, propval, len) == 0))
497 if ((phandle == 0) || (phandle == -1))
518 static int _fdt_stringlist_contains(
const char *
strlist,
int listlen,
524 while (listlen >= len) {
525 if (
memcmp(str, strlist, len+1) == 0)
527 p =
memchr(strlist,
'\0', listlen);
530 listlen -= (p-strlist) + 1;
542 prop =
fdt_getprop(fdt, nodeoffset,
"compatible", &len);
545 if (_fdt_stringlist_contains(prop, len, compatible))