Skip to content

Commit

Permalink
scripts/dtc: Update to upstream version v1.4.4-8-g756ffc4f52f6
Browse files Browse the repository at this point in the history
This adds the following commits from upstream:

756ffc4f52f6 Build pylibfdt as part of the normal build process
8cb3896358e9 Adjust libfdt.h to work with swig
b40aa8359aff Mention pylibfdt in the documentation
12cfb740cc76 Add tests for pylibfdt
50f250701631 Add an initial Python library for libfdt
cdbb2b6c7a3a checks: Warn on node name unit-addresses with '0x' or leading 0s
4c15d5da17cc checks: Add bus checks for simple-bus buses
33c3985226d3 checks: Add bus checks for PCI buses
558cd81bdd43 dtc: Bump version to v1.4.4
c17a811c62eb fdtput: Remove star from value_len documentation
194d5caaefcb fdtget: Use @return to document the return value
d922ecdd017b tests: Make realloc_fdt() really allocate *fdt
921cc17fec29 libfdt: overlay: Check the value of the right variable
9ffdf60bf463 dtc: Simplify asm_emit_string() implementation
881012e44386 libfdt: Change names of sparse helper macros
bad5b28049e5 Fix assorted sparse warnings
672ac09ea04d Clean up gcc attributes
49300f2ade6a dtc: Don't abuse struct fdt_reserve_entry
fa8bc7f928ac dtc: Bump version to v1.4.3
34a9886a177f Add printf format attributes
f72508e2b6ca Correct some broken printf() like format mismatches
397d5ef0203c libfdt: Add fdt_setprop_empty()
69a1bd6ad3f9 libfdt: Remove undefined behaviour setting empty properties
acd1b534a592 Print output filename as part of warning messages
120775eb1cf3 dtc: Use streq() in preference to strcmp()
852e9ecbe197 checks: Add Warning for stricter node name character checking
ef0e8f061534 checks: Add Warning for stricter property name character checking
00d7bb1f4b0e dtc: pos parameter to srcpos_string() can't be NULL
95d57726bca4 livetree.c: Fix memory leak
3b9c97093d6e dtc: Fix NULL pointer use in dtlabel + dtref case
43eb551426ea manual: Fix typo it -> in
4baf15f7f13f Makefile: Add tags rule

Signed-off-by: Rob Herring <[email protected]>
  • Loading branch information
robherring committed Mar 22, 2017
1 parent 86cef61 commit 89d1231
Show file tree
Hide file tree
Showing 19 changed files with 523 additions and 182 deletions.
361 changes: 319 additions & 42 deletions scripts/dtc/checks.c

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions scripts/dtc/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ struct data data_merge(struct data d1, struct data d2)
struct data data_append_integer(struct data d, uint64_t value, int bits)
{
uint8_t value_8;
uint16_t value_16;
uint32_t value_32;
uint64_t value_64;
fdt16_t value_16;
fdt32_t value_32;
fdt64_t value_64;

switch (bits) {
case 8:
Expand All @@ -197,14 +197,14 @@ struct data data_append_integer(struct data d, uint64_t value, int bits)
}
}

struct data data_append_re(struct data d, const struct fdt_reserve_entry *re)
struct data data_append_re(struct data d, uint64_t address, uint64_t size)
{
struct fdt_reserve_entry bere;
struct fdt_reserve_entry re;

bere.address = cpu_to_fdt64(re->address);
bere.size = cpu_to_fdt64(re->size);
re.address = cpu_to_fdt64(address);
re.size = cpu_to_fdt64(size);

return data_append_data(d, &bere, sizeof(bere));
return data_append_data(d, &re, sizeof(re));
}

struct data data_append_cell(struct data d, cell_t word)
Expand Down
3 changes: 2 additions & 1 deletion scripts/dtc/dtc-lexer.l
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ static int dts_version = 1;

static void push_input_file(const char *filename);
static bool pop_input_file(void);
static void lexical_error(const char *fmt, ...);
static void PRINTF(1, 2) lexical_error(const char *fmt, ...);

%}

%%
Expand Down
77 changes: 39 additions & 38 deletions scripts/dtc/dtc-lexer.lex.c_shipped
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,9 @@ static int dts_version = 1;

static void push_input_file(const char *filename);
static bool pop_input_file(void);
static void lexical_error(const char *fmt, ...);
#line 660 "dtc-lexer.lex.c"
static void PRINTF(1, 2) lexical_error(const char *fmt, ...);

#line 661 "dtc-lexer.lex.c"

#define INITIAL 0
#define BYTESTRING 1
Expand Down Expand Up @@ -878,9 +879,9 @@ YY_DECL
}

{
#line 68 "dtc-lexer.l"
#line 69 "dtc-lexer.l"

#line 884 "dtc-lexer.lex.c"
#line 885 "dtc-lexer.lex.c"

while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
Expand Down Expand Up @@ -937,7 +938,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
/* rule 1 can match eol */
YY_RULE_SETUP
#line 69 "dtc-lexer.l"
#line 70 "dtc-lexer.l"
{
char *name = strchr(yytext, '\"') + 1;
yytext[yyleng-1] = '\0';
Expand All @@ -947,7 +948,7 @@ YY_RULE_SETUP
case 2:
/* rule 2 can match eol */
YY_RULE_SETUP
#line 75 "dtc-lexer.l"
#line 76 "dtc-lexer.l"
{
char *line, *fnstart, *fnend;
struct data fn;
Expand Down Expand Up @@ -981,7 +982,7 @@ case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(BYTESTRING):
case YY_STATE_EOF(PROPNODENAME):
case YY_STATE_EOF(V1):
#line 104 "dtc-lexer.l"
#line 105 "dtc-lexer.l"
{
if (!pop_input_file()) {
yyterminate();
Expand All @@ -991,7 +992,7 @@ case YY_STATE_EOF(V1):
case 3:
/* rule 3 can match eol */
YY_RULE_SETUP
#line 110 "dtc-lexer.l"
#line 111 "dtc-lexer.l"
{
DPRINT("String: %s\n", yytext);
yylval.data = data_copy_escape_string(yytext+1,
Expand All @@ -1001,7 +1002,7 @@ YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
#line 117 "dtc-lexer.l"
#line 118 "dtc-lexer.l"
{
DPRINT("Keyword: /dts-v1/\n");
dts_version = 1;
Expand All @@ -1011,15 +1012,15 @@ YY_RULE_SETUP
YY_BREAK
case 5:
YY_RULE_SETUP
#line 124 "dtc-lexer.l"
#line 125 "dtc-lexer.l"
{
DPRINT("Keyword: /plugin/\n");
return DT_PLUGIN;
}
YY_BREAK
case 6:
YY_RULE_SETUP
#line 129 "dtc-lexer.l"
#line 130 "dtc-lexer.l"
{
DPRINT("Keyword: /memreserve/\n");
BEGIN_DEFAULT();
Expand All @@ -1028,7 +1029,7 @@ YY_RULE_SETUP
YY_BREAK
case 7:
YY_RULE_SETUP
#line 135 "dtc-lexer.l"
#line 136 "dtc-lexer.l"
{
DPRINT("Keyword: /bits/\n");
BEGIN_DEFAULT();
Expand All @@ -1037,7 +1038,7 @@ YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
#line 141 "dtc-lexer.l"
#line 142 "dtc-lexer.l"
{
DPRINT("Keyword: /delete-property/\n");
DPRINT("<PROPNODENAME>\n");
Expand All @@ -1047,7 +1048,7 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
#line 148 "dtc-lexer.l"
#line 149 "dtc-lexer.l"
{
DPRINT("Keyword: /delete-node/\n");
DPRINT("<PROPNODENAME>\n");
Expand All @@ -1057,7 +1058,7 @@ YY_RULE_SETUP
YY_BREAK
case 10:
YY_RULE_SETUP
#line 155 "dtc-lexer.l"
#line 156 "dtc-lexer.l"
{
DPRINT("Label: %s\n", yytext);
yylval.labelref = xstrdup(yytext);
Expand All @@ -1067,7 +1068,7 @@ YY_RULE_SETUP
YY_BREAK
case 11:
YY_RULE_SETUP
#line 162 "dtc-lexer.l"
#line 163 "dtc-lexer.l"
{
char *e;
DPRINT("Integer Literal: '%s'\n", yytext);
Expand All @@ -1093,7 +1094,7 @@ YY_RULE_SETUP
case 12:
/* rule 12 can match eol */
YY_RULE_SETUP
#line 184 "dtc-lexer.l"
#line 185 "dtc-lexer.l"
{
struct data d;
DPRINT("Character literal: %s\n", yytext);
Expand All @@ -1117,7 +1118,7 @@ YY_RULE_SETUP
YY_BREAK
case 13:
YY_RULE_SETUP
#line 205 "dtc-lexer.l"
#line 206 "dtc-lexer.l"
{ /* label reference */
DPRINT("Ref: %s\n", yytext+1);
yylval.labelref = xstrdup(yytext+1);
Expand All @@ -1126,7 +1127,7 @@ YY_RULE_SETUP
YY_BREAK
case 14:
YY_RULE_SETUP
#line 211 "dtc-lexer.l"
#line 212 "dtc-lexer.l"
{ /* new-style path reference */
yytext[yyleng-1] = '\0';
DPRINT("Ref: %s\n", yytext+2);
Expand All @@ -1136,7 +1137,7 @@ YY_RULE_SETUP
YY_BREAK
case 15:
YY_RULE_SETUP
#line 218 "dtc-lexer.l"
#line 219 "dtc-lexer.l"
{
yylval.byte = strtol(yytext, NULL, 16);
DPRINT("Byte: %02x\n", (int)yylval.byte);
Expand All @@ -1145,7 +1146,7 @@ YY_RULE_SETUP
YY_BREAK
case 16:
YY_RULE_SETUP
#line 224 "dtc-lexer.l"
#line 225 "dtc-lexer.l"
{
DPRINT("/BYTESTRING\n");
BEGIN_DEFAULT();
Expand All @@ -1154,7 +1155,7 @@ YY_RULE_SETUP
YY_BREAK
case 17:
YY_RULE_SETUP
#line 230 "dtc-lexer.l"
#line 231 "dtc-lexer.l"
{
DPRINT("PropNodeName: %s\n", yytext);
yylval.propnodename = xstrdup((yytext[0] == '\\') ?
Expand All @@ -1165,7 +1166,7 @@ YY_RULE_SETUP
YY_BREAK
case 18:
YY_RULE_SETUP
#line 238 "dtc-lexer.l"
#line 239 "dtc-lexer.l"
{
DPRINT("Binary Include\n");
return DT_INCBIN;
Expand All @@ -1174,64 +1175,64 @@ YY_RULE_SETUP
case 19:
/* rule 19 can match eol */
YY_RULE_SETUP
#line 243 "dtc-lexer.l"
#line 244 "dtc-lexer.l"
/* eat whitespace */
YY_BREAK
case 20:
/* rule 20 can match eol */
YY_RULE_SETUP
#line 244 "dtc-lexer.l"
#line 245 "dtc-lexer.l"
/* eat C-style comments */
YY_BREAK
case 21:
/* rule 21 can match eol */
YY_RULE_SETUP
#line 245 "dtc-lexer.l"
#line 246 "dtc-lexer.l"
/* eat C++-style comments */
YY_BREAK
case 22:
YY_RULE_SETUP
#line 247 "dtc-lexer.l"
#line 248 "dtc-lexer.l"
{ return DT_LSHIFT; };
YY_BREAK
case 23:
YY_RULE_SETUP
#line 248 "dtc-lexer.l"
#line 249 "dtc-lexer.l"
{ return DT_RSHIFT; };
YY_BREAK
case 24:
YY_RULE_SETUP
#line 249 "dtc-lexer.l"
#line 250 "dtc-lexer.l"
{ return DT_LE; };
YY_BREAK
case 25:
YY_RULE_SETUP
#line 250 "dtc-lexer.l"
#line 251 "dtc-lexer.l"
{ return DT_GE; };
YY_BREAK
case 26:
YY_RULE_SETUP
#line 251 "dtc-lexer.l"
#line 252 "dtc-lexer.l"
{ return DT_EQ; };
YY_BREAK
case 27:
YY_RULE_SETUP
#line 252 "dtc-lexer.l"
#line 253 "dtc-lexer.l"
{ return DT_NE; };
YY_BREAK
case 28:
YY_RULE_SETUP
#line 253 "dtc-lexer.l"
#line 254 "dtc-lexer.l"
{ return DT_AND; };
YY_BREAK
case 29:
YY_RULE_SETUP
#line 254 "dtc-lexer.l"
#line 255 "dtc-lexer.l"
{ return DT_OR; };
YY_BREAK
case 30:
YY_RULE_SETUP
#line 256 "dtc-lexer.l"
#line 257 "dtc-lexer.l"
{
DPRINT("Char: %c (\\x%02x)\n", yytext[0],
(unsigned)yytext[0]);
Expand All @@ -1249,10 +1250,10 @@ YY_RULE_SETUP
YY_BREAK
case 31:
YY_RULE_SETUP
#line 271 "dtc-lexer.l"
#line 272 "dtc-lexer.l"
ECHO;
YY_BREAK
#line 1256 "dtc-lexer.lex.c"
#line 1257 "dtc-lexer.lex.c"

case YY_END_OF_BUFFER:
{
Expand Down Expand Up @@ -2218,7 +2219,7 @@ void yyfree (void * ptr )

#define YYTABLES_NAME "yytables"

#line 271 "dtc-lexer.l"
#line 272 "dtc-lexer.l"



Expand Down
6 changes: 3 additions & 3 deletions scripts/dtc/dtc-parser.tab.c_shipped
Original file line number Diff line number Diff line change
Expand Up @@ -1557,10 +1557,10 @@ yyreduce:
{
struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));

add_label(&target->labels, (yyvsp[-2].labelref));
if (target)
if (target) {
add_label(&target->labels, (yyvsp[-2].labelref));
merge_nodes(target, (yyvsp[0].node));
else
} else
ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
(yyval.node) = (yyvsp[-3].node);
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/dtc/dtc-parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ devicetree:
{
struct node *target = get_node_by_ref($1, $3);

add_label(&target->labels, $2);
if (target)
if (target) {
add_label(&target->labels, $2);
merge_nodes(target, $4);
else
} else
ERROR(&@3, "Label or path %s not found", $3);
$$ = $1;
}
Expand Down
Loading

0 comments on commit 89d1231

Please sign in to comment.