Commit Graph

613 Commits (RHEL-7.4)

Author SHA1 Message Date
David Gibson 94993f4fc4 libfdt: Abolish fdt_property_offset()
fdt_property_offset() is the only function in the library returning a
direct offset to a property, and no function takes such an offset
(they only take offsets to nodes, not properties).  Furthermore the
only client uses for this function I can think of involve immediately
translating the offset into a pointer, effectively duplicating the
internal function _fdt_getprop()

This function abolishes fdt_property_offset(), replacing it with
fdt_get_property(), a renamed and now externally visible version of
_fdt_getprop().
2006-12-11 16:15:34 +11: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
David Gibson 1a765f51a4 libfdt: Fixups for 64-bit machines
The error encoding for pointers is incorrect on machines where
sizeof(int) != sizeof(void *), which includes most 64-bit platforms
(in particular, AMD64 and powerpc64).  This patch fixes it.
2006-12-07 15:24:26 +11:00
David Gibson e25487db34 libfdt: Fix libfdt for little endian hosts
This patch fixes a number of embarrasing oversights which meant libfdt
did not work correctly on little endian machines.  With this patch the
testsuite now passes on x86.  Device trees are always created
big-endian.
2006-12-04 12:52:45 +11:00
David Gibson 81bdd52c07 libfdt: Add dtb files to .gitignore
Ignores .dtb files in the tests subdirectory.
2006-12-04 11:17:32 +11:00
David Gibson 7ba551f966 libfdt: Read-write support
This patch adds support for random access, read-write support on flat trees.
2006-12-01 16:59:43 +11:00
David Gibson fe92f6bb75 libfdt: Introduce flat tree format v17
v17 of the blob format adds a field for the size of the structure
block, but is backwards compatible with v16.  This patch introduces
definitions for the new field, and uses it to improve the bounds
checking in the read-only code.  It also cleans up the sequential
write code using it: we no longer need to borrow the version field as
a write pointer.
2006-12-01 16:25:39 +11:00
David Gibson aeddfe2c34 libfdt: Factor out string search function
This patch pulls out the logic for finding a string in the string table
into _fdt_find_string(), from fdt_sw.c's find_add_string().  This function
will be useful for random-access read-write functions.  In the process
clean up the search logic a little.
2006-12-01 15:11:58 +11:00
David Gibson 423697628a libfdt: Implement fdt_move()
Implement the fdt_move() function for copying/moving device trees
to a new buffer, or within an existing buffer.
2006-12-01 15:07:19 +11:00
David Gibson ede25deae6 libfdt: Export accessors for header fields
This patch adds exported accessor macros for the various flat device
tree header fields to libfdt.h.  This necessitates moving some of the
byte-swapping functions.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2006-12-01 15:02:10 +11:00
David Gibson 41722c230c libfdt: Fix logic in nop_property testcase
This patch fixes some completely bogus error checking logic from the
nop_property testcase (resulted from a cut-and-paste error).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2006-12-01 13:10:07 +11:00
David Gibson 65380f164c Add a copy of the GPL
Since the file preamples say it's there, we really should include it.
2006-11-29 16:49:27 +11:00
David Gibson 063693a9e4 libfdt: Sequential write support
This patch adds code to libfdt to create flat trees from scratch, writing
sequentially.
2006-11-29 16:45:46 +11:00
David Gibson 3aa4cfd66b Simplify string table access functions
The range sanity checking on the fdt_string_cmp() function causes problems
for the sequential write code (or at least for using RO functions on an
incomplete SW tree).  Plus they didn't really fit with the philosphy for
the RO code of working as widely as possible on weirdly constructed trees.
2006-11-29 16:34:30 +11:00
David Gibson 156649d4f6 Fix building of dumptrees
Without this rather odd constrained pattern rule, make attempts to build
dumptrees using the default %: %.c rule instead of the defined %: %.o and
%.o: %.c rules.
2006-11-29 13:34:22 +11:00
David Gibson 4e6221c171 Have tests read example tree from a generated file, rather than link it in.
This makes the tests more flexible to re-use for testing the output from
the write tests.
2006-11-28 17:20:01 +11:00
David Gibson 3da0f9a10d libfdt - library for manipulating device trees in flattened format
Initial revision, read-only and "in-place" (no memmove() required)
write operations only.
2006-11-27 16:21:28 +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
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 7f6d12b3a1 Remove unused enum from dtc.h. 2005-07-15 17:20:34 +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