When writing the memory reserve table in assembly output,
emit both halves of each 64 bit number on a single .long
statement. This results in two lines per memory reserve
slot instead of four, each line contains one field (start
or size).
Signed-off-by: Milton Miller <miltonm@bga.com>
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>
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>
The version 17 flat device tree format added struct size. When
writing version 17 assembly output the field must be emitted.
Signed-off-by: Milton Miller <miltonm@bga.com>
Commit 0738774fcc introduced some
incorrect indentation / bracketing in unflatten_tree(). By luck, the
extra break statement intended to be within an if block, but actually
afterwards has no semantic effect. Still, this patch gets rid of it
for cleanliness.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Since Milton's patch, dtc will accept (and, correctly, ignore) NOP
tags when given dtb input v16 or later. However, although NOPs
weren't defined in earlier versions, they're not ambiguous, so should
be accepted there as well. This patch does so, printing a mere
warning when finding NOPs in a too-early dtb version.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Version 16 and later of the flat device tree format allow NOPs
to be placed in the tree. When processing dtb input, dtc must
recognise them.
Previously it would produce the error message
FATAL ERROR: Invalid opcode word 00000004 in device tree blob
Signed-off-by: Milton Miller <miltonm@bga.com>
With the last improvement to pad out the blob, I broke the blob
header totalsize adjustment. The adjustment was moved up in the
code before the memory image of the blob is created.
Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
This makes padding out the blob if the user requested extra size much
easer. The assembly and writing to the file is more straight forward too.
Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Implement the -R <number> option to add memory reserve slots.
Add a -S <size> option makes the blob at least this number of bytes.
Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
libfdt defined a new version of the flattened device tree format,
version 17. It is backwards compatible with version 16, just adding
an extra header field giving the size of the blob's structure blob.
This patch adds support to dtc allowing it to read and write version
17 blobs. It also makes version 17 the default output version for
blobs.
At the same time we change the code to consistently using decimal
numbers for versions. Previously we sometimes used 16 and sometimes
0x10 to refer to version 16.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The reserve mem regions are screwy if you read a blob on x86. I'm
guessing there may be a few more of these lurking in the code.
Signed-off-by: Michael Neuling <mikey@neuling.org>
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>
even for ASM output. It was inconsistent with the binary
output form, and kernel folks decided to have the early
kernel perform the reservation itself.
it shouldn't be (because the assembler will do the necessary swapping).
The cell values (asm_emit_cell()) are different from the data values
(asm_emit_data()) because the cell values are generated within the
program and don't get swapped like the data values read from the dts file.
They should be left as they are so that the assembler will swap them,
if necessary. For example, when the property length field was 4,
the asm output contained ".long 0x4000000" and sent the kernel prom.c
dt parsing code into the weeds.
Pointed out by Mark Greer.