diff options
Diffstat (limited to 'util/cbfstool/fmd_parser.c_shipped')
-rw-r--r-- | util/cbfstool/fmd_parser.c_shipped | 176 |
1 files changed, 95 insertions, 81 deletions
diff --git a/util/cbfstool/fmd_parser.c_shipped b/util/cbfstool/fmd_parser.c_shipped index 826a1a0bed..2597fc6637 100644 --- a/util/cbfstool/fmd_parser.c_shipped +++ b/util/cbfstool/fmd_parser.c_shipped @@ -136,7 +136,8 @@ void yyerror(const char *s); INTEGER = 258, OCTAL = 259, STRING = 260, - FLAG_CBFS = 261 + FLAG_CBFS = 261, + FLAG_PRESERVE = 262 }; #endif /* Tokens. */ @@ -144,6 +145,7 @@ void yyerror(const char *s); #define OCTAL 259 #define STRING 260 #define FLAG_CBFS 261 +#define FLAG_PRESERVE 262 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED @@ -159,7 +161,7 @@ union YYSTYPE union flashmap_flags flags; struct descriptor_list region_listhdr; -#line 163 "y.tab.c" /* yacc.c:355 */ +#line 165 "y.tab.c" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; @@ -176,7 +178,7 @@ int yyparse (void); /* Copy the second part of user declarations. */ -#line 180 "y.tab.c" /* yacc.c:358 */ +#line 182 "y.tab.c" /* yacc.c:358 */ #ifdef short # undef short @@ -418,21 +420,21 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 4 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 17 +#define YYLAST 23 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 12 +#define YYNTOKENS 13 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 14 /* YYNRULES -- Number of rules. */ -#define YYNRULES 20 +#define YYNRULES 21 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 30 +#define YYNSTATES 31 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 261 +#define YYMAXUTOK 262 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -445,15 +447,15 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 7, 8, 2, 2, 2, 2, 2, 2, 2, 2, + 8, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 9, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 10, 2, 11, 2, 2, 2, 2, + 2, 2, 2, 11, 2, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -467,16 +469,16 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6 + 5, 6, 7 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 79, 79, 85, 99, 106, 107, 108, 108, 109, - 110, 111, 112, 113, 114, 115, 117, 121, 122, 123, - 134 + 0, 80, 80, 86, 100, 107, 108, 109, 109, 110, + 111, 112, 113, 114, 115, 116, 117, 119, 123, 124, + 125, 136 }; #endif @@ -486,10 +488,11 @@ static const yytype_uint8 yyrline[] = static const char *const yytname[] = { "$end", "error", "$undefined", "INTEGER", "OCTAL", "STRING", - "FLAG_CBFS", "'('", "')'", "'@'", "'{'", "'}'", "$accept", "flash_chip", - "flash_region", "region_name", "region_flags_opt", "region_flags", - "region_flag", "region_offset_opt", "region_offset", "region_size_opt", - "region_size", "region_list_opt", "region_list", "region_list_entries", YY_NULLPTR + "FLAG_CBFS", "FLAG_PRESERVE", "'('", "')'", "'@'", "'{'", "'}'", + "$accept", "flash_chip", "flash_region", "region_name", + "region_flags_opt", "region_flags", "region_flag", "region_offset_opt", + "region_offset", "region_size_opt", "region_size", "region_list_opt", + "region_list", "region_list_entries", YY_NULLPTR }; #endif @@ -498,8 +501,8 @@ static const char *const yytname[] = (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { - 0, 256, 257, 258, 259, 260, 261, 40, 41, 64, - 123, 125 + 0, 256, 257, 258, 259, 260, 261, 262, 40, 41, + 64, 123, 125 }; # endif @@ -517,9 +520,10 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int8 yypact[] = { - -4, -12, 2, -6, -12, 1, 4, -12, -12, -12, - -2, -4, -12, -12, 3, -5, -1, -6, -12, -12, - -12, 5, -1, 4, -12, -12, -2, -12, -12, -12 + -1, -12, 1, -2, -12, 2, 3, -12, -12, -12, + 0, -1, -12, -12, 4, -5, -4, -2, -12, -12, + -12, -12, 5, -4, 3, -12, -12, 0, -12, -12, + -12 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -527,23 +531,24 @@ static const yytype_int8 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 4, 0, 10, 1, 0, 0, 11, 12, 15, - 0, 0, 2, 19, 5, 0, 0, 10, 18, 20, - 9, 0, 7, 13, 6, 8, 16, 14, 3, 17 + 0, 4, 0, 11, 1, 0, 0, 12, 13, 16, + 0, 0, 2, 20, 5, 0, 0, 11, 19, 21, + 9, 10, 0, 7, 14, 6, 8, 17, 15, 3, + 18 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -12, -12, -3, 9, -12, -11, -12, 0, -12, -12, - -9, -12, -10, -12 + -12, -12, -6, 10, -12, -10, -12, 6, -12, -12, + -9, -12, -11, -12 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 2, 13, 14, 17, 21, 22, 6, 7, 26, - 10, 28, 12, 15 + -1, 2, 13, 14, 17, 22, 23, 6, 7, 27, + 10, 29, 12, 15 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -551,39 +556,42 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { - 1, 1, 4, 5, 8, 20, 18, 9, 11, 3, - 16, 25, 19, 24, 27, 0, 29, 23 + 1, 4, 20, 21, 1, 8, 9, 18, 5, 19, + 3, 11, 16, 26, 25, 28, 30, 0, 0, 0, + 0, 0, 0, 24 }; static const yytype_int8 yycheck[] = { - 5, 5, 0, 9, 3, 6, 11, 3, 10, 0, - 7, 22, 15, 8, 23, -1, 26, 17 + 5, 0, 6, 7, 5, 3, 3, 12, 10, 15, + 0, 11, 8, 23, 9, 24, 27, -1, -1, -1, + -1, -1, -1, 17 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 5, 13, 15, 0, 9, 19, 20, 3, 3, - 22, 10, 24, 14, 15, 25, 7, 16, 11, 14, - 6, 17, 18, 19, 8, 17, 21, 22, 23, 24 + 0, 5, 14, 16, 0, 10, 20, 21, 3, 3, + 23, 11, 25, 15, 16, 26, 8, 17, 12, 15, + 6, 7, 18, 19, 20, 9, 18, 22, 23, 24, + 25 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 12, 13, 14, 15, 16, 16, 17, 17, 18, - 19, 19, 20, 21, 21, 22, 23, 23, 24, 25, - 25 + 0, 13, 14, 15, 16, 17, 17, 18, 18, 19, + 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, + 26, 26 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 4, 5, 1, 0, 3, 1, 2, 1, - 0, 1, 2, 0, 1, 1, 0, 1, 3, 1, - 2 + 1, 0, 1, 2, 0, 1, 1, 0, 1, 3, + 1, 2 }; @@ -1260,17 +1268,17 @@ yyreduce: switch (yyn) { case 2: -#line 80 "fmd_parser.y" /* yacc.c:1646 */ +#line 81 "fmd_parser.y" /* yacc.c:1646 */ { union flashmap_flags flags = { .v=0 }; if (!(res = parse_descriptor((yyvsp[-3].strval), flags, (yyvsp[-2].maybe_intval), (yyvsp[-1].maybe_intval), (yyvsp[0].region_listhdr)))) YYABORT; } -#line 1270 "y.tab.c" /* yacc.c:1646 */ +#line 1278 "y.tab.c" /* yacc.c:1646 */ break; case 3: -#line 87 "fmd_parser.y" /* yacc.c:1646 */ +#line 88 "fmd_parser.y" /* yacc.c:1646 */ { struct flashmap_descriptor *node = parse_descriptor((yyvsp[-4].strval), (yyvsp[-3].flags), (yyvsp[-2].maybe_intval), (yyvsp[-1].maybe_intval), (yyvsp[0].region_listhdr)); if (!node) @@ -1283,85 +1291,91 @@ yyreduce: (yyval.region_ptr) = node; } -#line 1287 "y.tab.c" /* yacc.c:1646 */ +#line 1295 "y.tab.c" /* yacc.c:1646 */ break; case 4: -#line 100 "fmd_parser.y" /* yacc.c:1646 */ +#line 101 "fmd_parser.y" /* yacc.c:1646 */ { if (!(yyvsp[0].strval)) { perror("E: While allocating section name"); YYABORT; } } -#line 1298 "y.tab.c" /* yacc.c:1646 */ +#line 1306 "y.tab.c" /* yacc.c:1646 */ break; case 5: -#line 106 "fmd_parser.y" /* yacc.c:1646 */ +#line 107 "fmd_parser.y" /* yacc.c:1646 */ { (yyval.flags) = (union flashmap_flags){ .v=0 }; } -#line 1304 "y.tab.c" /* yacc.c:1646 */ +#line 1312 "y.tab.c" /* yacc.c:1646 */ break; case 6: -#line 107 "fmd_parser.y" /* yacc.c:1646 */ +#line 108 "fmd_parser.y" /* yacc.c:1646 */ { (yyval.flags) = (yyvsp[-1].flags); } -#line 1310 "y.tab.c" /* yacc.c:1646 */ +#line 1318 "y.tab.c" /* yacc.c:1646 */ break; case 8: -#line 108 "fmd_parser.y" /* yacc.c:1646 */ +#line 109 "fmd_parser.y" /* yacc.c:1646 */ { (yyval.flags).v = (yyvsp[-1].flags).v | (yyvsp[0].flags).v; } -#line 1316 "y.tab.c" /* yacc.c:1646 */ +#line 1324 "y.tab.c" /* yacc.c:1646 */ break; case 9: -#line 109 "fmd_parser.y" /* yacc.c:1646 */ +#line 110 "fmd_parser.y" /* yacc.c:1646 */ { (yyval.flags).v = 0; (yyval.flags).f.cbfs = 1; } -#line 1322 "y.tab.c" /* yacc.c:1646 */ +#line 1330 "y.tab.c" /* yacc.c:1646 */ break; case 10: -#line 110 "fmd_parser.y" /* yacc.c:1646 */ - { (yyval.maybe_intval) = (struct unsigned_option){false, 0}; } -#line 1328 "y.tab.c" /* yacc.c:1646 */ +#line 111 "fmd_parser.y" /* yacc.c:1646 */ + { (yyval.flags).v = 0; (yyval.flags).f.preserve = 1; } +#line 1336 "y.tab.c" /* yacc.c:1646 */ break; - case 12: + case 11: #line 112 "fmd_parser.y" /* yacc.c:1646 */ - { (yyval.maybe_intval) = (struct unsigned_option){true, (yyvsp[0].intval)}; } -#line 1334 "y.tab.c" /* yacc.c:1646 */ + { (yyval.maybe_intval) = (struct unsigned_option){false, 0}; } +#line 1342 "y.tab.c" /* yacc.c:1646 */ break; case 13: -#line 113 "fmd_parser.y" /* yacc.c:1646 */ - { (yyval.maybe_intval) = (struct unsigned_option){false, 0}; } -#line 1340 "y.tab.c" /* yacc.c:1646 */ +#line 114 "fmd_parser.y" /* yacc.c:1646 */ + { (yyval.maybe_intval) = (struct unsigned_option){true, (yyvsp[0].intval)}; } +#line 1348 "y.tab.c" /* yacc.c:1646 */ break; - case 15: + case 14: #line 115 "fmd_parser.y" /* yacc.c:1646 */ - { (yyval.maybe_intval) = (struct unsigned_option){true, (yyvsp[0].intval)}; } -#line 1346 "y.tab.c" /* yacc.c:1646 */ + { (yyval.maybe_intval) = (struct unsigned_option){false, 0}; } +#line 1354 "y.tab.c" /* yacc.c:1646 */ break; case 16: #line 117 "fmd_parser.y" /* yacc.c:1646 */ + { (yyval.maybe_intval) = (struct unsigned_option){true, (yyvsp[0].intval)}; } +#line 1360 "y.tab.c" /* yacc.c:1646 */ + break; + + case 17: +#line 119 "fmd_parser.y" /* yacc.c:1646 */ { (yyval.region_listhdr) = (struct descriptor_list) {.len = 0, .head = NULL, .tail = NULL}; } -#line 1355 "y.tab.c" /* yacc.c:1646 */ +#line 1369 "y.tab.c" /* yacc.c:1646 */ break; - case 18: -#line 122 "fmd_parser.y" /* yacc.c:1646 */ + case 19: +#line 124 "fmd_parser.y" /* yacc.c:1646 */ { (yyval.region_listhdr) = (yyvsp[-1].region_listhdr); } -#line 1361 "y.tab.c" /* yacc.c:1646 */ +#line 1375 "y.tab.c" /* yacc.c:1646 */ break; - case 19: -#line 124 "fmd_parser.y" /* yacc.c:1646 */ + case 20: +#line 126 "fmd_parser.y" /* yacc.c:1646 */ { struct descriptor_node *node = malloc(sizeof(*node)); if (!node) { @@ -1372,11 +1386,11 @@ yyreduce: node->next = NULL; (yyval.region_listhdr) = (struct descriptor_list){.len = 1, .head = node, .tail = node}; } -#line 1376 "y.tab.c" /* yacc.c:1646 */ +#line 1390 "y.tab.c" /* yacc.c:1646 */ break; - case 20: -#line 135 "fmd_parser.y" /* yacc.c:1646 */ + case 21: +#line 137 "fmd_parser.y" /* yacc.c:1646 */ { struct descriptor_node *node = malloc(sizeof(*node)); if (!node) { @@ -1390,11 +1404,11 @@ yyreduce: (yyval.region_listhdr) = (struct descriptor_list) {.len = (yyvsp[-1].region_listhdr).len + 1, .head = (yyvsp[-1].region_listhdr).head, .tail = node}; } -#line 1394 "y.tab.c" /* yacc.c:1646 */ +#line 1408 "y.tab.c" /* yacc.c:1646 */ break; -#line 1398 "y.tab.c" /* yacc.c:1646 */ +#line 1412 "y.tab.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1622,7 +1636,7 @@ yyreturn: #endif return yyresult; } -#line 149 "fmd_parser.y" /* yacc.c:1906 */ +#line 151 "fmd_parser.y" /* yacc.c:1906 */ struct flashmap_descriptor *parse_descriptor( |