This patch moves the dtc code for checking the device tree its
processing into a new checks.c. The tree accessor functions from
livetree.c which the checks use are exported and added to dtc.h.
Another small step towards a flexible checking architecture.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Previously, there were a few shift/reduce and reduce/reduce
errors in the grammar that were being handled by the not-so-popular
GLR Parser technique.
Flip a right-recursive stack-abusing rule into a left-recursive
stack-friendly rule and clear up three messes in one shot: No more
conflicts, no need for the GLR parser, and friendlier stackness.
Compensate by reversing the property list on the node.
Signed-off-by: Jon Loeliger <jdl@freescale.com>
At present, dtc makes a lot of semantic checks on the device tree by
default, and will refuse to produce output if they fail. This means
people tend to need -f to force output despite failing semantic checks
rather a lot.
This patch splits the device tree checks into structural checks (no
bad or duplicate names or phandles) and semantic checks (everything
else). By default, only the structural checks are performed, and are
fatal. -f will force output even with structural errors (using this
in -Idts mode would essentially always be a bad idea, but it might be
useful in -Idtb mode for examining a malformed dtb).
Semantic checks are only performed if the new -c command line option
is supplied, and are always warnings only. Semantic checks will never
be performed on a tree with structural errors.
This patch is only a stopgap before implementing proper fine-grained
error/warning handling, but it should at least get rid of the
far-too-frequent need for -f for the time being.
This patch removes the -f from the dtc testcases now that it's no
longer necessary.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This large patch removes all trailing whitespace from dtc (including
libfdt, the testsuite and documentation). It also removes a handful
of redundant blank lines (at the end of functions, or when there are
two blank lines together for no particular reason).
As well as anything else, this means that quilt won't whinge when I go
to convert the whole of libfdt into a patch to apply to the kernel.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
It is not an error for /chosen (or any of its children) to be missing.
It is not a requirement that the output of dtc be a complete, valid
device tree, as it may be intended that the dtb be passed through boot
code that will complete it. Thus, do not complain.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Add -h option for help
Add -q quiet option to reduce or suppress the whining
Create #define for the default version value.
Signed-off-by: vanbaren@cideas.com <vanbaren@cideas.com>
Remove warning for missing interrupt-controller property
under /chosen. There is consensus that this
property does not belong here.
Also, add a warning if interrupt-controller _is_ found
under /chosen.
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Jon Loeliger <jdl@freescale.com>
dtc allows nodes to have labels, which at present are just re-emitted
as symbols at the appropriate places when using asm-mode output. It
also allows "references" where the notation &/path/to/node in a cell
list will be replaced with the phandle of the referenced node.
This patch extends the reference syntax to allow references to labels
instead of just full device paths. This allows nodes deep within the
tree to be referenced with a shorter more convenient name. References
to labels are distinguished from reference to paths by the fact that
paths must start with a /, but labels can never start with a /.
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Jon Loeliger <jdl@freescale.com>
At present, the tree checking code in dtc will die with an assertion
failure if given a tree which has the invalid value 0 or -1 in a
property which should contain a phandle. This patch fixes the check
to die more gracefully with an error message indicating the invalid
phandle value.
Signed-off-by: David Gibson <dwg@au1.ibm.com>
The linux,platform property in /chosen was obsolete almost as soon as
it was invented. Remove the check for it from dtc, which just tends
to lead to irritating spurious failures.
Signed-off-by: David Gibson <dwg@au1.ibm.com>
dtc always sets the physical boot CPU to 0xfeedbeef. Add a -b option to
set this. Also add warnings when using the wrong property with the
wrong blob version.
Signed-off-by: Michael Neuling <mikey@neuling.org>