This patch adds an fdt_parent_offset() function which returns an
offset to the parent node of a given node. It also adds two helper
functions which are used to implement fdt_parent_offset() but are also
exported: fdt_supernode_atdepth_offset() which returns the ancestor of
a given node at a specified depth from the root of the tree, and
fdt_node_depth() which returns the depth of a given node.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This patch adds an fdt_get_path() function to libfdt, which returns
the full path of a given node in a caller supplied buffer.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This patch adds a new fdt_get_name() function to libfdt which will
return a node's name string (including unit address, if any).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Currently, fdt_path_offset() returns FDL_ERR_BADOFFSET if given a path
with a trailing '/'. In particular this means that
fdt_path_offset("/") returns FDT_ERR_BADOFFSET rather than 0 as one
would expect.
This patch fixes the function to accept and ignore trailing '/'
characters. As well as allowing fdt_path_offset("/") this means that
fdt_path_offset("/foo/") will return the same as
fdt_path_offset("/foo") which seems in keeping with the principle of
least surprise.
This also adds a testcase to ensure that fdt_path_offset("/") returns
0 as it should.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This patch substantially revamps the dtc Makefiles, in particular
better integrating the Makefile for dtc proper with the Makefiles
imported from libfdt for libfdt and the shared testsuite. Notable
changes:
- No recursive make calls. Instead subsidiary Makefiles are
included into the top-level Makefile so we get a complete dependency
information.
- Common pattern rules, CFLAGS etc. shared between dtc, libfdt
and testsuite, rather than separate copies.
- Vaguely Kbuild-like non-verbose mode used by default, which
makes warnings more prominent.
- libfdt Makefile consists only of variable definitions and
helper rules, to make it more easily embeddable into other Makefile
systems.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
There are quite a lot of testcases in the dtc testsuite (recently
imported from libfdt). It can be easy to miss a stray FAIL result in
the midst of all the rest. To improve this, this patch adds a summary
to the end of the testsuite results giving the total number of tests
along with the number of PASSes FAILs and other results.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Add the original simple test case and a case with
different based cell values. Correct output asm
files as well as stderr is captured.
Signed-off-by: Jon Loeliger <jdl@freescale.com>