diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2007-02-07 16:37:50 +1100 |
---|---|---|
committer | Jon Loeliger <jdl@freescale.com> | 2007-02-08 17:26:41 -0600 |
commit | 32da475af165a0e1e274aa9a8bbdfb873831efa7 (patch) | |
tree | b5e16c13805db07b410c543f0443daeb2c688e54 /dtc-parser.y | |
parent | 54382390e40654957e16da7ba48ee86822ffe590 (diff) | |
download | dtc-32da475af165a0e1e274aa9a8bbdfb873831efa7.tar.gz |
Allow multipart property values
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>
Diffstat (limited to 'dtc-parser.y')
-rw-r--r-- | dtc-parser.y | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/dtc-parser.y b/dtc-parser.y index 16d2277..bd725fe 100644 --- a/dtc-parser.y +++ b/dtc-parser.y @@ -58,6 +58,7 @@ extern struct boot_info *the_boot_info; %token <str> DT_REF %type <data> propdata +%type <data> propdataprefix %type <re> memreserve %type <re> memreserves %type <data> celllist @@ -121,9 +122,15 @@ propdef: label DT_PROPNAME '=' propdata ';' { } ; -propdata: DT_STRING { $$ = $1; } - | '<' celllist '>' { $$ = $2; } - | '[' bytestring ']' { $$ = $2; } +propdata: propdataprefix DT_STRING { $$ = data_merge($1, $2); } + | propdataprefix '<' celllist '>' { + $$ = data_merge(data_append_align($1, sizeof(cell_t)), $3); + } + | propdataprefix '[' bytestring ']' { $$ = data_merge($1, $3); } + ; + +propdataprefix: propdata ',' { $$ = $1; } + | /* empty */ { $$ = empty_data; } ; celllist: celllist DT_CELL { $$ = data_append_cell($1, $2); } |