From ffda804b52768467ea7b3394a3e2fe9039f87362 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Wed, 3 Sep 2014 12:40:15 -0500 Subject: sconfig: add cpu device type In order to enumerate CPU devices that are non-x86 (read: no lapic) provide a generic 'cpu' device. Change-Id: Ifeafdad8076935c3448784e6958117002509acbf Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/6824 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer Reviewed-by: Ronald G. Minnich --- util/sconfig/lex.yy.c_shipped | 62 +++++++++++++------------ util/sconfig/main.c | 4 ++ util/sconfig/sconfig.l | 1 + util/sconfig/sconfig.tab.c_shipped | 95 +++++++++++++++++++------------------- util/sconfig/sconfig.tab.h_shipped | 21 +++++---- util/sconfig/sconfig.y | 2 +- 6 files changed, 98 insertions(+), 87 deletions(-) diff --git a/util/sconfig/lex.yy.c_shipped b/util/sconfig/lex.yy.c_shipped index 1deb75dc17..fcb8989365 100644 --- a/util/sconfig/lex.yy.c_shipped +++ b/util/sconfig/lex.yy.c_shipped @@ -368,8 +368,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 30 -#define YY_END_OF_BUFFER 31 +#define YY_NUM_RULES 31 +#define YY_END_OF_BUFFER 32 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -379,19 +379,19 @@ struct yy_trans_info }; static yyconst flex_int16_t yy_accept[116] = { 0, - 0, 0, 31, 29, 1, 3, 29, 29, 29, 25, - 25, 23, 26, 29, 26, 26, 26, 29, 29, 29, - 29, 29, 29, 29, 1, 3, 29, 0, 29, 0, - 2, 25, 26, 29, 29, 29, 29, 26, 29, 29, - 29, 29, 29, 18, 29, 29, 29, 7, 29, 29, - 29, 29, 28, 28, 24, 29, 29, 29, 29, 29, - 17, 22, 12, 29, 29, 16, 29, 8, 9, 11, - 29, 29, 27, 4, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 13, 29, 29, - 29, 5, 15, 29, 10, 29, 29, 29, 20, 29, - - 29, 29, 29, 29, 6, 29, 29, 29, 29, 29, - 19, 29, 14, 21, 0 + 0, 0, 32, 30, 1, 3, 30, 30, 30, 26, + 26, 24, 27, 30, 27, 27, 27, 30, 30, 30, + 30, 30, 30, 30, 1, 3, 30, 0, 30, 0, + 2, 26, 27, 30, 30, 30, 30, 27, 30, 30, + 30, 30, 30, 19, 30, 30, 30, 7, 30, 30, + 30, 30, 29, 29, 25, 30, 30, 15, 30, 30, + 18, 23, 12, 30, 30, 17, 30, 8, 9, 11, + 30, 30, 28, 4, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 13, 30, 30, + 30, 5, 16, 30, 10, 30, 30, 30, 21, 30, + + 30, 30, 30, 30, 6, 30, 30, 30, 30, 30, + 20, 30, 14, 22, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -888,43 +888,43 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -{yylval.number=DOMAIN; return(BUS);} +{yylval.number=CPU; return(BUS);} YY_BREAK case 16: YY_RULE_SETUP -{yylval.number=IRQ; return(RESOURCE);} +{yylval.number=DOMAIN; return(BUS);} YY_BREAK case 17: YY_RULE_SETUP -{yylval.number=DRQ; return(RESOURCE);} +{yylval.number=IRQ; return(RESOURCE);} YY_BREAK case 18: YY_RULE_SETUP -{yylval.number=IO; return(RESOURCE);} +{yylval.number=DRQ; return(RESOURCE);} YY_BREAK case 19: YY_RULE_SETUP -{return(IOAPIC_IRQ);} +{yylval.number=IO; return(RESOURCE);} YY_BREAK case 20: YY_RULE_SETUP -{return(INHERIT);} +{return(IOAPIC_IRQ);} YY_BREAK case 21: YY_RULE_SETUP -{return(SUBSYSTEMID);} +{return(INHERIT);} YY_BREAK case 22: YY_RULE_SETUP -{return(END);} +{return(SUBSYSTEMID);} YY_BREAK case 23: YY_RULE_SETUP -{return(EQUALS);} +{return(END);} YY_BREAK case 24: YY_RULE_SETUP -{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} +{return(EQUALS);} YY_BREAK case 25: YY_RULE_SETUP @@ -936,19 +936,23 @@ YY_RULE_SETUP YY_BREAK case 27: YY_RULE_SETUP -{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);} +{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} YY_BREAK case 28: -/* rule 28 can match eol */ YY_RULE_SETUP -{yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);} +{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);} YY_BREAK case 29: +/* rule 29 can match eol */ YY_RULE_SETUP -{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);} +{yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);} YY_BREAK case 30: YY_RULE_SETUP +{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);} + YY_BREAK +case 31: +YY_RULE_SETUP ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): diff --git a/util/sconfig/main.c b/util/sconfig/main.c index a37523c27d..1241a87fed 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -272,6 +272,10 @@ struct device *new_device(struct device *parent, struct device *busdev, const in new_d->path = ".type=DEVICE_PATH_CPU_CLUSTER,{.cpu_cluster={ .cluster = 0x%x }}"; break; + case CPU: + new_d->path = ".type=DEVICE_PATH_CPU,{.cpu={ .id = 0x%x }}"; + break; + case DOMAIN: new_d->path = ".type=DEVICE_PATH_DOMAIN,{.domain={ .domain = 0x%x }}"; break; diff --git a/util/sconfig/sconfig.l b/util/sconfig/sconfig.l index 3e9535ef4e..37d487cb65 100755 --- a/util/sconfig/sconfig.l +++ b/util/sconfig/sconfig.l @@ -39,6 +39,7 @@ pnp {yylval.number=PNP; return(BUS);} i2c {yylval.number=I2C; return(BUS);} lapic {yylval.number=APIC; return(BUS);} cpu_cluster {yylval.number=CPU_CLUSTER; return(BUS);} +cpu {yylval.number=CPU; return(BUS);} domain {yylval.number=DOMAIN; return(BUS);} irq {yylval.number=IRQ; return(RESOURCE);} drq {yylval.number=DRQ; return(RESOURCE);} diff --git a/util/sconfig/sconfig.tab.c_shipped b/util/sconfig/sconfig.tab.c_shipped index 3a56ac86fd..43a16d1958 100644 --- a/util/sconfig/sconfig.tab.c_shipped +++ b/util/sconfig/sconfig.tab.c_shipped @@ -133,16 +133,17 @@ static struct device *cur_parent, *cur_bus; I2C = 270, APIC = 271, CPU_CLUSTER = 272, - DOMAIN = 273, - IRQ = 274, - DRQ = 275, - IO = 276, - NUMBER = 277, - SUBSYSTEMID = 278, - INHERIT = 279, - IOAPIC_IRQ = 280, - IOAPIC = 281, - PCIINT = 282 + CPU = 273, + DOMAIN = 274, + IRQ = 275, + DRQ = 276, + IO = 277, + NUMBER = 278, + SUBSYSTEMID = 279, + INHERIT = 280, + IOAPIC_IRQ = 281, + IOAPIC = 282, + PCIINT = 283 }; #endif @@ -387,10 +388,10 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 37 +#define YYLAST 39 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 28 +#define YYNTOKENS 29 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 13 /* YYNRULES -- Number of rules. */ @@ -400,7 +401,7 @@ union yyalloc /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 282 +#define YYMAXUTOK 283 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -436,7 +437,7 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27 + 25, 26, 27, 28 }; #if YYDEBUG @@ -452,14 +453,14 @@ static const yytype_uint8 yyprhs[] = /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 29, 0, -1, -1, 30, 33, -1, 31, 35, -1, - 31, 33, -1, 31, 38, -1, -1, 32, 35, -1, - 32, 33, -1, 32, 37, -1, 32, 39, -1, 32, - 40, -1, -1, -1, 3, 12, 34, 31, 9, -1, - -1, 4, 7, 22, 6, 36, 32, 9, -1, 8, - 22, 10, 22, -1, 5, 12, 10, 12, -1, 23, - 22, 22, -1, 23, 22, 22, 24, -1, 25, 22, - 27, 22, -1 + 30, 0, -1, -1, 31, 34, -1, 32, 36, -1, + 32, 34, -1, 32, 39, -1, -1, 33, 36, -1, + 33, 34, -1, 33, 38, -1, 33, 40, -1, 33, + 41, -1, -1, -1, 3, 12, 35, 32, 9, -1, + -1, 4, 7, 23, 6, 37, 33, 9, -1, 8, + 23, 10, 23, -1, 5, 12, 10, 12, -1, 24, + 23, 23, -1, 24, 23, 23, 25, -1, 26, 23, + 28, 23, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -478,7 +479,7 @@ static const char *const yytname[] = { "$end", "error", "$undefined", "CHIP", "DEVICE", "REGISTER", "BOOL", "BUS", "RESOURCE", "END", "EQUALS", "HEX", "STRING", "PCI", "PNP", "I2C", - "APIC", "CPU_CLUSTER", "DOMAIN", "IRQ", "DRQ", "IO", "NUMBER", + "APIC", "CPU_CLUSTER", "CPU", "DOMAIN", "IRQ", "DRQ", "IO", "NUMBER", "SUBSYSTEMID", "INHERIT", "IOAPIC_IRQ", "IOAPIC", "PCIINT", "$accept", "devtree", "$@1", "chipchildren", "devicechildren", "chip", "@2", "device", "@3", "resource", "registers", "subsystemid", "ioapic_irq", 0 @@ -492,16 +493,16 @@ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282 + 275, 276, 277, 278, 279, 280, 281, 282, 283 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 28, 30, 29, 31, 31, 31, 31, 32, 32, - 32, 32, 32, 32, 34, 33, 36, 35, 37, 38, - 39, 39, 40 + 0, 29, 31, 30, 32, 32, 32, 32, 33, 33, + 33, 33, 33, 33, 35, 34, 37, 36, 38, 39, + 40, 40, 41 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -533,21 +534,21 @@ static const yytype_int8 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -9 +#define YYPACT_NINF -10 static const yytype_int8 yypact[] = { - -9, 3, 1, -9, -2, -9, -9, -9, 4, 5, - -1, -9, -9, -9, -9, -8, 7, 9, 6, -9, - -9, -9, -3, 2, -9, 8, 10, -9, -9, -9, - -9, -9, 11, 12, -4, 13, -5, 14, -9, -9, - -9 + -10, 3, 1, -10, -2, -10, -10, -10, 4, 5, + -1, -10, -10, -10, -10, -9, 7, 9, 6, -10, + -10, -10, -3, -4, -10, 2, 8, -10, -10, -10, + -10, -10, 10, 11, 0, 12, 13, 14, -10, -10, + -10 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -9, -9, -9, -9, -9, -6, -9, 15, -9, -9, - -9, -9, -9 + -10, -10, -10, -10, -10, -6, -10, 17, -10, -10, + -10, -10, -10 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -557,13 +558,13 @@ static const yytype_int8 yypgoto[] = static const yytype_uint8 yytable[] = { 4, 9, 12, 3, 4, 23, 24, 4, 9, 10, - 6, 16, 15, 11, 17, 19, 27, 18, 20, 39, - 25, 35, 26, 37, 32, 0, 0, 0, 0, 0, - 33, 0, 34, 0, 36, 38, 40, 28 + 6, 16, 15, 11, 17, 19, 27, 18, 20, 32, + 35, 25, 0, 26, 0, 33, 0, 0, 37, 0, + 0, 34, 0, 0, 36, 38, 0, 40, 39, 28 }; #define yypact_value_is_default(yystate) \ - ((yystate) == (-9)) + ((yystate) == (-10)) #define yytable_value_is_error(yytable_value) \ YYID (0) @@ -571,20 +572,20 @@ static const yytype_uint8 yytable[] = static const yytype_int8 yycheck[] = { 3, 4, 8, 0, 3, 8, 9, 3, 4, 5, - 12, 12, 7, 9, 22, 6, 22, 10, 12, 24, - 23, 10, 25, 27, 22, -1, -1, -1, -1, -1, - 22, -1, 22, -1, 22, 22, 22, 22 + 12, 12, 7, 9, 23, 6, 22, 10, 12, 23, + 10, 24, -1, 26, -1, 23, -1, -1, 28, -1, + -1, 23, -1, -1, 23, 23, -1, 23, 25, 22 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 29, 30, 0, 3, 33, 12, 34, 31, 4, - 5, 9, 33, 35, 38, 7, 12, 22, 10, 6, - 12, 36, 32, 8, 9, 23, 25, 33, 35, 37, - 39, 40, 22, 22, 22, 10, 22, 27, 22, 24, - 22 + 0, 30, 31, 0, 3, 34, 12, 35, 32, 4, + 5, 9, 34, 36, 39, 7, 12, 23, 10, 6, + 12, 37, 33, 8, 9, 24, 26, 34, 36, 38, + 40, 41, 23, 23, 23, 10, 23, 28, 23, 25, + 23 }; #define yyerrok (yyerrstatus = 0) diff --git a/util/sconfig/sconfig.tab.h_shipped b/util/sconfig/sconfig.tab.h_shipped index be65179901..061abd4309 100644 --- a/util/sconfig/sconfig.tab.h_shipped +++ b/util/sconfig/sconfig.tab.h_shipped @@ -52,16 +52,17 @@ I2C = 270, APIC = 271, CPU_CLUSTER = 272, - DOMAIN = 273, - IRQ = 274, - DRQ = 275, - IO = 276, - NUMBER = 277, - SUBSYSTEMID = 278, - INHERIT = 279, - IOAPIC_IRQ = 280, - IOAPIC = 281, - PCIINT = 282 + CPU = 273, + DOMAIN = 274, + IRQ = 275, + DRQ = 276, + IO = 277, + NUMBER = 278, + SUBSYSTEMID = 279, + INHERIT = 280, + IOAPIC_IRQ = 281, + IOAPIC = 282, + PCIINT = 283 }; #endif diff --git a/util/sconfig/sconfig.y b/util/sconfig/sconfig.y index 8ea702ec90..ba450b89c5 100755 --- a/util/sconfig/sconfig.y +++ b/util/sconfig/sconfig.y @@ -30,7 +30,7 @@ static struct device *cur_parent, *cur_bus; int number; } -%token CHIP DEVICE REGISTER BOOL BUS RESOURCE END EQUALS HEX STRING PCI PNP I2C APIC CPU_CLUSTER DOMAIN IRQ DRQ IO NUMBER SUBSYSTEMID INHERIT IOAPIC_IRQ IOAPIC PCIINT +%token CHIP DEVICE REGISTER BOOL BUS RESOURCE END EQUALS HEX STRING PCI PNP I2C APIC CPU_CLUSTER CPU DOMAIN IRQ DRQ IO NUMBER SUBSYSTEMID INHERIT IOAPIC_IRQ IOAPIC PCIINT %% devtree: { cur_parent = cur_bus = head; } chip { postprocess_devtree(); } ; -- cgit v1.2.3