aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2008-08-06 22:24:17 -0400
committerPaul Mackerras <paulus@samba.org>2008-08-20 02:34:58 -0400
commited95d7450dcbfeb45ffc9d39b1747aee82b49a51 (patch)
treefaca7d89e2907e1407161f967477ed2ae21d46bb /arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped
parent0ec27c049d80535f77901654a310b090106b046c (diff)
powerpc: Update in-kernel dtc and libfdt to version 1.2.0
Some time ago, a copies of the upstream dtc and libfdt sources were included in the kernel tree to avoid having these as external dependencies for building the kernel. Since then development on the upstream dtc and libfdt has continued. This updates the in-kernel versions to match the recently released upstream dtc version 1.2.0. This includes a number of bugfixes, many cleanups and a few new features. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped')
-rw-r--r--arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped387
1 files changed, 222 insertions, 165 deletions
diff --git a/arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped b/arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped
index 28e6ec0296a1..27129377e5d2 100644
--- a/arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped
+++ b/arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped
@@ -75,7 +75,8 @@
75 DT_BYTE = 264, 75 DT_BYTE = 264,
76 DT_STRING = 265, 76 DT_STRING = 265,
77 DT_LABEL = 266, 77 DT_LABEL = 266,
78 DT_REF = 267 78 DT_REF = 267,
79 DT_INCBIN = 268
79 }; 80 };
80#endif 81#endif
81/* Tokens. */ 82/* Tokens. */
@@ -89,6 +90,7 @@
89#define DT_STRING 265 90#define DT_STRING 265
90#define DT_LABEL 266 91#define DT_LABEL 266
91#define DT_REF 267 92#define DT_REF 267
93#define DT_INCBIN 268
92 94
93 95
94 96
@@ -96,14 +98,17 @@
96/* Copy the first part of user declarations. */ 98/* Copy the first part of user declarations. */
97#line 23 "dtc-parser.y" 99#line 23 "dtc-parser.y"
98 100
101#include <stdio.h>
102
99#include "dtc.h" 103#include "dtc.h"
100#include "srcpos.h" 104#include "srcpos.h"
101 105
102int yylex(void); 106extern int yylex(void);
103unsigned long long eval_literal(const char *s, int base, int bits);
104 107
105extern struct boot_info *the_boot_info; 108extern struct boot_info *the_boot_info;
109extern int treesource_error;
106 110
111static unsigned long long eval_literal(const char *s, int base, int bits);
107 112
108 113
109/* Enabling traces. */ 114/* Enabling traces. */
@@ -126,16 +131,16 @@ extern struct boot_info *the_boot_info;
126 131
127#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 132#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
128typedef union YYSTYPE 133typedef union YYSTYPE
129#line 34 "dtc-parser.y" 134#line 37 "dtc-parser.y"
130{ 135{
131 char *propnodename; 136 char *propnodename;
132 char *literal; 137 char *literal;
133 char *labelref; 138 char *labelref;
134 unsigned int cbase; 139 unsigned int cbase;
135 u8 byte; 140 uint8_t byte;
136 struct data data; 141 struct data data;
137 142
138 u64 addr; 143 uint64_t addr;
139 cell_t cell; 144 cell_t cell;
140 struct property *prop; 145 struct property *prop;
141 struct property *proplist; 146 struct property *proplist;
@@ -144,7 +149,7 @@ typedef union YYSTYPE
144 struct reserve_info *re; 149 struct reserve_info *re;
145} 150}
146/* Line 187 of yacc.c. */ 151/* Line 187 of yacc.c. */
147#line 148 "dtc-parser.tab.c" 152#line 153 "dtc-parser.tab.c"
148 YYSTYPE; 153 YYSTYPE;
149# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 154# define yystype YYSTYPE /* obsolescent; will be withdrawn */
150# define YYSTYPE_IS_DECLARED 1 155# define YYSTYPE_IS_DECLARED 1
@@ -169,7 +174,7 @@ typedef struct YYLTYPE
169 174
170 175
171/* Line 216 of yacc.c. */ 176/* Line 216 of yacc.c. */
172#line 173 "dtc-parser.tab.c" 177#line 178 "dtc-parser.tab.c"
173 178
174#ifdef short 179#ifdef short
175# undef short 180# undef short
@@ -386,20 +391,20 @@ union yyalloc
386/* YYFINAL -- State number of the termination state. */ 391/* YYFINAL -- State number of the termination state. */
387#define YYFINAL 9 392#define YYFINAL 9
388/* YYLAST -- Last index in YYTABLE. */ 393/* YYLAST -- Last index in YYTABLE. */
389#define YYLAST 60 394#define YYLAST 73
390 395
391/* YYNTOKENS -- Number of terminals. */ 396/* YYNTOKENS -- Number of terminals. */
392#define YYNTOKENS 24 397#define YYNTOKENS 27
393/* YYNNTS -- Number of nonterminals. */ 398/* YYNNTS -- Number of nonterminals. */
394#define YYNNTS 20 399#define YYNNTS 20
395/* YYNRULES -- Number of rules. */ 400/* YYNRULES -- Number of rules. */
396#define YYNRULES 43 401#define YYNRULES 45
397/* YYNRULES -- Number of states. */ 402/* YYNRULES -- Number of states. */
398#define YYNSTATES 67 403#define YYNSTATES 76
399 404
400/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 405/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
401#define YYUNDEFTOK 2 406#define YYUNDEFTOK 2
402#define YYMAXUTOK 267 407#define YYMAXUTOK 268
403 408
404#define YYTRANSLATE(YYX) \ 409#define YYTRANSLATE(YYX) \
405 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 410 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -411,15 +416,15 @@ static const yytype_uint8 yytranslate[] =
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 23, 14, 2, 15, 2, 2, 419 24, 26, 2, 2, 25, 15, 2, 16, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 420 2, 2, 2, 2, 2, 2, 2, 2, 2, 14,
416 19, 18, 20, 2, 2, 2, 2, 2, 2, 2, 421 20, 19, 21, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 21, 2, 22, 2, 2, 2, 2, 2, 2, 424 2, 22, 2, 23, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 16, 2, 17, 2, 2, 2, 2, 427 2, 2, 2, 17, 2, 18, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -433,7 +438,7 @@ static const yytype_uint8 yytranslate[] =
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 440 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
436 5, 6, 7, 8, 9, 10, 11, 12 441 5, 6, 7, 8, 9, 10, 11, 12, 13
437}; 442};
438 443
439#if YYDEBUG 444#if YYDEBUG
@@ -443,37 +448,39 @@ static const yytype_uint8 yyprhs[] =
443{ 448{
444 0, 0, 3, 8, 11, 12, 15, 21, 22, 25, 449 0, 0, 3, 8, 11, 12, 15, 21, 22, 25,
445 27, 34, 36, 38, 41, 47, 48, 51, 57, 61, 450 27, 34, 36, 38, 41, 47, 48, 51, 57, 61,
446 64, 69, 74, 77, 80, 81, 84, 87, 88, 91, 451 64, 69, 74, 77, 87, 93, 96, 97, 100, 103,
447 94, 97, 98, 100, 102, 105, 106, 109, 112, 113, 452 104, 107, 110, 113, 114, 116, 118, 121, 122, 125,
448 116, 119, 123, 124 453 128, 129, 132, 135, 139, 140
449}; 454};
450 455
451/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 456/* YYRHS -- A `-1'-separated list of the rules' RHS. */
452static const yytype_int8 yyrhs[] = 457static const yytype_int8 yyrhs[] =
453{ 458{
454 25, 0, -1, 3, 13, 26, 31, -1, 28, 31, 459 28, 0, -1, 3, 14, 29, 34, -1, 31, 34,
455 -1, -1, 27, 26, -1, 43, 4, 30, 30, 13, 460 -1, -1, 30, 29, -1, 46, 4, 33, 33, 14,
456 -1, -1, 29, 28, -1, 27, -1, 43, 4, 30, 461 -1, -1, 32, 31, -1, 30, -1, 46, 4, 33,
457 14, 30, 13, -1, 6, -1, 7, -1, 15, 32, 462 15, 33, 14, -1, 6, -1, 7, -1, 16, 35,
458 -1, 16, 33, 41, 17, 13, -1, -1, 33, 34, 463 -1, 17, 36, 44, 18, 14, -1, -1, 36, 37,
459 -1, 43, 5, 18, 35, 13, -1, 43, 5, 13, 464 -1, 46, 5, 19, 38, 14, -1, 46, 5, 14,
460 -1, 36, 10, -1, 36, 19, 37, 20, -1, 36, 465 -1, 39, 10, -1, 39, 20, 40, 21, -1, 39,
461 21, 40, 22, -1, 36, 12, -1, 35, 11, -1, 466 22, 43, 23, -1, 39, 12, -1, 39, 13, 24,
462 -1, 35, 23, -1, 36, 11, -1, -1, 37, 39, 467 10, 25, 33, 25, 33, 26, -1, 39, 13, 24,
463 -1, 37, 12, -1, 37, 11, -1, -1, 8, -1, 468 10, 26, -1, 38, 11, -1, -1, 38, 25, -1,
464 6, -1, 38, 7, -1, -1, 40, 9, -1, 40, 469 39, 11, -1, -1, 40, 42, -1, 40, 12, -1,
465 11, -1, -1, 42, 41, -1, 42, 34, -1, 43, 470 40, 11, -1, -1, 8, -1, 6, -1, 41, 7,
466 5, 32, -1, -1, 11, -1 471 -1, -1, 43, 9, -1, 43, 11, -1, -1, 45,
472 44, -1, 45, 37, -1, 46, 5, 35, -1, -1,
473 11, -1
467}; 474};
468 475
469/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 476/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
470static const yytype_uint16 yyrline[] = 477static const yytype_uint16 yyrline[] =
471{ 478{
472 0, 85, 85, 89, 97, 100, 107, 115, 118, 125, 479 0, 89, 89, 93, 101, 104, 111, 119, 122, 129,
473 129, 136, 140, 147, 154, 162, 165, 172, 176, 183, 480 133, 140, 144, 151, 158, 166, 169, 176, 180, 187,
474 187, 191, 195, 199, 207, 210, 214, 222, 225, 229, 481 191, 195, 199, 203, 220, 231, 239, 242, 246, 254,
475 234, 242, 245, 249, 253, 261, 264, 268, 276, 279, 482 257, 261, 266, 274, 277, 281, 285, 293, 296, 300,
476 283, 291, 299, 302 483 308, 311, 315, 323, 331, 334
477}; 484};
478#endif 485#endif
479 486
@@ -484,12 +491,12 @@ static const char *const yytname[] =
484{ 491{
485 "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", 492 "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE",
486 "DT_PROPNODENAME", "DT_LITERAL", "DT_LEGACYLITERAL", "DT_BASE", 493 "DT_PROPNODENAME", "DT_LITERAL", "DT_LEGACYLITERAL", "DT_BASE",
487 "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", "';'", "'-'", "'/'", "'{'", 494 "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", "DT_INCBIN", "';'", "'-'",
488 "'}'", "'='", "'<'", "'>'", "'['", "']'", "','", "$accept", "sourcefile", 495 "'/'", "'{'", "'}'", "'='", "'<'", "'>'", "'['", "']'", "'('", "','",
489 "memreserves", "memreserve", "v0_memreserves", "v0_memreserve", "addr", 496 "')'", "$accept", "sourcefile", "memreserves", "memreserve",
490 "devicetree", "nodedef", "proplist", "propdef", "propdata", 497 "v0_memreserves", "v0_memreserve", "addr", "devicetree", "nodedef",
491 "propdataprefix", "celllist", "cellbase", "cellval", "bytestring", 498 "proplist", "propdef", "propdata", "propdataprefix", "celllist",
492 "subnodes", "subnode", "label", 0 499 "cellbase", "cellval", "bytestring", "subnodes", "subnode", "label", 0
493}; 500};
494#endif 501#endif
495 502
@@ -499,19 +506,19 @@ static const char *const yytname[] =
499static const yytype_uint16 yytoknum[] = 506static const yytype_uint16 yytoknum[] =
500{ 507{
501 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 508 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
502 265, 266, 267, 59, 45, 47, 123, 125, 61, 60, 509 265, 266, 267, 268, 59, 45, 47, 123, 125, 61,
503 62, 91, 93, 44 510 60, 62, 91, 93, 40, 44, 41
504}; 511};
505# endif 512# endif
506 513
507/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 514/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
508static const yytype_uint8 yyr1[] = 515static const yytype_uint8 yyr1[] =
509{ 516{
510 0, 24, 25, 25, 26, 26, 27, 28, 28, 29, 517 0, 27, 28, 28, 29, 29, 30, 31, 31, 32,
511 29, 30, 30, 31, 32, 33, 33, 34, 34, 35, 518 32, 33, 33, 34, 35, 36, 36, 37, 37, 38,
512 35, 35, 35, 35, 36, 36, 36, 37, 37, 37, 519 38, 38, 38, 38, 38, 38, 39, 39, 39, 40,
513 37, 38, 38, 39, 39, 40, 40, 40, 41, 41, 520 40, 40, 40, 41, 41, 42, 42, 43, 43, 43,
514 41, 42, 43, 43 521 44, 44, 44, 45, 46, 46
515}; 522};
516 523
517/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 524/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -519,9 +526,9 @@ static const yytype_uint8 yyr2[] =
519{ 526{
520 0, 2, 4, 2, 0, 2, 5, 0, 2, 1, 527 0, 2, 4, 2, 0, 2, 5, 0, 2, 1,
521 6, 1, 1, 2, 5, 0, 2, 5, 3, 2, 528 6, 1, 1, 2, 5, 0, 2, 5, 3, 2,
522 4, 4, 2, 2, 0, 2, 2, 0, 2, 2, 529 4, 4, 2, 9, 5, 2, 0, 2, 2, 0,
523 2, 0, 1, 1, 2, 0, 2, 2, 0, 2, 530 2, 2, 2, 0, 1, 1, 2, 0, 2, 2,
524 2, 3, 0, 1 531 0, 2, 2, 3, 0, 1
525}; 532};
526 533
527/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 534/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -529,81 +536,86 @@ static const yytype_uint8 yyr2[] =
529 means the default is an error. */ 536 means the default is an error. */
530static const yytype_uint8 yydefact[] = 537static const yytype_uint8 yydefact[] =
531{ 538{
532 7, 0, 43, 0, 9, 0, 7, 0, 4, 1, 539 7, 0, 45, 0, 9, 0, 7, 0, 4, 1,
533 0, 3, 8, 0, 0, 4, 0, 15, 13, 11, 540 0, 3, 8, 0, 0, 4, 0, 15, 13, 11,
534 12, 0, 2, 5, 0, 38, 0, 0, 0, 16, 541 12, 0, 2, 5, 0, 40, 0, 0, 0, 16,
535 0, 38, 0, 0, 6, 0, 40, 39, 0, 10, 542 0, 40, 0, 0, 6, 0, 42, 41, 0, 10,
536 14, 18, 24, 41, 0, 0, 23, 17, 25, 19, 543 14, 18, 26, 43, 0, 0, 25, 17, 27, 19,
537 26, 22, 27, 35, 31, 0, 33, 32, 30, 29, 544 28, 22, 0, 29, 37, 0, 33, 0, 0, 35,
538 20, 0, 28, 36, 37, 21, 34 545 34, 32, 31, 20, 0, 30, 38, 39, 21, 0,
546 24, 36, 0, 0, 0, 23
539}; 547};
540 548
541/* YYDEFGOTO[NTERM-NUM]. */ 549/* YYDEFGOTO[NTERM-NUM]. */
542static const yytype_int8 yydefgoto[] = 550static const yytype_int8 yydefgoto[] =
543{ 551{
544 -1, 3, 14, 4, 5, 6, 27, 11, 18, 25, 552 -1, 3, 14, 4, 5, 6, 27, 11, 18, 25,
545 29, 44, 45, 54, 61, 62, 55, 30, 31, 7 553 29, 44, 45, 56, 64, 65, 57, 30, 31, 7
546}; 554};
547 555
548/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 556/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
549 STATE-NUM. */ 557 STATE-NUM. */
550#define YYPACT_NINF -13 558#define YYPACT_NINF -14
551static const yytype_int8 yypact[] = 559static const yytype_int8 yypact[] =
552{ 560{
553 23, 11, -13, 37, -13, -4, 18, 39, 18, -13, 561 30, -11, -14, 7, -14, -1, 27, 13, 27, -14,
554 28, -13, -13, 34, -4, 18, 41, -13, -13, -13, 562 8, -14, -14, 40, -1, 27, 35, -14, -14, -14,
555 -13, 25, -13, -13, 34, -3, 34, 33, 34, -13, 563 -14, 21, -14, -14, 40, 24, 40, 28, 40, -14,
556 30, -3, 43, 36, -13, 38, -13, -13, 20, -13, 564 32, 24, 46, 38, -14, 39, -14, -14, 26, -14,
557 -13, -13, -13, -13, 2, 9, -13, -13, -13, -13, 565 -14, -14, -14, -14, -9, 10, -14, -14, -14, -14,
558 -13, -13, -13, -13, -2, -6, -13, -13, -13, -13, 566 -14, -14, 31, -14, -14, 44, -2, 3, 23, -14,
559 -13, 45, -13, -13, -13, -13, -13 567 -14, -14, -14, -14, 50, -14, -14, -14, -14, 40,
568 -14, -14, 33, 40, 36, -14
560}; 569};
561 570
562/* YYPGOTO[NTERM-NUM]. */ 571/* YYPGOTO[NTERM-NUM]. */
563static const yytype_int8 yypgoto[] = 572static const yytype_int8 yypgoto[] =
564{ 573{
565 -13, -13, 35, 27, 47, -13, -12, 40, 17, -13, 574 -14, -14, 48, 29, 53, -14, -13, 47, 34, -14,
566 26, -13, -13, -13, -13, -13, -13, 29, -13, -8 575 37, -14, -14, -14, -14, -14, -14, 42, -14, -7
567}; 576};
568 577
569/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 578/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
570 positive, shift that token. If negative, reduce the rule which 579 positive, shift that token. If negative, reduce the rule which
571 number is the opposite. If zero, do what YYDEFACT says. 580 number is the opposite. If zero, do what YYDEFACT says.
572 If YYTABLE_NINF, syntax error. */ 581 If YYTABLE_NINF, syntax error. */
573#define YYTABLE_NINF -43 582#define YYTABLE_NINF -45
574static const yytype_int8 yytable[] = 583static const yytype_int8 yytable[] =
575{ 584{
576 16, 21, -42, 63, 56, 64, 57, 16, 2, 58, 585 21, 16, 46, 8, 59, 47, 60, 9, 16, 61,
577 59, 10, 28, 46, 33, 47, 65, 32, 60, 49, 586 62, 28, 66, 33, 67, 10, 48, 13, 32, 63,
578 50, 51, -42, 32, 8, 48, 1, -42, 52, 2, 587 49, 50, 51, 52, 32, 17, 68, 19, 20, -44,
579 53, 19, 20, 41, 2, 15, 17, 9, 42, 26, 588 53, -44, 54, 1, -44, 2, 26, 15, 2, 24,
580 19, 20, 15, 13, 17, 24, 34, 35, 38, 39, 589 41, 2, 34, 17, 15, 42, 19, 20, 69, 70,
581 23, 40, 66, 12, 22, 43, 0, 36, 0, 0, 590 35, 38, 39, 40, 58, 55, 72, 71, 73, 12,
582 37 591 74, 22, 75, 23, 0, 0, 0, 0, 36, 0,
592 0, 0, 43, 37
583}; 593};
584 594
585static const yytype_int8 yycheck[] = 595static const yytype_int8 yycheck[] =
586{ 596{
587 8, 13, 5, 9, 6, 11, 8, 15, 11, 11, 597 13, 8, 11, 14, 6, 14, 8, 0, 15, 11,
588 12, 15, 24, 11, 26, 13, 22, 25, 20, 10, 598 12, 24, 9, 26, 11, 16, 25, 4, 25, 21,
589 11, 12, 4, 31, 13, 23, 3, 4, 19, 11, 599 10, 11, 12, 13, 31, 17, 23, 6, 7, 5,
590 21, 6, 7, 13, 11, 8, 16, 0, 18, 14, 600 20, 4, 22, 3, 4, 11, 15, 8, 11, 4,
591 6, 7, 15, 4, 16, 4, 13, 17, 5, 13, 601 14, 11, 14, 17, 15, 19, 6, 7, 25, 26,
592 15, 13, 7, 6, 14, 38, -1, 31, -1, -1, 602 18, 5, 14, 14, 10, 24, 69, 7, 25, 6,
593 31 603 73, 14, 26, 15, -1, -1, -1, -1, 31, -1,
604 -1, -1, 38, 31
594}; 605};
595 606
596/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 607/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
597 symbol of state STATE-NUM. */ 608 symbol of state STATE-NUM. */
598static const yytype_uint8 yystos[] = 609static const yytype_uint8 yystos[] =
599{ 610{
600 0, 3, 11, 25, 27, 28, 29, 43, 13, 0, 611 0, 3, 11, 28, 30, 31, 32, 46, 14, 0,
601 15, 31, 28, 4, 26, 27, 43, 16, 32, 6, 612 16, 34, 31, 4, 29, 30, 46, 17, 35, 6,
602 7, 30, 31, 26, 4, 33, 14, 30, 30, 34, 613 7, 33, 34, 29, 4, 36, 15, 33, 33, 37,
603 41, 42, 43, 30, 13, 17, 34, 41, 5, 13, 614 44, 45, 46, 33, 14, 18, 37, 44, 5, 14,
604 13, 13, 18, 32, 35, 36, 11, 13, 23, 10, 615 14, 14, 19, 35, 38, 39, 11, 14, 25, 10,
605 11, 12, 19, 21, 37, 40, 6, 8, 11, 12, 616 11, 12, 13, 20, 22, 24, 40, 43, 10, 6,
606 20, 38, 39, 9, 11, 22, 7 617 8, 11, 12, 21, 41, 42, 9, 11, 23, 25,
618 26, 7, 33, 25, 33, 26
607}; 619};
608 620
609#define yyerrok (yyerrstatus = 0) 621#define yyerrok (yyerrstatus = 0)
@@ -1440,289 +1452,323 @@ yyreduce:
1440 switch (yyn) 1452 switch (yyn)
1441 { 1453 {
1442 case 2: 1454 case 2:
1443#line 86 "dtc-parser.y" 1455#line 90 "dtc-parser.y"
1444 { 1456 {
1445 the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node)); 1457 the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), 0);
1446 ;} 1458 ;}
1447 break; 1459 break;
1448 1460
1449 case 3: 1461 case 3:
1450#line 90 "dtc-parser.y" 1462#line 94 "dtc-parser.y"
1451 { 1463 {
1452 the_boot_info = build_boot_info((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].node)); 1464 the_boot_info = build_boot_info((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].node), 0);
1453 ;} 1465 ;}
1454 break; 1466 break;
1455 1467
1456 case 4: 1468 case 4:
1457#line 97 "dtc-parser.y" 1469#line 101 "dtc-parser.y"
1458 { 1470 {
1459 (yyval.re) = NULL; 1471 (yyval.re) = NULL;
1460 ;} 1472 ;}
1461 break; 1473 break;
1462 1474
1463 case 5: 1475 case 5:
1464#line 101 "dtc-parser.y" 1476#line 105 "dtc-parser.y"
1465 { 1477 {
1466 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); 1478 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
1467 ;} 1479 ;}
1468 break; 1480 break;
1469 1481
1470 case 6: 1482 case 6:
1471#line 108 "dtc-parser.y" 1483#line 112 "dtc-parser.y"
1472 { 1484 {
1473 (yyval.re) = build_reserve_entry((yyvsp[(3) - (5)].addr), (yyvsp[(4) - (5)].addr), (yyvsp[(1) - (5)].labelref)); 1485 (yyval.re) = build_reserve_entry((yyvsp[(3) - (5)].addr), (yyvsp[(4) - (5)].addr), (yyvsp[(1) - (5)].labelref));
1474 ;} 1486 ;}
1475 break; 1487 break;
1476 1488
1477 case 7: 1489 case 7:
1478#line 115 "dtc-parser.y" 1490#line 119 "dtc-parser.y"
1479 { 1491 {
1480 (yyval.re) = NULL; 1492 (yyval.re) = NULL;
1481 ;} 1493 ;}
1482 break; 1494 break;
1483 1495
1484 case 8: 1496 case 8:
1485#line 119 "dtc-parser.y" 1497#line 123 "dtc-parser.y"
1486 { 1498 {
1487 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); 1499 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
1488 ;} 1500 ;}
1489 break; 1501 break;
1490 1502
1491 case 9: 1503 case 9:
1492#line 126 "dtc-parser.y" 1504#line 130 "dtc-parser.y"
1493 { 1505 {
1494 (yyval.re) = (yyvsp[(1) - (1)].re); 1506 (yyval.re) = (yyvsp[(1) - (1)].re);
1495 ;} 1507 ;}
1496 break; 1508 break;
1497 1509
1498 case 10: 1510 case 10:
1499#line 130 "dtc-parser.y" 1511#line 134 "dtc-parser.y"
1500 { 1512 {
1501 (yyval.re) = build_reserve_entry((yyvsp[(3) - (6)].addr), (yyvsp[(5) - (6)].addr) - (yyvsp[(3) - (6)].addr) + 1, (yyvsp[(1) - (6)].labelref)); 1513 (yyval.re) = build_reserve_entry((yyvsp[(3) - (6)].addr), (yyvsp[(5) - (6)].addr) - (yyvsp[(3) - (6)].addr) + 1, (yyvsp[(1) - (6)].labelref));
1502 ;} 1514 ;}
1503 break; 1515 break;
1504 1516
1505 case 11: 1517 case 11:
1506#line 137 "dtc-parser.y" 1518#line 141 "dtc-parser.y"
1507 { 1519 {
1508 (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); 1520 (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64);
1509 ;} 1521 ;}
1510 break; 1522 break;
1511 1523
1512 case 12: 1524 case 12:
1513#line 141 "dtc-parser.y" 1525#line 145 "dtc-parser.y"
1514 { 1526 {
1515 (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 16, 64); 1527 (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 16, 64);
1516 ;} 1528 ;}
1517 break; 1529 break;
1518 1530
1519 case 13: 1531 case 13:
1520#line 148 "dtc-parser.y" 1532#line 152 "dtc-parser.y"
1521 { 1533 {
1522 (yyval.node) = name_node((yyvsp[(2) - (2)].node), "", NULL); 1534 (yyval.node) = name_node((yyvsp[(2) - (2)].node), "", NULL);
1523 ;} 1535 ;}
1524 break; 1536 break;
1525 1537
1526 case 14: 1538 case 14:
1527#line 155 "dtc-parser.y" 1539#line 159 "dtc-parser.y"
1528 { 1540 {
1529 (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); 1541 (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist));
1530 ;} 1542 ;}
1531 break; 1543 break;
1532 1544
1533 case 15: 1545 case 15:
1534#line 162 "dtc-parser.y" 1546#line 166 "dtc-parser.y"
1535 { 1547 {
1536 (yyval.proplist) = NULL; 1548 (yyval.proplist) = NULL;
1537 ;} 1549 ;}
1538 break; 1550 break;
1539 1551
1540 case 16: 1552 case 16:
1541#line 166 "dtc-parser.y" 1553#line 170 "dtc-parser.y"
1542 { 1554 {
1543 (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); 1555 (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
1544 ;} 1556 ;}
1545 break; 1557 break;
1546 1558
1547 case 17: 1559 case 17:
1548#line 173 "dtc-parser.y" 1560#line 177 "dtc-parser.y"
1549 { 1561 {
1550 (yyval.prop) = build_property((yyvsp[(2) - (5)].propnodename), (yyvsp[(4) - (5)].data), (yyvsp[(1) - (5)].labelref)); 1562 (yyval.prop) = build_property((yyvsp[(2) - (5)].propnodename), (yyvsp[(4) - (5)].data), (yyvsp[(1) - (5)].labelref));
1551 ;} 1563 ;}
1552 break; 1564 break;
1553 1565
1554 case 18: 1566 case 18:
1555#line 177 "dtc-parser.y" 1567#line 181 "dtc-parser.y"
1556 { 1568 {
1557 (yyval.prop) = build_property((yyvsp[(2) - (3)].propnodename), empty_data, (yyvsp[(1) - (3)].labelref)); 1569 (yyval.prop) = build_property((yyvsp[(2) - (3)].propnodename), empty_data, (yyvsp[(1) - (3)].labelref));
1558 ;} 1570 ;}
1559 break; 1571 break;
1560 1572
1561 case 19: 1573 case 19:
1562#line 184 "dtc-parser.y" 1574#line 188 "dtc-parser.y"
1563 { 1575 {
1564 (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); 1576 (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
1565 ;} 1577 ;}
1566 break; 1578 break;
1567 1579
1568 case 20: 1580 case 20:
1569#line 188 "dtc-parser.y" 1581#line 192 "dtc-parser.y"
1570 { 1582 {
1571 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); 1583 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
1572 ;} 1584 ;}
1573 break; 1585 break;
1574 1586
1575 case 21: 1587 case 21:
1576#line 192 "dtc-parser.y" 1588#line 196 "dtc-parser.y"
1577 { 1589 {
1578 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); 1590 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
1579 ;} 1591 ;}
1580 break; 1592 break;
1581 1593
1582 case 22: 1594 case 22:
1583#line 196 "dtc-parser.y" 1595#line 200 "dtc-parser.y"
1584 { 1596 {
1585 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); 1597 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref));
1586 ;} 1598 ;}
1587 break; 1599 break;
1588 1600
1589 case 23: 1601 case 23:
1590#line 200 "dtc-parser.y" 1602#line 204 "dtc-parser.y"
1591 { 1603 {
1592 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); 1604 struct search_path path = { srcpos_file->dir, NULL, NULL };
1605 struct dtc_file *file = dtc_open_file((yyvsp[(4) - (9)].data).val, &path);
1606 struct data d = empty_data;
1607
1608 if ((yyvsp[(6) - (9)].addr) != 0)
1609 if (fseek(file->file, (yyvsp[(6) - (9)].addr), SEEK_SET) != 0)
1610 yyerrorf("Couldn't seek to offset %llu in \"%s\": %s",
1611 (unsigned long long)(yyvsp[(6) - (9)].addr),
1612 (yyvsp[(4) - (9)].data).val, strerror(errno));
1613
1614 d = data_copy_file(file->file, (yyvsp[(8) - (9)].addr));
1615
1616 (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
1617 dtc_close_file(file);
1593 ;} 1618 ;}
1594 break; 1619 break;
1595 1620
1596 case 24: 1621 case 24:
1597#line 207 "dtc-parser.y" 1622#line 221 "dtc-parser.y"
1598 { 1623 {
1599 (yyval.data) = empty_data; 1624 struct search_path path = { srcpos_file->dir, NULL, NULL };
1625 struct dtc_file *file = dtc_open_file((yyvsp[(4) - (5)].data).val, &path);
1626 struct data d = empty_data;
1627
1628 d = data_copy_file(file->file, -1);
1629
1630 (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d);
1631 dtc_close_file(file);
1600 ;} 1632 ;}
1601 break; 1633 break;
1602 1634
1603 case 25: 1635 case 25:
1604#line 211 "dtc-parser.y" 1636#line 232 "dtc-parser.y"
1605 { 1637 {
1606 (yyval.data) = (yyvsp[(1) - (2)].data); 1638 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1607 ;} 1639 ;}
1608 break; 1640 break;
1609 1641
1610 case 26: 1642 case 26:
1611#line 215 "dtc-parser.y" 1643#line 239 "dtc-parser.y"
1612 { 1644 {
1613 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); 1645 (yyval.data) = empty_data;
1614 ;} 1646 ;}
1615 break; 1647 break;
1616 1648
1617 case 27: 1649 case 27:
1618#line 222 "dtc-parser.y" 1650#line 243 "dtc-parser.y"
1619 { 1651 {
1620 (yyval.data) = empty_data; 1652 (yyval.data) = (yyvsp[(1) - (2)].data);
1621 ;} 1653 ;}
1622 break; 1654 break;
1623 1655
1624 case 28: 1656 case 28:
1625#line 226 "dtc-parser.y" 1657#line 247 "dtc-parser.y"
1626 { 1658 {
1627 (yyval.data) = data_append_cell((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].cell)); 1659 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1628 ;} 1660 ;}
1629 break; 1661 break;
1630 1662
1631 case 29: 1663 case 29:
1632#line 230 "dtc-parser.y" 1664#line 254 "dtc-parser.y"
1665 {
1666 (yyval.data) = empty_data;
1667 ;}
1668 break;
1669
1670 case 30:
1671#line 258 "dtc-parser.y"
1672 {
1673 (yyval.data) = data_append_cell((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].cell));
1674 ;}
1675 break;
1676
1677 case 31:
1678#line 262 "dtc-parser.y"
1633 { 1679 {
1634 (yyval.data) = data_append_cell(data_add_marker((yyvsp[(1) - (2)].data), REF_PHANDLE, 1680 (yyval.data) = data_append_cell(data_add_marker((yyvsp[(1) - (2)].data), REF_PHANDLE,
1635 (yyvsp[(2) - (2)].labelref)), -1); 1681 (yyvsp[(2) - (2)].labelref)), -1);
1636 ;} 1682 ;}
1637 break; 1683 break;
1638 1684
1639 case 30: 1685 case 32:
1640#line 235 "dtc-parser.y" 1686#line 267 "dtc-parser.y"
1641 { 1687 {
1642 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); 1688 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1643 ;} 1689 ;}
1644 break; 1690 break;
1645 1691
1646 case 31: 1692 case 33:
1647#line 242 "dtc-parser.y" 1693#line 274 "dtc-parser.y"
1648 { 1694 {
1649 (yyval.cbase) = 16; 1695 (yyval.cbase) = 16;
1650 ;} 1696 ;}
1651 break; 1697 break;
1652 1698
1653 case 33: 1699 case 35:
1654#line 250 "dtc-parser.y" 1700#line 282 "dtc-parser.y"
1655 { 1701 {
1656 (yyval.cell) = eval_literal((yyvsp[(1) - (1)].literal), 0, 32); 1702 (yyval.cell) = eval_literal((yyvsp[(1) - (1)].literal), 0, 32);
1657 ;} 1703 ;}
1658 break; 1704 break;
1659 1705
1660 case 34: 1706 case 36:
1661#line 254 "dtc-parser.y" 1707#line 286 "dtc-parser.y"
1662 { 1708 {
1663 (yyval.cell) = eval_literal((yyvsp[(2) - (2)].literal), (yyvsp[(1) - (2)].cbase), 32); 1709 (yyval.cell) = eval_literal((yyvsp[(2) - (2)].literal), (yyvsp[(1) - (2)].cbase), 32);
1664 ;} 1710 ;}
1665 break; 1711 break;
1666 1712
1667 case 35: 1713 case 37:
1668#line 261 "dtc-parser.y" 1714#line 293 "dtc-parser.y"
1669 { 1715 {
1670 (yyval.data) = empty_data; 1716 (yyval.data) = empty_data;
1671 ;} 1717 ;}
1672 break; 1718 break;
1673 1719
1674 case 36: 1720 case 38:
1675#line 265 "dtc-parser.y" 1721#line 297 "dtc-parser.y"
1676 { 1722 {
1677 (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); 1723 (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
1678 ;} 1724 ;}
1679 break; 1725 break;
1680 1726
1681 case 37: 1727 case 39:
1682#line 269 "dtc-parser.y" 1728#line 301 "dtc-parser.y"
1683 { 1729 {
1684 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); 1730 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1685 ;} 1731 ;}
1686 break; 1732 break;
1687 1733
1688 case 38: 1734 case 40:
1689#line 276 "dtc-parser.y" 1735#line 308 "dtc-parser.y"
1690 { 1736 {
1691 (yyval.nodelist) = NULL; 1737 (yyval.nodelist) = NULL;
1692 ;} 1738 ;}
1693 break; 1739 break;
1694 1740
1695 case 39: 1741 case 41:
1696#line 280 "dtc-parser.y" 1742#line 312 "dtc-parser.y"
1697 { 1743 {
1698 (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); 1744 (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist));
1699 ;} 1745 ;}
1700 break; 1746 break;
1701 1747
1702 case 40: 1748 case 42:
1703#line 284 "dtc-parser.y" 1749#line 316 "dtc-parser.y"
1704 { 1750 {
1705 yyerror("syntax error: properties must precede subnodes\n"); 1751 yyerror("syntax error: properties must precede subnodes");
1706 YYERROR; 1752 YYERROR;
1707 ;} 1753 ;}
1708 break; 1754 break;
1709 1755
1710 case 41: 1756 case 43:
1711#line 292 "dtc-parser.y" 1757#line 324 "dtc-parser.y"
1712 { 1758 {
1713 (yyval.node) = name_node((yyvsp[(3) - (3)].node), (yyvsp[(2) - (3)].propnodename), (yyvsp[(1) - (3)].labelref)); 1759 (yyval.node) = name_node((yyvsp[(3) - (3)].node), (yyvsp[(2) - (3)].propnodename), (yyvsp[(1) - (3)].labelref));
1714 ;} 1760 ;}
1715 break; 1761 break;
1716 1762
1717 case 42: 1763 case 44:
1718#line 299 "dtc-parser.y" 1764#line 331 "dtc-parser.y"
1719 { 1765 {
1720 (yyval.labelref) = NULL; 1766 (yyval.labelref) = NULL;
1721 ;} 1767 ;}
1722 break; 1768 break;
1723 1769
1724 case 43: 1770 case 45:
1725#line 303 "dtc-parser.y" 1771#line 335 "dtc-parser.y"
1726 { 1772 {
1727 (yyval.labelref) = (yyvsp[(1) - (1)].labelref); 1773 (yyval.labelref) = (yyvsp[(1) - (1)].labelref);
1728 ;} 1774 ;}
@@ -1730,7 +1776,7 @@ yyreduce:
1730 1776
1731 1777
1732/* Line 1267 of yacc.c. */ 1778/* Line 1267 of yacc.c. */
1733#line 1734 "dtc-parser.tab.c" 1779#line 1780 "dtc-parser.tab.c"
1734 default: break; 1780 default: break;
1735 } 1781 }
1736 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1782 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1950,21 +1996,32 @@ yyreturn:
1950} 1996}
1951 1997
1952 1998
1953#line 308 "dtc-parser.y" 1999#line 340 "dtc-parser.y"
1954 2000
1955 2001
1956void yyerror (char const *s) 2002void yyerrorf(char const *s, ...)
1957{ 2003{
1958 const char *fname = srcpos_filename_for_num(yylloc.filenum); 2004 const char *fname = srcpos_file ? srcpos_file->name : "<no-file>";
2005 va_list va;
2006 va_start(va, s);
1959 2007
1960 if (strcmp(fname, "-") == 0) 2008 if (strcmp(fname, "-") == 0)
1961 fname = "stdin"; 2009 fname = "stdin";
1962 2010
1963 fprintf(stderr, "%s:%d %s\n", 2011 fprintf(stderr, "%s:%d ", fname, yylloc.first_line);
1964 fname, yylloc.first_line, s); 2012 vfprintf(stderr, s, va);
2013 fprintf(stderr, "\n");
2014
2015 treesource_error = 1;
2016 va_end(va);
2017}
2018
2019void yyerror (char const *s)
2020{
2021 yyerrorf("%s", s);
1965} 2022}
1966 2023
1967unsigned long long eval_literal(const char *s, int base, int bits) 2024static unsigned long long eval_literal(const char *s, int base, int bits)
1968{ 2025{
1969 unsigned long long val; 2026 unsigned long long val;
1970 char *e; 2027 char *e;