aboutsummaryrefslogtreecommitdiff
path: root/dtc-parser.y
AgeCommit message (Collapse)AuthorFilesLines
2008-05-19dtc: Rework handling of boot_cpuid_physDavid Gibson1-2/+2
Currently, dtc will put the nonsense value 0xfeedbeef into the boot_cpuid_phys field of an output blob, unless explicitly given another value with the -b command line option. As well as being a totally unuseful default value, this also means that dtc won't properly preserve the boot_cpuid_phys field in -I dtb -O dtb mode. This patch reworks things to improve the boot_cpuid handling. The new semantics are that the output's boot_cpuid_phys value is: the value given on the command line if -b is used otherwise the value from the input, if in -I dtb mode otherwise 0 Implementation-wise we do the following: - boot_cpuid_phys is added to struct boot_info, so that structure now contains all of the blob's semantic information. - dt_to_blob() and dt_to_asm() output the cpuid given in boot_info - dt_from_blob() fills in boot_info based on the input blob - The other dt_from_*() functions just record 0, but we can change this easily if e.g. we invent a way of specifying the boot cpu in the source format. - main() overrides the cpuid in the boot_info between input and output if -b is given We add some testcases to check this new behaviour. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-03-23dtc: Make eval_literal() staticDavid Gibson1-3/+3
eval_literal() is used only in the parser, so make it a static function. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-01-07Remove \n from yyerror() call.Scott Wood1-1/+1
The \n is provided by yyerror(). Signed-off-by: Scott Wood <scottwood@freescale.com>
2008-01-04Return a non-zero exit code if an error occurs during dts parsing.Scott Wood1-0/+2
Previously, only failure to parse caused the reading of the tree to fail; semantic errors that called yyerror() but not YYERROR only emitted a message, without signalling make to stop the build. Signed-off-by: Scott Wood <scottwood@freescale.com>
2008-01-04Look for include files in the directory of the including file.Scott Wood1-1/+1
Looking in the diretory dtc is invoked from is not very useful behavior. As part of the code reorganization to implement this, I removed the uniquifying of name storage -- it seemed a rather dubious optimization given likely usage, and some aspects of it would have been mildly awkward to integrate with the new code. Signed-off-by: Scott Wood <scottwood@freescale.com>
2008-01-04Add yyerrorf() for formatted error messages.Scott Wood1-3/+13
Signed-off-by: Scott Wood <scottwood@freescale.com>
2007-12-05dtc: Implement path referencesDavid Gibson1-0/+4
This patch extends dtc syntax to allow references (&label, or &{/full/path}) directly within property definitions, rather than inside a cell list. Such references are expanded to the full path of the referenced node, as a string, instead of to a phandle as references within cell lists are evaluated. A testcase is also included. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-12-05dtc: Generate useful error message for properties after subnodesDavid Gibson1-0/+5
On several occasions, I've accidentally put properties after subnodes in a dts file. I've then spent ages thinking that the resulting syntax error was because of something else. This patch arranges for this specific syntax error to generate a more specific and useful error message. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-11-26dtc: Merge refs and labels into single "markers" list (v2)David Gibson1-5/+6
Currently, every 'data' object, used to represent property values, has two lists of fixup structures - one for labels and one for references. Sometimes we want to look at them separately, but other times we need to consider both types of fixup. I'm planning to implement string references, where a full path rather than a phandle is substituted into a property value. Adding yet another list of fixups for that would start to get silly. So, this patch merges the "refs" and "labels" lists into a single list of "markers", each of which has a type field indicating if it represents a label or a phandle reference. String references or any other new type of in-data marker will then just need a new type value - merging data blocks and other common manipulations will just work. While I was at it I made some cleanups to the handling of fixups which simplify things further. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-11-08dtc: Switch dtc to C-style literalsDavid Gibson1-2/+36
dtc: Switch dtc to C-style literals This patch introduces a new version of dts file, distinguished from older files by starting with the special token /dts-v1/. dts files in the new version take C-style literals instead of the old bare hex or OF-style base notation. In addition, the "range" for of memreserve entries (/memreserve/ f0000-fffff) is no longer recognized in the new format. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-11-08dtc: Simplify lexing/parsing of literals vs. node/property namesDavid Gibson1-68/+56
The current scheme of having CELLDATA and MEMRESERVE states to recognize hex literals instead of node or property names is arse-backwards. The patch switches things around so that literals are lexed in normal states, and property/node names are only recognized in the special PROPNODENAME state, which is only entered after a { or a ;, and is left as soon as we scan a property/node name or a keyword. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-11-05dtc: Don't force alignment of cell list dataDavid Gibson1-2/+1
At present, defining a property as, say: foo = [abcd], <ffffffff>; Will cause dtc to insert 2 bytes of zeros between the abcd and the ffffffff, to align the cell form data. Doing so seemed like a good idea at the time, but I don't believe there are any users who actually rely on this behaviour. Segher claims that OF has some defined bindings which include properties an unaligned subsection of which is interpreted as 32-bit ints (i.e. like cell data). Worse, this alignment will cause nothing but pain when we add expression support to dtc (when celldata is included in a larger bytestring expession, we won't know the size of the preceding chunk of the expression until it's evaluated, so we would have to carry alignment fixup information right through the expression evaluation process). Therefore, this patch kills off this alignment behaviour. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-25DTC: Remove the need for the GLR Parser.Jon Loeliger1-3/+2
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>
2007-10-23DTC: Remove an unneeded %token definition.Jon Loeliger1-1/+0
Signed-off-by: Jon Loeliger <jdl@freescale.com> Acked-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-23DTC: Minor grammar rule shuffle.Jon Loeliger1-31/+31
I like to see the basis cases established early in the rule sets, so place "empty" reduction first. Purely cosmetic. Signed-off-by: Jon Loeliger <jdl@freescale.com> Acked-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-22Reformat grammar rules to not mix language syntax and yacc syntax.Jon Loeliger1-34/+118
Use consistent indenting on all rule actions. Signed-off-by: Jon Loeliger <jdl@freescale.com> Acked-by: David Gibson <david@gibson.dropbear.id.au>
2007-09-18dtc: Whitespace cleanupDavid Gibson1-6/+6
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>
2007-07-07dtc: implement labels on property dataMilton Miller1-0/+4
Extend the parser grammer to allow labels before or after any property data (string, cell list, or byte list), and any byte or cell within the property data. Store the labels using the same linked list structure as node references, but using a parallel list. When writing assembly output emit global labels as offsets from the start of the definition of the data. Note that the alignment for a cell list is done as part of the opening < delimiter, not the = or , before it. To label a cell after a string or byte list put the label inside the cell list. For example, prop = zero: [ aa bb ], two: < four: 1234 > eight: ; will produce labels with offsets 0, 2, 4, and 8 bytes from the beginning of the data for property prop. Signed-off-by: Milton Miller <miltonm@bga.com>
2007-07-07dtc: implement labels on memory reserve slotsMilton Miller1-4/+4
Allow a label to be placed on a memory reserve entry. Change the parser to recognize and store them. Emit them when writing assembly output. Signed-off-by: Milton Miller <miltonm@bga.com>
2007-07-07dtc: complain about unparsed digits in cell listsMilton Miller1-3/+11
Check that strtoul() parsed the complete string. As with the number overflow case, write a non-fatal error message to stdout. Signed-off-by: Milton Miller <miltonm@bga.com>
2007-07-07dtc: move declaration of yyerrorMilton Miller1-1/+0
yyerror() is used by both dtc-parser.y and dtc-lexer.l, so move the declaration to srcpos.h. Signed-off-by: Milton Miller <miltonm@bga.com>
2007-03-26DTC: Add support for a C-like #include "file" mechanism.Jon Loeliger1-1/+8
Keeps track of open files in a stack, and assigns a filenum to source positions for each lexical token. Modified error reporting to show source file as well. No policy on file directory basis has been decided. Still handles stdin. Tested on all arch/powerpc/boot/dts DTS files Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-02-16Moved data_convert_cell() out of data.c to the parser.Jon Loeliger1-3/+27
It constructs a cell_t, not data objects. Renamed it to cell_from_string() as well. Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-02-15Add support for decimal, octal and binary based cell values.Jon Loeliger1-2/+14
New syntax d#, b#, o# and h# allow for an explicit prefix on cell values to specify their base. Eg: <d# 123> Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-02-08Allow multipart property valuesDavid Gibson1-3/+10
At present each property definition in a dts file must give as the value either a string ("abc..."), a bytestring ([12abcd...]) or a cell list (<1 2 3 ...>). This patch allows a property value to be given as several of these, comma-separated. The final property value is just the components appended together. So a property could have a list of cells followed by a string, or a bytestring followed by some cells. Cells are always aligned, so if cells are given following a string or bytestring which is not a multiple of 4 bytes long, zero bytes are inserted to align the following cells. The primary motivation for this feature, however, is to allow defining a property as a list of several strings. This is what's needed for defining OF 'compatible' properties, and is less ugly and fiddly than using embedded \0s in the strings. Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Jon Loeliger <jdl@freescale.com>
2005-10-24Rework tracking of reserve entries during processing. This is initial workDavid Gibson1-10/+7
to allow more powerful handling of reserve entries.
2005-10-19Rudimentary support for reporting the line number of syntax errors.David Gibson1-3/+4
2005-07-15Support for specifying memreserve ranges in the source format, based onDavid Gibson1-4/+35
a patch by Jon Loeliger <jdl AT freescale.com>, although tweaked substantially.
2005-07-11Use u8 instead of uint8_t, as we do with the other size types.David Gibson1-1/+1
2005-06-17Remove build_empty_property(). It wasn't useful.David Gibson1-1/+1
2005-06-16Rudimentary phandle reference support.David Gibson1-0/+4
2005-06-16Initial label support. Also switch to glr-parser mode and get rid ofDavid Gibson1-6/+19
hacks that were necessary without it.
2005-06-08Initial commitDavid Gibson1-0/+116