sconfig: Allow setting device status in device tree

For devices supporting both Linux and Windows, we may find some ACPI
devices that only need drivers in Linux and should not even be shown in
Windows Device Manager UI.

The new 'hidden' keyword in device tree 'device' statement allows
devices sharing same driver to call acpi_gen_writeSTA with different
values.

BUG=b:72200466
BRANCH=eve
TEST=Builds and boots properly on device eve

Change-Id: Iae881a294b122d3a581b456285d2992ab637fb8e
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://review.coreboot.org/28566
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
This commit is contained in:
Hung-Te Lin 2018-09-10 10:51:26 +08:00 committed by Patrick Georgi
parent c1dc7932b5
commit 936dbe1d06
8 changed files with 255 additions and 235 deletions

View File

@ -133,6 +133,7 @@ struct device {
unsigned int initialized : 1; /* 1 if we have initialized the device */
unsigned int on_mainboard : 1;
unsigned int disable_pcie_aspm : 1;
unsigned int hidden : 1; /* set if we should hide from UI */
struct pci_irq_info pci_irq_info[4];
u8 command;

View File

@ -358,8 +358,8 @@ static void yynoreturn yy_fatal_error (yyconst char* msg );
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
#define YY_NUM_RULES 36
#define YY_END_OF_BUFFER 37
#define YY_NUM_RULES 37
#define YY_END_OF_BUFFER 38
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@ -367,23 +367,24 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[139] =
static yyconst flex_int16_t yy_accept[145] =
{ 0,
0, 0, 37, 35, 1, 3, 35, 35, 35, 30,
30, 28, 31, 35, 31, 31, 31, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 1, 3, 35,
0, 35, 35, 0, 2, 30, 31, 35, 35, 35,
35, 31, 35, 35, 35, 35, 35, 35, 23, 35,
35, 35, 35, 7, 35, 35, 35, 35, 35, 35,
34, 34, 35, 0, 29, 35, 35, 15, 35, 35,
22, 27, 35, 12, 35, 35, 21, 35, 35, 8,
9, 11, 35, 19, 35, 20, 35, 0, 32, 4,
35, 35, 35, 35, 35, 35, 35, 18, 35, 35,
0, 0, 38, 36, 1, 3, 36, 36, 36, 31,
31, 29, 32, 36, 32, 32, 32, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36, 1, 3,
36, 0, 36, 36, 0, 2, 31, 32, 36, 36,
36, 36, 32, 36, 36, 36, 36, 36, 36, 36,
24, 36, 36, 36, 36, 7, 36, 36, 36, 36,
36, 36, 35, 35, 36, 0, 30, 36, 36, 16,
36, 36, 23, 28, 36, 36, 13, 36, 36, 22,
36, 36, 8, 10, 12, 36, 20, 36, 21, 36,
0, 33, 4, 36, 36, 36, 36, 36, 36, 36,
33, 33, 35, 35, 35, 35, 35, 35, 13, 35,
35, 35, 5, 16, 35, 35, 10, 35, 35, 35,
17, 25, 35, 35, 35, 35, 35, 6, 35, 35,
35, 35, 35, 24, 35, 14, 26, 0
36, 19, 36, 36, 34, 34, 36, 36, 36, 36,
36, 36, 36, 14, 36, 36, 36, 5, 17, 36,
9, 36, 11, 36, 36, 36, 18, 26, 36, 36,
36, 36, 36, 6, 36, 36, 36, 36, 36, 25,
36, 15, 27, 0
} ;
static yyconst YY_CHAR yy_ec[256] =
@ -426,106 +427,110 @@ static yyconst YY_CHAR yy_meta[39] =
1, 1, 1, 1, 1, 1, 1, 1
} ;
static yyconst flex_uint16_t yy_base[146] =
static yyconst flex_uint16_t yy_base[152] =
{ 0,
0, 0, 207, 0, 204, 208, 202, 37, 41, 38,
167, 0, 44, 189, 54, 78, 60, 181, 45, 184,
173, 42, 47, 178, 41, 165, 0, 195, 208, 77,
191, 87, 91, 192, 208, 0, 88, 104, 179, 168,
157, 93, 164, 159, 169, 160, 168, 162, 168, 153,
153, 157, 159, 0, 155, 149, 155, 152, 158, 157,
0, 208, 101, 169, 0, 162, 142, 155, 145, 152,
0, 0, 147, 0, 146, 136, 0, 140, 135, 0,
0, 0, 138, 0, 129, 0, 156, 155, 0, 0,
140, 139, 132, 124, 123, 129, 134, 0, 119, 113,
0, 0, 212, 0, 209, 213, 207, 37, 41, 38,
172, 0, 44, 194, 54, 78, 60, 186, 181, 45,
188, 177, 42, 47, 182, 41, 169, 0, 199, 213,
77, 195, 87, 91, 196, 213, 0, 88, 104, 183,
172, 161, 93, 168, 163, 173, 164, 171, 171, 165,
171, 156, 156, 160, 162, 0, 158, 152, 158, 155,
161, 160, 0, 213, 101, 172, 0, 165, 145, 158,
148, 155, 0, 0, 150, 150, 0, 148, 138, 0,
142, 137, 0, 0, 0, 140, 0, 131, 0, 158,
157, 0, 0, 142, 141, 134, 126, 136, 124, 130,
0, 208, 124, 128, 120, 122, 121, 126, 0, 110,
110, 107, 0, 0, 109, 93, 104, 98, 84, 84,
0, 0, 89, 77, 87, 71, 66, 0, 64, 62,
50, 47, 33, 0, 28, 0, 0, 208, 40, 129,
131, 133, 135, 137, 139
135, 0, 120, 114, 0, 213, 125, 129, 121, 123,
119, 121, 126, 0, 110, 110, 107, 0, 0, 109,
0, 93, 104, 98, 84, 84, 0, 0, 89, 77,
87, 71, 66, 0, 64, 62, 50, 47, 33, 0,
28, 0, 0, 213, 40, 129, 131, 133, 135, 137,
139
} ;
static yyconst flex_int16_t yy_def[146] =
static yyconst flex_int16_t yy_def[152] =
{ 0,
138, 1, 138, 139, 138, 138, 139, 140, 141, 139,
10, 139, 10, 139, 10, 10, 10, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 138, 138, 140,
142, 143, 141, 144, 138, 10, 10, 10, 139, 139,
139, 10, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 138, 143, 145, 38, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 138, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
144, 1, 144, 145, 144, 144, 145, 146, 147, 145,
10, 145, 10, 145, 10, 10, 10, 145, 145, 145,
145, 145, 145, 145, 145, 145, 145, 145, 144, 144,
146, 148, 149, 147, 150, 144, 10, 10, 10, 145,
145, 145, 10, 145, 145, 145, 145, 145, 145, 145,
145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
145, 145, 145, 144, 149, 151, 39, 145, 145, 145,
145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
144, 145, 145, 145, 145, 145, 145, 145, 145, 145,
139, 138, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 139, 139, 139, 139, 0, 138, 138,
138, 138, 138, 138, 138
145, 145, 145, 145, 145, 144, 145, 145, 145, 145,
145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
145, 145, 145, 0, 144, 144, 144, 144, 144, 144,
144
} ;
static yyconst flex_uint16_t yy_nxt[247] =
static yyconst flex_uint16_t yy_nxt[252] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 10, 12,
13, 13, 14, 4, 4, 4, 13, 13, 15, 16,
17, 13, 18, 4, 19, 20, 21, 4, 22, 23,
4, 24, 25, 4, 26, 4, 4, 4, 31, 31,
27, 32, 34, 35, 36, 36, 36, 137, 37, 37,
37, 37, 37, 47, 37, 37, 37, 37, 37, 37,
37, 37, 37, 53, 136, 55, 37, 37, 37, 54,
58, 135, 48, 49, 56, 59, 50, 40, 31, 31,
134, 61, 133, 41, 37, 37, 37, 45, 64, 64,
132, 27, 34, 35, 37, 37, 37, 131, 42, 37,
17, 13, 18, 19, 20, 21, 22, 4, 23, 24,
4, 25, 26, 4, 27, 4, 4, 4, 32, 32,
28, 33, 35, 36, 37, 37, 37, 143, 38, 38,
38, 38, 38, 49, 38, 38, 38, 38, 38, 38,
38, 38, 38, 55, 142, 57, 38, 38, 38, 56,
60, 141, 50, 51, 58, 61, 52, 41, 32, 32,
140, 63, 139, 42, 38, 38, 38, 46, 66, 66,
138, 28, 35, 36, 38, 38, 38, 137, 43, 38,
37, 37, 64, 64, 130, 87, 43, 129, 128, 44,
65, 65, 65, 127, 65, 65, 126, 125, 124, 123,
65, 65, 65, 65, 65, 65, 122, 121, 69, 30,
30, 33, 33, 31, 31, 63, 63, 34, 34, 64,
64, 120, 119, 118, 117, 116, 115, 114, 113, 112,
111, 110, 109, 108, 107, 106, 105, 104, 103, 102,
101, 100, 99, 98, 97, 96, 95, 94, 93, 92,
91, 90, 89, 88, 86, 85, 84, 83, 82, 81,
80, 79, 78, 77, 76, 75, 74, 73, 72, 71,
70, 68, 67, 66, 35, 62, 28, 60, 57, 52,
38, 38, 66, 66, 136, 90, 44, 135, 134, 45,
67, 67, 67, 133, 67, 67, 132, 131, 130, 129,
67, 67, 67, 67, 67, 67, 128, 127, 71, 31,
31, 34, 34, 32, 32, 65, 65, 35, 35, 66,
66, 126, 125, 124, 123, 122, 121, 120, 119, 118,
117, 116, 115, 114, 113, 112, 111, 110, 109, 108,
107, 106, 105, 104, 103, 102, 101, 100, 99, 98,
97, 96, 95, 94, 93, 92, 91, 89, 88, 87,
86, 85, 84, 83, 82, 81, 80, 79, 78, 77,
76, 75, 74, 73, 72, 70, 69, 68, 36, 64,
51, 46, 39, 38, 29, 28, 138, 3, 138, 138,
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
138, 138, 138, 138, 138, 138
29, 62, 59, 54, 53, 48, 47, 40, 39, 30,
29, 144, 3, 144, 144, 144, 144, 144, 144, 144,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
144
} ;
static yyconst flex_int16_t yy_chk[247] =
static yyconst flex_int16_t yy_chk[252] =
{ 0,
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, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 8, 8,
139, 8, 9, 9, 10, 10, 10, 135, 10, 10,
13, 13, 13, 19, 10, 10, 10, 10, 10, 10,
15, 15, 15, 22, 133, 23, 17, 17, 17, 22,
25, 132, 19, 19, 23, 25, 19, 15, 30, 30,
131, 30, 130, 15, 16, 16, 16, 17, 32, 32,
129, 32, 33, 33, 37, 37, 37, 127, 16, 42,
145, 8, 9, 9, 10, 10, 10, 141, 10, 10,
13, 13, 13, 20, 10, 10, 10, 10, 10, 10,
15, 15, 15, 23, 139, 24, 17, 17, 17, 23,
26, 138, 20, 20, 24, 26, 20, 15, 31, 31,
137, 31, 136, 15, 16, 16, 16, 17, 33, 33,
135, 33, 34, 34, 38, 38, 38, 133, 16, 43,
42, 42, 63, 63, 126, 63, 16, 125, 124, 16,
38, 38, 38, 123, 38, 38, 120, 119, 118, 117,
38, 38, 38, 38, 38, 38, 116, 115, 42, 140,
140, 141, 141, 142, 142, 143, 143, 144, 144, 145,
145, 112, 111, 110, 108, 107, 106, 105, 104, 103,
100, 99, 97, 96, 95, 94, 93, 92, 91, 88,
87, 85, 83, 79, 78, 76, 75, 73, 70, 69,
68, 67, 66, 64, 60, 59, 58, 57, 56, 55,
53, 52, 51, 50, 49, 48, 47, 46, 45, 44,
43, 41, 40, 39, 34, 31, 28, 26, 24, 21,
43, 43, 65, 65, 132, 65, 16, 131, 130, 16,
39, 39, 39, 129, 39, 39, 126, 125, 124, 123,
39, 39, 39, 39, 39, 39, 122, 120, 43, 146,
146, 147, 147, 148, 148, 149, 149, 150, 150, 151,
151, 117, 116, 115, 113, 112, 111, 110, 109, 108,
107, 104, 103, 101, 100, 99, 98, 97, 96, 95,
94, 91, 90, 88, 86, 82, 81, 79, 78, 76,
75, 72, 71, 70, 69, 68, 66, 62, 61, 60,
59, 58, 57, 55, 54, 53, 52, 51, 50, 49,
48, 47, 46, 45, 44, 42, 41, 40, 35, 32,
20, 18, 14, 11, 7, 5, 3, 138, 138, 138,
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
138, 138, 138, 138, 138, 138
29, 27, 25, 22, 21, 19, 18, 14, 11, 7,
5, 3, 144, 144, 144, 144, 144, 144, 144, 144,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144,
144
} ;
static yy_state_type yy_last_accepting_state;
@ -804,13 +809,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 >= 139 )
if ( yy_current_state >= 145 )
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] != 208 );
while ( yy_base[yy_current_state] != 213 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@ -870,87 +875,87 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
{yylval.number=PCI; return(BUS);}
{yylval.number=3; return(HIDDEN);}
YY_BREAK
case 10:
YY_RULE_SETUP
{yylval.number=IOAPIC; return(BUS);}
{yylval.number=PCI; return(BUS);}
YY_BREAK
case 11:
YY_RULE_SETUP
{yylval.number=PNP; return(BUS);}
{yylval.number=IOAPIC; return(BUS);}
YY_BREAK
case 12:
YY_RULE_SETUP
{yylval.number=I2C; return(BUS);}
{yylval.number=PNP; return(BUS);}
YY_BREAK
case 13:
YY_RULE_SETUP
{yylval.number=APIC; return(BUS);}
{yylval.number=I2C; return(BUS);}
YY_BREAK
case 14:
YY_RULE_SETUP
{yylval.number=CPU_CLUSTER; return(BUS);}
{yylval.number=APIC; return(BUS);}
YY_BREAK
case 15:
YY_RULE_SETUP
{yylval.number=CPU; return(BUS);}
{yylval.number=CPU_CLUSTER; return(BUS);}
YY_BREAK
case 16:
YY_RULE_SETUP
{yylval.number=DOMAIN; return(BUS);}
{yylval.number=CPU; return(BUS);}
YY_BREAK
case 17:
YY_RULE_SETUP
{yylval.number=GENERIC; return(BUS);}
{yylval.number=DOMAIN; return(BUS);}
YY_BREAK
case 18:
YY_RULE_SETUP
{yylval.number=MMIO; return(BUS);}
{yylval.number=GENERIC; return(BUS);}
YY_BREAK
case 19:
YY_RULE_SETUP
{yylval.number=SPI; return(BUS);}
{yylval.number=MMIO; return(BUS);}
YY_BREAK
case 20:
YY_RULE_SETUP
{yylval.number=USB; return(BUS);}
{yylval.number=SPI; return(BUS);}
YY_BREAK
case 21:
YY_RULE_SETUP
{yylval.number=IRQ; return(RESOURCE);}
{yylval.number=USB; return(BUS);}
YY_BREAK
case 22:
YY_RULE_SETUP
{yylval.number=DRQ; return(RESOURCE);}
{yylval.number=IRQ; return(RESOURCE);}
YY_BREAK
case 23:
YY_RULE_SETUP
{yylval.number=IO; return(RESOURCE);}
{yylval.number=DRQ; return(RESOURCE);}
YY_BREAK
case 24:
YY_RULE_SETUP
{return(IOAPIC_IRQ);}
{yylval.number=IO; return(RESOURCE);}
YY_BREAK
case 25:
YY_RULE_SETUP
{return(INHERIT);}
{return(IOAPIC_IRQ);}
YY_BREAK
case 26:
YY_RULE_SETUP
{return(SUBSYSTEMID);}
{return(INHERIT);}
YY_BREAK
case 27:
YY_RULE_SETUP
{return(END);}
{return(SUBSYSTEMID);}
YY_BREAK
case 28:
YY_RULE_SETUP
{return(EQUALS);}
{return(END);}
YY_BREAK
case 29:
YY_RULE_SETUP
{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
{return(EQUALS);}
YY_BREAK
case 30:
YY_RULE_SETUP
@ -962,12 +967,11 @@ YY_RULE_SETUP
YY_BREAK
case 32:
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 33:
/* rule 33 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 34:
/* rule 34 can match eol */
@ -975,10 +979,15 @@ YY_RULE_SETUP
{yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
YY_BREAK
case 35:
/* rule 35 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);}
YY_BREAK
case 36:
YY_RULE_SETUP
{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);}
YY_BREAK
case 36:
case 37:
YY_RULE_SETUP
ECHO;
YY_BREAK
@ -1274,7 +1283,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 >= 139 )
if ( yy_current_state >= 145 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
@ -1302,11 +1311,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 >= 139 )
if ( yy_current_state >= 145 )
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 == 138);
yy_is_jam = (yy_current_state == 144);
return yy_is_jam ? 0 : yy_current_state;
}

View File

@ -480,7 +480,7 @@ static void set_new_child(struct bus *parent, struct device *child)
struct device *new_device(struct bus *parent,
struct chip_instance *chip_instance,
const int bustype, const char *devnum,
int enabled)
int status)
{
char *tmp;
int path_a;
@ -511,7 +511,8 @@ struct device *new_device(struct bus *parent,
sprintf(name, "_dev%d", new_d->id);
new_d->name = name;
new_d->enabled = enabled;
new_d->enabled = status & 0x01;
new_d->hidden = (status >> 1) & 0x01;
new_d->chip_instance = chip_instance;
chip_instance->ref_count++;
@ -787,6 +788,7 @@ static void pass1(FILE *fil, struct device *ptr, struct device *next)
fprintf(fil, ptr->path, ptr->path_a, ptr->path_b);
fprintf(fil, "},\n");
fprintf(fil, "\t.enabled = %d,\n", ptr->enabled);
fprintf(fil, "\t.hidden = %d,\n", ptr->hidden);
fprintf(fil, "\t.on_mainboard = 1,\n");
if (ptr->subsystem_vendor > 0)
fprintf(fil, "\t.subsystem_vendor = 0x%04x,\n",

View File

@ -102,8 +102,9 @@ struct device {
/* Monotonically increasing ID for the device. */
int id;
/* Indicates whether this device is enabled. */
/* Indicates device status (enabled / hidden or not). */
int enabled;
int hidden;
/* Subsystem IDs for the device. */
int subsystem_vendor;
@ -147,7 +148,7 @@ extern struct bus *root_parent;
struct device *new_device(struct bus *parent,
struct chip_instance *chip_instance,
const int bustype, const char *devnum,
int enabled);
int status);
void add_resource(struct bus *bus, int type, int index, int base);

View File

@ -29,6 +29,7 @@ device {return(DEVICE);}
register {return(REGISTER);}
on {yylval.number=1; return(BOOL);}
off {yylval.number=0; return(BOOL);}
hidden {yylval.number=3; return(HIDDEN);}
pci {yylval.number=PCI; return(BUS);}
ioapic {yylval.number=IOAPIC; return(BUS);}
pnp {yylval.number=PNP; return(BUS);}

View File

@ -128,32 +128,33 @@ extern int yydebug;
DEVICE = 259,
REGISTER = 260,
BOOL = 261,
BUS = 262,
RESOURCE = 263,
END = 264,
EQUALS = 265,
HEX = 266,
STRING = 267,
PCI = 268,
PNP = 269,
I2C = 270,
APIC = 271,
CPU_CLUSTER = 272,
CPU = 273,
DOMAIN = 274,
IRQ = 275,
DRQ = 276,
IO = 277,
NUMBER = 278,
SUBSYSTEMID = 279,
INHERIT = 280,
IOAPIC_IRQ = 281,
IOAPIC = 282,
PCIINT = 283,
GENERIC = 284,
SPI = 285,
USB = 286,
MMIO = 287
HIDDEN = 262,
BUS = 263,
RESOURCE = 264,
END = 265,
EQUALS = 266,
HEX = 267,
STRING = 268,
PCI = 269,
PNP = 270,
I2C = 271,
APIC = 272,
CPU_CLUSTER = 273,
CPU = 274,
DOMAIN = 275,
IRQ = 276,
DRQ = 277,
IO = 278,
NUMBER = 279,
SUBSYSTEMID = 280,
INHERIT = 281,
IOAPIC_IRQ = 282,
IOAPIC = 283,
PCIINT = 284,
GENERIC = 285,
SPI = 286,
USB = 287,
MMIO = 288
};
#endif
@ -428,21 +429,21 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 3
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 39
#define YYLAST 40
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 33
#define YYNTOKENS 34
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 13
#define YYNNTS 14
/* YYNRULES -- Number of rules. */
#define YYNRULES 22
#define YYNRULES 24
/* YYNSTATES -- Number of states. */
#define YYNSTATES 41
#define YYNSTATES 43
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 287
#define YYMAXUTOK 288
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@ -479,7 +480,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, 28, 29, 30, 31, 32
25, 26, 27, 28, 29, 30, 31, 32, 33
};
#if YYDEBUG
@ -487,8 +488,8 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyrline[] =
{
0, 36, 36, 36, 38, 38, 38, 38, 40, 40,
40, 40, 40, 40, 42, 42, 51, 51, 59, 62,
65, 68, 71
40, 40, 40, 40, 42, 42, 51, 51, 59, 59,
61, 64, 67, 70, 73
};
#endif
@ -498,12 +499,12 @@ static const yytype_uint8 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "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", "GENERIC",
"SPI", "USB", "MMIO", "$accept", "devtree", "$@1", "chipchildren",
"devicechildren", "chip", "@2", "device", "@3", "resource", "registers",
"subsystemid", "ioapic_irq", YY_NULLPTR
"HIDDEN", "BUS", "RESOURCE", "END", "EQUALS", "HEX", "STRING", "PCI",
"PNP", "I2C", "APIC", "CPU_CLUSTER", "CPU", "DOMAIN", "IRQ", "DRQ", "IO",
"NUMBER", "SUBSYSTEMID", "INHERIT", "IOAPIC_IRQ", "IOAPIC", "PCIINT",
"GENERIC", "SPI", "USB", "MMIO", "$accept", "devtree", "$@1",
"chipchildren", "devicechildren", "chip", "@2", "device", "@3", "status",
"resource", "registers", "subsystemid", "ioapic_irq", YY_NULLPTR
};
#endif
@ -515,7 +516,7 @@ 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, 283, 284,
285, 286, 287
285, 286, 287, 288
};
# endif
@ -533,11 +534,11 @@ static const yytype_uint16 yytoknum[] =
STATE-NUM. */
static const yytype_int8 yypact[] =
{
-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
-10, 11, 9, -10, 1, -10, -10, -10, 0, 5,
3, -10, -10, -10, -10, -9, 6, 2, 7, -10,
-10, -10, -10, -10, -3, -5, -10, -1, 4, -10,
-10, -10, -10, -10, 10, 8, -4, 12, 13, 14,
-10, -10, -10
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@ -546,24 +547,24 @@ static const yytype_int8 yypact[] =
static const yytype_uint8 yydefact[] =
{
2, 0, 0, 1, 0, 3, 14, 7, 0, 0,
0, 15, 5, 4, 6, 0, 0, 0, 0, 16,
19, 13, 0, 0, 17, 0, 0, 9, 8, 10,
11, 12, 0, 0, 0, 0, 20, 0, 18, 21,
22
0, 15, 5, 4, 6, 0, 0, 0, 0, 18,
19, 16, 21, 13, 0, 0, 17, 0, 0, 9,
8, 10, 11, 12, 0, 0, 0, 0, 22, 0,
20, 23, 24
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
-10, -10, -10, -10, -10, -6, -10, 17, -10, -10,
-10, -10, -10
-10, -10, -10, -10, -10, -6, -10, 16, -10, -10,
-10, -10, -10, -10
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
-1, 1, 2, 8, 22, 5, 7, 13, 21, 29,
14, 30, 31
-1, 1, 2, 8, 24, 5, 7, 13, 23, 21,
31, 14, 32, 33
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@ -571,45 +572,47 @@ static const yytype_int8 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] =
{
4, 9, 12, 3, 4, 23, 24, 4, 9, 10,
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
4, 9, 12, 4, 9, 10, 25, 26, 19, 20,
11, 3, 4, 15, 6, 17, 16, 18, 29, 34,
22, 37, 27, 35, 28, 39, 0, 0, 36, 0,
0, 0, 38, 0, 0, 0, 40, 0, 42, 41,
30
};
static const yytype_int8 yycheck[] =
{
3, 4, 8, 0, 3, 8, 9, 3, 4, 5,
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
3, 4, 8, 3, 4, 5, 9, 10, 6, 7,
10, 0, 3, 8, 13, 24, 13, 11, 24, 24,
13, 11, 25, 24, 27, 29, -1, -1, 24, -1,
-1, -1, 24, -1, -1, -1, 24, -1, 24, 26,
24
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 34, 35, 0, 3, 38, 12, 39, 36, 4,
5, 9, 38, 40, 43, 7, 12, 23, 10, 6,
12, 41, 37, 8, 9, 24, 26, 38, 40, 42,
44, 45, 23, 23, 23, 10, 23, 28, 23, 25,
23
0, 35, 36, 0, 3, 39, 13, 40, 37, 4,
5, 10, 39, 41, 45, 8, 13, 24, 11, 6,
7, 43, 13, 42, 38, 9, 10, 25, 27, 39,
41, 44, 46, 47, 24, 24, 24, 11, 24, 29,
24, 26, 24
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
0, 33, 35, 34, 36, 36, 36, 36, 37, 37,
37, 37, 37, 37, 39, 38, 41, 40, 42, 43,
44, 44, 45
0, 34, 36, 35, 37, 37, 37, 37, 38, 38,
38, 38, 38, 38, 40, 39, 42, 41, 43, 43,
44, 45, 46, 46, 47
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 2, 2, 2, 0, 2, 2,
2, 2, 2, 0, 0, 5, 0, 7, 4, 4,
3, 4, 4
2, 2, 2, 0, 0, 5, 0, 7, 1, 1,
4, 4, 3, 4, 4
};
@ -1326,31 +1329,31 @@ yyreduce:
break;
case 18:
case 20:
{ add_resource(cur_parent, (yyvsp[-3].number), strtol((yyvsp[-2].string), NULL, 0), strtol((yyvsp[0].string), NULL, 0)); }
break;
case 19:
case 21:
{ add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); }
break;
case 20:
case 22:
{ add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-1].string), NULL, 16), strtol((yyvsp[0].string), NULL, 16), 0); }
break;
case 21:
case 23:
{ add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-2].string), NULL, 16), strtol((yyvsp[-1].string), NULL, 16), 1); }
break;
case 22:
case 24:
{ add_ioapic_info(cur_parent, strtol((yyvsp[-2].string), NULL, 16), (yyvsp[-1].string), strtol((yyvsp[0].string), NULL, 16)); }

View File

@ -49,32 +49,33 @@ extern int yydebug;
DEVICE = 259,
REGISTER = 260,
BOOL = 261,
BUS = 262,
RESOURCE = 263,
END = 264,
EQUALS = 265,
HEX = 266,
STRING = 267,
PCI = 268,
PNP = 269,
I2C = 270,
APIC = 271,
CPU_CLUSTER = 272,
CPU = 273,
DOMAIN = 274,
IRQ = 275,
DRQ = 276,
IO = 277,
NUMBER = 278,
SUBSYSTEMID = 279,
INHERIT = 280,
IOAPIC_IRQ = 281,
IOAPIC = 282,
PCIINT = 283,
GENERIC = 284,
SPI = 285,
USB = 286,
MMIO = 287
HIDDEN = 262,
BUS = 263,
RESOURCE = 264,
END = 265,
EQUALS = 266,
HEX = 267,
STRING = 268,
PCI = 269,
PNP = 270,
I2C = 271,
APIC = 272,
CPU_CLUSTER = 273,
CPU = 274,
DOMAIN = 275,
IRQ = 276,
DRQ = 277,
IO = 278,
NUMBER = 279,
SUBSYSTEMID = 280,
INHERIT = 281,
IOAPIC_IRQ = 282,
IOAPIC = 283,
PCIINT = 284,
GENERIC = 285,
SPI = 286,
USB = 287,
MMIO = 288
};
#endif

View File

@ -31,7 +31,7 @@ static struct chip_instance *cur_chip_instance;
int number;
}
%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 GENERIC SPI USB MMIO
%token CHIP DEVICE REGISTER BOOL HIDDEN BUS RESOURCE END EQUALS HEX STRING PCI PNP I2C APIC CPU_CLUSTER CPU DOMAIN IRQ DRQ IO NUMBER SUBSYSTEMID INHERIT IOAPIC_IRQ IOAPIC PCIINT GENERIC SPI USB MMIO
%%
devtree: { cur_parent = root_parent; } chip;
@ -48,7 +48,7 @@ chip: CHIP STRING /* == path */ {
cur_chip_instance = chip_dequeue_tail();
};
device: DEVICE BUS NUMBER /* == devnum */ BOOL {
device: DEVICE BUS NUMBER /* == devnum */ status {
$<dev>$ = new_device(cur_parent, cur_chip_instance, $<number>2, $<string>3, $<number>4);
cur_parent = $<dev>$->last_bus;
}
@ -56,6 +56,8 @@ device: DEVICE BUS NUMBER /* == devnum */ BOOL {
cur_parent = $<dev>5->parent;
};
status: BOOL | HIDDEN;
resource: RESOURCE NUMBER /* == resnum */ EQUALS NUMBER /* == resval */
{ add_resource(cur_parent, $<number>1, strtol($<string>2, NULL, 0), strtol($<string>4, NULL, 0)); } ;