Commit graph

79 commits

Author SHA1 Message Date
David Gibson
6936273aa4 dtc: Remove bogus break statement
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>
2007-07-02 08:30:57 -05:00
David Gibson
0738774fcc dtc: Accept NOPs in dtb input regardless of version
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>
2007-06-25 21:39:26 -05:00
Milton Miller
ce243227f1 dtc: parse NOP in dtb input
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>
2007-06-11 08:40:00 -05:00
Jerry Van Baren
7ea144f4c0 Fix the -S to modify the totalsize properly.
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>
2007-04-20 08:43:45 -05:00
Jerry Van Baren
86c01ee6df Assemble the blob in memory before writing it out.
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>
2007-04-19 17:24:52 -05:00
Jerry Van Baren
ca25e54ddd Fix reserve map output for asm format.
Add extra reserve map slots output for asm format (previously done for dtb
  output).

Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
2007-04-19 17:19:57 -05:00
Jerry Van Baren
4384b23454 Implement the -R option and add a -S option.
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>
2007-04-05 09:57:55 -05:00
David Gibson
46c88dfcca Add support for flat device tree format version 17
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>
2007-03-14 15:36:37 -05:00
Michael Neuling
332c536425 dtc: fix endian issue when reading blobs
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>
2006-07-07 09:30:44 -05:00
Michael Neuling
38e8f8fd88 dtc: add setting of physical boot cpu
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>
2006-06-07 09:42:15 -05:00
Jon Loeliger
05ae3d8eeb Use .long on high and low halfs of u64s to avoid .quad
as it appears .quad isn't available in some assemblers.
2006-04-19 11:58:45 -05:00
Jon Loeliger
f7374f60eb Don't generate the mem-reserve entry for the blob itself,
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.
2006-04-19 11:34:22 -05:00
Mark A. Greer
7a9f663ac7 The problem is that asm_emit_cell() was swapping its asm output when
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.
2006-04-19 11:16:32 -05:00
David Gibson
712e52e438 Use names for output functions in the form dt_to_*() instead of
write_dt_*() for consistency with the dt_from_*() input functions.
2005-10-26 16:56:26 +10:00
David Gibson
f040d95b84 Rework tracking of reserve entries during processing. This is initial work
to allow more powerful handling of reserve entries.
2005-10-24 18:18:38 +10:00
David Gibson
6c0f36769a Fix endian problems with handling of memreserve entries (bug pointed out
by Pantelis Antoniou).  The rule is that the memreserve data in struct
boot_info is always stored big-endian.
2005-08-29 13:36:15 +10:00
David Gibson
230f253e9b Remove an unused function, mark a bunch of other functions and variables
as static.  Mostly found by sparse.
2005-08-29 12:48:02 +10:00
David Gibson
41916138dd Forgot to realign after emitting auto-generated "name" properties. Oops. 2005-08-25 15:39:09 +10:00
David Gibson
dffc2a8972 Add a couple of missing cpu_to_be32() writing the version numbers out. 2005-08-25 14:47:20 +10:00
David Gibson
4ddf7c020c In flat tree reading, check for (negative) string offsets which underrun
the input blob. (Patch from Michael Ellerman).
2005-08-19 16:11:11 +10:00
David Gibson
f0517db250 Support for specifying memreserve ranges in the source format, based on
a patch by Jon Loeliger <jdl AT freescale.com>, although tweaked
substantially.
2005-07-15 17:14:24 +10:00
David Gibson
586606e35d Oops, fix stupid bug where we emitted padding before, rather than after
the blob header.
2005-07-14 11:27:24 +10:00
David Gibson
47f23dee09 Ensure that the reserve map is doubleword aligned in blob and asm output. 2005-07-11 17:19:26 +10:00
David Gibson
a6c69572a3 Remove inaccurate comment. 2005-07-11 17:09:42 +10:00
David Gibson
7ee3ffd43f Fix bug in error message. 2005-07-11 16:45:57 +10:00
David Gibson
ab870cadb4 First cut at a "libdt" set of routines for extracting things from the
flattened tree.  Could be used in firmware.
2005-06-23 15:45:13 +10:00
David Gibson
81f2e89c75 Rudimentary phandle reference support. 2005-06-16 17:04:00 +10:00
David Gibson
4102d840d9 Initial label support. Also switch to glr-parser mode and get rid of
hacks that were necessary without it.
2005-06-16 14:36:37 +10:00
David Gibson
fc14dad769 Initial commit 2005-06-08 17:18:34 +10:00