History log of /external/dtc/treesource.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
bad5b28049e5e0562a8ad91797fb77953a53fa20 05-Mar-2017 David Gibson <david@gibson.dropbear.id.au> Fix assorted sparse warnings

This fixes a great many sparse warnings on the fdt and libfdt sources.
These are mostly due to incorrect mixing of endian annotated and native
integer types.

This includes fixing a couple of quasi-bugs where we had endian conversions
the wrong way around (this will have the right effect in practice, but is
certainly conceptually incorrect).

This doesn't make the whole tree sparse clean: there are many warnings in
bison and lex generated code, and there are a handful of other remaining
warnings that are (for now) more trouble than they're worth to fix (and
are not genuine bugs).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
49300f2ade6a6ad9b19957b1fce41fccfe1246a3 05-Mar-2017 David Gibson <david@gibson.dropbear.id.au> dtc: Don't abuse struct fdt_reserve_entry

struct fdt_reserve_entry is defined in fdt.h to exactly mirror the
in-memory layout of a reserve entry in the flattened tree. Since that is
always big-endian, it uses fdt64_t elements, which have sparse annotations
marking them as not native endian.

However, in dtc, we also use struct fdt_reserve_entry inside struct
reserve_info, and use it with native endian values. This will cause sparse
errors.

This stops this abuse, making struct reserve_info have its own native
endian fields for the same information.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
00fbb8696b665ab138406cc9522793f2096031a0 31-May-2016 David Gibson <david@gibson.dropbear.id.au> Rename boot_info

struct boot_info is named that for historical reasons, and isn't
particularly meaningful. Essentially it contains all the information -
in "live" form from a single dts or dtb file. As we move towards support
for dynamic dt overlays, that name will become increasingly bad.

So, in preparation, rename it to dt_info. At the same time rename the
'the_boot_info' global to 'parser_output' since that's its actual purpose.
Unfortunately we do need the global unless we switch to bison's re-entrant
parser extensions, which would introduce its own complications.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
25a9bd6267bf1a2e144344325a71432193eed4b0 19-Jun-2014 Andrei Errapart <andrei@errapartengineering.com> Correct write_propval_bytes() for platforms with signed char by default

Some platforms (including the Microsoft C compiler) have char defaulting
to signed. write_propval_bytes() in the -O dts code will not behave
correctly in this case, due to sign extension.

Signed-off-by: Andrei Errapart <andrei@errapartengineering.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
fa928fba7e1ce94aef58798e77a9261192fdbb01 18-Jun-2014 David Gibson <david@gibson.dropbear.id.au> Fix an off-by-2 error in the source output code

This has been there for ages, but the assertion makes no sense in the
context of the test immediately preceding it. This caused an abort()
when in -I dts -O dts mode with the right sort of internal labels in a
string property value.

Add a testcase for this and another candidate edge case (though this one
we already get right).

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
17119ab0a52df5fb30749d038d796d7e78702e3c 25-Dec-2013 Serge Lamikhov-Center <Serge.Lamikhov@gmail.com> Pass 'unsigned char' type to isdigit()/isspace()/isprint() functions

The isdigit(), isprint(), etc. functions take an int, whose value is
required to be in the range of an _unsigned_ char, or EOF. This, horribly,
means that systems which have a signed char by default need casts to pass
a char variable safely to these functions.

We can't do this more nicely by making the variables themselves 'unsigned
char *' because then we'll get warnings passing them to the strchr() etc.
functions.

At least the cygwin version of these functions, are designed to generate
warnings if this isn't done, as explained by this comment from ctype.h:
These macros are intentionally written in a manner that will trigger
a gcc -Wall warning if the user mistakenly passes a 'char' instead
of an int containing an 'unsigned char'.

Signed-off-by: Serge Lamikhov-Center <Serge.Lamikhov@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
17625371eeea2fa7257361163c52d336a1a98ebc 28-Oct-2013 David Gibson <david@gibson.dropbear.id.au> Use stdbool more widely

We already use the C99 bool type from stdbool.h in a few places. However
there are many other places we represent boolean values as plain ints.
This patch changes that.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
a6e6c60e3a97a6b3a033cd052bb3740fd53cbf4c 07-Feb-2012 Horst Kronstorfer <hkronsto@frequentis.com> dtc: Fix zero-length input segfault

This patch fixes a segmentation fault caused by dereferencing a NULL
pointer (pos->file aka yylloc.file) in srcpos_string when the input
length is 0 (fe 'dtc </dev/null'.) Reason: yylloc.file is initialized
with 0 and the tokenizer, which updates yylloc.file via srcpos_update
doesn't get a chance to run on zero-length input.

Signed-off-by: Horst Kronstorfer <hkronsto@frequentis.com>
/external/dtc/treesource.c
05898c67c15d73fe50bd87fc939bd9ee6a4275ce 24-Feb-2010 David Gibson <david@gibson.dropbear.id.au> dtc: Allow multiple labels on nodes and properties

At present, both the grammar and our internal data structures mean
that there can be only one label on a node or property. This is a
fairly arbitrary constraint, given that any number of value labels can
appear at the same point, and that in C you can have any number of
labels on the same statement.

This is pretty much a non-issue now, but it may become important with
some of the extensions that Grant and I have in mind. It's not that
hard to change, so this patch does so, allowing an arbitrary number of
labels on any given node or property. As usual a testcase is added
too.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
/external/dtc/treesource.c
d68cb36b0bebc7711ada9b750f3c19398c44efb7 08-Dec-2009 David Gibson <david@gibson.dropbear.id.au> dtc: Simpler interface to source file management

This patch cleans up our handling of input files, particularly dts
source files, but also (to an extent) other input files such as those
used by /incbin/ and those used in -I dtb and -I fs modes.

We eliminate the current clunky mechanism which combines search paths
(which we don't actually use at present) with the open relative to
current source file behaviour, which we do.

Instead there's a single srcfile_relative_open() entry point for
callers which opens a new input file relative to the current source
file (which the srcpos code tracks internally). It doesn't currently
do search paths, but we can add that later without messing with the
callers, by drawing the search path from a global (which makes sense
anyway, rather than shuffling it around the rest of the processing
code).

That suffices for non-dts input files. For the actual dts files,
srcfile_push() and srcfile_pop() wrappers open the file while also
keeping track of it as the current source file for future opens.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
c623fe5c21e0358fc38a4e8ddb0d51379f0733e8 09-Sep-2009 David Gibson <david@gibson.dropbear.id.au> Fix bug in -Odts with properties containing multiple terminating nulls

When in -Odts mode, dtc will not produce correct output for
string-like properties which have more than one \0 character at the
end of the property's bytestring. In fact, it generates output which
is not syntactically correct. This patch fixes the bug, and adds a
testcase for future regressions here.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
01a2d8a3e9f19cb1f5ee923af23682fad783a799 04-Aug-2008 David Gibson <david@gibson.dropbear.id.au> dtc: Make many functions 'static'

This patch marks various functions not shared between c files
'static', as they should be. There are a couple of functions in dtc,
and many in the testsuite.

This is *almost* enough to enable the -Wmissing-prototypes warning.
It's not quite enough, because there's a mess of junk in the flex
generated code which triggers that warning which I'm not yet sure how
to deal with.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
1409097db8be6ba662e3808654671554c5803bf0 07-Jul-2008 David Gibson <david@gibson.dropbear.id.au> dtc: Enable and fix -Wcast-qual warnings

Enabling -Wcast-qual warnings in dtc shows up a number of places where
we are incorrectly discarding a const qualification. There are also
some places where we are intentionally discarding the 'const', and we
need an ugly cast through uintptr_t to suppress the warning. However,
most of these are pretty well isolated with the *_w() functions. So
in the interests of maximum safety with const qualifications, this
patch enables the warnings and fixes the existing complaints.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
c8c374b8565081da08e3d1d73df8ddb0d6a66ae3 25-Jun-2008 David Gibson <david@gibson.dropbear.id.au> dtc: Use the same endian-conversion functions as libfdt

Currently both libfdt and dtc define a set of endian conversion macros
for accessing the device tree blob which is always big-endian. libfdt
uses names like cpu_to_fdt32() and dtc uses names like cpu_to_be32 (as
the Linux kernel). This patch switches dtc over to using the libfdt
macros (including libfdt_env.h to supply them). This has a couple of
small advantages:
- Removes some code duplication
- Will make conversion a bit easier if we ever need to produce
little-endian device tree blobs.
- dtc no longer needs to pull in netinet/in.h simply for the
ntohs() and ntohl() functions

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
35aa1a273bc407271f8a1e7b91989b9e6787879c 16-May-2008 David Gibson <david@gibson.dropbear.id.au> dtc: Simplify error handling for unparseable input

Currently, main() tests if it got a valid input tree from whichever
dt_from_*() function it invoked and if not, die()s. For one thing,
this test has, for no good reason, three different ways for those
functions to communicate a failure to provide input (bi NULL, bi->dt
NULL, or bi->error non-zero). For another, in every case save one, if
the dt_from_*() functions are unable to provide input they will
immediately die() (with a more specific error message) rather than
proceeding to the test in main().

Therefore, this patch removes this test, making the one case that
could have triggered it (in dt_from_source()) call die() directly
instead. With this change, the error field in struct boot_info is now
unused, so remove it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
8a88ad8badfe54d91b35c5da25889de0db54f43e 05-Mar-2008 David Gibson <david@gibson.dropbear.id.au> dtc: Remove ugly include stack abuse

Currently, dt_from_source() uses push_input_file() to set up the
initial input file for the lexer. That sounds sensible - put the
outermost input file at the bottom of the stack - until you realise
that what it *actually* does is pushes the current, uninitialized,
lexer input state onto the stack, then sets up the new lexer input.

That necessitates an extra check in pop_input_file(), rather than
signalling termination in the natural way when the include stack is
empty, it has to check when it pops the bogus uninitialized state off
the stack. Ick.

With that fixed, push_input_file(), pop_input_file() and
incl_file_stack itself become local to the lexer, so make them static.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
b2de518b80eb01b1004e137ff2435b03dc40018d 29-Feb-2008 David Gibson <david@gibson.dropbear.id.au> dtc: Make -I dtb mode use fill_fullpaths()

At present -I dts and -I fs modes both use the fill_fullpaths() helper
function to fill in the fullpath and basenamelen fields of struct
node, which are useful in later parts of the code. -I dtb mode,
however, fills these in itself.

This patch simplifies flattree.c by making -I dtb mode use
fill_fullpaths() like the others.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
ad4f54ae2b67ddcd4d128fd4b5c21c66a640d237 04-Jan-2008 Scott Wood <scottwood@freescale.com> Return a non-zero exit code if an error occurs during dts parsing.

Previously, only failure to parse caused the reading of the tree to fail;
semantic errors that called yyerror() but not YYERROR only emitted a message,
without signalling make to stop the build.

Signed-off-by: Scott Wood <scottwood@freescale.com>
/external/dtc/treesource.c
f77fe6a20e75a2289faf86f9b6b529044a07b072 04-Jan-2008 Scott Wood <scottwood@freescale.com> Add yyerrorf() for formatted error messages.

Signed-off-by: Scott Wood <scottwood@freescale.com>
/external/dtc/treesource.c
92cb9a25b1a9117f4dacb0bce8c16b90b73b8698 04-Dec-2007 David Gibson <david@gibson.dropbear.id.au> dtc: Add many const qualifications

This adds 'const' qualifiers to many variables and functions. In
particular it's now used for passing names to the tree accesor
functions.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
dc941774e228779562379a221ddc489d289e8513 22-Nov-2007 David Gibson <david@gibson.dropbear.id.au> dtc: Merge refs and labels into single "markers" list (v2)

Currently, every 'data' object, used to represent property values, has
two lists of fixup structures - one for labels and one for references.
Sometimes we want to look at them separately, but other times we need
to consider both types of fixup.

I'm planning to implement string references, where a full path rather
than a phandle is substituted into a property value. Adding yet
another list of fixups for that would start to get silly. So, this
patch merges the "refs" and "labels" lists into a single list of
"markers", each of which has a type field indicating if it represents
a label or a phandle reference. String references or any other new
type of in-data marker will then just need a new type value - merging
data blocks and other common manipulations will just work.

While I was at it I made some cleanups to the handling of fixups which
simplify things further.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
91967acabdfbff8b44fd3a19f432bc6e690df8cc 07-Nov-2007 David Gibson <david@gibson.dropbear.id.au> dtc: -Odts produces v1 output

This patch alters the -Odts mode output so that it uses dts-v1 format.
This means that dtc -Idts -Odts used on a v0 dts file will convert
that file to v1.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Jon Loeliger <jdl@freescale.com>
/external/dtc/treesource.c
d3ea6e5f96e8b6fb74607b9061836f2bdd57b0af 07-Nov-2007 David Gibson <david@gibson.dropbear.id.au> dtc: Make -Idts -Odts preserve property-internal labels

This patch changes -Odts mode output so that labels within property
values in the input are preserved in the output. Applied on top of
the earlier patch to preserve node and property labels in -Odts mode,
this means that dtc in -Idts -Odts mode will transfer all labels in
the input to the output.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
ed01ae41e2cbbbd26c9efd495b833ba9eb1e062a 07-Nov-2007 David Gibson <david@gibson.dropbear.id.au> dtc: Refactor printing of property values in -Odts mode

Currently the main recursive tree printing function,
write_tree_source_node(), calls guess_type() to apply heuristics to
see how to print a property value, then calls the appropriate
write_propval_*() function to print it.

However, future heuristics for handling internal labels and the like
don't work well this way. Therefore, this patch refactors things to
have write_tree_source_node() call a new write_propval() function,
which incorporates the heurstic logic from guess_type() and also calls
the right function to do the actual printing.

No behavioural change.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
02563ad023122ac2dbd6de6169eaf4b911ddcc7e 02-Nov-2007 David Gibson <david@gibson.dropbear.id.au> dtc: Make -Idts -Odts preserve node/property labels

This patch changes -Odts mode output so that labels on properties,
nodes and memreserve entries in input source are preserved in the
output.

Preserving labels within property values is trickier - another patch
coming later.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
5a98ddd10af0113d80e08946f9ba5dbc99174402 16-Oct-2007 David Gibson <david@gibson.dropbear.id.au> dtc: Improve -Odts output

This patch makes improvements to the way properties are printed when
in dtc is producing dts output.
- Characters which need escaping are now properly handled when
printing properties as strings
- The heuristics for what format to use for a property are
improved so that 'compatible' properties will be displayed as
expected.
- escapes.dts is altered to better demonstrate the changes,
and the string_escapes testcase is adjusted accordingly.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
63dc9c7113cd0fff60d04b05cd8053e70279f9d4 18-Sep-2007 David Gibson <david@gibson.dropbear.id.au> dtc: Whitespace cleanup

This large patch removes all trailing whitespace from dtc (including
libfdt, the testsuite and documentation). It also removes a handful
of redundant blank lines (at the end of functions, or when there are
two blank lines together for no particular reason).

As well as anything else, this means that quilt won't whinge when I go
to convert the whole of libfdt into a patch to apply to the kernel.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/external/dtc/treesource.c
e45e6fd274826991c2b7e01fde4d73110487e0e0 23-Mar-2007 Jon Loeliger <jdl@freescale.com> 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>
/external/dtc/treesource.c
712e52e4386295c6ae9570721c4c91965d747b08 26-Oct-2005 David Gibson <dgibson@sneetch.(none)> Use names for output functions in the form dt_to_*() instead of
write_dt_*() for consistency with the dt_from_*() input functions.
/external/dtc/treesource.c
f040d95b847c4f7d1fa4c3c6309127b8c1ffd8b3 24-Oct-2005 David Gibson <dgibson@sneetch.(none)> Rework tracking of reserve entries during processing. This is initial work
to allow more powerful handling of reserve entries.
/external/dtc/treesource.c
6c0f36769af7e015030d033edf6b10f7ec50318c 29-Aug-2005 David Gibson <dgibson@sneetch.(none)> 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.
/external/dtc/treesource.c
230f253e9b187efd67787f98639aadb15916d0e9 28-Aug-2005 David Gibson <dgibson@sneetch.(none)> Remove an unused function, mark a bunch of other functions and variables
as static. Mostly found by sparse.
/external/dtc/treesource.c
f0517db25008374955e1b09a140413d7e0f499c3 15-Jul-2005 David Gibson <dgibson@sneetch.(none)> Support for specifying memreserve ranges in the source format, based on
a patch by Jon Loeliger <jdl AT freescale.com>, although tweaked
substantially.
/external/dtc/treesource.c
fc14dad7692d84d5f0f547fd0456b3f98526b6cc 08-Jun-2005 David Gibson <dgibson@sneetch.(none)> Initial commit
/external/dtc/treesource.c