sconfig: Add SMBIOS type 9 entries

Add the new field 'smbios_slot_desc', which takes 2 to 4 arguments.
The field is valid for PCI devices and only compiled if SMBIOS table
generation is enabled.

smbios_slot_desc arguments:
1. slot type
2. slot lenth
3. slot designation (optional)
4. slot data width (optional)

Example:

    device pci 1c.1 on
        smbios_slot_desc "21" "3" "MINI-PCI-FULL" "8"
    end # PCIe Port #2 Integrated Wireless LAN

Tested on Lenovo T520.

Change-Id: If95aae3c322d3da47637613b9a872ba1f7af9080
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32307
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
This commit is contained in:
Patrick Rudolph 2019-04-12 14:42:17 +02:00 committed by Patrick Georgi
parent 1a93058448
commit ac24d3c311
8 changed files with 344 additions and 242 deletions

View File

@ -141,6 +141,12 @@ struct device {
#if !DEVTREE_EARLY #if !DEVTREE_EARLY
struct chip_operations *chip_ops; struct chip_operations *chip_ops;
const char *name; const char *name;
#if CONFIG(GENERATE_SMBIOS_TABLES)
u8 smbios_slot_type;
u8 smbios_slot_data_width;
u8 smbios_slot_length;
const char *smbios_slot_designation;
#endif
#endif #endif
DEVTREE_CONST void *chip_info; DEVTREE_CONST void *chip_info;
}; };

View File

@ -168,7 +168,7 @@ extern FILE *yyin, *yyout;
do \ do \
{ \ { \
/* Undo effects of setting up yytext. */ \ /* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \ yy_size_t yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\ YY_LESS_LINENO(yyless_macro_arg);\
*yy_cp = (yy_hold_char); \ *yy_cp = (yy_hold_char); \
YY_RESTORE_YY_MORE_OFFSET \ YY_RESTORE_YY_MORE_OFFSET \
@ -358,8 +358,8 @@ static void yynoreturn yy_fatal_error (yyconst char* msg );
*yy_cp = '\0'; \ *yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp; (yy_c_buf_p) = yy_cp;
#define YY_NUM_RULES 37 #define YY_NUM_RULES 38
#define YY_END_OF_BUFFER 38 #define YY_END_OF_BUFFER 39
/* This struct is not used in this scanner, /* This struct is not used in this scanner,
but its presence is necessary. */ but its presence is necessary. */
struct yy_trans_info struct yy_trans_info
@ -367,24 +367,25 @@ struct yy_trans_info
flex_int32_t yy_verify; flex_int32_t yy_verify;
flex_int32_t yy_nxt; flex_int32_t yy_nxt;
}; };
static yyconst flex_int16_t yy_accept[145] = static yyconst flex_int16_t yy_accept[160] =
{ 0, { 0,
0, 0, 38, 36, 1, 3, 36, 36, 36, 31, 0, 0, 39, 37, 1, 3, 37, 37, 37, 32,
31, 29, 32, 36, 32, 32, 32, 36, 36, 36, 32, 30, 33, 37, 33, 33, 33, 37, 37, 37,
36, 36, 36, 36, 36, 36, 36, 36, 1, 3, 37, 37, 37, 37, 37, 37, 37, 37, 1, 3,
36, 0, 36, 36, 0, 2, 31, 32, 36, 36, 37, 0, 37, 37, 0, 2, 32, 33, 37, 37,
36, 36, 32, 36, 36, 36, 36, 36, 36, 36, 37, 37, 33, 37, 37, 37, 37, 37, 37, 37,
24, 36, 36, 36, 36, 7, 36, 36, 36, 36, 24, 37, 37, 37, 37, 7, 37, 37, 37, 37,
36, 36, 35, 35, 36, 0, 30, 36, 36, 16, 37, 37, 37, 36, 36, 37, 0, 31, 37, 37,
36, 36, 23, 28, 36, 36, 13, 36, 36, 22, 16, 37, 37, 23, 28, 37, 37, 13, 37, 37,
36, 36, 8, 10, 12, 36, 20, 36, 21, 36, 22, 37, 37, 8, 10, 12, 37, 37, 20, 37,
0, 33, 4, 36, 36, 36, 36, 36, 36, 36, 21, 37, 0, 34, 4, 37, 37, 37, 37, 37,
36, 19, 36, 36, 34, 34, 36, 36, 36, 36, 37, 37, 37, 19, 37, 37, 37, 35, 35, 37,
36, 36, 36, 14, 36, 36, 36, 5, 17, 36, 37, 37, 37, 37, 37, 37, 14, 37, 37, 37,
9, 36, 11, 36, 36, 36, 18, 26, 36, 36, 37, 5, 17, 37, 9, 37, 11, 37, 37, 37,
36, 36, 36, 6, 36, 36, 36, 36, 36, 25, 37, 18, 26, 37, 37, 37, 37, 37, 37, 6,
36, 15, 27, 0 37, 37, 37, 37, 37, 37, 37, 25, 37, 37,
15, 37, 27, 37, 37, 37, 37, 29, 0
} ; } ;
static yyconst YY_CHAR yy_ec[256] = static yyconst YY_CHAR yy_ec[256] =
@ -427,110 +428,114 @@ static yyconst YY_CHAR yy_meta[39] =
1, 1, 1, 1, 1, 1, 1, 1 1, 1, 1, 1, 1, 1, 1, 1
} ; } ;
static yyconst flex_uint16_t yy_base[152] = static yyconst flex_uint16_t yy_base[167] =
{ 0, { 0,
0, 0, 212, 0, 209, 213, 207, 37, 41, 38, 0, 0, 227, 0, 224, 228, 222, 37, 41, 38,
172, 0, 44, 194, 54, 78, 60, 186, 181, 45, 187, 0, 44, 209, 54, 78, 60, 201, 196, 45,
188, 177, 42, 47, 182, 41, 169, 0, 199, 213, 203, 192, 42, 47, 197, 62, 184, 0, 214, 228,
77, 195, 87, 91, 196, 213, 0, 88, 104, 183, 77, 210, 88, 69, 211, 228, 0, 87, 104, 198,
172, 161, 93, 168, 163, 173, 164, 171, 171, 165, 187, 176, 93, 183, 178, 188, 179, 186, 186, 180,
171, 156, 156, 160, 162, 0, 158, 152, 158, 155, 186, 171, 171, 175, 177, 0, 173, 167, 173, 177,
161, 160, 0, 213, 101, 172, 0, 165, 145, 158, 169, 175, 174, 0, 228, 101, 186, 0, 179, 159,
148, 155, 0, 0, 150, 150, 0, 148, 138, 0, 172, 162, 169, 0, 0, 164, 164, 0, 162, 152,
142, 137, 0, 0, 0, 140, 0, 131, 0, 158, 0, 156, 151, 0, 0, 0, 154, 153, 0, 144,
157, 0, 0, 142, 141, 134, 126, 136, 124, 130, 0, 171, 170, 0, 0, 155, 154, 147, 139, 149,
135, 0, 120, 114, 0, 213, 125, 129, 121, 123, 137, 143, 148, 0, 133, 136, 126, 0, 228, 137,
119, 121, 126, 0, 110, 110, 107, 0, 0, 109, 141, 133, 135, 131, 133, 138, 0, 122, 122, 121,
0, 93, 104, 98, 84, 84, 0, 0, 89, 77, 118, 0, 0, 133, 0, 117, 134, 128, 132, 113,
87, 71, 66, 0, 64, 62, 50, 47, 33, 0, 113, 0, 0, 120, 112, 110, 121, 94, 95, 0,
28, 0, 0, 213, 40, 129, 131, 133, 135, 137, 94, 92, 97, 86, 85, 84, 76, 0, 71, 78,
139 0, 67, 0, 61, 55, 32, 29, 0, 228, 40,
129, 131, 133, 135, 137, 139
} ; } ;
static yyconst flex_int16_t yy_def[152] = static yyconst flex_int16_t yy_def[167] =
{ 0, { 0,
144, 1, 144, 145, 144, 144, 145, 146, 147, 145, 159, 1, 159, 160, 159, 159, 160, 161, 162, 160,
10, 145, 10, 145, 10, 10, 10, 145, 145, 145, 10, 160, 10, 160, 10, 10, 10, 160, 160, 160,
145, 145, 145, 145, 145, 145, 145, 145, 144, 144, 160, 160, 160, 160, 160, 160, 160, 160, 159, 159,
146, 148, 149, 147, 150, 144, 10, 10, 10, 145, 161, 163, 164, 162, 165, 159, 10, 10, 10, 160,
145, 145, 10, 145, 145, 145, 145, 145, 145, 145, 160, 160, 10, 160, 160, 160, 160, 160, 160, 160,
145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
145, 145, 145, 144, 149, 151, 39, 145, 145, 145, 160, 160, 160, 160, 159, 164, 166, 39, 160, 160,
145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
144, 145, 145, 145, 145, 145, 145, 145, 145, 145, 160, 160, 159, 160, 160, 160, 160, 160, 160, 160,
145, 145, 145, 145, 145, 144, 145, 145, 145, 145, 160, 160, 160, 160, 160, 160, 160, 160, 159, 160,
145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
145, 145, 145, 0, 144, 144, 144, 144, 144, 144, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
144 160, 160, 160, 160, 160, 160, 160, 160, 0, 159,
159, 159, 159, 159, 159, 159
} ; } ;
static yyconst flex_uint16_t yy_nxt[252] = static yyconst flex_uint16_t yy_nxt[267] =
{ 0, { 0,
4, 5, 6, 7, 8, 9, 10, 11, 10, 12, 4, 5, 6, 7, 8, 9, 10, 11, 10, 12,
13, 13, 14, 4, 4, 4, 13, 13, 15, 16, 13, 13, 14, 4, 4, 4, 13, 13, 15, 16,
17, 13, 18, 19, 20, 21, 22, 4, 23, 24, 17, 13, 18, 19, 20, 21, 22, 4, 23, 24,
4, 25, 26, 4, 27, 4, 4, 4, 32, 32, 4, 25, 26, 4, 27, 4, 4, 4, 32, 32,
28, 33, 35, 36, 37, 37, 37, 143, 38, 38, 28, 33, 35, 36, 37, 37, 37, 158, 38, 38,
38, 38, 38, 49, 38, 38, 38, 38, 38, 38, 38, 38, 38, 49, 38, 38, 38, 38, 38, 38,
38, 38, 38, 55, 142, 57, 38, 38, 38, 56, 38, 38, 38, 55, 157, 57, 38, 38, 38, 56,
60, 141, 50, 51, 58, 61, 52, 41, 32, 32, 35, 36, 50, 51, 58, 156, 52, 41, 32, 32,
140, 63, 139, 42, 38, 38, 38, 46, 66, 66, 155, 64, 154, 42, 38, 38, 38, 46, 60, 67,
138, 28, 35, 36, 38, 38, 38, 137, 43, 38, 67, 61, 28, 38, 38, 38, 62, 153, 43, 38,
38, 38, 66, 66, 136, 90, 44, 135, 134, 45, 38, 38, 67, 67, 152, 92, 44, 151, 150, 45,
67, 67, 67, 133, 67, 67, 132, 131, 130, 129, 68, 68, 68, 149, 68, 68, 148, 147, 146, 145,
67, 67, 67, 67, 67, 67, 128, 127, 71, 31, 68, 68, 68, 68, 68, 68, 144, 143, 72, 31,
31, 34, 34, 32, 32, 65, 65, 35, 35, 66, 31, 34, 34, 32, 32, 66, 66, 35, 35, 67,
66, 126, 125, 124, 123, 122, 121, 120, 119, 118, 67, 142, 141, 140, 139, 138, 137, 136, 135, 134,
117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124,
107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114,
97, 96, 95, 94, 93, 92, 91, 89, 88, 87, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104,
86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94,
76, 75, 74, 73, 72, 70, 69, 68, 36, 64, 93, 91, 90, 89, 88, 87, 86, 85, 84, 83,
29, 62, 59, 54, 53, 48, 47, 40, 39, 30, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73,
29, 144, 3, 144, 144, 144, 144, 144, 144, 144, 71, 70, 69, 36, 65, 29, 63, 59, 54, 53,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 48, 47, 40, 39, 30, 29, 159, 3, 159, 159,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159,
144 159, 159, 159, 159, 159, 159, 159, 159, 159, 159,
159, 159, 159, 159, 159, 159
} ; } ;
static yyconst flex_int16_t yy_chk[252] = static yyconst flex_int16_t yy_chk[267] =
{ 0, { 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, 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, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8,
145, 8, 9, 9, 10, 10, 10, 141, 10, 10, 160, 8, 9, 9, 10, 10, 10, 157, 10, 10,
13, 13, 13, 20, 10, 10, 10, 10, 10, 10, 13, 13, 13, 20, 10, 10, 10, 10, 10, 10,
15, 15, 15, 23, 139, 24, 17, 17, 17, 23, 15, 15, 15, 23, 156, 24, 17, 17, 17, 23,
26, 138, 20, 20, 24, 26, 20, 15, 31, 31, 34, 34, 20, 20, 24, 155, 20, 15, 31, 31,
137, 31, 136, 15, 16, 16, 16, 17, 33, 33, 154, 31, 152, 15, 16, 16, 16, 17, 26, 33,
135, 33, 34, 34, 38, 38, 38, 133, 16, 43, 33, 26, 33, 38, 38, 38, 26, 150, 16, 43,
43, 43, 65, 65, 132, 65, 16, 131, 130, 16, 43, 43, 66, 66, 149, 66, 16, 147, 146, 16,
39, 39, 39, 129, 39, 39, 126, 125, 124, 123, 39, 39, 39, 145, 39, 39, 144, 143, 142, 141,
39, 39, 39, 39, 39, 39, 122, 120, 43, 146, 39, 39, 39, 39, 39, 39, 139, 138, 43, 161,
146, 147, 147, 148, 148, 149, 149, 150, 150, 151, 161, 162, 162, 163, 163, 164, 164, 165, 165, 166,
151, 117, 116, 115, 113, 112, 111, 110, 109, 108, 166, 137, 136, 135, 134, 131, 130, 129, 128, 127,
107, 104, 103, 101, 100, 99, 98, 97, 96, 95, 126, 124, 121, 120, 119, 118, 116, 115, 114, 113,
94, 91, 90, 88, 86, 82, 81, 79, 78, 76, 112, 111, 110, 107, 106, 105, 103, 102, 101, 100,
75, 72, 71, 70, 69, 68, 66, 62, 61, 60, 99, 98, 97, 96, 93, 92, 90, 88, 87, 83,
59, 58, 57, 55, 54, 53, 52, 51, 50, 49, 82, 80, 79, 77, 76, 73, 72, 71, 70, 69,
48, 47, 46, 45, 44, 42, 41, 40, 35, 32, 67, 63, 62, 61, 60, 59, 58, 57, 55, 54,
29, 27, 25, 22, 21, 19, 18, 14, 11, 7, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44,
5, 3, 144, 144, 144, 144, 144, 144, 144, 144, 42, 41, 40, 35, 32, 29, 27, 25, 22, 21,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 19, 18, 14, 11, 7, 5, 3, 159, 159, 159,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159,
144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159,
144 159, 159, 159, 159, 159, 159, 159, 159, 159, 159,
159, 159, 159, 159, 159, 159
} ; } ;
static yy_state_type yy_last_accepting_state; static yy_state_type yy_last_accepting_state;
@ -674,7 +679,7 @@ static int input (void );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \ { \
int c = '*'; \ int c = '*'; \
size_t n; \ int n; \
for ( n = 0; n < max_size && \ for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \ buf[n] = (char) c; \
@ -687,7 +692,7 @@ static int input (void );
else \ else \
{ \ { \
errno=0; \ errno=0; \
while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
{ \ { \
if( errno != EINTR) \ if( errno != EINTR) \
{ \ { \
@ -809,13 +814,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 145 ) if ( yy_current_state >= 160 )
yy_c = yy_meta[(unsigned int) yy_c]; yy_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
++yy_cp; ++yy_cp;
} }
while ( yy_base[yy_current_state] != 213 ); while ( yy_base[yy_current_state] != 228 );
yy_find_action: yy_find_action:
yy_act = yy_accept[yy_current_state]; yy_act = yy_accept[yy_current_state];
@ -955,11 +960,11 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 29: case 29:
YY_RULE_SETUP YY_RULE_SETUP
{return(EQUALS);} {return(SLOT_DESC);}
YY_BREAK YY_BREAK
case 30: case 30:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} {return(EQUALS);}
YY_BREAK YY_BREAK
case 31: case 31:
YY_RULE_SETUP YY_RULE_SETUP
@ -971,12 +976,11 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 33: case 33:
YY_RULE_SETUP 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 YY_BREAK
case 34: case 34:
/* rule 34 can match eol */
YY_RULE_SETUP 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 YY_BREAK
case 35: case 35:
/* rule 35 can match eol */ /* rule 35 can match eol */
@ -984,10 +988,15 @@ 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+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
YY_BREAK YY_BREAK
case 36: case 36:
/* rule 36 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 37:
YY_RULE_SETUP 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, yyleng); yylval.string[yyleng]='\0'; return(STRING);}
YY_BREAK YY_BREAK
case 37: case 38:
YY_RULE_SETUP YY_RULE_SETUP
ECHO; ECHO;
YY_BREAK YY_BREAK
@ -1135,7 +1144,7 @@ static int yy_get_next_buffer (void)
{ {
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
char *source = (yytext_ptr); char *source = (yytext_ptr);
int number_to_move, i; yy_size_t number_to_move, i;
int ret_val; int ret_val;
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
@ -1164,7 +1173,7 @@ static int yy_get_next_buffer (void)
/* Try to read more data. */ /* Try to read more data. */
/* First move last chars to start of buffer. */ /* First move last chars to start of buffer. */
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
for ( i = 0; i < number_to_move; ++i ) for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++); *(dest++) = *(source++);
@ -1200,7 +1209,7 @@ static int yy_get_next_buffer (void)
b->yy_ch_buf = (char *) b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */ /* Include room in for 2 EOB chars. */
yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); yyrealloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2) );
} }
else else
/* Can't grow it, we don't own it. */ /* Can't grow it, we don't own it. */
@ -1246,10 +1255,10 @@ static int yy_get_next_buffer (void)
else else
ret_val = EOB_ACT_CONTINUE_SCAN; ret_val = EOB_ACT_CONTINUE_SCAN;
if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */ /* Extend the array by 50%, plus the number we really need. */
int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,(yy_size_t) new_size );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
} }
@ -1283,7 +1292,7 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 145 ) if ( yy_current_state >= 160 )
yy_c = yy_meta[(unsigned int) yy_c]; yy_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
@ -1311,11 +1320,11 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 145 ) if ( yy_current_state >= 160 )
yy_c = yy_meta[(unsigned int) yy_c]; yy_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
yy_is_jam = (yy_current_state == 144); yy_is_jam = (yy_current_state == 159);
return yy_is_jam ? 0 : yy_current_state; return yy_is_jam ? 0 : yy_current_state;
} }
@ -1510,12 +1519,12 @@ static void yy_load_buffer_state (void)
if ( ! b ) if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_buf_size = (yy_size_t)size; b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because /* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters. * we need to put in 2 end-of-buffer characters.
*/ */
b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); b->yy_ch_buf = (char *) yyalloc((yy_size_t) (b->yy_buf_size + 2) );
if ( ! b->yy_ch_buf ) if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
@ -1718,7 +1727,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
if ( ! b ) if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base; b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0; b->yy_is_our_buffer = 0;
b->yy_input_file = NULL; b->yy_input_file = NULL;
@ -1801,7 +1810,7 @@ static void yynoreturn yy_fatal_error (yyconst char* msg )
do \ do \
{ \ { \
/* Undo effects of setting up yytext. */ \ /* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \ yy_size_t yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\ YY_LESS_LINENO(yyless_macro_arg);\
yytext[yyleng] = (yy_hold_char); \ yytext[yyleng] = (yy_hold_char); \
(yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_c_buf_p) = yytext + yyless_macro_arg; \

View File

@ -622,6 +622,22 @@ void add_register(struct chip_instance *chip_instance, char *name, char *val)
} }
} }
void add_slot_desc(struct bus *bus, char *type, char *length, char *designation,
char *data_width)
{
struct device *dev = bus->dev;
if (dev->bustype != PCI && dev->bustype != DOMAIN) {
printf("ERROR: 'slot_type' only allowed for PCI devices\n");
exit(1);
}
dev->smbios_slot_type = type;
dev->smbios_slot_length = length;
dev->smbios_slot_data_width = data_width;
dev->smbios_slot_designation = designation;
}
void add_pci_subsystem_ids(struct bus *bus, int vendor, int device, void add_pci_subsystem_ids(struct bus *bus, int vendor, int device,
int inherit) int inherit)
{ {
@ -831,7 +847,30 @@ static void pass1(FILE *fil, struct device *ptr, struct device *next)
fprintf(fil, "\t.chip_info = &%s_info_%d,\n", fprintf(fil, "\t.chip_info = &%s_info_%d,\n",
chip_ins->chip->name_underscore, chip_ins->id); chip_ins->chip->name_underscore, chip_ins->id);
if (next) if (next)
fprintf(fil, "\t.next=&%s\n", next->name); fprintf(fil, "\t.next=&%s,\n", next->name);
if (ptr->smbios_slot_type || ptr->smbios_slot_data_width ||
ptr->smbios_slot_designation || ptr->smbios_slot_length) {
fprintf(fil, "#if !DEVTREE_EARLY\n");
fprintf(fil, "#if CONFIG(GENERATE_SMBIOS_TABLES)\n");
}
/* SMBIOS types start at 1, if zero it hasn't been set */
if (ptr->smbios_slot_type)
fprintf(fil, "\t.smbios_slot_type = %s,\n",
ptr->smbios_slot_type);
if (ptr->smbios_slot_data_width)
fprintf(fil, "\t.smbios_slot_data_width = %s,\n",
ptr->smbios_slot_data_width);
if (ptr->smbios_slot_designation)
fprintf(fil, "\t.smbios_slot_designation = \"%s\",\n",
ptr->smbios_slot_designation);
if (ptr->smbios_slot_length)
fprintf(fil, "\t.smbios_slot_length = %s,\n",
ptr->smbios_slot_length);
if (ptr->smbios_slot_type || ptr->smbios_slot_data_width ||
ptr->smbios_slot_designation || ptr->smbios_slot_length) {
fprintf(fil, "#endif\n");
fprintf(fil, "#endif\n");
}
fprintf(fil, "};\n"); fprintf(fil, "};\n");
emit_resources(fil, ptr); emit_resources(fil, ptr);

View File

@ -141,6 +141,18 @@ struct device {
struct bus *bus; struct bus *bus;
/* Pointer to last bus under this device. */ /* Pointer to last bus under this device. */
struct bus *last_bus; struct bus *last_bus;
/* SMBIOS slot type */
char *smbios_slot_type;
/* SMBIOS slot data width */
char *smbios_slot_data_width;
/* SMBIOS slot description for reference designation */
char *smbios_slot_designation;
/* SMBIOS slot length */
char *smbios_slot_length;
}; };
extern struct bus *root_parent; extern struct bus *root_parent;
@ -158,6 +170,9 @@ void add_pci_subsystem_ids(struct bus *bus, int vendor, int device,
void add_ioapic_info(struct bus *bus, int apicid, const char *_srcpin, void add_ioapic_info(struct bus *bus, int apicid, const char *_srcpin,
int irqpin); int irqpin);
void add_slot_desc(struct bus *bus, char *type, char *length, char *designation,
char *data_width);
void yyrestart(FILE *input_file); void yyrestart(FILE *input_file);
/* Add chip data to tail of queue. */ /* Add chip data to tail of queue. */

View File

@ -21,40 +21,41 @@ int linenum = 0;
%} %}
%option nodebug %option nodebug
%% %%
[ \t]+ {} [ \t]+ {}
#.*\n {linenum++;} #.*\n {linenum++;}
\r?\n {linenum++;} \r?\n {linenum++;}
chip {return(CHIP);} chip {return(CHIP);}
device {return(DEVICE);} device {return(DEVICE);}
register {return(REGISTER);} register {return(REGISTER);}
on {yylval.number=1; return(BOOL);} on {yylval.number=1; return(BOOL);}
off {yylval.number=0; return(BOOL);} off {yylval.number=0; return(BOOL);}
hidden {yylval.number=3; return(HIDDEN);} hidden {yylval.number=3; return(HIDDEN);}
pci {yylval.number=PCI; return(BUS);} pci {yylval.number=PCI; return(BUS);}
ioapic {yylval.number=IOAPIC; return(BUS);} ioapic {yylval.number=IOAPIC; return(BUS);}
pnp {yylval.number=PNP; return(BUS);} pnp {yylval.number=PNP; return(BUS);}
i2c {yylval.number=I2C; return(BUS);} i2c {yylval.number=I2C; return(BUS);}
lapic {yylval.number=APIC; return(BUS);} lapic {yylval.number=APIC; return(BUS);}
cpu_cluster {yylval.number=CPU_CLUSTER; return(BUS);} cpu_cluster {yylval.number=CPU_CLUSTER; return(BUS);}
cpu {yylval.number=CPU; return(BUS);} cpu {yylval.number=CPU; return(BUS);}
domain {yylval.number=DOMAIN; return(BUS);} domain {yylval.number=DOMAIN; return(BUS);}
generic {yylval.number=GENERIC; return(BUS);} generic {yylval.number=GENERIC; return(BUS);}
mmio {yylval.number=MMIO; return(BUS);} mmio {yylval.number=MMIO; return(BUS);}
spi {yylval.number=SPI; return(BUS);} spi {yylval.number=SPI; return(BUS);}
usb {yylval.number=USB; return(BUS);} usb {yylval.number=USB; return(BUS);}
irq {yylval.number=IRQ; return(RESOURCE);} irq {yylval.number=IRQ; return(RESOURCE);}
drq {yylval.number=DRQ; return(RESOURCE);} drq {yylval.number=DRQ; return(RESOURCE);}
io {yylval.number=IO; return(RESOURCE);} io {yylval.number=IO; return(RESOURCE);}
ioapic_irq {return(IOAPIC_IRQ);} ioapic_irq {return(IOAPIC_IRQ);}
inherit {return(INHERIT);} inherit {return(INHERIT);}
subsystemid {return(SUBSYSTEMID);} subsystemid {return(SUBSYSTEMID);}
end {return(END);} end {return(END);}
= {return(EQUALS);} smbios_slot_desc {return(SLOT_DESC);}
0x[0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} = {return(EQUALS);}
[0-9.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} 0x[0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
[0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} [0-9.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
INT[A-D] {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);} [0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
\"\"[^\"]+\"\" {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);} INT[A-D] {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+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);} \"\"[^\"]+\"\" {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
[^ \n\t]+ {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);}
[^ \n\t]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);}
%% %%

View File

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 3.0.4. */ /* A Bison parser, made by GNU Bison 3.0.5. */
/* Bison implementation for Yacc-like parsers in C /* Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -44,7 +44,7 @@
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "3.0.4" #define YYBISON_VERSION "3.0.5"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
@ -144,17 +144,18 @@ extern int yydebug;
DOMAIN = 275, DOMAIN = 275,
IRQ = 276, IRQ = 276,
DRQ = 277, DRQ = 277,
IO = 278, SLOT_DESC = 278,
NUMBER = 279, IO = 279,
SUBSYSTEMID = 280, NUMBER = 280,
INHERIT = 281, SUBSYSTEMID = 281,
IOAPIC_IRQ = 282, INHERIT = 282,
IOAPIC = 283, IOAPIC_IRQ = 283,
PCIINT = 284, IOAPIC = 284,
GENERIC = 285, PCIINT = 285,
SPI = 286, GENERIC = 286,
USB = 287, SPI = 287,
MMIO = 288 USB = 288,
MMIO = 289
}; };
#endif #endif
@ -429,21 +430,21 @@ 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 40 #define YYLAST 43
/* YYNTOKENS -- Number of terminals. */ /* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 34 #define YYNTOKENS 35
/* YYNNTS -- Number of nonterminals. */ /* YYNNTS -- Number of nonterminals. */
#define YYNNTS 14 #define YYNNTS 15
/* YYNRULES -- Number of rules. */ /* YYNRULES -- Number of rules. */
#define YYNRULES 24 #define YYNRULES 28
/* YYNSTATES -- Number of states. */ /* YYNSTATES -- Number of states. */
#define YYNSTATES 43 #define YYNSTATES 49
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */ by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2 #define YYUNDEFTOK 2
#define YYMAXUTOK 288 #define YYMAXUTOK 289
#define YYTRANSLATE(YYX) \ #define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@ -480,7 +481,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
}; };
#if YYDEBUG #if YYDEBUG
@ -488,8 +489,8 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyrline[] = static const yytype_uint8 yyrline[] =
{ {
0, 36, 36, 36, 38, 38, 38, 38, 40, 40, 0, 36, 36, 36, 38, 38, 38, 38, 40, 40,
40, 40, 40, 40, 42, 42, 51, 51, 59, 59, 40, 40, 40, 40, 40, 42, 42, 51, 51, 59,
61, 64, 67, 70, 73 59, 61, 64, 67, 70, 73, 76, 79, 82
}; };
#endif #endif
@ -500,11 +501,12 @@ static const char *const yytname[] =
{ {
"$end", "error", "$undefined", "CHIP", "DEVICE", "REGISTER", "BOOL", "$end", "error", "$undefined", "CHIP", "DEVICE", "REGISTER", "BOOL",
"HIDDEN", "BUS", "RESOURCE", "END", "EQUALS", "HEX", "STRING", "PCI", "HIDDEN", "BUS", "RESOURCE", "END", "EQUALS", "HEX", "STRING", "PCI",
"PNP", "I2C", "APIC", "CPU_CLUSTER", "CPU", "DOMAIN", "IRQ", "DRQ", "IO", "PNP", "I2C", "APIC", "CPU_CLUSTER", "CPU", "DOMAIN", "IRQ", "DRQ",
"NUMBER", "SUBSYSTEMID", "INHERIT", "IOAPIC_IRQ", "IOAPIC", "PCIINT", "SLOT_DESC", "IO", "NUMBER", "SUBSYSTEMID", "INHERIT", "IOAPIC_IRQ",
"GENERIC", "SPI", "USB", "MMIO", "$accept", "devtree", "$@1", "IOAPIC", "PCIINT", "GENERIC", "SPI", "USB", "MMIO", "$accept",
"chipchildren", "devicechildren", "chip", "@2", "device", "@3", "status", "devtree", "$@1", "chipchildren", "devicechildren", "chip", "@2",
"resource", "registers", "subsystemid", "ioapic_irq", YY_NULLPTR "device", "@3", "status", "resource", "registers", "subsystemid",
"ioapic_irq", "smbios_slot_desc", YY_NULLPTR
}; };
#endif #endif
@ -516,14 +518,14 @@ static const yytype_uint16 yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288 285, 286, 287, 288, 289
}; };
# endif # endif
#define YYPACT_NINF -10 #define YYPACT_NINF -12
#define yypact_value_is_default(Yystate) \ #define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-10))) (!!((Yystate) == (-12)))
#define YYTABLE_NINF -1 #define YYTABLE_NINF -1
@ -534,11 +536,11 @@ static const yytype_uint16 yytoknum[] =
STATE-NUM. */ STATE-NUM. */
static const yytype_int8 yypact[] = static const yytype_int8 yypact[] =
{ {
-10, 11, 9, -10, 1, -10, -10, -10, 0, 5, -12, 11, 9, -12, 1, -12, -12, -12, 0, 5,
3, -10, -10, -10, -10, -9, 6, 2, 7, -10, 3, -12, -12, -12, -12, -10, 6, 2, 8, -12,
-10, -10, -10, -10, -3, -5, -10, -1, 4, -10, -12, -12, -12, -12, -3, -1, -12, 13, 4, 7,
-10, -10, -10, -10, 10, 8, -4, 12, 13, 14, -12, -12, -12, -12, -12, -12, 16, 15, 10, -11,
-10, -10, -10 12, 17, -5, 14, -12, 18, -12, -12, -12
}; };
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@ -546,25 +548,25 @@ static const yytype_int8 yypact[] =
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, 3, 14, 7, 0, 0, 2, 0, 0, 1, 0, 3, 15, 7, 0, 0,
0, 15, 5, 4, 6, 0, 0, 0, 0, 18, 0, 16, 5, 4, 6, 0, 0, 0, 0, 19,
19, 16, 21, 13, 0, 0, 17, 0, 0, 9, 20, 17, 22, 14, 0, 0, 18, 0, 0, 0,
8, 10, 11, 12, 0, 0, 0, 0, 22, 0, 9, 8, 10, 11, 12, 13, 0, 0, 0, 0,
20, 23, 24 0, 28, 23, 0, 21, 27, 24, 25, 26
}; };
/* YYPGOTO[NTERM-NUM]. */ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] = static const yytype_int8 yypgoto[] =
{ {
-10, -10, -10, -10, -10, -6, -10, 16, -10, -10, -12, -12, -12, -12, -12, -6, -12, 19, -12, -12,
-10, -10, -10, -10 -12, -12, -12, -12, -12
}; };
/* YYDEFGOTO[NTERM-NUM]. */ /* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] = static const yytype_int8 yydefgoto[] =
{ {
-1, 1, 2, 8, 24, 5, 7, 13, 23, 21, -1, 1, 2, 8, 24, 5, 7, 13, 23, 21,
31, 14, 32, 33 32, 14, 33, 34, 35
}; };
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@ -573,46 +575,46 @@ static const yytype_int8 yydefgoto[] =
static const yytype_uint8 yytable[] = static const yytype_uint8 yytable[] =
{ {
4, 9, 12, 4, 9, 10, 25, 26, 19, 20, 4, 9, 12, 4, 9, 10, 25, 26, 19, 20,
11, 3, 4, 15, 6, 17, 16, 18, 29, 34, 11, 3, 4, 15, 6, 17, 16, 18, 30, 43,
22, 37, 27, 35, 28, 39, 0, 0, 36, 0, 27, 22, 46, 28, 36, 29, 37, 40, 41, 38,
0, 0, 38, 0, 0, 0, 40, 0, 42, 41, 45, 48, 39, 0, 0, 42, 0, 44, 0, 47,
30 0, 0, 0, 31
}; };
static const yytype_int8 yycheck[] = static const yytype_int8 yycheck[] =
{ {
3, 4, 8, 3, 4, 5, 9, 10, 6, 7, 3, 4, 8, 3, 4, 5, 9, 10, 6, 7,
10, 0, 3, 8, 13, 24, 13, 11, 24, 24, 10, 0, 3, 8, 13, 25, 13, 11, 24, 30,
13, 11, 25, 24, 27, 29, -1, -1, 24, -1, 23, 13, 27, 26, 25, 28, 13, 11, 13, 25,
-1, -1, 24, -1, -1, -1, 24, -1, 24, 26, 13, 13, 25, -1, -1, 25, -1, 25, -1, 25,
24 -1, -1, -1, 24
}; };
/* 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, 35, 36, 0, 3, 39, 13, 40, 37, 4, 0, 36, 37, 0, 3, 40, 13, 41, 38, 4,
5, 10, 39, 41, 45, 8, 13, 24, 11, 6, 5, 10, 40, 42, 46, 8, 13, 25, 11, 6,
7, 43, 13, 42, 38, 9, 10, 25, 27, 39, 7, 44, 13, 43, 39, 9, 10, 23, 26, 28,
41, 44, 46, 47, 24, 24, 24, 11, 24, 29, 40, 42, 45, 47, 48, 49, 25, 13, 25, 25,
24, 26, 24 11, 13, 25, 30, 25, 13, 27, 25, 13
}; };
/* 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, 34, 36, 35, 37, 37, 37, 37, 38, 38, 0, 35, 37, 36, 38, 38, 38, 38, 39, 39,
38, 38, 38, 38, 40, 39, 42, 41, 43, 43, 39, 39, 39, 39, 39, 41, 40, 43, 42, 44,
44, 45, 46, 46, 47 44, 45, 46, 47, 47, 48, 49, 49, 49
}; };
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_uint8 yyr2[] = static const yytype_uint8 yyr2[] =
{ {
0, 2, 0, 2, 2, 2, 2, 0, 2, 2, 0, 2, 0, 2, 2, 2, 2, 0, 2, 2,
2, 2, 2, 0, 0, 5, 0, 7, 1, 1, 2, 2, 2, 2, 0, 0, 5, 0, 7, 1,
4, 4, 3, 4, 4 1, 4, 4, 3, 4, 4, 5, 4, 3
}; };
@ -973,6 +975,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
case N: \ case N: \
yyformat = S; \ yyformat = S; \
break break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error")); YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@ -1294,7 +1297,7 @@ yyreduce:
break; break;
case 14: case 15:
{ {
(yyval.chip_instance) = new_chip_instance((yyvsp[0].string)); (yyval.chip_instance) = new_chip_instance((yyvsp[0].string));
@ -1304,7 +1307,7 @@ yyreduce:
break; break;
case 15: case 16:
{ {
cur_chip_instance = chip_dequeue_tail(); cur_chip_instance = chip_dequeue_tail();
@ -1312,7 +1315,7 @@ yyreduce:
break; break;
case 16: case 17:
{ {
(yyval.dev) = new_device(cur_parent, cur_chip_instance, (yyvsp[-2].number), (yyvsp[-1].string), (yyvsp[0].number)); (yyval.dev) = new_device(cur_parent, cur_chip_instance, (yyvsp[-2].number), (yyvsp[-1].string), (yyvsp[0].number));
@ -1321,7 +1324,7 @@ yyreduce:
break; break;
case 17: case 18:
{ {
cur_parent = (yyvsp[-2].dev)->parent; cur_parent = (yyvsp[-2].dev)->parent;
@ -1329,36 +1332,54 @@ yyreduce:
break; break;
case 20: case 21:
{ add_resource(cur_parent, (yyvsp[-3].number), strtol((yyvsp[-2].string), NULL, 0), strtol((yyvsp[0].string), NULL, 0)); } { add_resource(cur_parent, (yyvsp[-3].number), strtol((yyvsp[-2].string), NULL, 0), strtol((yyvsp[0].string), NULL, 0)); }
break; break;
case 21: case 22:
{ add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); } { add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); }
break; break;
case 22: case 23:
{ add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-1].string), NULL, 16), strtol((yyvsp[0].string), NULL, 16), 0); } { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-1].string), NULL, 16), strtol((yyvsp[0].string), NULL, 16), 0); }
break; break;
case 23: case 24:
{ add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-2].string), NULL, 16), strtol((yyvsp[-1].string), NULL, 16), 1); } { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-2].string), NULL, 16), strtol((yyvsp[-1].string), NULL, 16), 1); }
break; break;
case 24: case 25:
{ add_ioapic_info(cur_parent, strtol((yyvsp[-2].string), NULL, 16), (yyvsp[-1].string), strtol((yyvsp[0].string), NULL, 16)); } { add_ioapic_info(cur_parent, strtol((yyvsp[-2].string), NULL, 16), (yyvsp[-1].string), strtol((yyvsp[0].string), NULL, 16)); }
break; break;
case 26:
{ add_slot_desc(cur_parent, (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string)); }
break;
case 27:
{ add_slot_desc(cur_parent, (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string), NULL); }
break;
case 28:
{ add_slot_desc(cur_parent, (yyvsp[-1].string), (yyvsp[0].string), NULL, NULL); }
break;
default: break; default: break;

View File

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 3.0.4. */ /* A Bison parser, made by GNU Bison 3.0.5. */
/* Bison interface for Yacc-like parsers in C /* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -65,17 +65,18 @@ extern int yydebug;
DOMAIN = 275, DOMAIN = 275,
IRQ = 276, IRQ = 276,
DRQ = 277, DRQ = 277,
IO = 278, SLOT_DESC = 278,
NUMBER = 279, IO = 279,
SUBSYSTEMID = 280, NUMBER = 280,
INHERIT = 281, SUBSYSTEMID = 281,
IOAPIC_IRQ = 282, INHERIT = 282,
IOAPIC = 283, IOAPIC_IRQ = 283,
PCIINT = 284, IOAPIC = 284,
GENERIC = 285, PCIINT = 285,
SPI = 286, GENERIC = 286,
USB = 287, SPI = 287,
MMIO = 288 USB = 288,
MMIO = 289
}; };
#endif #endif

View File

@ -31,13 +31,13 @@ static struct chip_instance *cur_chip_instance;
int number; int number;
} }
%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 %token CHIP DEVICE REGISTER BOOL HIDDEN BUS RESOURCE END EQUALS HEX STRING PCI PNP I2C APIC CPU_CLUSTER CPU DOMAIN IRQ DRQ SLOT_DESC IO NUMBER SUBSYSTEMID INHERIT IOAPIC_IRQ IOAPIC PCIINT GENERIC SPI USB MMIO
%% %%
devtree: { cur_parent = root_parent; } chip; devtree: { cur_parent = root_parent; } chip;
chipchildren: chipchildren device | chipchildren chip | chipchildren registers | /* empty */ ; chipchildren: chipchildren device | chipchildren chip | chipchildren registers | /* empty */ ;
devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | /* empty */ ; devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | devicechildren smbios_slot_desc | /* empty */ ;
chip: CHIP STRING /* == path */ { chip: CHIP STRING /* == path */ {
$<chip_instance>$ = new_chip_instance($<string>2); $<chip_instance>$ = new_chip_instance($<string>2);
@ -72,4 +72,14 @@ subsystemid: SUBSYSTEMID NUMBER NUMBER INHERIT
ioapic_irq: IOAPIC_IRQ NUMBER PCIINT NUMBER ioapic_irq: IOAPIC_IRQ NUMBER PCIINT NUMBER
{ add_ioapic_info(cur_parent, strtol($<string>2, NULL, 16), $<string>3, strtol($<string>4, NULL, 16)); }; { add_ioapic_info(cur_parent, strtol($<string>2, NULL, 16), $<string>3, strtol($<string>4, NULL, 16)); };
smbios_slot_desc: SLOT_DESC STRING STRING STRING STRING
{ add_slot_desc(cur_parent, $<string>2, $<string>3, $<string>4, $<string>5); };
smbios_slot_desc: SLOT_DESC STRING STRING STRING
{ add_slot_desc(cur_parent, $<string>2, $<string>3, $<string>4, NULL); };
smbios_slot_desc: SLOT_DESC STRING STRING
{ add_slot_desc(cur_parent, $<string>2, $<string>3, NULL, NULL); };
%% %%