mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-28 01:51:33 +00:00
scripts/dtc: Update to upstream version v1.4.4
This adds the following commits from upstream: 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 Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
c0e032e009
commit
d6fc90ced4
14 changed files with 132 additions and 156 deletions
|
@ -72,12 +72,8 @@ struct check {
|
||||||
#define CHECK(_nm, _fn, _d, ...) \
|
#define CHECK(_nm, _fn, _d, ...) \
|
||||||
CHECK_ENTRY(_nm, _fn, _d, false, false, __VA_ARGS__)
|
CHECK_ENTRY(_nm, _fn, _d, false, false, __VA_ARGS__)
|
||||||
|
|
||||||
#ifdef __GNUC__
|
static inline void PRINTF(3, 4) check_msg(struct check *c, struct dt_info *dti,
|
||||||
static inline void check_msg(struct check *c, struct dt_info *dti,
|
const char *fmt, ...)
|
||||||
const char *fmt, ...) __attribute__((format (printf, 3, 4)));
|
|
||||||
#endif
|
|
||||||
static inline void check_msg(struct check *c, struct dt_info *dti,
|
|
||||||
const char *fmt, ...)
|
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
@ -538,13 +534,13 @@ static void fixup_phandle_references(struct check *c, struct dt_info *dti,
|
||||||
FAIL(c, dti, "Reference to non-existent node or "
|
FAIL(c, dti, "Reference to non-existent node or "
|
||||||
"label \"%s\"\n", m->ref);
|
"label \"%s\"\n", m->ref);
|
||||||
else /* mark the entry as unresolved */
|
else /* mark the entry as unresolved */
|
||||||
*((cell_t *)(prop->val.val + m->offset)) =
|
*((fdt32_t *)(prop->val.val + m->offset)) =
|
||||||
cpu_to_fdt32(0xffffffff);
|
cpu_to_fdt32(0xffffffff);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
phandle = get_node_phandle(dt, refnode);
|
phandle = get_node_phandle(dt, refnode);
|
||||||
*((cell_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
|
*((fdt32_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
struct data data_append_integer(struct data d, uint64_t value, int bits)
|
||||||
{
|
{
|
||||||
uint8_t value_8;
|
uint8_t value_8;
|
||||||
uint16_t value_16;
|
fdt16_t value_16;
|
||||||
uint32_t value_32;
|
fdt32_t value_32;
|
||||||
uint64_t value_64;
|
fdt64_t value_64;
|
||||||
|
|
||||||
switch (bits) {
|
switch (bits) {
|
||||||
case 8:
|
case 8:
|
||||||
|
@ -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);
|
re.address = cpu_to_fdt64(address);
|
||||||
bere.size = cpu_to_fdt64(re->size);
|
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)
|
struct data data_append_cell(struct data d, cell_t word)
|
||||||
|
|
|
@ -62,12 +62,7 @@ static int dts_version = 1;
|
||||||
|
|
||||||
static void push_input_file(const char *filename);
|
static void push_input_file(const char *filename);
|
||||||
static bool pop_input_file(void);
|
static bool pop_input_file(void);
|
||||||
#ifdef __GNUC__
|
static void PRINTF(1, 2) lexical_error(const char *fmt, ...);
|
||||||
static void lexical_error(const char *fmt, ...)
|
|
||||||
__attribute__((format (printf, 1, 2)));
|
|
||||||
#else
|
|
||||||
static void lexical_error(const char *fmt, ...);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
|
@ -663,14 +663,9 @@ static int dts_version = 1;
|
||||||
|
|
||||||
static void push_input_file(const char *filename);
|
static void push_input_file(const char *filename);
|
||||||
static bool pop_input_file(void);
|
static bool pop_input_file(void);
|
||||||
#ifdef __GNUC__
|
static void PRINTF(1, 2) lexical_error(const char *fmt, ...);
|
||||||
static void lexical_error(const char *fmt, ...)
|
|
||||||
__attribute__((format (printf, 1, 2)));
|
|
||||||
#else
|
|
||||||
static void lexical_error(const char *fmt, ...);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#line 674 "dtc-lexer.lex.c"
|
#line 669 "dtc-lexer.lex.c"
|
||||||
|
|
||||||
#define INITIAL 0
|
#define INITIAL 0
|
||||||
#define BYTESTRING 1
|
#define BYTESTRING 1
|
||||||
|
@ -861,9 +856,9 @@ YY_DECL
|
||||||
register char *yy_cp, *yy_bp;
|
register char *yy_cp, *yy_bp;
|
||||||
register int yy_act;
|
register int yy_act;
|
||||||
|
|
||||||
#line 74 "dtc-lexer.l"
|
#line 69 "dtc-lexer.l"
|
||||||
|
|
||||||
#line 867 "dtc-lexer.lex.c"
|
#line 862 "dtc-lexer.lex.c"
|
||||||
|
|
||||||
if ( !(yy_init) )
|
if ( !(yy_init) )
|
||||||
{
|
{
|
||||||
|
@ -946,7 +941,7 @@ do_action: /* This label is used only to access EOF actions. */
|
||||||
case 1:
|
case 1:
|
||||||
/* rule 1 can match eol */
|
/* rule 1 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 75 "dtc-lexer.l"
|
#line 70 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
char *name = strchr(yytext, '\"') + 1;
|
char *name = strchr(yytext, '\"') + 1;
|
||||||
yytext[yyleng-1] = '\0';
|
yytext[yyleng-1] = '\0';
|
||||||
|
@ -956,7 +951,7 @@ YY_RULE_SETUP
|
||||||
case 2:
|
case 2:
|
||||||
/* rule 2 can match eol */
|
/* rule 2 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 81 "dtc-lexer.l"
|
#line 76 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
char *line, *fnstart, *fnend;
|
char *line, *fnstart, *fnend;
|
||||||
struct data fn;
|
struct data fn;
|
||||||
|
@ -990,7 +985,7 @@ case YY_STATE_EOF(INITIAL):
|
||||||
case YY_STATE_EOF(BYTESTRING):
|
case YY_STATE_EOF(BYTESTRING):
|
||||||
case YY_STATE_EOF(PROPNODENAME):
|
case YY_STATE_EOF(PROPNODENAME):
|
||||||
case YY_STATE_EOF(V1):
|
case YY_STATE_EOF(V1):
|
||||||
#line 110 "dtc-lexer.l"
|
#line 105 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
if (!pop_input_file()) {
|
if (!pop_input_file()) {
|
||||||
yyterminate();
|
yyterminate();
|
||||||
|
@ -1000,7 +995,7 @@ case YY_STATE_EOF(V1):
|
||||||
case 3:
|
case 3:
|
||||||
/* rule 3 can match eol */
|
/* rule 3 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 116 "dtc-lexer.l"
|
#line 111 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
DPRINT("String: %s\n", yytext);
|
DPRINT("String: %s\n", yytext);
|
||||||
yylval.data = data_copy_escape_string(yytext+1,
|
yylval.data = data_copy_escape_string(yytext+1,
|
||||||
|
@ -1010,7 +1005,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 4:
|
case 4:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 123 "dtc-lexer.l"
|
#line 118 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
DPRINT("Keyword: /dts-v1/\n");
|
DPRINT("Keyword: /dts-v1/\n");
|
||||||
dts_version = 1;
|
dts_version = 1;
|
||||||
|
@ -1020,7 +1015,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 5:
|
case 5:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 130 "dtc-lexer.l"
|
#line 125 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
DPRINT("Keyword: /plugin/\n");
|
DPRINT("Keyword: /plugin/\n");
|
||||||
return DT_PLUGIN;
|
return DT_PLUGIN;
|
||||||
|
@ -1028,7 +1023,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 6:
|
case 6:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 135 "dtc-lexer.l"
|
#line 130 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
DPRINT("Keyword: /memreserve/\n");
|
DPRINT("Keyword: /memreserve/\n");
|
||||||
BEGIN_DEFAULT();
|
BEGIN_DEFAULT();
|
||||||
|
@ -1037,7 +1032,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 7:
|
case 7:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 141 "dtc-lexer.l"
|
#line 136 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
DPRINT("Keyword: /bits/\n");
|
DPRINT("Keyword: /bits/\n");
|
||||||
BEGIN_DEFAULT();
|
BEGIN_DEFAULT();
|
||||||
|
@ -1046,7 +1041,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 8:
|
case 8:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 147 "dtc-lexer.l"
|
#line 142 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
DPRINT("Keyword: /delete-property/\n");
|
DPRINT("Keyword: /delete-property/\n");
|
||||||
DPRINT("<PROPNODENAME>\n");
|
DPRINT("<PROPNODENAME>\n");
|
||||||
|
@ -1056,7 +1051,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 9:
|
case 9:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 154 "dtc-lexer.l"
|
#line 149 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
DPRINT("Keyword: /delete-node/\n");
|
DPRINT("Keyword: /delete-node/\n");
|
||||||
DPRINT("<PROPNODENAME>\n");
|
DPRINT("<PROPNODENAME>\n");
|
||||||
|
@ -1066,7 +1061,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 10:
|
case 10:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 161 "dtc-lexer.l"
|
#line 156 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
DPRINT("Label: %s\n", yytext);
|
DPRINT("Label: %s\n", yytext);
|
||||||
yylval.labelref = xstrdup(yytext);
|
yylval.labelref = xstrdup(yytext);
|
||||||
|
@ -1076,7 +1071,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 11:
|
case 11:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 168 "dtc-lexer.l"
|
#line 163 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
char *e;
|
char *e;
|
||||||
DPRINT("Integer Literal: '%s'\n", yytext);
|
DPRINT("Integer Literal: '%s'\n", yytext);
|
||||||
|
@ -1102,7 +1097,7 @@ YY_RULE_SETUP
|
||||||
case 12:
|
case 12:
|
||||||
/* rule 12 can match eol */
|
/* rule 12 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 190 "dtc-lexer.l"
|
#line 185 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
struct data d;
|
struct data d;
|
||||||
DPRINT("Character literal: %s\n", yytext);
|
DPRINT("Character literal: %s\n", yytext);
|
||||||
|
@ -1126,7 +1121,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 13:
|
case 13:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 211 "dtc-lexer.l"
|
#line 206 "dtc-lexer.l"
|
||||||
{ /* label reference */
|
{ /* label reference */
|
||||||
DPRINT("Ref: %s\n", yytext+1);
|
DPRINT("Ref: %s\n", yytext+1);
|
||||||
yylval.labelref = xstrdup(yytext+1);
|
yylval.labelref = xstrdup(yytext+1);
|
||||||
|
@ -1135,7 +1130,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 14:
|
case 14:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 217 "dtc-lexer.l"
|
#line 212 "dtc-lexer.l"
|
||||||
{ /* new-style path reference */
|
{ /* new-style path reference */
|
||||||
yytext[yyleng-1] = '\0';
|
yytext[yyleng-1] = '\0';
|
||||||
DPRINT("Ref: %s\n", yytext+2);
|
DPRINT("Ref: %s\n", yytext+2);
|
||||||
|
@ -1145,7 +1140,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 15:
|
case 15:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 224 "dtc-lexer.l"
|
#line 219 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
yylval.byte = strtol(yytext, NULL, 16);
|
yylval.byte = strtol(yytext, NULL, 16);
|
||||||
DPRINT("Byte: %02x\n", (int)yylval.byte);
|
DPRINT("Byte: %02x\n", (int)yylval.byte);
|
||||||
|
@ -1154,7 +1149,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 16:
|
case 16:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 230 "dtc-lexer.l"
|
#line 225 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
DPRINT("/BYTESTRING\n");
|
DPRINT("/BYTESTRING\n");
|
||||||
BEGIN_DEFAULT();
|
BEGIN_DEFAULT();
|
||||||
|
@ -1163,7 +1158,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 17:
|
case 17:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 236 "dtc-lexer.l"
|
#line 231 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
DPRINT("PropNodeName: %s\n", yytext);
|
DPRINT("PropNodeName: %s\n", yytext);
|
||||||
yylval.propnodename = xstrdup((yytext[0] == '\\') ?
|
yylval.propnodename = xstrdup((yytext[0] == '\\') ?
|
||||||
|
@ -1174,7 +1169,7 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 18:
|
case 18:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 244 "dtc-lexer.l"
|
#line 239 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
DPRINT("Binary Include\n");
|
DPRINT("Binary Include\n");
|
||||||
return DT_INCBIN;
|
return DT_INCBIN;
|
||||||
|
@ -1183,64 +1178,64 @@ YY_RULE_SETUP
|
||||||
case 19:
|
case 19:
|
||||||
/* rule 19 can match eol */
|
/* rule 19 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 249 "dtc-lexer.l"
|
#line 244 "dtc-lexer.l"
|
||||||
/* eat whitespace */
|
/* eat whitespace */
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 20:
|
case 20:
|
||||||
/* rule 20 can match eol */
|
/* rule 20 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 250 "dtc-lexer.l"
|
#line 245 "dtc-lexer.l"
|
||||||
/* eat C-style comments */
|
/* eat C-style comments */
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 21:
|
case 21:
|
||||||
/* rule 21 can match eol */
|
/* rule 21 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 251 "dtc-lexer.l"
|
#line 246 "dtc-lexer.l"
|
||||||
/* eat C++-style comments */
|
/* eat C++-style comments */
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 22:
|
case 22:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 253 "dtc-lexer.l"
|
#line 248 "dtc-lexer.l"
|
||||||
{ return DT_LSHIFT; };
|
{ return DT_LSHIFT; };
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 23:
|
case 23:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 254 "dtc-lexer.l"
|
#line 249 "dtc-lexer.l"
|
||||||
{ return DT_RSHIFT; };
|
{ return DT_RSHIFT; };
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 24:
|
case 24:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 255 "dtc-lexer.l"
|
#line 250 "dtc-lexer.l"
|
||||||
{ return DT_LE; };
|
{ return DT_LE; };
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 25:
|
case 25:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 256 "dtc-lexer.l"
|
#line 251 "dtc-lexer.l"
|
||||||
{ return DT_GE; };
|
{ return DT_GE; };
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 26:
|
case 26:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 257 "dtc-lexer.l"
|
#line 252 "dtc-lexer.l"
|
||||||
{ return DT_EQ; };
|
{ return DT_EQ; };
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 27:
|
case 27:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 258 "dtc-lexer.l"
|
#line 253 "dtc-lexer.l"
|
||||||
{ return DT_NE; };
|
{ return DT_NE; };
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 28:
|
case 28:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 259 "dtc-lexer.l"
|
#line 254 "dtc-lexer.l"
|
||||||
{ return DT_AND; };
|
{ return DT_AND; };
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 29:
|
case 29:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 260 "dtc-lexer.l"
|
#line 255 "dtc-lexer.l"
|
||||||
{ return DT_OR; };
|
{ return DT_OR; };
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 30:
|
case 30:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 262 "dtc-lexer.l"
|
#line 257 "dtc-lexer.l"
|
||||||
{
|
{
|
||||||
DPRINT("Char: %c (\\x%02x)\n", yytext[0],
|
DPRINT("Char: %c (\\x%02x)\n", yytext[0],
|
||||||
(unsigned)yytext[0]);
|
(unsigned)yytext[0]);
|
||||||
|
@ -1258,10 +1253,10 @@ YY_RULE_SETUP
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 31:
|
case 31:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 277 "dtc-lexer.l"
|
#line 272 "dtc-lexer.l"
|
||||||
ECHO;
|
ECHO;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
#line 1265 "dtc-lexer.lex.c"
|
#line 1260 "dtc-lexer.lex.c"
|
||||||
|
|
||||||
case YY_END_OF_BUFFER:
|
case YY_END_OF_BUFFER:
|
||||||
{
|
{
|
||||||
|
@ -2220,7 +2215,7 @@ void yyfree (void * ptr )
|
||||||
|
|
||||||
#define YYTABLES_NAME "yytables"
|
#define YYTABLES_NAME "yytables"
|
||||||
|
|
||||||
#line 277 "dtc-lexer.l"
|
#line 272 "dtc-lexer.l"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ static const char *guess_type_by_name(const char *fname, const char *fallback)
|
||||||
static const char *guess_input_format(const char *fname, const char *fallback)
|
static const char *guess_input_format(const char *fname, const char *fallback)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
uint32_t magic;
|
fdt32_t magic;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
if (stat(fname, &statbuf) != 0)
|
if (stat(fname, &statbuf) != 0)
|
||||||
|
@ -159,8 +159,7 @@ static const char *guess_input_format(const char *fname, const char *fallback)
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
magic = fdt32_to_cpu(magic);
|
if (fdt32_to_cpu(magic) == FDT_MAGIC)
|
||||||
if (magic == FDT_MAGIC)
|
|
||||||
return "dtb";
|
return "dtb";
|
||||||
|
|
||||||
return guess_type_by_name(fname, fallback);
|
return guess_type_by_name(fname, fallback);
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
#define debug(...)
|
#define debug(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_FDT_VERSION 17
|
#define DEFAULT_FDT_VERSION 17
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -114,7 +113,7 @@ struct data data_insert_at_marker(struct data d, struct marker *m,
|
||||||
struct data data_merge(struct data d1, struct data d2);
|
struct data data_merge(struct data d1, struct data d2);
|
||||||
struct data data_append_cell(struct data d, cell_t word);
|
struct data data_append_cell(struct data d, cell_t word);
|
||||||
struct data data_append_integer(struct data d, uint64_t word, int bits);
|
struct data data_append_integer(struct data d, uint64_t word, 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 data data_append_addr(struct data d, uint64_t addr);
|
struct data data_append_addr(struct data d, uint64_t addr);
|
||||||
struct data data_append_byte(struct data d, uint8_t byte);
|
struct data data_append_byte(struct data d, uint8_t byte);
|
||||||
struct data data_append_zeroes(struct data d, int len);
|
struct data data_append_zeroes(struct data d, int len);
|
||||||
|
@ -227,7 +226,7 @@ uint32_t guess_boot_cpuid(struct node *tree);
|
||||||
/* Boot info (tree plus memreserve information */
|
/* Boot info (tree plus memreserve information */
|
||||||
|
|
||||||
struct reserve_info {
|
struct reserve_info {
|
||||||
struct fdt_reserve_entry re;
|
uint64_t address, size;
|
||||||
|
|
||||||
struct reserve_info *next;
|
struct reserve_info *next;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ static struct version_info {
|
||||||
|
|
||||||
struct emitter {
|
struct emitter {
|
||||||
void (*cell)(void *, cell_t);
|
void (*cell)(void *, cell_t);
|
||||||
void (*string)(void *, char *, int);
|
void (*string)(void *, const char *, int);
|
||||||
void (*align)(void *, int);
|
void (*align)(void *, int);
|
||||||
void (*data)(void *, struct data);
|
void (*data)(void *, struct data);
|
||||||
void (*beginnode)(void *, struct label *labels);
|
void (*beginnode)(void *, struct label *labels);
|
||||||
|
@ -64,7 +64,7 @@ static void bin_emit_cell(void *e, cell_t val)
|
||||||
*dtbuf = data_append_cell(*dtbuf, val);
|
*dtbuf = data_append_cell(*dtbuf, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bin_emit_string(void *e, char *str, int len)
|
static void bin_emit_string(void *e, const char *str, int len)
|
||||||
{
|
{
|
||||||
struct data *dtbuf = e;
|
struct data *dtbuf = e;
|
||||||
|
|
||||||
|
@ -144,22 +144,14 @@ static void asm_emit_cell(void *e, cell_t val)
|
||||||
(val >> 8) & 0xff, val & 0xff);
|
(val >> 8) & 0xff, val & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void asm_emit_string(void *e, char *str, int len)
|
static void asm_emit_string(void *e, const char *str, int len)
|
||||||
{
|
{
|
||||||
FILE *f = e;
|
FILE *f = e;
|
||||||
char c = 0;
|
|
||||||
|
|
||||||
if (len != 0) {
|
if (len != 0)
|
||||||
/* XXX: ewww */
|
fprintf(f, "\t.string\t\"%.*s\"\n", len, str);
|
||||||
c = str[len];
|
else
|
||||||
str[len] = '\0';
|
fprintf(f, "\t.string\t\"%s\"\n", str);
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(f, "\t.string\t\"%s\"\n", str);
|
|
||||||
|
|
||||||
if (len != 0) {
|
|
||||||
str[len] = c;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void asm_emit_align(void *e, int a)
|
static void asm_emit_align(void *e, int a)
|
||||||
|
@ -179,7 +171,7 @@ static void asm_emit_data(void *e, struct data d)
|
||||||
emit_offset_label(f, m->ref, m->offset);
|
emit_offset_label(f, m->ref, m->offset);
|
||||||
|
|
||||||
while ((d.len - off) >= sizeof(uint32_t)) {
|
while ((d.len - off) >= sizeof(uint32_t)) {
|
||||||
asm_emit_cell(e, fdt32_to_cpu(*((uint32_t *)(d.val+off))));
|
asm_emit_cell(e, fdt32_to_cpu(*((fdt32_t *)(d.val+off))));
|
||||||
off += sizeof(uint32_t);
|
off += sizeof(uint32_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,17 +310,16 @@ static struct data flatten_reserve_list(struct reserve_info *reservelist,
|
||||||
{
|
{
|
||||||
struct reserve_info *re;
|
struct reserve_info *re;
|
||||||
struct data d = empty_data;
|
struct data d = empty_data;
|
||||||
static struct fdt_reserve_entry null_re = {0,0};
|
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (re = reservelist; re; re = re->next) {
|
for (re = reservelist; re; re = re->next) {
|
||||||
d = data_append_re(d, &re->re);
|
d = data_append_re(d, re->address, re->size);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Add additional reserved slots if the user asked for them.
|
* Add additional reserved slots if the user asked for them.
|
||||||
*/
|
*/
|
||||||
for (j = 0; j < reservenum; j++) {
|
for (j = 0; j < reservenum; j++) {
|
||||||
d = data_append_re(d, &null_re);
|
d = data_append_re(d, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
|
@ -544,11 +535,11 @@ void dt_to_asm(FILE *f, struct dt_info *dti, int version)
|
||||||
fprintf(f, "\t.globl\t%s\n", l->label);
|
fprintf(f, "\t.globl\t%s\n", l->label);
|
||||||
fprintf(f, "%s:\n", l->label);
|
fprintf(f, "%s:\n", l->label);
|
||||||
}
|
}
|
||||||
ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->re.address >> 32));
|
ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->address >> 32));
|
||||||
ASM_EMIT_BELONG(f, "0x%08x",
|
ASM_EMIT_BELONG(f, "0x%08x",
|
||||||
(unsigned int)(re->re.address & 0xffffffff));
|
(unsigned int)(re->address & 0xffffffff));
|
||||||
ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->re.size >> 32));
|
ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->size >> 32));
|
||||||
ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->re.size & 0xffffffff));
|
ASM_EMIT_BELONG(f, "0x%08x", (unsigned int)(re->size & 0xffffffff));
|
||||||
}
|
}
|
||||||
for (i = 0; i < reservenum; i++) {
|
for (i = 0; i < reservenum; i++) {
|
||||||
fprintf(f, "\t.long\t0, 0\n\t.long\t0, 0\n");
|
fprintf(f, "\t.long\t0, 0\n\t.long\t0, 0\n");
|
||||||
|
@ -609,7 +600,7 @@ static void flat_read_chunk(struct inbuf *inb, void *p, int len)
|
||||||
|
|
||||||
static uint32_t flat_read_word(struct inbuf *inb)
|
static uint32_t flat_read_word(struct inbuf *inb)
|
||||||
{
|
{
|
||||||
uint32_t val;
|
fdt32_t val;
|
||||||
|
|
||||||
assert(((inb->ptr - inb->base) % sizeof(val)) == 0);
|
assert(((inb->ptr - inb->base) % sizeof(val)) == 0);
|
||||||
|
|
||||||
|
@ -718,13 +709,15 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb)
|
||||||
* First pass, count entries.
|
* First pass, count entries.
|
||||||
*/
|
*/
|
||||||
while (1) {
|
while (1) {
|
||||||
|
uint64_t address, size;
|
||||||
|
|
||||||
flat_read_chunk(inb, &re, sizeof(re));
|
flat_read_chunk(inb, &re, sizeof(re));
|
||||||
re.address = fdt64_to_cpu(re.address);
|
address = fdt64_to_cpu(re.address);
|
||||||
re.size = fdt64_to_cpu(re.size);
|
size = fdt64_to_cpu(re.size);
|
||||||
if (re.size == 0)
|
if (size == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
new = build_reserve_entry(re.address, re.size);
|
new = build_reserve_entry(address, size);
|
||||||
reservelist = add_reserve_entry(reservelist, new);
|
reservelist = add_reserve_entry(reservelist, new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,6 +810,7 @@ static struct node *unflatten_tree(struct inbuf *dtbuf,
|
||||||
struct dt_info *dt_from_blob(const char *fname)
|
struct dt_info *dt_from_blob(const char *fname)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
fdt32_t magic_buf, totalsize_buf;
|
||||||
uint32_t magic, totalsize, version, size_dt, boot_cpuid_phys;
|
uint32_t magic, totalsize, version, size_dt, boot_cpuid_phys;
|
||||||
uint32_t off_dt, off_str, off_mem_rsvmap;
|
uint32_t off_dt, off_str, off_mem_rsvmap;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -833,7 +827,7 @@ struct dt_info *dt_from_blob(const char *fname)
|
||||||
|
|
||||||
f = srcfile_relative_open(fname, NULL);
|
f = srcfile_relative_open(fname, NULL);
|
||||||
|
|
||||||
rc = fread(&magic, sizeof(magic), 1, f);
|
rc = fread(&magic_buf, sizeof(magic_buf), 1, f);
|
||||||
if (ferror(f))
|
if (ferror(f))
|
||||||
die("Error reading DT blob magic number: %s\n",
|
die("Error reading DT blob magic number: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
@ -844,11 +838,11 @@ struct dt_info *dt_from_blob(const char *fname)
|
||||||
die("Mysterious short read reading magic number\n");
|
die("Mysterious short read reading magic number\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
magic = fdt32_to_cpu(magic);
|
magic = fdt32_to_cpu(magic_buf);
|
||||||
if (magic != FDT_MAGIC)
|
if (magic != FDT_MAGIC)
|
||||||
die("Blob has incorrect magic number\n");
|
die("Blob has incorrect magic number\n");
|
||||||
|
|
||||||
rc = fread(&totalsize, sizeof(totalsize), 1, f);
|
rc = fread(&totalsize_buf, sizeof(totalsize_buf), 1, f);
|
||||||
if (ferror(f))
|
if (ferror(f))
|
||||||
die("Error reading DT blob size: %s\n", strerror(errno));
|
die("Error reading DT blob size: %s\n", strerror(errno));
|
||||||
if (rc < 1) {
|
if (rc < 1) {
|
||||||
|
@ -858,7 +852,7 @@ struct dt_info *dt_from_blob(const char *fname)
|
||||||
die("Mysterious short read reading blob size\n");
|
die("Mysterious short read reading blob size\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
totalsize = fdt32_to_cpu(totalsize);
|
totalsize = fdt32_to_cpu(totalsize_buf);
|
||||||
if (totalsize < FDT_V1_SIZE)
|
if (totalsize < FDT_V1_SIZE)
|
||||||
die("DT blob size (%d) is too small\n", totalsize);
|
die("DT blob size (%d) is too small\n", totalsize);
|
||||||
|
|
||||||
|
|
|
@ -58,16 +58,16 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef __CHECKER__
|
#ifdef __CHECKER__
|
||||||
#define __force __attribute__((force))
|
#define FDT_FORCE __attribute__((force))
|
||||||
#define __bitwise __attribute__((bitwise))
|
#define FDT_BITWISE __attribute__((bitwise))
|
||||||
#else
|
#else
|
||||||
#define __force
|
#define FDT_FORCE
|
||||||
#define __bitwise
|
#define FDT_BITWISE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef uint16_t __bitwise fdt16_t;
|
typedef uint16_t FDT_BITWISE fdt16_t;
|
||||||
typedef uint32_t __bitwise fdt32_t;
|
typedef uint32_t FDT_BITWISE fdt32_t;
|
||||||
typedef uint64_t __bitwise fdt64_t;
|
typedef uint64_t FDT_BITWISE fdt64_t;
|
||||||
|
|
||||||
#define EXTRACT_BYTE(x, n) ((unsigned long long)((uint8_t *)&x)[n])
|
#define EXTRACT_BYTE(x, n) ((unsigned long long)((uint8_t *)&x)[n])
|
||||||
#define CPU_TO_FDT16(x) ((EXTRACT_BYTE(x, 0) << 8) | EXTRACT_BYTE(x, 1))
|
#define CPU_TO_FDT16(x) ((EXTRACT_BYTE(x, 0) << 8) | EXTRACT_BYTE(x, 1))
|
||||||
|
@ -80,29 +80,29 @@ typedef uint64_t __bitwise fdt64_t;
|
||||||
|
|
||||||
static inline uint16_t fdt16_to_cpu(fdt16_t x)
|
static inline uint16_t fdt16_to_cpu(fdt16_t x)
|
||||||
{
|
{
|
||||||
return (__force uint16_t)CPU_TO_FDT16(x);
|
return (FDT_FORCE uint16_t)CPU_TO_FDT16(x);
|
||||||
}
|
}
|
||||||
static inline fdt16_t cpu_to_fdt16(uint16_t x)
|
static inline fdt16_t cpu_to_fdt16(uint16_t x)
|
||||||
{
|
{
|
||||||
return (__force fdt16_t)CPU_TO_FDT16(x);
|
return (FDT_FORCE fdt16_t)CPU_TO_FDT16(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t fdt32_to_cpu(fdt32_t x)
|
static inline uint32_t fdt32_to_cpu(fdt32_t x)
|
||||||
{
|
{
|
||||||
return (__force uint32_t)CPU_TO_FDT32(x);
|
return (FDT_FORCE uint32_t)CPU_TO_FDT32(x);
|
||||||
}
|
}
|
||||||
static inline fdt32_t cpu_to_fdt32(uint32_t x)
|
static inline fdt32_t cpu_to_fdt32(uint32_t x)
|
||||||
{
|
{
|
||||||
return (__force fdt32_t)CPU_TO_FDT32(x);
|
return (FDT_FORCE fdt32_t)CPU_TO_FDT32(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t fdt64_to_cpu(fdt64_t x)
|
static inline uint64_t fdt64_to_cpu(fdt64_t x)
|
||||||
{
|
{
|
||||||
return (__force uint64_t)CPU_TO_FDT64(x);
|
return (FDT_FORCE uint64_t)CPU_TO_FDT64(x);
|
||||||
}
|
}
|
||||||
static inline fdt64_t cpu_to_fdt64(uint64_t x)
|
static inline fdt64_t cpu_to_fdt64(uint64_t x)
|
||||||
{
|
{
|
||||||
return (__force fdt64_t)CPU_TO_FDT64(x);
|
return (FDT_FORCE fdt64_t)CPU_TO_FDT64(x);
|
||||||
}
|
}
|
||||||
#undef CPU_TO_FDT64
|
#undef CPU_TO_FDT64
|
||||||
#undef CPU_TO_FDT32
|
#undef CPU_TO_FDT32
|
||||||
|
|
|
@ -319,8 +319,8 @@ struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size)
|
||||||
|
|
||||||
memset(new, 0, sizeof(*new));
|
memset(new, 0, sizeof(*new));
|
||||||
|
|
||||||
new->re.address = address;
|
new->address = address;
|
||||||
new->re.size = size;
|
new->size = size;
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ struct property *get_property(struct node *node, const char *propname)
|
||||||
cell_t propval_cell(struct property *prop)
|
cell_t propval_cell(struct property *prop)
|
||||||
{
|
{
|
||||||
assert(prop->val.len == sizeof(cell_t));
|
assert(prop->val.len == sizeof(cell_t));
|
||||||
return fdt32_to_cpu(*((cell_t *)prop->val.val));
|
return fdt32_to_cpu(*((fdt32_t *)prop->val.val));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct property *get_property_by_label(struct node *tree, const char *label,
|
struct property *get_property_by_label(struct node *tree, const char *label,
|
||||||
|
@ -599,13 +599,13 @@ static int cmp_reserve_info(const void *ax, const void *bx)
|
||||||
a = *((const struct reserve_info * const *)ax);
|
a = *((const struct reserve_info * const *)ax);
|
||||||
b = *((const struct reserve_info * const *)bx);
|
b = *((const struct reserve_info * const *)bx);
|
||||||
|
|
||||||
if (a->re.address < b->re.address)
|
if (a->address < b->address)
|
||||||
return -1;
|
return -1;
|
||||||
else if (a->re.address > b->re.address)
|
else if (a->address > b->address)
|
||||||
return 1;
|
return 1;
|
||||||
else if (a->re.size < b->re.size)
|
else if (a->size < b->size)
|
||||||
return -1;
|
return -1;
|
||||||
else if (a->re.size > b->re.size)
|
else if (a->size > b->size)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -902,7 +902,7 @@ static void add_local_fixup_entry(struct dt_info *dti,
|
||||||
struct node *refnode)
|
struct node *refnode)
|
||||||
{
|
{
|
||||||
struct node *wn, *nwn; /* local fixup node, walk node, new */
|
struct node *wn, *nwn; /* local fixup node, walk node, new */
|
||||||
uint32_t value_32;
|
fdt32_t value_32;
|
||||||
char **compp;
|
char **compp;
|
||||||
int i, depth;
|
int i, depth;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
struct srcfile_state {
|
struct srcfile_state {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
@ -106,12 +107,10 @@ extern void srcpos_update(struct srcpos *pos, const char *text, int len);
|
||||||
extern struct srcpos *srcpos_copy(struct srcpos *pos);
|
extern struct srcpos *srcpos_copy(struct srcpos *pos);
|
||||||
extern char *srcpos_string(struct srcpos *pos);
|
extern char *srcpos_string(struct srcpos *pos);
|
||||||
|
|
||||||
extern void srcpos_verror(struct srcpos *pos, const char *prefix,
|
extern void PRINTF(3, 0) srcpos_verror(struct srcpos *pos, const char *prefix,
|
||||||
const char *fmt, va_list va)
|
const char *fmt, va_list va);
|
||||||
__attribute__((format(printf, 3, 0)));
|
extern void PRINTF(3, 4) srcpos_error(struct srcpos *pos, const char *prefix,
|
||||||
extern void srcpos_error(struct srcpos *pos, const char *prefix,
|
const char *fmt, ...);
|
||||||
const char *fmt, ...)
|
|
||||||
__attribute__((format(printf, 3, 4)));
|
|
||||||
|
|
||||||
extern void srcpos_set_line(char *f, int l);
|
extern void srcpos_set_line(char *f, int l);
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ static void write_propval_string(FILE *f, struct data val)
|
||||||
static void write_propval_cells(FILE *f, struct data val)
|
static void write_propval_cells(FILE *f, struct data val)
|
||||||
{
|
{
|
||||||
void *propend = val.val + val.len;
|
void *propend = val.val + val.len;
|
||||||
cell_t *cp = (cell_t *)val.val;
|
fdt32_t *cp = (fdt32_t *)val.val;
|
||||||
struct marker *m = val.markers;
|
struct marker *m = val.markers;
|
||||||
|
|
||||||
fprintf(f, "<");
|
fprintf(f, "<");
|
||||||
|
@ -275,8 +275,8 @@ void dt_to_source(FILE *f, struct dt_info *dti)
|
||||||
for_each_label(re->labels, l)
|
for_each_label(re->labels, l)
|
||||||
fprintf(f, "%s: ", l->label);
|
fprintf(f, "%s: ", l->label);
|
||||||
fprintf(f, "/memreserve/\t0x%016llx 0x%016llx;\n",
|
fprintf(f, "/memreserve/\t0x%016llx 0x%016llx;\n",
|
||||||
(unsigned long long)re->re.address,
|
(unsigned long long)re->address,
|
||||||
(unsigned long long)re->re.size);
|
(unsigned long long)re->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
write_tree_source_node(f, dti->dt, 0);
|
write_tree_source_node(f, dti->dt, 0);
|
||||||
|
|
|
@ -396,7 +396,7 @@ void utilfdt_print_data(const char *data, int len)
|
||||||
} while (s < data + len);
|
} while (s < data + len);
|
||||||
|
|
||||||
} else if ((len % 4) == 0) {
|
} else if ((len % 4) == 0) {
|
||||||
const uint32_t *cell = (const uint32_t *)data;
|
const fdt32_t *cell = (const fdt32_t *)data;
|
||||||
|
|
||||||
printf(" = <");
|
printf(" = <");
|
||||||
for (i = 0, len /= 4; i < len; i++)
|
for (i = 0, len /= 4; i < len; i++)
|
||||||
|
@ -412,15 +412,16 @@ void utilfdt_print_data(const char *data, int len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void util_version(void)
|
void NORETURN util_version(void)
|
||||||
{
|
{
|
||||||
printf("Version: %s\n", DTC_VERSION);
|
printf("Version: %s\n", DTC_VERSION);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void util_usage(const char *errmsg, const char *synopsis,
|
void NORETURN util_usage(const char *errmsg, const char *synopsis,
|
||||||
const char *short_opts, struct option const long_opts[],
|
const char *short_opts,
|
||||||
const char * const opts_help[])
|
struct option const long_opts[],
|
||||||
|
const char * const opts_help[])
|
||||||
{
|
{
|
||||||
FILE *fp = errmsg ? stderr : stdout;
|
FILE *fp = errmsg ? stderr : stdout;
|
||||||
const char a_arg[] = "<arg>";
|
const char a_arg[] = "<arg>";
|
||||||
|
|
|
@ -25,15 +25,17 @@
|
||||||
* USA
|
* USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define PRINTF(i, j) __attribute__((format (printf, i, j)))
|
||||||
|
#define NORETURN __attribute__((noreturn))
|
||||||
|
#else
|
||||||
|
#define PRINTF(i, j)
|
||||||
|
#define NORETURN
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||||
|
|
||||||
#ifdef __GNUC__
|
static inline void NORETURN PRINTF(1, 2) die(const char *str, ...)
|
||||||
static inline void
|
|
||||||
__attribute__((noreturn)) __attribute__((format (printf, 1, 2)))
|
|
||||||
die(const char *str, ...)
|
|
||||||
#else
|
|
||||||
static inline void die(const char *str, ...)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
@ -66,12 +68,7 @@ static inline void *xrealloc(void *p, size_t len)
|
||||||
|
|
||||||
extern char *xstrdup(const char *s);
|
extern char *xstrdup(const char *s);
|
||||||
|
|
||||||
#ifdef __GNUC__
|
extern int PRINTF(2, 3) xasprintf(char **strp, const char *fmt, ...);
|
||||||
extern int __attribute__((format (printf, 2, 3)))
|
|
||||||
xasprintf(char **strp, const char *fmt, ...);
|
|
||||||
#else
|
|
||||||
extern int xasprintf(char **strp, const char *fmt, ...);
|
|
||||||
#endif
|
|
||||||
extern char *join_path(const char *path, const char *name);
|
extern char *join_path(const char *path, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -200,7 +197,7 @@ void utilfdt_print_data(const char *data, int len);
|
||||||
/**
|
/**
|
||||||
* Show source version and exit
|
* Show source version and exit
|
||||||
*/
|
*/
|
||||||
void util_version(void) __attribute__((noreturn));
|
void NORETURN util_version(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show usage and exit
|
* Show usage and exit
|
||||||
|
@ -214,9 +211,10 @@ void util_version(void) __attribute__((noreturn));
|
||||||
* @param long_opts The structure of long options
|
* @param long_opts The structure of long options
|
||||||
* @param opts_help An array of help strings (should align with long_opts)
|
* @param opts_help An array of help strings (should align with long_opts)
|
||||||
*/
|
*/
|
||||||
void util_usage(const char *errmsg, const char *synopsis,
|
void NORETURN util_usage(const char *errmsg, const char *synopsis,
|
||||||
const char *short_opts, struct option const long_opts[],
|
const char *short_opts,
|
||||||
const char * const opts_help[]) __attribute__((noreturn));
|
struct option const long_opts[],
|
||||||
|
const char * const opts_help[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show usage and exit
|
* Show usage and exit
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define DTC_VERSION "DTC 1.4.3"
|
#define DTC_VERSION "DTC 1.4.4"
|
||||||
|
|
Loading…
Add table
Reference in a new issue