2019-06-20 23:19:38 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2005-06-08 09:18:34 +02:00
|
|
|
/*
|
|
|
|
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dtc.h"
|
2007-03-23 21:18:41 +01:00
|
|
|
#include "srcpos.h"
|
2005-06-08 09:18:34 +02:00
|
|
|
|
|
|
|
extern FILE *yyin;
|
|
|
|
extern int yyparse(void);
|
2012-02-07 10:02:53 +01:00
|
|
|
extern YYLTYPE yylloc;
|
2005-07-15 09:14:24 +02:00
|
|
|
|
2016-05-31 03:58:42 +02:00
|
|
|
struct dt_info *parser_output;
|
2013-10-28 11:06:53 +01:00
|
|
|
bool treesource_error;
|
2005-07-15 09:14:24 +02:00
|
|
|
|
2016-05-31 03:58:42 +02:00
|
|
|
struct dt_info *dt_from_source(const char *fname)
|
2005-06-08 09:18:34 +02:00
|
|
|
{
|
2016-05-31 03:58:42 +02:00
|
|
|
parser_output = NULL;
|
2013-10-28 11:06:53 +01:00
|
|
|
treesource_error = false;
|
2005-07-15 09:14:24 +02:00
|
|
|
|
2009-12-08 04:24:42 +01:00
|
|
|
srcfile_push(fname);
|
|
|
|
yyin = current_srcfile->f;
|
2012-02-07 10:02:53 +01:00
|
|
|
yylloc.file = current_srcfile;
|
2007-03-23 21:18:41 +01:00
|
|
|
|
2005-06-08 09:18:34 +02:00
|
|
|
if (yyparse() != 0)
|
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>
2008-05-16 05:21:51 +02:00
|
|
|
die("Unable to parse input tree\n");
|
|
|
|
|
|
|
|
if (treesource_error)
|
|
|
|
die("Syntax error parsing input tree\n");
|
2005-06-08 09:18:34 +02:00
|
|
|
|
2016-05-31 03:58:42 +02:00
|
|
|
return parser_output;
|
2005-06-08 09:18:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void write_prefix(FILE *f, int level)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < level; i++)
|
|
|
|
fputc('\t', f);
|
|
|
|
}
|
|
|
|
|
2013-10-28 11:06:53 +01:00
|
|
|
static bool isstring(char c)
|
2007-10-17 04:39:10 +02:00
|
|
|
{
|
2013-12-25 05:26:03 +01:00
|
|
|
return (isprint((unsigned char)c)
|
2007-10-17 04:39:10 +02:00
|
|
|
|| (c == '\0')
|
|
|
|
|| strchr("\a\b\t\n\v\f\r", c));
|
|
|
|
}
|
|
|
|
|
2018-06-28 23:37:01 +02:00
|
|
|
static void write_propval_string(FILE *f, const char *s, size_t len)
|
2007-10-17 04:39:10 +02:00
|
|
|
{
|
2018-06-28 23:37:01 +02:00
|
|
|
const char *end = s + len - 1;
|
2018-09-26 21:27:08 +02:00
|
|
|
|
|
|
|
if (!len)
|
|
|
|
return;
|
|
|
|
|
2018-06-28 23:37:01 +02:00
|
|
|
assert(*end == '\0');
|
2007-10-17 04:39:10 +02:00
|
|
|
|
2009-09-09 06:38:30 +02:00
|
|
|
fprintf(f, "\"");
|
2018-06-28 23:37:01 +02:00
|
|
|
while (s < end) {
|
|
|
|
char c = *s++;
|
2007-10-17 04:39:10 +02:00
|
|
|
switch (c) {
|
|
|
|
case '\a':
|
|
|
|
fprintf(f, "\\a");
|
|
|
|
break;
|
|
|
|
case '\b':
|
|
|
|
fprintf(f, "\\b");
|
|
|
|
break;
|
|
|
|
case '\t':
|
|
|
|
fprintf(f, "\\t");
|
|
|
|
break;
|
|
|
|
case '\n':
|
|
|
|
fprintf(f, "\\n");
|
|
|
|
break;
|
|
|
|
case '\v':
|
|
|
|
fprintf(f, "\\v");
|
|
|
|
break;
|
|
|
|
case '\f':
|
|
|
|
fprintf(f, "\\f");
|
|
|
|
break;
|
|
|
|
case '\r':
|
|
|
|
fprintf(f, "\\r");
|
|
|
|
break;
|
|
|
|
case '\\':
|
|
|
|
fprintf(f, "\\\\");
|
|
|
|
break;
|
|
|
|
case '\"':
|
|
|
|
fprintf(f, "\\\"");
|
|
|
|
break;
|
|
|
|
case '\0':
|
2018-06-28 23:37:01 +02:00
|
|
|
fprintf(f, "\\0");
|
2007-10-17 04:39:10 +02:00
|
|
|
break;
|
|
|
|
default:
|
2013-12-25 05:26:03 +01:00
|
|
|
if (isprint((unsigned char)c))
|
2007-10-17 04:39:10 +02:00
|
|
|
fprintf(f, "%c", c);
|
|
|
|
else
|
2018-06-28 23:37:01 +02:00
|
|
|
fprintf(f, "\\x%02"PRIx8, c);
|
2007-10-17 04:39:10 +02:00
|
|
|
}
|
|
|
|
}
|
2007-11-07 00:21:20 +01:00
|
|
|
fprintf(f, "\"");
|
2007-10-17 04:39:10 +02:00
|
|
|
}
|
|
|
|
|
2018-06-28 23:37:01 +02:00
|
|
|
static void write_propval_int(FILE *f, const char *p, size_t len, size_t width)
|
2007-10-17 04:39:10 +02:00
|
|
|
{
|
2018-06-28 23:37:01 +02:00
|
|
|
const char *end = p + len;
|
|
|
|
assert(len % width == 0);
|
2007-11-07 00:22:25 +01:00
|
|
|
|
2018-06-28 23:37:01 +02:00
|
|
|
for (; p < end; p += width) {
|
|
|
|
switch (width) {
|
|
|
|
case 1:
|
2018-09-14 20:39:06 +02:00
|
|
|
fprintf(f, "%02"PRIx8, *(const uint8_t*)p);
|
2007-10-17 04:39:10 +02:00
|
|
|
break;
|
2018-06-28 23:37:01 +02:00
|
|
|
case 2:
|
2020-04-14 07:02:51 +02:00
|
|
|
fprintf(f, "0x%02"PRIx16, dtb_ld16(p));
|
2018-06-28 23:37:01 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
2020-04-14 07:02:51 +02:00
|
|
|
fprintf(f, "0x%02"PRIx32, dtb_ld32(p));
|
2018-06-28 23:37:01 +02:00
|
|
|
break;
|
|
|
|
case 8:
|
2020-04-14 07:02:51 +02:00
|
|
|
fprintf(f, "0x%02"PRIx64, dtb_ld64(p));
|
2018-06-28 23:37:01 +02:00
|
|
|
break;
|
|
|
|
}
|
2018-09-14 20:39:06 +02:00
|
|
|
if (p + width < end)
|
|
|
|
fputc(' ', f);
|
2007-11-07 00:22:25 +01:00
|
|
|
}
|
2007-10-17 04:39:10 +02:00
|
|
|
}
|
|
|
|
|
Kill bogus TYPE_BLOB marker type
Since commit 32b9c6130762 "Preserve datatype markers when emitting dts
format", we no longer try to guess the value type. Instead, we reuse
the type of the datatype markers when they are present, if the type
is either TYPE_UINT* or TYPE_STRING.
This causes 'dtc -I fs' to crash:
Starting program: /root/dtc -q -f -O dts -I fs /proc/device-tree
/dts-v1/;
/ {
Program received signal SIGSEGV, Segmentation fault.
__strlen_power8 () at ../sysdeps/powerpc/powerpc64/power8/strlen.S:47
47 ld r12,0(r4) /* Load doubleword from memory. */
(gdb) bt
#0 __strlen_power8 () at ../sysdeps/powerpc/powerpc64/power8/strlen.S:47
#1 0x00007ffff7de3d10 in __GI__IO_fputs (str=<optimized out>,
fp=<optimized out>) at iofputs.c:33
#2 0x000000001000c7a0 in write_propval (prop=0x100525e0,
f=0x7ffff7f718a0 <_IO_2_1_stdout_>) at treesource.c:245
The offending line is:
fprintf(f, "%s", delim_start[emit_type]);
where emit_type is TYPE_BLOB and:
static const char *delim_start[] = {
[TYPE_UINT8] = "[",
[TYPE_UINT16] = "/bits/ 16 <",
[TYPE_UINT32] = "<",
[TYPE_UINT64] = "/bits/ 64 <",
[TYPE_STRING] = "",
};
/* Data blobs */
enum markertype {
TYPE_NONE,
REF_PHANDLE,
REF_PATH,
LABEL,
TYPE_UINT8,
TYPE_UINT16,
TYPE_UINT32,
TYPE_UINT64,
TYPE_BLOB,
TYPE_STRING,
};
Because TYPE_BLOB < TYPE_STRING and delim_start[] is a static array,
delim_start[emit_type] is 0x0. The glibc usually prints out "(null)"
when one passes 0x0 to %s, but it seems to call fputs() internally if
the format is exactly "%s", hence the crash.
TYPE_BLOB basically means the data comes from a file and we don't know
its type. We don't care for the former, and the latter is TYPE_NONE.
So let's drop TYPE_BLOB completely and use TYPE_NONE instead when reading
the file. Then, try to guess the data type at emission time, like the
code already does for refs and labels.
Instead of adding yet another check for TYPE_NONE, an helper is introduced
to check if the data marker has type information, ie, >= TYPE_UINT8.
Fixes: 32b9c61307629ac76c6ac0bead6f926d579b3d2c
Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-08-30 12:01:59 +02:00
|
|
|
static bool has_data_type_information(struct marker *m)
|
|
|
|
{
|
|
|
|
return m->type >= TYPE_UINT8;
|
|
|
|
}
|
|
|
|
|
2018-06-28 23:37:01 +02:00
|
|
|
static struct marker *next_type_marker(struct marker *m)
|
2007-10-17 04:39:10 +02:00
|
|
|
{
|
Kill bogus TYPE_BLOB marker type
Since commit 32b9c6130762 "Preserve datatype markers when emitting dts
format", we no longer try to guess the value type. Instead, we reuse
the type of the datatype markers when they are present, if the type
is either TYPE_UINT* or TYPE_STRING.
This causes 'dtc -I fs' to crash:
Starting program: /root/dtc -q -f -O dts -I fs /proc/device-tree
/dts-v1/;
/ {
Program received signal SIGSEGV, Segmentation fault.
__strlen_power8 () at ../sysdeps/powerpc/powerpc64/power8/strlen.S:47
47 ld r12,0(r4) /* Load doubleword from memory. */
(gdb) bt
#0 __strlen_power8 () at ../sysdeps/powerpc/powerpc64/power8/strlen.S:47
#1 0x00007ffff7de3d10 in __GI__IO_fputs (str=<optimized out>,
fp=<optimized out>) at iofputs.c:33
#2 0x000000001000c7a0 in write_propval (prop=0x100525e0,
f=0x7ffff7f718a0 <_IO_2_1_stdout_>) at treesource.c:245
The offending line is:
fprintf(f, "%s", delim_start[emit_type]);
where emit_type is TYPE_BLOB and:
static const char *delim_start[] = {
[TYPE_UINT8] = "[",
[TYPE_UINT16] = "/bits/ 16 <",
[TYPE_UINT32] = "<",
[TYPE_UINT64] = "/bits/ 64 <",
[TYPE_STRING] = "",
};
/* Data blobs */
enum markertype {
TYPE_NONE,
REF_PHANDLE,
REF_PATH,
LABEL,
TYPE_UINT8,
TYPE_UINT16,
TYPE_UINT32,
TYPE_UINT64,
TYPE_BLOB,
TYPE_STRING,
};
Because TYPE_BLOB < TYPE_STRING and delim_start[] is a static array,
delim_start[emit_type] is 0x0. The glibc usually prints out "(null)"
when one passes 0x0 to %s, but it seems to call fputs() internally if
the format is exactly "%s", hence the crash.
TYPE_BLOB basically means the data comes from a file and we don't know
its type. We don't care for the former, and the latter is TYPE_NONE.
So let's drop TYPE_BLOB completely and use TYPE_NONE instead when reading
the file. Then, try to guess the data type at emission time, like the
code already does for refs and labels.
Instead of adding yet another check for TYPE_NONE, an helper is introduced
to check if the data marker has type information, ie, >= TYPE_UINT8.
Fixes: 32b9c61307629ac76c6ac0bead6f926d579b3d2c
Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-08-30 12:01:59 +02:00
|
|
|
while (m && !has_data_type_information(m))
|
2018-06-28 23:37:01 +02:00
|
|
|
m = m->next;
|
|
|
|
return m;
|
|
|
|
}
|
2007-11-07 00:22:25 +01:00
|
|
|
|
2018-09-11 22:41:30 +02:00
|
|
|
size_t type_marker_length(struct marker *m)
|
2018-06-28 23:37:01 +02:00
|
|
|
{
|
|
|
|
struct marker *next = next_type_marker(m->next);
|
2007-11-07 00:22:25 +01:00
|
|
|
|
2018-06-28 23:37:01 +02:00
|
|
|
if (next)
|
|
|
|
return next->offset - m->offset;
|
|
|
|
return 0;
|
2007-11-07 00:21:20 +01:00
|
|
|
}
|
|
|
|
|
2018-06-28 23:37:01 +02:00
|
|
|
static const char *delim_start[] = {
|
|
|
|
[TYPE_UINT8] = "[",
|
|
|
|
[TYPE_UINT16] = "/bits/ 16 <",
|
|
|
|
[TYPE_UINT32] = "<",
|
|
|
|
[TYPE_UINT64] = "/bits/ 64 <",
|
|
|
|
[TYPE_STRING] = "",
|
|
|
|
};
|
|
|
|
static const char *delim_end[] = {
|
2018-09-14 20:39:06 +02:00
|
|
|
[TYPE_UINT8] = "]",
|
|
|
|
[TYPE_UINT16] = ">",
|
|
|
|
[TYPE_UINT32] = ">",
|
|
|
|
[TYPE_UINT64] = ">",
|
2018-06-28 23:37:01 +02:00
|
|
|
[TYPE_STRING] = "",
|
|
|
|
};
|
|
|
|
|
|
|
|
static enum markertype guess_value_type(struct property *prop)
|
2007-11-07 00:21:20 +01:00
|
|
|
{
|
|
|
|
int len = prop->val.len;
|
2007-12-04 04:26:15 +01:00
|
|
|
const char *p = prop->val.val;
|
2007-11-22 04:39:23 +01:00
|
|
|
struct marker *m = prop->val.markers;
|
2007-11-07 00:21:20 +01:00
|
|
|
int nnotstring = 0, nnul = 0;
|
2007-11-07 00:22:25 +01:00
|
|
|
int nnotstringlbl = 0, nnotcelllbl = 0;
|
2007-11-07 00:21:20 +01:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
if (! isstring(p[i]))
|
|
|
|
nnotstring++;
|
|
|
|
if (p[i] == '\0')
|
|
|
|
nnul++;
|
|
|
|
}
|
|
|
|
|
2007-11-22 04:39:23 +01:00
|
|
|
for_each_marker_of_type(m, LABEL) {
|
|
|
|
if ((m->offset > 0) && (prop->val.val[m->offset - 1] != '\0'))
|
2007-11-07 00:22:25 +01:00
|
|
|
nnotstringlbl++;
|
2007-11-22 04:39:23 +01:00
|
|
|
if ((m->offset % sizeof(cell_t)) != 0)
|
2007-11-07 00:22:25 +01:00
|
|
|
nnotcelllbl++;
|
|
|
|
}
|
2007-11-07 00:21:20 +01:00
|
|
|
|
2020-06-23 11:43:43 +02:00
|
|
|
if ((p[len-1] == '\0') && (nnotstring == 0) && (nnul <= (len-nnul))
|
2007-11-07 00:22:25 +01:00
|
|
|
&& (nnotstringlbl == 0)) {
|
2018-06-28 23:37:01 +02:00
|
|
|
return TYPE_STRING;
|
2007-11-07 00:22:25 +01:00
|
|
|
} else if (((len % sizeof(cell_t)) == 0) && (nnotcelllbl == 0)) {
|
2018-06-28 23:37:01 +02:00
|
|
|
return TYPE_UINT32;
|
2007-11-07 00:21:20 +01:00
|
|
|
}
|
2007-11-07 00:22:25 +01:00
|
|
|
|
2018-06-28 23:37:01 +02:00
|
|
|
return TYPE_UINT8;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void write_propval(FILE *f, struct property *prop)
|
|
|
|
{
|
|
|
|
size_t len = prop->val.len;
|
|
|
|
struct marker *m = prop->val.markers;
|
|
|
|
struct marker dummy_marker;
|
|
|
|
enum markertype emit_type = TYPE_NONE;
|
annotations: add the annotation functionality
Provide the new command-line option:
--annotate (abbreviated -T)
--annotate provides one or more filenames and line numbers indicating
the origin of a given line. The filename is expressed relative the the
filename provided on the command line. Nothing is printed for overlays,
etc.
-T can be repeated giving more verbose annotations. These consist of
one or more tuples of: filename, starting line, starting column, ending
line ending column. The full path is given for the file name.
Overlays, etc are annotated with <no-file>:<no-line>.
The verbose annotations may be too verbose for normal use.
There are numerous changes in srcpos.c to provide the relative filenames
(variables initial_path, initial_pathlen and initial_cpp, new functions
set_initial_path and shorten_to_initial_path, and changes in
srcfile_push and srcpos_set_line). The change in srcpos_set_line takes
care of the case where cpp is used as a preprocessor. In that case the
initial file name is not the one provided on the command line but the
one found at the beginnning of the cpp output.
shorten_to_initial_path only returns a string if it has some shortening
to do. Otherwise it returns NULL and relies on the caller to use the
initial string. This simplifies memory management, by making clear to
the caller whether a new string is allocated.
The new functions srcpos_string_comment, srcpos_string_first, and
srcpos_string_last print the annotations. srcpos_string_comment is
recursive to print a list of source file positions.
Various changes are sprinkled throughout treesource.c to print the
annotations.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-16 17:30:00 +01:00
|
|
|
char *srcstr;
|
2018-06-28 23:37:01 +02:00
|
|
|
|
|
|
|
if (len == 0) {
|
annotations: add the annotation functionality
Provide the new command-line option:
--annotate (abbreviated -T)
--annotate provides one or more filenames and line numbers indicating
the origin of a given line. The filename is expressed relative the the
filename provided on the command line. Nothing is printed for overlays,
etc.
-T can be repeated giving more verbose annotations. These consist of
one or more tuples of: filename, starting line, starting column, ending
line ending column. The full path is given for the file name.
Overlays, etc are annotated with <no-file>:<no-line>.
The verbose annotations may be too verbose for normal use.
There are numerous changes in srcpos.c to provide the relative filenames
(variables initial_path, initial_pathlen and initial_cpp, new functions
set_initial_path and shorten_to_initial_path, and changes in
srcfile_push and srcpos_set_line). The change in srcpos_set_line takes
care of the case where cpp is used as a preprocessor. In that case the
initial file name is not the one provided on the command line but the
one found at the beginnning of the cpp output.
shorten_to_initial_path only returns a string if it has some shortening
to do. Otherwise it returns NULL and relies on the caller to use the
initial string. This simplifies memory management, by making clear to
the caller whether a new string is allocated.
The new functions srcpos_string_comment, srcpos_string_first, and
srcpos_string_last print the annotations. srcpos_string_comment is
recursive to print a list of source file positions.
Various changes are sprinkled throughout treesource.c to print the
annotations.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-16 17:30:00 +01:00
|
|
|
fprintf(f, ";");
|
|
|
|
if (annotate) {
|
|
|
|
srcstr = srcpos_string_first(prop->srcpos, annotate);
|
|
|
|
if (srcstr) {
|
|
|
|
fprintf(f, " /* %s */", srcstr);
|
|
|
|
free(srcstr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fprintf(f, "\n");
|
2018-06-28 23:37:01 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Fix missing labels when emitting dts format
When there is a label inside a sequence of ints at the end of a
property, an assertion is hit because write_propval() expects all the
labels to be at the very end of the property data. This is clearly wrong
behaviour.
To reproduce run: "dtc -O dts tests/label01.dts". dtc fails on property
/randomnode/blob.
Fix by reworking the write_propval() loop to remove the separate
iterating over label markers. Instead handle the label markers as part
of the main marker iteration loop. This guarantees that each label
marker is handled at the right location, even if all the data markers
have already been handled, and has the added advantage of making the
code simpler.
However, a side effect of this code is that a label at the very end of
an int sequence will be emitted outside the sequence delimiters. For
example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 >, L1: L2: < 3 4 > L3: L4:;
The two representations are equivalent in the data model, but the
current test case was looking for the former, but needed to be modified
to look for the later. The alternative would be to render labels before
closing the sequence, but that makes less sense syntactically because
labels between sequences are normally to point at the next one, not the
former. For example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 L1: L2: >, < 3 4 L3: L4: >;
DTC doesn't current have the information to know if the label should be
inside or outside the sequence, but in common usage, it is more likely
that L1 & L2 refer to the second sequence, not the end of the first.
Fixes: 32b9c6130762 ("Preserve datatype markers when emitting dts
format")
Reported-by: Łukasz Dobrowolski <lukasz.dobrowolski@nokia.com>
Signed-off-by: Grant Likely <grant.likely@arm.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-14 15:01:09 +02:00
|
|
|
fprintf(f, " =");
|
2018-06-28 23:37:01 +02:00
|
|
|
|
|
|
|
if (!next_type_marker(m)) {
|
|
|
|
/* data type information missing, need to guess */
|
|
|
|
dummy_marker.type = guess_value_type(prop);
|
|
|
|
dummy_marker.next = prop->val.markers;
|
|
|
|
dummy_marker.offset = 0;
|
|
|
|
dummy_marker.ref = NULL;
|
|
|
|
m = &dummy_marker;
|
|
|
|
}
|
|
|
|
|
|
|
|
for_each_marker(m) {
|
Fix missing labels when emitting dts format
When there is a label inside a sequence of ints at the end of a
property, an assertion is hit because write_propval() expects all the
labels to be at the very end of the property data. This is clearly wrong
behaviour.
To reproduce run: "dtc -O dts tests/label01.dts". dtc fails on property
/randomnode/blob.
Fix by reworking the write_propval() loop to remove the separate
iterating over label markers. Instead handle the label markers as part
of the main marker iteration loop. This guarantees that each label
marker is handled at the right location, even if all the data markers
have already been handled, and has the added advantage of making the
code simpler.
However, a side effect of this code is that a label at the very end of
an int sequence will be emitted outside the sequence delimiters. For
example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 >, L1: L2: < 3 4 > L3: L4:;
The two representations are equivalent in the data model, but the
current test case was looking for the former, but needed to be modified
to look for the later. The alternative would be to render labels before
closing the sequence, but that makes less sense syntactically because
labels between sequences are normally to point at the next one, not the
former. For example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 L1: L2: >, < 3 4 L3: L4: >;
DTC doesn't current have the information to know if the label should be
inside or outside the sequence, but in common usage, it is more likely
that L1 & L2 refer to the second sequence, not the end of the first.
Fixes: 32b9c6130762 ("Preserve datatype markers when emitting dts
format")
Reported-by: Łukasz Dobrowolski <lukasz.dobrowolski@nokia.com>
Signed-off-by: Grant Likely <grant.likely@arm.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-14 15:01:09 +02:00
|
|
|
size_t chunk_len = (m->next ? m->next->offset : len) - m->offset;
|
|
|
|
size_t data_len = type_marker_length(m) ? : len - m->offset;
|
2018-06-28 23:37:01 +02:00
|
|
|
const char *p = &prop->val.val[m->offset];
|
|
|
|
|
Fix missing labels when emitting dts format
When there is a label inside a sequence of ints at the end of a
property, an assertion is hit because write_propval() expects all the
labels to be at the very end of the property data. This is clearly wrong
behaviour.
To reproduce run: "dtc -O dts tests/label01.dts". dtc fails on property
/randomnode/blob.
Fix by reworking the write_propval() loop to remove the separate
iterating over label markers. Instead handle the label markers as part
of the main marker iteration loop. This guarantees that each label
marker is handled at the right location, even if all the data markers
have already been handled, and has the added advantage of making the
code simpler.
However, a side effect of this code is that a label at the very end of
an int sequence will be emitted outside the sequence delimiters. For
example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 >, L1: L2: < 3 4 > L3: L4:;
The two representations are equivalent in the data model, but the
current test case was looking for the former, but needed to be modified
to look for the later. The alternative would be to render labels before
closing the sequence, but that makes less sense syntactically because
labels between sequences are normally to point at the next one, not the
former. For example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 L1: L2: >, < 3 4 L3: L4: >;
DTC doesn't current have the information to know if the label should be
inside or outside the sequence, but in common usage, it is more likely
that L1 & L2 refer to the second sequence, not the end of the first.
Fixes: 32b9c6130762 ("Preserve datatype markers when emitting dts
format")
Reported-by: Łukasz Dobrowolski <lukasz.dobrowolski@nokia.com>
Signed-off-by: Grant Likely <grant.likely@arm.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-14 15:01:09 +02:00
|
|
|
if (has_data_type_information(m)) {
|
|
|
|
emit_type = m->type;
|
|
|
|
fprintf(f, " %s", delim_start[emit_type]);
|
2018-10-10 17:19:30 +02:00
|
|
|
} else if (m->type == LABEL)
|
Fix missing labels when emitting dts format
When there is a label inside a sequence of ints at the end of a
property, an assertion is hit because write_propval() expects all the
labels to be at the very end of the property data. This is clearly wrong
behaviour.
To reproduce run: "dtc -O dts tests/label01.dts". dtc fails on property
/randomnode/blob.
Fix by reworking the write_propval() loop to remove the separate
iterating over label markers. Instead handle the label markers as part
of the main marker iteration loop. This guarantees that each label
marker is handled at the right location, even if all the data markers
have already been handled, and has the added advantage of making the
code simpler.
However, a side effect of this code is that a label at the very end of
an int sequence will be emitted outside the sequence delimiters. For
example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 >, L1: L2: < 3 4 > L3: L4:;
The two representations are equivalent in the data model, but the
current test case was looking for the former, but needed to be modified
to look for the later. The alternative would be to render labels before
closing the sequence, but that makes less sense syntactically because
labels between sequences are normally to point at the next one, not the
former. For example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 L1: L2: >, < 3 4 L3: L4: >;
DTC doesn't current have the information to know if the label should be
inside or outside the sequence, but in common usage, it is more likely
that L1 & L2 refer to the second sequence, not the end of the first.
Fixes: 32b9c6130762 ("Preserve datatype markers when emitting dts
format")
Reported-by: Łukasz Dobrowolski <lukasz.dobrowolski@nokia.com>
Signed-off-by: Grant Likely <grant.likely@arm.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-14 15:01:09 +02:00
|
|
|
fprintf(f, " %s:", m->ref);
|
2018-10-10 17:19:30 +02:00
|
|
|
else if (m->offset)
|
|
|
|
fputc(' ', f);
|
2018-06-28 23:37:01 +02:00
|
|
|
|
Fix missing labels when emitting dts format
When there is a label inside a sequence of ints at the end of a
property, an assertion is hit because write_propval() expects all the
labels to be at the very end of the property data. This is clearly wrong
behaviour.
To reproduce run: "dtc -O dts tests/label01.dts". dtc fails on property
/randomnode/blob.
Fix by reworking the write_propval() loop to remove the separate
iterating over label markers. Instead handle the label markers as part
of the main marker iteration loop. This guarantees that each label
marker is handled at the right location, even if all the data markers
have already been handled, and has the added advantage of making the
code simpler.
However, a side effect of this code is that a label at the very end of
an int sequence will be emitted outside the sequence delimiters. For
example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 >, L1: L2: < 3 4 > L3: L4:;
The two representations are equivalent in the data model, but the
current test case was looking for the former, but needed to be modified
to look for the later. The alternative would be to render labels before
closing the sequence, but that makes less sense syntactically because
labels between sequences are normally to point at the next one, not the
former. For example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 L1: L2: >, < 3 4 L3: L4: >;
DTC doesn't current have the information to know if the label should be
inside or outside the sequence, but in common usage, it is more likely
that L1 & L2 refer to the second sequence, not the end of the first.
Fixes: 32b9c6130762 ("Preserve datatype markers when emitting dts
format")
Reported-by: Łukasz Dobrowolski <lukasz.dobrowolski@nokia.com>
Signed-off-by: Grant Likely <grant.likely@arm.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-14 15:01:09 +02:00
|
|
|
if (emit_type == TYPE_NONE) {
|
|
|
|
assert(chunk_len == 0);
|
2018-06-28 23:37:01 +02:00
|
|
|
continue;
|
Fix missing labels when emitting dts format
When there is a label inside a sequence of ints at the end of a
property, an assertion is hit because write_propval() expects all the
labels to be at the very end of the property data. This is clearly wrong
behaviour.
To reproduce run: "dtc -O dts tests/label01.dts". dtc fails on property
/randomnode/blob.
Fix by reworking the write_propval() loop to remove the separate
iterating over label markers. Instead handle the label markers as part
of the main marker iteration loop. This guarantees that each label
marker is handled at the right location, even if all the data markers
have already been handled, and has the added advantage of making the
code simpler.
However, a side effect of this code is that a label at the very end of
an int sequence will be emitted outside the sequence delimiters. For
example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 >, L1: L2: < 3 4 > L3: L4:;
The two representations are equivalent in the data model, but the
current test case was looking for the former, but needed to be modified
to look for the later. The alternative would be to render labels before
closing the sequence, but that makes less sense syntactically because
labels between sequences are normally to point at the next one, not the
former. For example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 L1: L2: >, < 3 4 L3: L4: >;
DTC doesn't current have the information to know if the label should be
inside or outside the sequence, but in common usage, it is more likely
that L1 & L2 refer to the second sequence, not the end of the first.
Fixes: 32b9c6130762 ("Preserve datatype markers when emitting dts
format")
Reported-by: Łukasz Dobrowolski <lukasz.dobrowolski@nokia.com>
Signed-off-by: Grant Likely <grant.likely@arm.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-14 15:01:09 +02:00
|
|
|
}
|
2018-06-28 23:37:01 +02:00
|
|
|
|
|
|
|
switch(emit_type) {
|
|
|
|
case TYPE_UINT16:
|
|
|
|
write_propval_int(f, p, chunk_len, 2);
|
|
|
|
break;
|
|
|
|
case TYPE_UINT32:
|
|
|
|
write_propval_int(f, p, chunk_len, 4);
|
|
|
|
break;
|
|
|
|
case TYPE_UINT64:
|
|
|
|
write_propval_int(f, p, chunk_len, 8);
|
|
|
|
break;
|
|
|
|
case TYPE_STRING:
|
|
|
|
write_propval_string(f, p, chunk_len);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
write_propval_int(f, p, chunk_len, 1);
|
|
|
|
}
|
|
|
|
|
Fix missing labels when emitting dts format
When there is a label inside a sequence of ints at the end of a
property, an assertion is hit because write_propval() expects all the
labels to be at the very end of the property data. This is clearly wrong
behaviour.
To reproduce run: "dtc -O dts tests/label01.dts". dtc fails on property
/randomnode/blob.
Fix by reworking the write_propval() loop to remove the separate
iterating over label markers. Instead handle the label markers as part
of the main marker iteration loop. This guarantees that each label
marker is handled at the right location, even if all the data markers
have already been handled, and has the added advantage of making the
code simpler.
However, a side effect of this code is that a label at the very end of
an int sequence will be emitted outside the sequence delimiters. For
example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 >, L1: L2: < 3 4 > L3: L4:;
The two representations are equivalent in the data model, but the
current test case was looking for the former, but needed to be modified
to look for the later. The alternative would be to render labels before
closing the sequence, but that makes less sense syntactically because
labels between sequences are normally to point at the next one, not the
former. For example:
Input: intprop = < 1 2 L1: >, L2: < 3 4 L3: > L4:;
Output: intprop = < 1 2 L1: L2: >, < 3 4 L3: L4: >;
DTC doesn't current have the information to know if the label should be
inside or outside the sequence, but in common usage, it is more likely
that L1 & L2 refer to the second sequence, not the end of the first.
Fixes: 32b9c6130762 ("Preserve datatype markers when emitting dts
format")
Reported-by: Łukasz Dobrowolski <lukasz.dobrowolski@nokia.com>
Signed-off-by: Grant Likely <grant.likely@arm.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-14 15:01:09 +02:00
|
|
|
if (chunk_len == data_len) {
|
|
|
|
size_t pos = m->offset + chunk_len;
|
|
|
|
fprintf(f, pos == len ? "%s" : "%s,",
|
|
|
|
delim_end[emit_type] ? : "");
|
|
|
|
emit_type = TYPE_NONE;
|
|
|
|
}
|
2018-06-28 23:37:01 +02:00
|
|
|
}
|
annotations: add the annotation functionality
Provide the new command-line option:
--annotate (abbreviated -T)
--annotate provides one or more filenames and line numbers indicating
the origin of a given line. The filename is expressed relative the the
filename provided on the command line. Nothing is printed for overlays,
etc.
-T can be repeated giving more verbose annotations. These consist of
one or more tuples of: filename, starting line, starting column, ending
line ending column. The full path is given for the file name.
Overlays, etc are annotated with <no-file>:<no-line>.
The verbose annotations may be too verbose for normal use.
There are numerous changes in srcpos.c to provide the relative filenames
(variables initial_path, initial_pathlen and initial_cpp, new functions
set_initial_path and shorten_to_initial_path, and changes in
srcfile_push and srcpos_set_line). The change in srcpos_set_line takes
care of the case where cpp is used as a preprocessor. In that case the
initial file name is not the one provided on the command line but the
one found at the beginnning of the cpp output.
shorten_to_initial_path only returns a string if it has some shortening
to do. Otherwise it returns NULL and relies on the caller to use the
initial string. This simplifies memory management, by making clear to
the caller whether a new string is allocated.
The new functions srcpos_string_comment, srcpos_string_first, and
srcpos_string_last print the annotations. srcpos_string_comment is
recursive to print a list of source file positions.
Various changes are sprinkled throughout treesource.c to print the
annotations.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-16 17:30:00 +01:00
|
|
|
fprintf(f, ";");
|
|
|
|
if (annotate) {
|
|
|
|
srcstr = srcpos_string_first(prop->srcpos, annotate);
|
|
|
|
if (srcstr) {
|
|
|
|
fprintf(f, " /* %s */", srcstr);
|
|
|
|
free(srcstr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fprintf(f, "\n");
|
2007-10-17 04:39:10 +02:00
|
|
|
}
|
2005-07-15 09:14:24 +02:00
|
|
|
|
2005-08-29 04:48:02 +02:00
|
|
|
static void write_tree_source_node(FILE *f, struct node *tree, int level)
|
2005-06-08 09:18:34 +02:00
|
|
|
{
|
|
|
|
struct property *prop;
|
|
|
|
struct node *child;
|
2010-02-24 08:22:17 +01:00
|
|
|
struct label *l;
|
annotations: add the annotation functionality
Provide the new command-line option:
--annotate (abbreviated -T)
--annotate provides one or more filenames and line numbers indicating
the origin of a given line. The filename is expressed relative the the
filename provided on the command line. Nothing is printed for overlays,
etc.
-T can be repeated giving more verbose annotations. These consist of
one or more tuples of: filename, starting line, starting column, ending
line ending column. The full path is given for the file name.
Overlays, etc are annotated with <no-file>:<no-line>.
The verbose annotations may be too verbose for normal use.
There are numerous changes in srcpos.c to provide the relative filenames
(variables initial_path, initial_pathlen and initial_cpp, new functions
set_initial_path and shorten_to_initial_path, and changes in
srcfile_push and srcpos_set_line). The change in srcpos_set_line takes
care of the case where cpp is used as a preprocessor. In that case the
initial file name is not the one provided on the command line but the
one found at the beginnning of the cpp output.
shorten_to_initial_path only returns a string if it has some shortening
to do. Otherwise it returns NULL and relies on the caller to use the
initial string. This simplifies memory management, by making clear to
the caller whether a new string is allocated.
The new functions srcpos_string_comment, srcpos_string_first, and
srcpos_string_last print the annotations. srcpos_string_comment is
recursive to print a list of source file positions.
Various changes are sprinkled throughout treesource.c to print the
annotations.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-16 17:30:00 +01:00
|
|
|
char *srcstr;
|
2005-06-08 09:18:34 +02:00
|
|
|
|
|
|
|
write_prefix(f, level);
|
2010-02-24 08:22:17 +01:00
|
|
|
for_each_label(tree->labels, l)
|
|
|
|
fprintf(f, "%s: ", l->label);
|
2005-06-08 09:18:34 +02:00
|
|
|
if (tree->name && (*tree->name))
|
annotations: add the annotation functionality
Provide the new command-line option:
--annotate (abbreviated -T)
--annotate provides one or more filenames and line numbers indicating
the origin of a given line. The filename is expressed relative the the
filename provided on the command line. Nothing is printed for overlays,
etc.
-T can be repeated giving more verbose annotations. These consist of
one or more tuples of: filename, starting line, starting column, ending
line ending column. The full path is given for the file name.
Overlays, etc are annotated with <no-file>:<no-line>.
The verbose annotations may be too verbose for normal use.
There are numerous changes in srcpos.c to provide the relative filenames
(variables initial_path, initial_pathlen and initial_cpp, new functions
set_initial_path and shorten_to_initial_path, and changes in
srcfile_push and srcpos_set_line). The change in srcpos_set_line takes
care of the case where cpp is used as a preprocessor. In that case the
initial file name is not the one provided on the command line but the
one found at the beginnning of the cpp output.
shorten_to_initial_path only returns a string if it has some shortening
to do. Otherwise it returns NULL and relies on the caller to use the
initial string. This simplifies memory management, by making clear to
the caller whether a new string is allocated.
The new functions srcpos_string_comment, srcpos_string_first, and
srcpos_string_last print the annotations. srcpos_string_comment is
recursive to print a list of source file positions.
Various changes are sprinkled throughout treesource.c to print the
annotations.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-16 17:30:00 +01:00
|
|
|
fprintf(f, "%s {", tree->name);
|
2005-06-08 09:18:34 +02:00
|
|
|
else
|
annotations: add the annotation functionality
Provide the new command-line option:
--annotate (abbreviated -T)
--annotate provides one or more filenames and line numbers indicating
the origin of a given line. The filename is expressed relative the the
filename provided on the command line. Nothing is printed for overlays,
etc.
-T can be repeated giving more verbose annotations. These consist of
one or more tuples of: filename, starting line, starting column, ending
line ending column. The full path is given for the file name.
Overlays, etc are annotated with <no-file>:<no-line>.
The verbose annotations may be too verbose for normal use.
There are numerous changes in srcpos.c to provide the relative filenames
(variables initial_path, initial_pathlen and initial_cpp, new functions
set_initial_path and shorten_to_initial_path, and changes in
srcfile_push and srcpos_set_line). The change in srcpos_set_line takes
care of the case where cpp is used as a preprocessor. In that case the
initial file name is not the one provided on the command line but the
one found at the beginnning of the cpp output.
shorten_to_initial_path only returns a string if it has some shortening
to do. Otherwise it returns NULL and relies on the caller to use the
initial string. This simplifies memory management, by making clear to
the caller whether a new string is allocated.
The new functions srcpos_string_comment, srcpos_string_first, and
srcpos_string_last print the annotations. srcpos_string_comment is
recursive to print a list of source file positions.
Various changes are sprinkled throughout treesource.c to print the
annotations.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-16 17:30:00 +01:00
|
|
|
fprintf(f, "/ {");
|
|
|
|
|
|
|
|
if (annotate) {
|
|
|
|
srcstr = srcpos_string_first(tree->srcpos, annotate);
|
|
|
|
if (srcstr) {
|
|
|
|
fprintf(f, " /* %s */", srcstr);
|
|
|
|
free(srcstr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fprintf(f, "\n");
|
2005-06-08 09:18:34 +02:00
|
|
|
|
|
|
|
for_each_property(tree, prop) {
|
2007-11-02 06:10:30 +01:00
|
|
|
write_prefix(f, level+1);
|
2010-02-24 08:22:17 +01:00
|
|
|
for_each_label(prop->labels, l)
|
|
|
|
fprintf(f, "%s: ", l->label);
|
2007-11-02 06:10:30 +01:00
|
|
|
fprintf(f, "%s", prop->name);
|
2007-11-07 00:21:20 +01:00
|
|
|
write_propval(f, prop);
|
2005-06-08 09:18:34 +02:00
|
|
|
}
|
|
|
|
for_each_child(tree, child) {
|
|
|
|
fprintf(f, "\n");
|
2005-07-15 09:14:24 +02:00
|
|
|
write_tree_source_node(f, child, level+1);
|
2005-06-08 09:18:34 +02:00
|
|
|
}
|
|
|
|
write_prefix(f, level);
|
annotations: add the annotation functionality
Provide the new command-line option:
--annotate (abbreviated -T)
--annotate provides one or more filenames and line numbers indicating
the origin of a given line. The filename is expressed relative the the
filename provided on the command line. Nothing is printed for overlays,
etc.
-T can be repeated giving more verbose annotations. These consist of
one or more tuples of: filename, starting line, starting column, ending
line ending column. The full path is given for the file name.
Overlays, etc are annotated with <no-file>:<no-line>.
The verbose annotations may be too verbose for normal use.
There are numerous changes in srcpos.c to provide the relative filenames
(variables initial_path, initial_pathlen and initial_cpp, new functions
set_initial_path and shorten_to_initial_path, and changes in
srcfile_push and srcpos_set_line). The change in srcpos_set_line takes
care of the case where cpp is used as a preprocessor. In that case the
initial file name is not the one provided on the command line but the
one found at the beginnning of the cpp output.
shorten_to_initial_path only returns a string if it has some shortening
to do. Otherwise it returns NULL and relies on the caller to use the
initial string. This simplifies memory management, by making clear to
the caller whether a new string is allocated.
The new functions srcpos_string_comment, srcpos_string_first, and
srcpos_string_last print the annotations. srcpos_string_comment is
recursive to print a list of source file positions.
Various changes are sprinkled throughout treesource.c to print the
annotations.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-11-16 17:30:00 +01:00
|
|
|
fprintf(f, "};");
|
|
|
|
if (annotate) {
|
|
|
|
srcstr = srcpos_string_last(tree->srcpos, annotate);
|
|
|
|
if (srcstr) {
|
|
|
|
fprintf(f, " /* %s */", srcstr);
|
|
|
|
free(srcstr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fprintf(f, "\n");
|
2005-06-08 09:18:34 +02:00
|
|
|
}
|
2005-07-15 09:14:24 +02:00
|
|
|
|
2016-05-31 03:58:42 +02:00
|
|
|
void dt_to_source(FILE *f, struct dt_info *dti)
|
2005-07-15 09:14:24 +02:00
|
|
|
{
|
2005-10-24 10:18:38 +02:00
|
|
|
struct reserve_info *re;
|
2005-07-15 09:14:24 +02:00
|
|
|
|
2007-11-07 01:17:37 +01:00
|
|
|
fprintf(f, "/dts-v1/;\n\n");
|
|
|
|
|
2016-05-31 03:58:42 +02:00
|
|
|
for (re = dti->reservelist; re; re = re->next) {
|
2010-02-24 08:22:17 +01:00
|
|
|
struct label *l;
|
|
|
|
|
|
|
|
for_each_label(re->labels, l)
|
|
|
|
fprintf(f, "%s: ", l->label);
|
2007-11-07 01:17:37 +01:00
|
|
|
fprintf(f, "/memreserve/\t0x%016llx 0x%016llx;\n",
|
2017-03-06 02:04:45 +01:00
|
|
|
(unsigned long long)re->address,
|
|
|
|
(unsigned long long)re->size);
|
2005-07-15 09:14:24 +02:00
|
|
|
}
|
|
|
|
|
2016-05-31 03:58:42 +02:00
|
|
|
write_tree_source_node(f, dti->dt, 0);
|
2005-07-15 09:14:24 +02:00
|
|
|
}
|