summaryrefslogtreecommitdiff
path: root/util/cbfstool
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2019-03-04 15:41:09 +0800
committerPatrick Georgi <pgeorgi@google.com>2019-03-05 20:51:39 +0000
commit49a44505637ecfa3a6c1606bc0986e70397966b0 (patch)
tree3af3d1ace358e80e1a9f660a49db5215f4972f05 /util/cbfstool
parent44b4ec740db6dafed432a411506bfd7975a221f8 (diff)
cbfstool: Support new FMD flag "PRESERVE"
When updating firmware, it is very often that we may want to preserve few sections, for example vital product data (VPD) including serial number, calibration data and cache. A firmware updater has to hard-code the section names that need to be preserved and is hard to maintain. A better approach is to specify that in FMAP area flags (the `area_flag` field) using FMAP_AREA_PRESERVE. With this patchset, a FMD parser flag "PRESERVE" is introduced and will be converted to FMAP_AREA_PRESERVE when generating FMAP data (by fmap_from_fmd.c). For example, The FMD statement: RO_VPD(PRESERVE)@0x0 16k will generate an FMAP firmware section that: area_name = "RO_VPD" area_offset = 0 area_size = 16384 area_flags = FMAP_AREA_PRESERVE BUG=chromium:936768 TEST=make; boots on x86 "google/eve" and arm "google/kukui" devices Manually added 'PRESERVE' to some FMD files, and verify (by running fmap.py) the output coreboot.rom has FMAP_AREA_PRESERVE set Change-Id: I51e7d31029b98868a1cab0d26bf04a14db01b1c0 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/31707 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'util/cbfstool')
-rw-r--r--util/cbfstool/fmap_from_fmd.c6
-rw-r--r--util/cbfstool/fmd.h1
-rw-r--r--util/cbfstool/fmd_parser.c_shipped176
-rw-r--r--util/cbfstool/fmd_parser.h_shipped6
-rw-r--r--util/cbfstool/fmd_parser.y2
-rw-r--r--util/cbfstool/fmd_scanner.c_shipped133
-rw-r--r--util/cbfstool/fmd_scanner.h_shipped2
-rw-r--r--util/cbfstool/fmd_scanner.l1
8 files changed, 177 insertions, 150 deletions
diff --git a/util/cbfstool/fmap_from_fmd.c b/util/cbfstool/fmap_from_fmd.c
index 5e3ec89ec1..374667a373 100644
--- a/util/cbfstool/fmap_from_fmd.c
+++ b/util/cbfstool/fmap_from_fmd.c
@@ -23,6 +23,7 @@
static bool fmap_append_fmd_node(struct fmap **flashmap,
const struct flashmap_descriptor *section,
unsigned absolute_watermark) {
+ uint16_t flags = 0;
if (strlen(section->name) >= FMAP_STRLEN) {
ERROR("Section name ('%s') exceeds %d character FMAP format limit\n",
section->name, FMAP_STRLEN - 1);
@@ -31,8 +32,11 @@ static bool fmap_append_fmd_node(struct fmap **flashmap,
absolute_watermark += section->offset;
+ if (section->flags.f.preserve)
+ flags |= FMAP_AREA_PRESERVE;
+
if (fmap_append_area(flashmap, absolute_watermark, section->size,
- (uint8_t *)section->name, 0) < 0) {
+ (uint8_t *)section->name, flags) < 0) {
ERROR("Failed to insert section '%s' into FMAP\n",
section->name);
return false;
diff --git a/util/cbfstool/fmd.h b/util/cbfstool/fmd.h
index 2d8c57f922..90e6d6e176 100644
--- a/util/cbfstool/fmd.h
+++ b/util/cbfstool/fmd.h
@@ -32,6 +32,7 @@
union flashmap_flags {
struct {
int cbfs: 1; /* The section contains a CBFS area. */
+ int preserve: 1; /* Preserve the section before update. */
} f;
int v;
};
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(
diff --git a/util/cbfstool/fmd_parser.h_shipped b/util/cbfstool/fmd_parser.h_shipped
index 9863b893ed..07c0259f94 100644
--- a/util/cbfstool/fmd_parser.h_shipped
+++ b/util/cbfstool/fmd_parser.h_shipped
@@ -75,7 +75,8 @@ void yyerror(const char *s);
INTEGER = 258,
OCTAL = 259,
STRING = 260,
- FLAG_CBFS = 261
+ FLAG_CBFS = 261,
+ FLAG_PRESERVE = 262
};
#endif
/* Tokens. */
@@ -83,6 +84,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
@@ -98,7 +100,7 @@ union YYSTYPE
union flashmap_flags flags;
struct descriptor_list region_listhdr;
-#line 102 "y.tab.h" /* yacc.c:1909 */
+#line 104 "y.tab.h" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;
diff --git a/util/cbfstool/fmd_parser.y b/util/cbfstool/fmd_parser.y
index 4ca418efea..3ba710c289 100644
--- a/util/cbfstool/fmd_parser.y
+++ b/util/cbfstool/fmd_parser.y
@@ -60,6 +60,7 @@ void yyerror(const char *s);
%token OCTAL
%token <strval> STRING
%token FLAG_CBFS
+%token FLAG_PRESERVE
%type <region_ptr> flash_region
%type <strval> region_name
@@ -107,6 +108,7 @@ region_flags_opt: { $$ = (union flashmap_flags){ .v=0 }; }
| '(' region_flags ')' { $$ = $2; };
region_flags: region_flag | region_flag region_flags { $$.v = $1.v | $2.v; };
region_flag: FLAG_CBFS { $$.v = 0; $$.f.cbfs = 1; };
+region_flag: FLAG_PRESERVE { $$.v = 0; $$.f.preserve = 1; };
region_offset_opt: { $$ = (struct unsigned_option){false, 0}; }
| region_offset;
region_offset: '@' INTEGER { $$ = (struct unsigned_option){true, $2}; };
diff --git a/util/cbfstool/fmd_scanner.c_shipped b/util/cbfstool/fmd_scanner.c_shipped
index b1b78e2603..71d541d8fd 100644
--- a/util/cbfstool/fmd_scanner.c_shipped
+++ b/util/cbfstool/fmd_scanner.c_shipped
@@ -363,8 +363,8 @@ static void yynoreturn yy_fatal_error (yyconst char* msg );
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
-#define YY_NUM_RULES 12
-#define YY_END_OF_BUFFER 13
+#define YY_NUM_RULES 13
+#define YY_END_OF_BUFFER 14
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -372,12 +372,12 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[32] =
+static yyconst flex_int16_t yy_accept[40] =
{ 0,
- 10, 10, 10, 10, 13, 10, 1, 1, 11, 3,
- 11, 6, 7, 4, 10, 10, 1, 0, 2, 8,
- 6, 10, 7, 7, 10, 8, 9, 10, 9, 5,
- 0
+ 11, 11, 11, 11, 14, 11, 1, 1, 12, 3,
+ 12, 7, 8, 4, 11, 11, 11, 1, 0, 2,
+ 9, 7, 11, 8, 8, 11, 11, 9, 10, 11,
+ 11, 10, 5, 11, 11, 11, 11, 6, 0
} ;
static yyconst YY_CHAR yy_ec[256] =
@@ -388,13 +388,13 @@ static yyconst YY_CHAR yy_ec[256] =
1, 2, 1, 1, 4, 1, 1, 1, 1, 5,
6, 1, 1, 1, 1, 1, 1, 7, 8, 8,
8, 8, 8, 8, 8, 8, 8, 1, 1, 1,
- 1, 1, 1, 9, 10, 11, 12, 10, 10, 13,
- 14, 1, 1, 1, 14, 1, 14, 1, 1, 1,
- 1, 1, 15, 1, 1, 1, 1, 16, 1, 1,
+ 1, 1, 1, 9, 10, 11, 12, 10, 13, 14,
+ 15, 1, 1, 1, 15, 1, 15, 1, 1, 16,
+ 1, 17, 18, 1, 1, 19, 1, 20, 1, 1,
1, 1, 1, 1, 1, 1, 10, 10, 10, 10,
10, 10, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 16,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 20,
1, 1, 9, 1, 9, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -412,56 +412,54 @@ static yyconst YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst YY_CHAR yy_meta[17] =
+static yyconst YY_CHAR yy_meta[21] =
{ 0,
1, 2, 2, 2, 2, 2, 1, 1, 2, 1,
- 1, 1, 1, 1, 1, 1
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
} ;
-static yyconst flex_uint16_t yy_base[35] =
+static yyconst flex_uint16_t yy_base[43] =
{ 0,
- 0, 0, 11, 12, 44, 0, 17, 19, 38, 77,
- 77, 18, 28, 77, 29, 0, 25, 36, 77, 15,
- 0, 42, 0, 0, 25, 0, 58, 22, 0, 0,
- 77, 32, 74, 29
+ 0, 8, 12, 13, 63, 0, 18, 20, 59, 64,
+ 64, 23, 19, 64, 50, 43, 0, 30, 56, 64,
+ 20, 0, 37, 0, 0, 44, 44, 0, 41, 28,
+ 24, 0, 0, 28, 22, 18, 23, 0, 64, 51,
+ 0, 53
} ;
-static yyconst flex_int16_t yy_def[35] =
+static yyconst flex_int16_t yy_def[43] =
{ 0,
- 31, 1, 1, 1, 31, 32, 31, 31, 33, 31,
- 31, 32, 32, 31, 32, 32, 31, 33, 31, 12,
- 32, 34, 13, 32, 32, 32, 34, 32, 32, 32,
- 0, 31, 31, 31
+ 40, 40, 2, 2, 39, 41, 39, 39, 42, 39,
+ 39, 41, 41, 39, 41, 41, 41, 39, 42, 39,
+ 12, 41, 41, 13, 41, 41, 41, 41, 23, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 0, 39,
+ 39, 39
} ;
-static yyconst flex_uint16_t yy_nxt[94] =
+static yyconst flex_uint16_t yy_nxt[85] =
{ 0,
- 6, 7, 8, 9, 10, 11, 12, 13, 11, 6,
- 6, 6, 6, 6, 6, 6, 14, 14, 17, 17,
- 17, 17, 15, 15, 20, 20, 17, 17, 26, 27,
- 16, 21, 16, 22, 23, 23, 30, 28, 19, 25,
- 19, 24, 16, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 16, 16, 16, 16, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 29, 16, 16, 18, 18, 5, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31
-
+ 17, 7, 8, 9, 10, 11, 12, 13, 11, 7,
+ 8, 9, 10, 11, 12, 13, 11, 14, 14, 18,
+ 18, 18, 18, 15, 15, 24, 24, 16, 16, 21,
+ 21, 18, 18, 25, 28, 38, 37, 22, 36, 17,
+ 35, 34, 23, 29, 29, 33, 29, 29, 29, 29,
+ 29, 6, 6, 19, 19, 32, 31, 30, 20, 27,
+ 26, 20, 39, 5, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39
} ;
-static yyconst flex_int16_t yy_chk[94] =
+static yyconst flex_int16_t yy_chk[85] =
{ 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 3, 4, 7, 7,
- 8, 8, 3, 4, 12, 12, 17, 17, 20, 34,
- 20, 12, 32, 12, 13, 13, 28, 25, 18, 15,
- 9, 13, 22, 5, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 22, 22, 22, 27, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 27, 27, 27, 33, 33, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31
-
+ 41, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 2, 2, 2, 2, 2, 2, 2, 3, 4, 7,
+ 7, 8, 8, 3, 4, 13, 13, 3, 4, 12,
+ 12, 18, 18, 13, 21, 37, 36, 12, 35, 21,
+ 34, 31, 12, 23, 23, 30, 23, 23, 23, 23,
+ 23, 40, 40, 42, 42, 29, 27, 26, 19, 16,
+ 15, 9, 5, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39
} ;
static yy_state_type yy_last_accepting_state;
@@ -502,7 +500,7 @@ char *yytext;
int parse_integer(char *src, int base);
int copy_string(const char *src);
-#line 506 "<stdout>"
+#line 504 "<stdout>"
#define INITIAL 0
#define FLAGS 1
@@ -723,7 +721,7 @@ YY_DECL
{
#line 31 "fmd_scanner.l"
-#line 727 "<stdout>"
+#line 725 "<stdout>"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -750,13 +748,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 32 )
+ if ( yy_current_state >= 40 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 77 );
+ while ( yy_base[yy_current_state] != 64 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -810,38 +808,43 @@ YY_RULE_SETUP
return FLAG_CBFS;
YY_BREAK
case 6:
-#line 38 "fmd_scanner.l"
-case 7:
YY_RULE_SETUP
-#line 38 "fmd_scanner.l"
-return parse_integer(yytext, 10);
+#line 37 "fmd_scanner.l"
+return FLAG_PRESERVE;
YY_BREAK
+case 7:
+#line 39 "fmd_scanner.l"
case 8:
YY_RULE_SETUP
#line 39 "fmd_scanner.l"
-return OCTAL;
+return parse_integer(yytext, 10);
YY_BREAK
case 9:
YY_RULE_SETUP
#line 40 "fmd_scanner.l"
-return parse_integer(yytext + 2, 16);
+return OCTAL;
YY_BREAK
case 10:
YY_RULE_SETUP
#line 41 "fmd_scanner.l"
-return copy_string(yytext);
+return parse_integer(yytext + 2, 16);
YY_BREAK
case 11:
YY_RULE_SETUP
#line 42 "fmd_scanner.l"
-return *yytext;
+return copy_string(yytext);
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 44 "fmd_scanner.l"
+#line 43 "fmd_scanner.l"
+return *yytext;
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 45 "fmd_scanner.l"
ECHO;
YY_BREAK
-#line 845 "<stdout>"
+#line 848 "<stdout>"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(FLAGS):
yyterminate();
@@ -1135,7 +1138,7 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 32 )
+ if ( yy_current_state >= 40 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
@@ -1163,11 +1166,11 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 32 )
+ if ( yy_current_state >= 40 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
- yy_is_jam = (yy_current_state == 31);
+ yy_is_jam = (yy_current_state == 39);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1843,7 +1846,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 44 "fmd_scanner.l"
+#line 45 "fmd_scanner.l"
diff --git a/util/cbfstool/fmd_scanner.h_shipped b/util/cbfstool/fmd_scanner.h_shipped
index ff990c687f..2a8b291b50 100644
--- a/util/cbfstool/fmd_scanner.h_shipped
+++ b/util/cbfstool/fmd_scanner.h_shipped
@@ -317,7 +317,7 @@ extern int yylex (void);
#undef YY_DECL
#endif
-#line 44 "fmd_scanner.l"
+#line 45 "fmd_scanner.l"
#line 324 "fmd_scanner.h_shipped"
diff --git a/util/cbfstool/fmd_scanner.l b/util/cbfstool/fmd_scanner.l
index 3e0f3133b1..be9a5def84 100644
--- a/util/cbfstool/fmd_scanner.l
+++ b/util/cbfstool/fmd_scanner.l
@@ -34,6 +34,7 @@ MULTIPLIER [KMG]
\( BEGIN(FLAGS); return *yytext;
<FLAGS>\) BEGIN(INITIAL); return *yytext;
<FLAGS>CBFS return FLAG_CBFS;
+<FLAGS>PRESERVE return FLAG_PRESERVE;
0{MULTIPLIER}? |
[1-9][0-9]*{MULTIPLIER}? return parse_integer(yytext, 10);
0[0-9]+{MULTIPLIER}? return OCTAL;