Commit Graph

67 Commits (86c01ee6dfc68c633eaaee6ab62d0742fd82b24f)

Author SHA1 Message Date
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 4f5370a138 Add -o <output file> to the usage message.
Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
2007-04-19 17:17:51 -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
Jon Loeliger ce34ae3b23 DTC: Incorporate some review suggestions.
- Change include syntax to:  /include/ "filename"
    - Move private functions directly into dtc-lexer.l
    - Define YYID for some older parser templates

Also fix a #include ordering problem around YYLTPE.

Signed-off-by; Jon Loeliger <jdl@freescale.com>
Acked-by: Haiying Wang <Haiying.Wang@freescale.com>
2007-03-28 17:07:44 -05:00
Jon Loeliger e45e6fd274 DTC: Add support for a C-like #include "file" mechanism.
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-03-26 08:36:07 -05:00
Scott Wood b29597d9a3 Remove bogus errors from check_chosen.
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>
2007-03-26 08:34:23 -05:00
Ed Swarthout 001430072f ftdump missing be32_to_cpu() on size cell. 2007-03-22 08:30:52 -05:00
Jerry Van Baren cd1da87116 Improve options, #define default version.
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>
2007-03-19 08:54:40 -05:00
David Gibson b299ac76a7 Get rid of libdt.c
libdt.c was an attempt at creating a device tree handling library
within the dtc codebase.  However, it was never even close to
completion, and is entirely obsoleted by it's spiritual descendent,
libfdt (currently a separate package).  This patch, therefore, removes
libdt.c entirely, along with its only reference in the Makefile, an
unused variable.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-03-14 15:36:42 -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
David Gibson 6ae55f9f9b Fix flat_dt_property structure
The structure in flat_dt.h defining the layout of a proprety within
the flat device tree is incorrect.  It has the offset to the
property's name, then the length when in fact (according to
booting-without-of.txt and the output of dtc) then length should come
first, followed by the name offset.

In fact, this structure is never used so the mistake doesn't break
anything, but it should still be fixed to avoid misleading people.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-02-27 08:46:55 -06:00
Stuart Yoder 5ae78ad8f8 remove check for interrupt-controller property under /chosen
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>
2007-02-20 11:55:20 -06:00
Jon Loeliger 3948849fd0 Moved data_convert_cell() out of data.c to the parser.
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-16 09:33:54 -06:00
Jon Loeliger fd84d97dee Add some initial test cases.
Add the original simple test case and a case with
different based cell values.  Correct output asm
files as well as stderr is captured.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-02-15 11:02:44 -06:00
Jon Loeliger af0278a3a0 Add support for decimal, octal and binary based cell values.
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-15 10:59:27 -06:00
David Gibson c226ddcabc Allow references to labels
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>
2007-02-08 17:27:12 -06:00
David Gibson 32da475af1 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>
2007-02-08 17:26:41 -06:00
David Gibson 54382390e4 Bugfix for CHECK_HAVE_WARN_PHANDLE()
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>
2007-01-31 07:39:57 -06:00
David Gibson e6dd3f1d3c Remove check for linux,platform property in /chosen
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>
2007-01-29 07:47:55 -06:00
David Gibson 95393db96f dtc: Remove verbose message from get_node_phandle()
get_node_phandle() had a leftover debugging printf(), which could muddy
dtc's output when checking trees.  This patch removes it.
2006-12-11 11:02:59 +11:00
Kim Phillips f016882f91 Change default output blob version from 3 to 16
Signed-off-by: Kim Phillips <Kim.Phillips@freescale.com>
Signed-off-by: Jon Loeliger <jdl@freescale.com>
2006-11-01 08:15:18 -06: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
Jon Loeliger a73b7d43d4 Merge branch 'jdl' 2006-06-24 17:33:28 -05:00
Jon Loeliger 6cf2bcd1e0 Add copyright. Fix 80-column line.
Signed-off-by: Jon Loeliger <jdl@jdl.com>
2006-06-24 15:52:48 -05:00
Jon Loeliger 780c742b14 Remove dead code.
Signed-off-by: Jon Loeliger <jdl@jdl.com>
2006-06-24 15:42:51 -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 f5aa792d81 Add paper on the flattened tree and dtc presented at linux.conf.au 2006 by
way of some more documentation.
2006-01-31 16:17:59 +11:00
Becky Bruce f192a7ae0b [PATCH] dtc: Update flat OF doc for new mdio properties
Add device-type and compatible as required fields for mdio node; add eTSEC
to ethernet model options.

Signed-off-by: Becky Bruce <Becky.bruce@freescale.com>
2006-01-11 12:59:59 +11:00
David Gibson 986c272d66 Added document describing flattened tree format and what properties / nodes
the kernel needs.  Written by BenH and Becky Bruce.
2005-12-06 15:22:36 +11:00
David Gibson 1ae70562f0 Remove no longer used (and already commented) reserve_data field from boot_info. 2005-10-26 16:57:40 +10: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 fccb194a14 Add a second cpu and a timebase frequency to test.dts. 2005-10-24 17:27:36 +10:00
David Gibson 8f1bc85611 Add a .gitignore file. 2005-10-21 17:28:42 +10:00
David Gibson 740a19a819 Alter add_property() and add_child() functiosn to add to the end of their
respective linked lists.  This means we no longer reverse the order or
properties and subnodes when in blob or fs input modes.
2005-10-21 17:26:45 +10:00
David Gibson cba839c728 Reduce message about too-long property names to a mere warning, it causes
too much trouble.  Still need to fix up error handling in general.
2005-10-20 13:56:23 +10:00
David Gibson 1847d161dc Update TODO 2005-10-19 16:29:52 +10:00
David Gibson 86dbcbd1e4 Rudimentary support for reporting the line number of syntax errors. 2005-10-19 16:00:31 +10:00
David Gibson b4ac04952a Oops avoid using case range gcc extension. 2005-10-17 10:27:45 +10:00
David Gibson 93c82174ea Use C99 fixed width integer type names in libdt. 2005-10-17 10:27:27 +10:00
David Gibson c6d036eaec Oops, use strtoul() instead of strtol() in dtc-lexer.l, so that we
correctly handle cell values above 7fffffff.  Bug pointed out by Kumar Gala.
2005-10-14 11:59:23 +10:00
David Gibson b2543fc875 Add ftdump utility, contributed by Pantelis Antoniou. 2005-08-29 14:58:27 +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