Improve the sconfig parser:
- The device tree must start with a chip (not a device) - It's more clearly visible at which places chip, device, register and resource can be used. Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5526 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
8d313685b0
commit
8f625f6e93
|
@ -380,12 +380,12 @@ union yyalloc
|
||||||
/* YYFINAL -- State number of the termination state. */
|
/* YYFINAL -- State number of the termination state. */
|
||||||
#define YYFINAL 3
|
#define YYFINAL 3
|
||||||
/* YYLAST -- Last index in YYTABLE. */
|
/* YYLAST -- Last index in YYTABLE. */
|
||||||
#define YYLAST 22
|
#define YYLAST 24
|
||||||
|
|
||||||
/* YYNTOKENS -- Number of terminals. */
|
/* YYNTOKENS -- Number of terminals. */
|
||||||
#define YYNTOKENS 23
|
#define YYNTOKENS 23
|
||||||
/* YYNNTS -- Number of nonterminals. */
|
/* YYNNTS -- Number of nonterminals. */
|
||||||
#define YYNNTS 12
|
#define YYNNTS 11
|
||||||
/* YYNRULES -- Number of rules. */
|
/* YYNRULES -- Number of rules. */
|
||||||
#define YYNRULES 17
|
#define YYNRULES 17
|
||||||
/* YYNRULES -- Number of states. */
|
/* YYNRULES -- Number of states. */
|
||||||
|
@ -436,26 +436,26 @@ static const yytype_uint8 yytranslate[] =
|
||||||
YYRHS. */
|
YYRHS. */
|
||||||
static const yytype_uint8 yyprhs[] =
|
static const yytype_uint8 yyprhs[] =
|
||||||
{
|
{
|
||||||
0, 0, 3, 4, 7, 9, 11, 14, 17, 18,
|
0, 0, 3, 4, 7, 10, 13, 16, 17, 20,
|
||||||
21, 24, 25, 26, 32, 33, 41, 46
|
23, 26, 27, 28, 34, 35, 43, 48
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||||
static const yytype_int8 yyrhs[] =
|
static const yytype_int8 yyrhs[] =
|
||||||
{
|
{
|
||||||
24, 0, -1, -1, 25, 26, -1, 29, -1, 31,
|
24, 0, -1, -1, 25, 28, -1, 26, 30, -1,
|
||||||
-1, 27, 26, -1, 27, 34, -1, -1, 28, 26,
|
26, 28, -1, 26, 33, -1, -1, 27, 30, -1,
|
||||||
-1, 28, 33, -1, -1, -1, 3, 12, 30, 27,
|
27, 28, -1, 27, 32, -1, -1, -1, 3, 12,
|
||||||
9, -1, -1, 4, 7, 22, 6, 32, 28, 9,
|
29, 26, 9, -1, -1, 4, 7, 22, 6, 31,
|
||||||
-1, 8, 22, 10, 22, -1, 5, 12, 10, 12,
|
27, 9, -1, 8, 22, 10, 22, -1, 5, 12,
|
||||||
-1
|
10, 12, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||||
static const yytype_uint8 yyrline[] =
|
static const yytype_uint8 yyrline[] =
|
||||||
{
|
{
|
||||||
0, 34, 34, 34, 36, 36, 38, 38, 38, 40,
|
0, 34, 34, 34, 36, 36, 36, 36, 38, 38,
|
||||||
40, 40, 42, 42, 52, 52, 64, 67
|
38, 38, 40, 40, 50, 50, 62, 65
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -467,8 +467,8 @@ static const char *const yytname[] =
|
||||||
"$end", "error", "$undefined", "CHIP", "DEVICE", "REGISTER", "BOOL",
|
"$end", "error", "$undefined", "CHIP", "DEVICE", "REGISTER", "BOOL",
|
||||||
"BUS", "RESOURCE", "END", "EQUALS", "HEX", "STRING", "PCI", "PNP", "I2C",
|
"BUS", "RESOURCE", "END", "EQUALS", "HEX", "STRING", "PCI", "PNP", "I2C",
|
||||||
"APIC", "APIC_CLUSTER", "PCI_DOMAIN", "IRQ", "DRQ", "IO", "NUMBER",
|
"APIC", "APIC_CLUSTER", "PCI_DOMAIN", "IRQ", "DRQ", "IO", "NUMBER",
|
||||||
"$accept", "devtree", "$@1", "devchip", "devices", "devicesorresources",
|
"$accept", "devtree", "$@1", "chipchildren", "devicechildren", "chip",
|
||||||
"chip", "@2", "device", "@3", "resource", "registers", 0
|
"@2", "device", "@3", "resource", "registers", 0
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -486,14 +486,14 @@ static const yytype_uint16 yytoknum[] =
|
||||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||||
static const yytype_uint8 yyr1[] =
|
static const yytype_uint8 yyr1[] =
|
||||||
{
|
{
|
||||||
0, 23, 25, 24, 26, 26, 27, 27, 27, 28,
|
0, 23, 25, 24, 26, 26, 26, 26, 27, 27,
|
||||||
28, 28, 30, 29, 32, 31, 33, 34
|
27, 27, 29, 28, 31, 30, 32, 33
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||||
static const yytype_uint8 yyr2[] =
|
static const yytype_uint8 yyr2[] =
|
||||||
{
|
{
|
||||||
0, 2, 0, 2, 1, 1, 2, 2, 0, 2,
|
0, 2, 0, 2, 2, 2, 2, 0, 2, 2,
|
||||||
2, 0, 0, 5, 0, 7, 4, 4
|
2, 0, 0, 5, 0, 7, 4, 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -502,35 +502,35 @@ static const yytype_uint8 yyr2[] =
|
||||||
means the default is an error. */
|
means the default is an error. */
|
||||||
static const yytype_uint8 yydefact[] =
|
static const yytype_uint8 yydefact[] =
|
||||||
{
|
{
|
||||||
2, 0, 0, 1, 0, 0, 3, 4, 5, 12,
|
2, 0, 0, 1, 0, 3, 12, 7, 0, 0,
|
||||||
0, 8, 0, 0, 14, 0, 13, 6, 7, 11,
|
0, 13, 5, 4, 6, 0, 0, 0, 0, 14,
|
||||||
0, 0, 0, 0, 15, 9, 10, 17, 0, 0,
|
17, 11, 0, 0, 15, 9, 8, 10, 0, 0,
|
||||||
16
|
16
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYDEFGOTO[NTERM-NUM]. */
|
/* YYDEFGOTO[NTERM-NUM]. */
|
||||||
static const yytype_int8 yydefgoto[] =
|
static const yytype_int8 yydefgoto[] =
|
||||||
{
|
{
|
||||||
-1, 1, 2, 6, 13, 21, 7, 11, 8, 19,
|
-1, 1, 2, 8, 22, 5, 7, 13, 21, 27,
|
||||||
26, 18
|
14
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||||
STATE-NUM. */
|
STATE-NUM. */
|
||||||
#define YYPACT_NINF -14
|
#define YYPACT_NINF -10
|
||||||
static const yytype_int8 yypact[] =
|
static const yytype_int8 yypact[] =
|
||||||
{
|
{
|
||||||
-14, 6, 8, -14, 2, 9, -14, -14, -14, -14,
|
-10, 6, 5, -10, -1, -10, -10, -10, -2, 8,
|
||||||
-9, -14, 11, -2, -14, 3, -14, -14, -14, -14,
|
0, -10, -10, -10, -10, -9, 7, 10, 9, -10,
|
||||||
10, 1, 7, -4, -14, -14, -14, -14, 12, -1,
|
-10, -10, 1, -4, -10, -10, -10, -10, 12, -3,
|
||||||
-14
|
-10
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYPGOTO[NTERM-NUM]. */
|
/* YYPGOTO[NTERM-NUM]. */
|
||||||
static const yytype_int8 yypgoto[] =
|
static const yytype_int8 yypgoto[] =
|
||||||
{
|
{
|
||||||
-14, -14, -14, -13, -14, -14, -14, -14, -14, -14,
|
-10, -10, -10, -10, -10, -8, -10, 2, -10, -10,
|
||||||
-14, -14
|
-10
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
|
@ -540,25 +540,25 @@ static const yytype_int8 yypgoto[] =
|
||||||
#define YYTABLE_NINF -1
|
#define YYTABLE_NINF -1
|
||||||
static const yytype_uint8 yytable[] =
|
static const yytype_uint8 yytable[] =
|
||||||
{
|
{
|
||||||
17, 4, 5, 15, 4, 5, 3, 16, 25, 23,
|
12, 4, 9, 10, 4, 9, 3, 11, 4, 23,
|
||||||
24, 4, 5, 12, 9, 20, 10, 14, 28, 27,
|
24, 6, 16, 17, 25, 15, 19, 18, 28, 30,
|
||||||
22, 30, 29
|
0, 20, 29, 0, 26
|
||||||
};
|
};
|
||||||
|
|
||||||
static const yytype_uint8 yycheck[] =
|
static const yytype_int8 yycheck[] =
|
||||||
{
|
{
|
||||||
13, 3, 4, 5, 3, 4, 0, 9, 21, 8,
|
8, 3, 4, 5, 3, 4, 0, 9, 3, 8,
|
||||||
9, 3, 4, 22, 12, 12, 7, 6, 22, 12,
|
9, 12, 12, 22, 22, 7, 6, 10, 22, 22,
|
||||||
10, 22, 10
|
-1, 12, 10, -1, 22
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||||
symbol of state STATE-NUM. */
|
symbol of state STATE-NUM. */
|
||||||
static const yytype_uint8 yystos[] =
|
static const yytype_uint8 yystos[] =
|
||||||
{
|
{
|
||||||
0, 24, 25, 0, 3, 4, 26, 29, 31, 12,
|
0, 24, 25, 0, 3, 28, 12, 29, 26, 4,
|
||||||
7, 30, 22, 27, 6, 5, 9, 26, 34, 32,
|
5, 9, 28, 30, 33, 7, 12, 22, 10, 6,
|
||||||
12, 28, 10, 8, 9, 26, 33, 12, 22, 10,
|
12, 31, 27, 8, 9, 28, 30, 32, 22, 10,
|
||||||
22
|
22
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,19 +31,17 @@ static struct device *cur_parent, *cur_bus;
|
||||||
}
|
}
|
||||||
%token CHIP DEVICE REGISTER BOOL BUS RESOURCE END EQUALS HEX STRING PCI PNP I2C APIC APIC_CLUSTER PCI_DOMAIN IRQ DRQ IO NUMBER
|
%token CHIP DEVICE REGISTER BOOL BUS RESOURCE END EQUALS HEX STRING PCI PNP I2C APIC APIC_CLUSTER PCI_DOMAIN IRQ DRQ IO NUMBER
|
||||||
%%
|
%%
|
||||||
devtree: { cur_parent = cur_bus = head; } devchip { postprocess_devtree(); } ;
|
devtree: { cur_parent = cur_bus = head; } chip { postprocess_devtree(); } ;
|
||||||
|
|
||||||
devchip: chip | device ;
|
chipchildren: chipchildren device | chipchildren chip | chipchildren registers | /* empty */ ;
|
||||||
|
|
||||||
devices: devices devchip | devices registers | ;
|
devicechildren: devicechildren device | devicechildren chip | devicechildren resource | /* empty */ ;
|
||||||
|
|
||||||
devicesorresources: devicesorresources devchip | devicesorresources resource | ;
|
|
||||||
|
|
||||||
chip: CHIP STRING /* == path */ {
|
chip: CHIP STRING /* == path */ {
|
||||||
$<device>$ = new_chip(cur_parent, cur_bus, $<string>2);
|
$<device>$ = new_chip(cur_parent, cur_bus, $<string>2);
|
||||||
cur_parent = $<device>$;
|
cur_parent = $<device>$;
|
||||||
}
|
}
|
||||||
devices END {
|
chipchildren END {
|
||||||
cur_parent = $<device>3->parent;
|
cur_parent = $<device>3->parent;
|
||||||
fold_in($<device>3);
|
fold_in($<device>3);
|
||||||
add_header($<device>3);
|
add_header($<device>3);
|
||||||
|
@ -54,7 +52,7 @@ device: DEVICE BUS NUMBER /* == devnum */ BOOL {
|
||||||
cur_parent = $<device>$;
|
cur_parent = $<device>$;
|
||||||
cur_bus = $<device>$;
|
cur_bus = $<device>$;
|
||||||
}
|
}
|
||||||
devicesorresources END {
|
devicechildren END {
|
||||||
cur_parent = $<device>5->parent;
|
cur_parent = $<device>5->parent;
|
||||||
cur_bus = $<device>5->bus;
|
cur_bus = $<device>5->bus;
|
||||||
fold_in($<device>5);
|
fold_in($<device>5);
|
||||||
|
|
Loading…
Reference in New Issue