From 8f625f6e9361e06da7017593df841fc69d5d68df Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 5 May 2010 13:13:47 +0000 Subject: 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 Acked-by: Stefan Reinauer Acked-by: Peter Stuge git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5526 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/sconfig/sconfig.tab.c_shipped | 78 +++++++++++++++++++------------------- util/sconfig/sconfig.y | 12 +++--- 2 files changed, 44 insertions(+), 46 deletions(-) (limited to 'util/sconfig') diff --git a/util/sconfig/sconfig.tab.c_shipped b/util/sconfig/sconfig.tab.c_shipped index 6f155ae8cc..4c78b62de3 100644 --- a/util/sconfig/sconfig.tab.c_shipped +++ b/util/sconfig/sconfig.tab.c_shipped @@ -380,12 +380,12 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 22 +#define YYLAST 24 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 23 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 12 +#define YYNNTS 11 /* YYNRULES -- Number of rules. */ #define YYNRULES 17 /* YYNRULES -- Number of states. */ @@ -436,26 +436,26 @@ static const yytype_uint8 yytranslate[] = YYRHS. */ static const yytype_uint8 yyprhs[] = { - 0, 0, 3, 4, 7, 9, 11, 14, 17, 18, - 21, 24, 25, 26, 32, 33, 41, 46 + 0, 0, 3, 4, 7, 10, 13, 16, 17, 20, + 23, 26, 27, 28, 34, 35, 43, 48 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 24, 0, -1, -1, 25, 26, -1, 29, -1, 31, - -1, 27, 26, -1, 27, 34, -1, -1, 28, 26, - -1, 28, 33, -1, -1, -1, 3, 12, 30, 27, - 9, -1, -1, 4, 7, 22, 6, 32, 28, 9, - -1, 8, 22, 10, 22, -1, 5, 12, 10, 12, - -1 + 24, 0, -1, -1, 25, 28, -1, 26, 30, -1, + 26, 28, -1, 26, 33, -1, -1, 27, 30, -1, + 27, 28, -1, 27, 32, -1, -1, -1, 3, 12, + 29, 26, 9, -1, -1, 4, 7, 22, 6, 31, + 27, 9, -1, 8, 22, 10, 22, -1, 5, 12, + 10, 12, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 34, 34, 34, 36, 36, 38, 38, 38, 40, - 40, 40, 42, 42, 52, 52, 64, 67 + 0, 34, 34, 34, 36, 36, 36, 36, 38, 38, + 38, 38, 40, 40, 50, 50, 62, 65 }; #endif @@ -467,8 +467,8 @@ static const char *const yytname[] = "$end", "error", "$undefined", "CHIP", "DEVICE", "REGISTER", "BOOL", "BUS", "RESOURCE", "END", "EQUALS", "HEX", "STRING", "PCI", "PNP", "I2C", "APIC", "APIC_CLUSTER", "PCI_DOMAIN", "IRQ", "DRQ", "IO", "NUMBER", - "$accept", "devtree", "$@1", "devchip", "devices", "devicesorresources", - "chip", "@2", "device", "@3", "resource", "registers", 0 + "$accept", "devtree", "$@1", "chipchildren", "devicechildren", "chip", + "@2", "device", "@3", "resource", "registers", 0 }; #endif @@ -486,14 +486,14 @@ static const yytype_uint16 yytoknum[] = /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 23, 25, 24, 26, 26, 27, 27, 27, 28, - 28, 28, 30, 29, 32, 31, 33, 34 + 0, 23, 25, 24, 26, 26, 26, 26, 27, 27, + 27, 27, 29, 28, 31, 30, 32, 33 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 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 }; @@ -502,35 +502,35 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 2, 0, 0, 1, 0, 0, 3, 4, 5, 12, - 0, 8, 0, 0, 14, 0, 13, 6, 7, 11, - 0, 0, 0, 0, 15, 9, 10, 17, 0, 0, + 2, 0, 0, 1, 0, 3, 12, 7, 0, 0, + 0, 13, 5, 4, 6, 0, 0, 0, 0, 14, + 17, 11, 0, 0, 15, 9, 8, 10, 0, 0, 16 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 2, 6, 13, 21, 7, 11, 8, 19, - 26, 18 + -1, 1, 2, 8, 22, 5, 7, 13, 21, 27, + 14 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -14 +#define YYPACT_NINF -10 static const yytype_int8 yypact[] = { - -14, 6, 8, -14, 2, 9, -14, -14, -14, -14, - -9, -14, 11, -2, -14, 3, -14, -14, -14, -14, - 10, 1, 7, -4, -14, -14, -14, -14, 12, -1, - -14 + -10, 6, 5, -10, -1, -10, -10, -10, -2, 8, + 0, -10, -10, -10, -10, -9, 7, 10, 9, -10, + -10, -10, 1, -4, -10, -10, -10, -10, 12, -3, + -10 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -14, -14, -14, -13, -14, -14, -14, -14, -14, -14, - -14, -14 + -10, -10, -10, -10, -10, -8, -10, 2, -10, -10, + -10 }; /* 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 static const yytype_uint8 yytable[] = { - 17, 4, 5, 15, 4, 5, 3, 16, 25, 23, - 24, 4, 5, 12, 9, 20, 10, 14, 28, 27, - 22, 30, 29 + 12, 4, 9, 10, 4, 9, 3, 11, 4, 23, + 24, 6, 16, 17, 25, 15, 19, 18, 28, 30, + 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, - 9, 3, 4, 22, 12, 12, 7, 6, 22, 12, - 10, 22, 10 + 8, 3, 4, 5, 3, 4, 0, 9, 3, 8, + 9, 12, 12, 22, 22, 7, 6, 10, 22, 22, + -1, 12, 10, -1, 22 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 24, 25, 0, 3, 4, 26, 29, 31, 12, - 7, 30, 22, 27, 6, 5, 9, 26, 34, 32, - 12, 28, 10, 8, 9, 26, 33, 12, 22, 10, + 0, 24, 25, 0, 3, 28, 12, 29, 26, 4, + 5, 9, 28, 30, 33, 7, 12, 22, 10, 6, + 12, 31, 27, 8, 9, 28, 30, 32, 22, 10, 22 }; diff --git a/util/sconfig/sconfig.y b/util/sconfig/sconfig.y index 162ce7050d..1c5db2ab5f 100755 --- a/util/sconfig/sconfig.y +++ b/util/sconfig/sconfig.y @@ -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 %% -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 | ; - -devicesorresources: devicesorresources devchip | devicesorresources resource | ; +devicechildren: devicechildren device | devicechildren chip | devicechildren resource | /* empty */ ; chip: CHIP STRING /* == path */ { $$ = new_chip(cur_parent, cur_bus, $2); cur_parent = $$; } - devices END { + chipchildren END { cur_parent = $3->parent; fold_in($3); add_header($3); @@ -54,7 +52,7 @@ device: DEVICE BUS NUMBER /* == devnum */ BOOL { cur_parent = $$; cur_bus = $$; } - devicesorresources END { + devicechildren END { cur_parent = $5->parent; cur_bus = $5->bus; fold_in($5); -- cgit v1.2.3