diff options
Diffstat (limited to 'util/sconfig')
-rw-r--r-- | util/sconfig/lex.yy.c_shipped | 372 | ||||
-rw-r--r-- | util/sconfig/main.c | 278 | ||||
-rw-r--r-- | util/sconfig/sconfig.h | 34 | ||||
-rwxr-xr-x | util/sconfig/sconfig.l | 4 | ||||
-rw-r--r-- | util/sconfig/sconfig.tab.c_shipped | 209 | ||||
-rw-r--r-- | util/sconfig/sconfig.tab.h_shipped | 14 | ||||
-rwxr-xr-x | util/sconfig/sconfig.y | 41 |
7 files changed, 700 insertions, 252 deletions
diff --git a/util/sconfig/lex.yy.c_shipped b/util/sconfig/lex.yy.c_shipped index 61928e6397..998505e69b 100644 --- a/util/sconfig/lex.yy.c_shipped +++ b/util/sconfig/lex.yy.c_shipped @@ -349,8 +349,8 @@ static void yynoreturn yy_fatal_error ( const char* msg ); (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 41 -#define YY_END_OF_BUFFER 42 +#define YY_NUM_RULES 45 +#define YY_END_OF_BUFFER 46 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -358,27 +358,30 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[173] = +static const flex_int16_t yy_accept[195] = { 0, - 0, 0, 42, 40, 1, 3, 40, 40, 40, 35, - 35, 33, 36, 40, 36, 36, 36, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 40, 1, 3, - 40, 0, 40, 40, 0, 2, 35, 36, 40, 40, - 40, 40, 36, 40, 40, 40, 40, 40, 40, 40, - 40, 27, 40, 40, 40, 40, 40, 40, 7, 40, - 40, 40, 40, 40, 40, 40, 39, 39, 40, 0, - 34, 40, 40, 17, 40, 40, 26, 31, 40, 40, - 40, 14, 40, 40, 25, 40, 23, 40, 40, 8, - 11, 13, 40, 40, 21, 40, 22, 40, 0, 37, - - 4, 40, 40, 40, 24, 40, 40, 40, 40, 40, - 40, 20, 40, 40, 40, 38, 38, 40, 40, 40, - 40, 40, 40, 40, 15, 40, 40, 40, 40, 40, - 5, 18, 40, 9, 40, 12, 40, 40, 40, 40, - 40, 19, 29, 40, 40, 40, 40, 40, 40, 40, - 40, 6, 40, 40, 40, 40, 10, 40, 40, 40, - 28, 40, 40, 16, 40, 30, 40, 40, 40, 40, - 32, 0 + 0, 0, 46, 44, 1, 3, 44, 44, 44, 39, + 39, 37, 40, 44, 40, 40, 40, 40, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 1, + 3, 44, 0, 44, 44, 0, 2, 39, 40, 44, + 44, 44, 44, 40, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 31, 44, 44, 44, 44, 44, + 44, 11, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 43, 43, 44, 0, 38, 44, 44, 21, 44, + 44, 30, 35, 44, 44, 44, 44, 44, 18, 44, + 44, 29, 44, 27, 44, 44, 12, 44, 15, 17, + + 44, 44, 44, 25, 44, 26, 44, 0, 41, 4, + 44, 44, 44, 28, 44, 44, 44, 44, 44, 44, + 44, 44, 24, 44, 44, 44, 44, 44, 42, 42, + 44, 44, 44, 8, 44, 44, 44, 44, 44, 19, + 44, 44, 10, 44, 44, 44, 44, 5, 22, 44, + 44, 13, 44, 16, 44, 9, 44, 44, 44, 44, + 44, 23, 33, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 6, 44, 44, 44, 7, 44, 14, 44, + 44, 44, 32, 44, 44, 20, 44, 34, 44, 44, + 44, 44, 36, 0 + } ; static const YY_CHAR yy_ec[256] = @@ -395,8 +398,8 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 16, 1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 1, 1, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 1, 37, - 38, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 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, @@ -413,126 +416,142 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static const YY_CHAR yy_meta[39] = +static const YY_CHAR yy_meta[40] = { 0, 1, 2, 2, 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 } ; -static const flex_int16_t yy_base[180] = +static const flex_int16_t yy_base[202] = { 0, - 0, 0, 240, 0, 237, 241, 235, 37, 41, 38, - 200, 0, 44, 222, 54, 78, 60, 214, 209, 45, - 49, 48, 42, 52, 212, 62, 199, 0, 229, 241, - 93, 225, 98, 79, 226, 241, 0, 97, 104, 213, - 202, 191, 110, 198, 193, 203, 192, 193, 200, 200, - 194, 200, 185, 185, 195, 185, 187, 189, 0, 185, - 179, 185, 189, 181, 187, 186, 0, 241, 125, 198, - 0, 191, 171, 184, 174, 181, 0, 0, 172, 175, - 175, 0, 173, 163, 0, 167, 0, 171, 161, 0, - 0, 0, 164, 163, 0, 154, 0, 181, 180, 0, - - 0, 165, 164, 157, 0, 149, 159, 147, 153, 158, - 159, 0, 142, 145, 135, 0, 241, 146, 150, 142, - 144, 140, 142, 147, 0, 131, 130, 130, 129, 126, - 0, 0, 141, 0, 125, 129, 115, 122, 126, 107, - 107, 0, 0, 114, 106, 105, 103, 114, 100, 101, - 94, 0, 105, 102, 99, 83, 0, 80, 83, 70, - 0, 60, 71, 0, 74, 0, 63, 55, 39, 29, - 0, 241, 40, 146, 148, 150, 152, 154, 156 + 0, 0, 265, 0, 262, 266, 260, 38, 42, 39, + 224, 0, 45, 247, 55, 79, 61, 58, 239, 234, + 46, 54, 55, 68, 73, 237, 46, 224, 0, 254, + 266, 101, 250, 107, 111, 251, 266, 0, 108, 111, + 238, 227, 216, 117, 223, 218, 228, 217, 225, 229, + 216, 223, 223, 217, 223, 208, 208, 218, 208, 210, + 212, 0, 199, 207, 201, 201, 206, 210, 202, 208, + 207, 0, 266, 132, 219, 0, 212, 192, 205, 195, + 202, 0, 0, 193, 191, 197, 194, 194, 0, 192, + 182, 0, 186, 0, 190, 180, 0, 183, 0, 0, + + 189, 181, 180, 0, 171, 0, 198, 197, 0, 0, + 182, 181, 174, 0, 178, 168, 164, 174, 162, 168, + 173, 174, 0, 161, 168, 155, 158, 147, 0, 266, + 159, 163, 155, 0, 154, 156, 152, 154, 159, 0, + 143, 148, 0, 141, 141, 140, 137, 0, 0, 149, + 151, 0, 135, 152, 138, 0, 145, 136, 117, 117, + 124, 0, 0, 123, 115, 114, 112, 123, 109, 119, + 109, 101, 0, 113, 111, 115, 0, 96, 0, 92, + 82, 70, 0, 65, 77, 0, 77, 0, 71, 59, + 44, 30, 0, 266, 41, 153, 155, 157, 159, 161, + + 163 } ; -static const flex_int16_t yy_def[180] = +static const flex_int16_t yy_def[202] = { 0, - 172, 1, 172, 173, 172, 172, 173, 174, 175, 173, - 10, 173, 10, 173, 10, 10, 10, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 172, 172, - 174, 176, 177, 175, 178, 172, 10, 10, 10, 173, - 173, 173, 10, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 172, 177, 179, - 39, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 172, 173, - - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 172, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 0, 172, 172, 172, 172, 172, 172, 172 + 194, 1, 194, 195, 194, 194, 195, 196, 197, 195, + 10, 195, 10, 195, 10, 10, 10, 10, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 194, + 194, 196, 198, 199, 197, 200, 194, 10, 10, 10, + 195, 195, 195, 10, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 194, 199, 201, 40, 195, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + + 195, 195, 195, 195, 195, 195, 195, 194, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 194, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 0, 194, 194, 194, 194, 194, 194, + + 194 } ; -static const flex_int16_t yy_nxt[280] = +static const flex_int16_t yy_nxt[306] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 10, 12, 13, 13, 14, 4, 4, 4, 13, 13, 15, 16, - 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, 171, 38, 38, - 38, 38, 38, 50, 38, 38, 38, 38, 38, 38, - 38, 38, 38, 58, 56, 54, 38, 38, 38, 59, - 60, 170, 51, 52, 57, 169, 53, 41, 55, 61, - 35, 36, 168, 42, 38, 38, 38, 46, 63, 167, - 166, 64, 47, 165, 32, 32, 65, 67, 43, 70, - - 70, 164, 28, 38, 38, 38, 44, 163, 162, 45, - 71, 71, 71, 161, 71, 71, 38, 38, 38, 160, - 71, 71, 71, 71, 71, 71, 70, 70, 159, 98, - 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, - 148, 147, 146, 145, 144, 75, 31, 31, 34, 34, - 32, 32, 69, 69, 35, 35, 70, 70, 143, 142, + 17, 18, 19, 20, 21, 22, 23, 4, 24, 25, + 4, 26, 27, 4, 28, 4, 4, 4, 4, 33, + 33, 29, 34, 36, 37, 38, 38, 38, 193, 39, + 39, 39, 39, 39, 53, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 57, 59, 68, 54, 55, 69, 192, 56, 42, 191, + 70, 60, 49, 58, 43, 39, 39, 39, 47, 61, + 190, 64, 189, 48, 50, 62, 188, 63, 187, 44, + + 65, 186, 33, 33, 66, 72, 185, 45, 75, 75, + 46, 29, 36, 37, 39, 39, 39, 76, 76, 76, + 184, 76, 76, 39, 39, 39, 183, 76, 76, 76, + 76, 76, 76, 75, 75, 182, 107, 181, 180, 179, + 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, + 168, 167, 80, 32, 32, 35, 35, 33, 33, 74, + 74, 36, 36, 75, 75, 166, 165, 164, 163, 162, + 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, + 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, + 131, 130, 129, 128, 127, 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, 97, 96, 95, 94, 93, 92, 91, + 111, 110, 109, 108, 106, 105, 104, 103, 102, 101, + 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, - 80, 79, 78, 77, 76, 74, 73, 72, 36, 68, - 29, 66, 62, 49, 48, 40, 39, 30, 29, 172, - 3, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172 + 79, 78, 77, 37, 73, 30, 71, 67, 52, 51, + 41, 40, 31, 30, 194, 3, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, + + 194, 194, 194, 194, 194 } ; -static const flex_int16_t yy_chk[280] = +static const flex_int16_t yy_chk[306] = { 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, - 173, 8, 9, 9, 10, 10, 10, 170, 10, 10, - 13, 13, 13, 20, 10, 10, 10, 10, 10, 10, - 15, 15, 15, 23, 22, 21, 17, 17, 17, 23, - 24, 169, 20, 20, 22, 168, 20, 15, 21, 24, - 34, 34, 167, 15, 16, 16, 16, 17, 26, 165, - 163, 26, 17, 162, 31, 31, 26, 31, 16, 33, - - 33, 160, 33, 38, 38, 38, 16, 159, 158, 16, - 39, 39, 39, 156, 39, 39, 43, 43, 43, 155, - 39, 39, 39, 39, 39, 39, 69, 69, 154, 69, - 153, 151, 150, 149, 148, 147, 146, 145, 144, 141, - 140, 139, 138, 137, 136, 43, 174, 174, 175, 175, - 176, 176, 177, 177, 178, 178, 179, 179, 135, 133, - 130, 129, 128, 127, 126, 124, 123, 122, 121, 120, - 119, 118, 115, 114, 113, 111, 110, 109, 108, 107, - 106, 104, 103, 102, 99, 98, 96, 94, 93, 89, - 88, 86, 84, 83, 81, 80, 79, 76, 75, 74, - - 73, 72, 70, 66, 65, 64, 63, 62, 61, 60, - 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, - 48, 47, 46, 45, 44, 42, 41, 40, 35, 32, - 29, 27, 25, 19, 18, 14, 11, 7, 5, 3, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, + 8, 195, 8, 9, 9, 10, 10, 10, 192, 10, + 10, 13, 13, 13, 21, 10, 10, 10, 10, 10, + 10, 15, 15, 15, 18, 18, 18, 17, 17, 17, + 22, 23, 27, 21, 21, 27, 191, 21, 15, 190, + 27, 23, 18, 22, 15, 16, 16, 16, 17, 24, + 189, 25, 187, 17, 18, 24, 185, 24, 184, 16, + + 25, 182, 32, 32, 25, 32, 181, 16, 34, 34, + 16, 34, 35, 35, 39, 39, 39, 40, 40, 40, + 180, 40, 40, 44, 44, 44, 178, 40, 40, 40, + 40, 40, 40, 74, 74, 176, 74, 175, 174, 172, + 171, 170, 169, 168, 167, 166, 165, 164, 161, 160, + 159, 158, 44, 196, 196, 197, 197, 198, 198, 199, + 199, 200, 200, 201, 201, 157, 155, 154, 153, 151, + 150, 147, 146, 145, 144, 142, 141, 139, 138, 137, + 136, 135, 133, 132, 131, 128, 127, 126, 125, 124, + 122, 121, 120, 119, 118, 117, 116, 115, 113, 112, + + 111, 108, 107, 105, 103, 102, 101, 98, 96, 95, + 93, 91, 90, 88, 87, 86, 85, 84, 81, 80, + 79, 78, 77, 75, 71, 70, 69, 68, 67, 66, + 65, 64, 63, 61, 60, 59, 58, 57, 56, 55, + 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, + 43, 42, 41, 36, 33, 30, 28, 26, 20, 19, + 14, 11, 7, 5, 3, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, + + 194, 194, 194, 194, 194 } ; static yy_state_type yy_last_accepting_state; @@ -549,21 +568,8 @@ int yy_flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -/* - * sconfig, coreboot device tree compiler - * - * Copyright (C) 2010 coresystems GmbH - * written by Patrick Georgi <patrick@georgi-clan.de> - * - * 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 - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +/* sconfig, coreboot device tree compiler */ +/* SPDX-License-Identifier: GPL-2.0-only */ #include "sconfig.tab.h" @@ -810,13 +816,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 >= 173 ) + if ( yy_current_state >= 195 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 241 ); + while ( yy_base[yy_current_state] != 266 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -868,144 +874,160 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -{yylval.number=1; return(BOOL);} +{return(FW_CONFIG_TABLE);} YY_BREAK case 8: YY_RULE_SETUP -{yylval.number=0; return(BOOL);} +{return(FW_CONFIG_FIELD);} YY_BREAK case 9: YY_RULE_SETUP -{yylval.number=3; return(STATUS);} +{return(FW_CONFIG_OPTION);} YY_BREAK case 10: YY_RULE_SETUP -{yylval.number=5; return(STATUS);} +{return(FW_CONFIG_PROBE);} YY_BREAK case 11: YY_RULE_SETUP -{yylval.number=PCI; return(BUS);} +{yylval.number=1; return(BOOL);} YY_BREAK case 12: YY_RULE_SETUP -{yylval.number=IOAPIC; return(BUS);} +{yylval.number=0; return(BOOL);} YY_BREAK case 13: YY_RULE_SETUP -{yylval.number=PNP; return(BUS);} +{yylval.number=3; return(STATUS);} YY_BREAK case 14: YY_RULE_SETUP -{yylval.number=I2C; return(BUS);} +{yylval.number=5; return(STATUS);} YY_BREAK case 15: YY_RULE_SETUP -{yylval.number=APIC; return(BUS);} +{yylval.number=PCI; return(BUS);} YY_BREAK case 16: YY_RULE_SETUP -{yylval.number=CPU_CLUSTER; return(BUS);} +{yylval.number=IOAPIC; return(BUS);} YY_BREAK case 17: YY_RULE_SETUP -{yylval.number=CPU; return(BUS);} +{yylval.number=PNP; return(BUS);} YY_BREAK case 18: YY_RULE_SETUP -{yylval.number=DOMAIN; return(BUS);} +{yylval.number=I2C; return(BUS);} YY_BREAK case 19: YY_RULE_SETUP -{yylval.number=GENERIC; return(BUS);} +{yylval.number=APIC; return(BUS);} YY_BREAK case 20: YY_RULE_SETUP -{yylval.number=MMIO; return(BUS);} +{yylval.number=CPU_CLUSTER; return(BUS);} YY_BREAK case 21: YY_RULE_SETUP -{yylval.number=SPI; return(BUS);} +{yylval.number=CPU; return(BUS);} YY_BREAK case 22: YY_RULE_SETUP -{yylval.number=USB; return(BUS);} +{yylval.number=DOMAIN; return(BUS);} YY_BREAK case 23: YY_RULE_SETUP -{yylval.number=LPC; return(BUS);} +{yylval.number=GENERIC; return(BUS);} YY_BREAK case 24: YY_RULE_SETUP -{yylval.number=ESPI; return(BUS);} +{yylval.number=MMIO; return(BUS);} YY_BREAK case 25: YY_RULE_SETUP -{yylval.number=IRQ; return(RESOURCE);} +{yylval.number=SPI; return(BUS);} YY_BREAK case 26: YY_RULE_SETUP -{yylval.number=DRQ; return(RESOURCE);} +{yylval.number=USB; return(BUS);} YY_BREAK case 27: YY_RULE_SETUP -{yylval.number=IO; return(RESOURCE);} +{yylval.number=LPC; return(BUS);} YY_BREAK case 28: YY_RULE_SETUP -{return(IOAPIC_IRQ);} +{yylval.number=ESPI; return(BUS);} YY_BREAK case 29: YY_RULE_SETUP -{return(INHERIT);} +{yylval.number=IRQ; return(RESOURCE);} YY_BREAK case 30: YY_RULE_SETUP -{return(SUBSYSTEMID);} +{yylval.number=DRQ; return(RESOURCE);} YY_BREAK case 31: YY_RULE_SETUP -{return(END);} +{yylval.number=IO; return(RESOURCE);} YY_BREAK case 32: YY_RULE_SETUP -{return(SLOT_DESC);} +{return(IOAPIC_IRQ);} YY_BREAK case 33: YY_RULE_SETUP -{return(EQUALS);} +{return(INHERIT);} YY_BREAK case 34: YY_RULE_SETUP -{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} +{return(SUBSYSTEMID);} YY_BREAK case 35: YY_RULE_SETUP -{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} +{return(END);} YY_BREAK case 36: YY_RULE_SETUP -{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} +{return(SLOT_DESC);} YY_BREAK case 37: YY_RULE_SETUP -{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);} +{return(EQUALS);} YY_BREAK case 38: -/* rule 38 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(NUMBER);} YY_BREAK case 39: -/* rule 39 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(NUMBER);} YY_BREAK case 40: 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(NUMBER);} YY_BREAK case 41: YY_RULE_SETUP +{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);} + YY_BREAK +case 42: +/* rule 42 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 43: +/* rule 43 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 44: +YY_RULE_SETUP +{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);} + YY_BREAK +case 45: +YY_RULE_SETUP ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): @@ -1304,7 +1326,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 >= 173 ) + if ( yy_current_state >= 195 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -1332,11 +1354,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 >= 173 ) + if ( yy_current_state >= 195 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 172); + yy_is_jam = (yy_current_state == 194); return yy_is_jam ? 0 : yy_current_state; } diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 0d8f7f86af..6752b61cbb 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -5,6 +5,7 @@ /* stat.h needs to be included before commonlib/helpers.h to avoid errors.*/ #include <sys/stat.h> #include <commonlib/helpers.h> +#include <stdint.h> #include "sconfig.h" #include "sconfig.tab.h" @@ -323,6 +324,266 @@ struct chip_instance *new_chip_instance(char *path) return instance; } +/* List of fw_config fields added during parsing. */ +static struct fw_config_field *fw_config_fields; + +static struct fw_config_option *find_fw_config_option(struct fw_config_field *field, + const char *name) +{ + struct fw_config_option *option = field->options; + + while (option && option->name) { + if (!strcmp(option->name, name)) + return option; + option = option->next; + } + return NULL; +} + +static struct fw_config_field *find_fw_config_field(const char *name) +{ + struct fw_config_field *field = fw_config_fields; + + while (field && field->name) { + if (!strcmp(field->name, name)) + return field; + field = field->next; + } + return NULL; +} + +struct fw_config_field *get_fw_config_field(const char *name) +{ + struct fw_config_field *field = find_fw_config_field(name); + + /* Fail if the field does not exist, new fields must be added with a mask. */ + if (!field) { + printf("ERROR: fw_config field not found: %s\n", name); + exit(1); + } + return field; +} + +static void append_fw_config_field(struct fw_config_field *add) +{ + struct fw_config_field *field = fw_config_fields; + + if (!fw_config_fields) { + fw_config_fields = add; + } else { + while (field && field->next) + field = field->next; + field->next = add; + } +} + +struct fw_config_field *new_fw_config_field(const char *name, + unsigned int start_bit, unsigned int end_bit) +{ + struct fw_config_field *field = find_fw_config_field(name); + + /* Check that field is within 32bits. */ + if (start_bit > end_bit || end_bit > 31) { + printf("ERROR: fw_config field %s has invalid range %u-%u\n", name, + start_bit, end_bit); + exit(1); + } + + /* Don't allow re-defining a field, only adding new fields. */ + if (field) { + printf("ERROR: fw_config field %s[%u-%u] already exists with range %u-%u\n", + name, start_bit, end_bit, field->start_bit, field->end_bit); + exit(1); + } + + /* Check for overlap with an existing field. */ + field = fw_config_fields; + while (field) { + /* Check if the mask overlaps. */ + if (start_bit <= field->end_bit && end_bit >= field->start_bit) { + printf("ERROR: fw_config field %s[%u-%u] overlaps %s[%u-%u]\n", + name, start_bit, end_bit, + field->name, field->start_bit, field->end_bit); + exit(1); + } + field = field->next; + } + + field = S_ALLOC(sizeof(*field)); + field->name = name; + field->start_bit = start_bit; + field->end_bit = end_bit; + append_fw_config_field(field); + + return field; +} + +static void append_fw_config_option_to_field(struct fw_config_field *field, + struct fw_config_option *add) +{ + struct fw_config_option *option = field->options; + + if (!option) { + field->options = add; + } else { + while (option && option->next) + option = option->next; + option->next = add; + } +} + +void add_fw_config_option(struct fw_config_field *field, const char *name, unsigned int value) +{ + struct fw_config_option *option; + uint32_t field_max_value; + + /* Check that option value fits within field mask. */ + field_max_value = (1 << (1 + field->end_bit - field->start_bit)) - 1; + if (value > field_max_value) { + printf("ERROR: fw_config option %s:%s value %u larger than field max %u\n", + field->name, name, value, field_max_value); + exit(1); + } + + /* Check for existing option with this name or value. */ + option = field->options; + while (option) { + if (!strcmp(option->name, name)) { + printf("ERROR: fw_config option name %s:%s already exists\n", + field->name, name); + exit(1); + } + /* Compare values. */ + if (value == option->value) { + printf("ERROR: fw_config option %s:%s[%u] redefined as %s\n", + field->name, option->name, value, name); + exit(1); + } + option = option->next; + } + + option = S_ALLOC(sizeof(*option)); + option->name = name; + option->value = value; + + /* Add option to the current field. */ + append_fw_config_option_to_field(field, option); +} + +static void append_fw_config_probe_to_dev(struct device *dev, struct fw_config_probe *add) +{ + struct fw_config_probe *probe = dev->probe; + + if (!probe) { + dev->probe = add; + } else { + while (probe && probe->next) + probe = probe->next; + probe->next = add; + } +} + +void add_fw_config_probe(struct bus *bus, const char *field, const char *option) +{ + struct fw_config_probe *probe; + + probe = bus->dev->probe; + while (probe) { + if (!strcmp(probe->field, field) && !strcmp(probe->option, option)) { + printf("ERROR: fw_config probe %s:%s already exists\n", field, option); + exit(1); + } + probe = probe->next; + } + + probe = S_ALLOC(sizeof(*probe)); + probe->field = field; + probe->option = option; + + append_fw_config_probe_to_dev(bus->dev, probe); +} + +static void emit_fw_config(FILE *fil) +{ + struct fw_config_field *field = fw_config_fields; + + if (!field) + return; + + fprintf(fil, "\n/* firmware configuration */\n"); + fprintf(fil, "#include <fw_config.h>\n"); + + while (field) { + struct fw_config_option *option = field->options; + uint32_t mask; + + fprintf(fil, "#define FW_CONFIG_FIELD_%s_NAME \"%s\"\n", + field->name, field->name); + + /* Compute mask from start and end bit. */ + mask = ((1 << (1 + field->end_bit - field->start_bit)) - 1); + mask <<= field->start_bit; + + fprintf(fil, "#define FW_CONFIG_FIELD_%s_MASK 0x%08x\n", + field->name, mask); + + while (option) { + fprintf(fil, "#define FW_CONFIG_FIELD_%s_OPTION_%s_NAME \"%s\"\n", + field->name, option->name, option->name); + fprintf(fil, "#define FW_CONFIG_FIELD_%s_OPTION_%s_VALUE 0x%08x\n", + field->name, option->name, option->value << field->start_bit); + + option = option->next; + } + + field = field->next; + } + + fprintf(fil, "\n"); +} + +static int emit_fw_config_probe(FILE *fil, struct device *dev) +{ + struct fw_config_probe *probe = dev->probe; + + fprintf(fil, "STORAGE struct fw_config %s_probe_list[] = {\n", dev->name); + + while (probe) { + /* Find matching field. */ + struct fw_config_field *field; + struct fw_config_option *option; + uint32_t mask, value; + + field = find_fw_config_field(probe->field); + if (!field) { + printf("ERROR: fw_config_probe field %s not found\n", probe->field); + return -1; + } + option = find_fw_config_option(field, probe->option); + if (!option) { + printf("ERROR: fw_config_probe field %s option %s not found\n", + probe->field, probe->option); + return -1; + } + + /* Fill out the probe structure with values from emit_fw_config(). */ + fprintf(fil, "\t{\n"); + fprintf(fil, "\t\t.field_name = FW_CONFIG_FIELD_%s_NAME,\n", probe->field); + fprintf(fil, "\t\t.option_name = FW_CONFIG_FIELD_%s_OPTION_%s_NAME,\n", + probe->field, probe->option); + fprintf(fil, "\t\t.mask = FW_CONFIG_FIELD_%s_MASK,\n", probe->field); + fprintf(fil, "\t\t.value = FW_CONFIG_FIELD_%s_OPTION_%s_VALUE,\n", + probe->field, probe->option); + fprintf(fil, "\t},\n"); + + probe = probe->next; + } + + /* Add empty entry to mark end of list. */ + fprintf(fil, "\t{ }\n};\n"); + return 0; +} + /* * Allocate a new bus for the provided device. * - If this is the first bus being allocated under this device, then its id @@ -733,6 +994,13 @@ static void pass1(FILE *fil, FILE *head, struct device *ptr, struct device *next if (chip_ins->base_chip_instance) chip_ins = chip_ins->base_chip_instance; + /* Emit probe structures. */ + if (ptr->probe && (emit_fw_config_probe(fil, ptr) < 0)) { + fclose(head); + fclose(fil); + exit(1); + } + if (ptr == &base_root_dev) fprintf(fil, "DEVTREE_CONST struct device %s = {\n", ptr->name); else @@ -780,6 +1048,8 @@ static void pass1(FILE *fil, FILE *head, struct device *ptr, struct device *next else fprintf(fil, "\t.sibling = NULL,\n"); fprintf(fil, "#if !DEVTREE_EARLY\n"); + if (ptr->probe) + fprintf(fil, "\t.probe_list = %s_probe_list,\n", ptr->name); for (pin = 0; pin < 4; pin++) { if (ptr->pci_irq_info[pin].ioapic_irq_pin > 0) fprintf(fil, @@ -1220,6 +1490,12 @@ static void update_device(struct device *base_dev, struct device *override_dev) } /* + * Use probe list from override device in place of base device, in order + * to allow an override to remove a probe from the base device. + */ + base_dev->probe = override_dev->probe; + + /* * Update base_chip_instance member in chip instance of override tree to forward it to * the chip instance in base tree. */ @@ -1343,9 +1619,11 @@ int main(int argc, char **argv) fprintf(autohead, "#ifndef __STATIC_DEVICE_TREE_H\n"); fprintf(autohead, "#define __STATIC_DEVICE_TREE_H\n\n"); fprintf(autohead, "#include <device/device.h>\n\n"); + emit_fw_config(autohead); fprintf(autogen, "#include <device/device.h>\n"); fprintf(autogen, "#include <device/pci.h>\n\n"); + fprintf(autogen, "#include <static.h>\n"); emit_chips(autogen); diff --git a/util/sconfig/sconfig.h b/util/sconfig/sconfig.h index a960b7f055..1bbff4644c 100644 --- a/util/sconfig/sconfig.h +++ b/util/sconfig/sconfig.h @@ -28,6 +28,27 @@ struct pci_irq_info { int ioapic_dst_id; }; +struct fw_config_option; +struct fw_config_option { + const char *name; + unsigned int value; + struct fw_config_option *next; +}; +struct fw_config_field; +struct fw_config_field { + const char *name; + unsigned int start_bit; + unsigned int end_bit; + struct fw_config_field *next; + struct fw_config_option *options; +}; +struct fw_config_probe; +struct fw_config_probe { + const char *field; + const char *option; + struct fw_config_probe *next; +}; + struct chip; struct chip_instance { /* Monotonically increasing ID for each chip instance. */ @@ -141,6 +162,9 @@ struct device { /* SMBIOS slot length */ char *smbios_slot_length; + + /* List of field+option to probe. */ + struct fw_config_probe *probe; }; extern struct bus *root_parent; @@ -171,3 +195,13 @@ void *chip_dequeue_tail(void); struct chip_instance *new_chip_instance(char *path); void add_register(struct chip_instance *chip, char *name, char *val); + +struct fw_config_field *get_fw_config_field(const char *name); + +struct fw_config_field *new_fw_config_field(const char *name, + unsigned int start_bit, unsigned int end_bit); + +void add_fw_config_option(struct fw_config_field *field, const char *name, + unsigned int value); + +void add_fw_config_probe(struct bus *bus, const char *field, const char *option); diff --git a/util/sconfig/sconfig.l b/util/sconfig/sconfig.l index 5ac5057e23..10a86a2f2b 100755 --- a/util/sconfig/sconfig.l +++ b/util/sconfig/sconfig.l @@ -14,6 +14,10 @@ int linenum = 0; chip {return(CHIP);} device {return(DEVICE);} register {return(REGISTER);} +fw_config {return(FW_CONFIG_TABLE);} +field {return(FW_CONFIG_FIELD);} +option {return(FW_CONFIG_OPTION);} +probe {return(FW_CONFIG_PROBE);} on {yylval.number=1; return(BOOL);} off {yylval.number=0; return(BOOL);} hidden {yylval.number=3; return(STATUS);} diff --git a/util/sconfig/sconfig.tab.c_shipped b/util/sconfig/sconfig.tab.c_shipped index 2bae43bc29..c78f1ace25 100644 --- a/util/sconfig/sconfig.tab.c_shipped +++ b/util/sconfig/sconfig.tab.c_shipped @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.5.4. */ +/* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison implementation for Yacc-like parsers in C @@ -48,7 +48,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.5.4" +#define YYBISON_VERSION "3.5.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -77,6 +77,7 @@ void yyerror(const char *s); static struct bus *cur_parent; static struct chip_instance *cur_chip_instance; +static struct fw_config_field *cur_field; @@ -111,8 +112,8 @@ static struct chip_instance *cur_chip_instance; /* Use api.header.include to #include this header instead of duplicating it here. */ -#ifndef YY_YY_HOME_ME_REPOS_COREBOOTORG_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED -# define YY_YY_HOME_ME_REPOS_COREBOOTORG_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED +#ifndef YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED +# define YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -160,7 +161,11 @@ extern int yydebug; USB = 289, MMIO = 290, LPC = 291, - ESPI = 292 + ESPI = 292, + FW_CONFIG_TABLE = 293, + FW_CONFIG_FIELD = 294, + FW_CONFIG_OPTION = 295, + FW_CONFIG_PROBE = 296 }; #endif @@ -186,7 +191,7 @@ extern YYSTYPE yylval; int yyparse (void); -#endif /* !YY_YY_HOME_ME_REPOS_COREBOOTORG_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */ +#endif /* !YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */ @@ -490,21 +495,21 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 3 +#define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 45 +#define YYLAST 58 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 38 +#define YYNTOKENS 42 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 15 +#define YYNNTS 23 /* YYNRULES -- Number of rules. */ -#define YYNRULES 29 +#define YYNRULES 44 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 50 +#define YYNSTATES 75 #define YYUNDEFTOK 2 -#define YYMAXUTOK 292 +#define YYMAXUTOK 296 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM @@ -545,16 +550,18 @@ static const yytype_int8 yytranslate[] = 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, 33, 34, - 35, 36, 37 + 35, 36, 37, 38, 39, 40, 41 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int8 yyrline[] = { - 0, 36, 36, 36, 38, 38, 38, 38, 40, 40, - 40, 40, 40, 40, 40, 40, 42, 42, 51, 51, - 59, 59, 61, 64, 67, 70, 73, 76, 79, 82 + 0, 24, 24, 24, 24, 26, 26, 26, 26, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 30, 30, + 39, 39, 47, 47, 49, 52, 55, 58, 61, 64, + 67, 70, 74, 77, 77, 80, 80, 83, 83, 89, + 89, 95, 95, 101, 105 }; #endif @@ -568,9 +575,13 @@ static const char *const yytname[] = "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", "LPC", - "ESPI", "$accept", "devtree", "$@1", "chipchildren", "devicechildren", - "chip", "@2", "device", "@3", "status", "resource", "registers", - "subsystemid", "ioapic_irq", "smbios_slot_desc", YY_NULLPTR + "ESPI", "FW_CONFIG_TABLE", "FW_CONFIG_FIELD", "FW_CONFIG_OPTION", + "FW_CONFIG_PROBE", "$accept", "devtree", "chipchildren", + "devicechildren", "chip", "@1", "device", "@2", "status", "resource", + "registers", "subsystemid", "ioapic_irq", "smbios_slot_desc", + "fw_config_table", "fw_config_table_children", + "fw_config_field_children", "fw_config_field", "$@3", "$@4", "$@5", + "fw_config_option", "fw_config_probe", YY_NULLPTR }; #endif @@ -582,11 +593,12 @@ static const yytype_int16 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, 288, 289, 290, 291, 292 + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296 }; # endif -#define YYPACT_NINF (-10) +#define YYPACT_NINF (-12) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) @@ -600,11 +612,14 @@ static const yytype_int16 yytoknum[] = STATE-NUM. */ static const yytype_int8 yypact[] = { - -10, 11, 10, -10, 0, -10, -10, -10, 1, 6, - 2, -10, -10, -10, -10, -9, 8, 3, 4, -10, - -10, -10, -10, -10, -3, -4, -10, 9, -1, 5, - -10, -10, -10, -10, -10, -10, -10, 15, 14, 7, - -2, 12, 16, 13, 17, -10, 18, -10, -10, -10 + -12, 3, -12, 4, -12, -12, -12, -12, -2, -12, + -12, 8, -12, 9, 1, 14, 11, -12, -12, -12, + -12, 2, -12, 5, 17, -12, -12, -6, 10, 16, + -12, -1, -12, 18, -12, -12, -12, -12, -12, 0, + -12, 7, -12, -12, -12, -3, 19, -12, 21, 20, + 22, 28, -12, -12, -12, -12, -12, -12, -12, -12, + 31, 30, 23, 24, 33, 25, 36, 26, 27, -12, + -12, 38, -12, -12, -12 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -612,25 +627,30 @@ static const yytype_int8 yypact[] = means the default is an error. */ static const yytype_int8 yydefact[] = { - 2, 0, 0, 1, 0, 3, 16, 7, 0, 0, - 0, 17, 5, 4, 6, 0, 0, 0, 0, 20, - 21, 18, 23, 15, 0, 0, 19, 0, 0, 0, - 9, 8, 10, 14, 11, 12, 13, 0, 0, 0, - 0, 0, 29, 24, 0, 22, 28, 25, 26, 27 + 2, 0, 1, 0, 34, 3, 4, 18, 0, 8, + 32, 0, 33, 0, 41, 0, 0, 19, 6, 5, + 7, 39, 36, 0, 0, 37, 36, 0, 0, 0, + 36, 0, 42, 0, 35, 22, 23, 20, 25, 0, + 40, 0, 17, 38, 43, 0, 0, 21, 0, 0, + 0, 0, 10, 9, 11, 15, 12, 13, 14, 16, + 0, 0, 0, 0, 0, 0, 31, 26, 0, 44, + 24, 30, 27, 28, 29 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -10, -10, -10, -10, -10, -5, -10, 20, -10, -10, - -10, 21, -10, -10, -10 + -12, -12, -12, -12, -9, -12, 12, -12, -12, -12, + 13, -12, -12, -12, -12, -12, -11, -12, -12, -12, + -12, -12, -12 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 2, 8, 24, 5, 7, 13, 23, 21, - 32, 14, 34, 35, 36 + -1, 1, 13, 45, 5, 9, 19, 42, 37, 54, + 20, 56, 57, 58, 6, 8, 27, 12, 30, 26, + 22, 34, 59 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -638,47 +658,56 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int8 yytable[] = { - 4, 9, 10, 12, 4, 9, 10, 25, 26, 19, - 20, 3, 11, 4, 6, 15, 16, 17, 22, 30, - 18, 27, 37, 38, 28, 39, 29, 41, 42, 44, - 46, 40, 49, 43, 0, 0, 0, 0, 45, 0, - 0, 47, 0, 48, 31, 33 + 3, 15, 16, 2, 18, 32, 3, 46, 47, 10, + 40, 43, 3, 15, 16, 31, 35, 36, 7, 39, + 17, 48, 14, 23, 49, 24, 50, 21, 25, 29, + 38, 28, 41, 44, 33, 61, 52, 11, 51, 33, + 33, 4, 64, 65, 66, 60, 62, 69, 63, 67, + 71, 70, 74, 73, 72, 68, 0, 53, 55 }; static const yytype_int8 yycheck[] = { - 3, 4, 5, 8, 3, 4, 5, 10, 11, 6, - 7, 0, 11, 3, 14, 9, 14, 26, 14, 24, - 12, 24, 26, 14, 27, 26, 29, 12, 14, 31, - 14, 26, 14, 26, -1, -1, -1, -1, 26, -1, - -1, 28, -1, 26, 24, 24 + 3, 4, 5, 0, 13, 11, 3, 10, 11, 11, + 11, 11, 3, 4, 5, 26, 6, 7, 14, 30, + 11, 24, 14, 9, 27, 14, 29, 26, 26, 12, + 14, 26, 14, 26, 40, 14, 45, 39, 41, 40, + 40, 38, 14, 12, 14, 26, 26, 14, 26, 26, + 14, 26, 14, 26, 28, 31, -1, 45, 45 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_int8 yystos[] = { - 0, 39, 40, 0, 3, 43, 14, 44, 41, 4, - 5, 11, 43, 45, 49, 9, 14, 26, 12, 6, - 7, 47, 14, 46, 42, 10, 11, 24, 27, 29, - 43, 45, 48, 49, 50, 51, 52, 26, 14, 26, - 26, 12, 14, 26, 31, 26, 14, 28, 26, 14 + 0, 43, 0, 3, 38, 46, 56, 14, 57, 47, + 11, 39, 59, 44, 14, 4, 5, 11, 46, 48, + 52, 26, 62, 9, 14, 26, 61, 58, 26, 12, + 60, 58, 11, 40, 63, 6, 7, 50, 14, 58, + 11, 14, 49, 11, 26, 45, 10, 11, 24, 27, + 29, 41, 46, 48, 51, 52, 53, 54, 55, 64, + 26, 14, 26, 26, 14, 12, 14, 26, 31, 14, + 26, 14, 28, 26, 14 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_int8 yyr1[] = { - 0, 38, 40, 39, 41, 41, 41, 41, 42, 42, - 42, 42, 42, 42, 42, 42, 44, 43, 46, 45, - 47, 47, 48, 49, 50, 50, 51, 52, 52, 52 + 0, 42, 43, 43, 43, 44, 44, 44, 44, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 47, 46, + 49, 48, 50, 50, 51, 52, 53, 53, 54, 55, + 55, 55, 56, 57, 57, 58, 58, 60, 59, 61, + 59, 62, 59, 63, 64 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_int8 yyr2[] = { - 0, 2, 0, 2, 2, 2, 2, 0, 2, 2, - 2, 2, 2, 2, 2, 0, 0, 5, 0, 7, - 1, 1, 4, 4, 3, 4, 4, 5, 4, 3 + 0, 2, 0, 2, 2, 2, 2, 2, 0, 2, + 2, 2, 2, 2, 2, 2, 2, 0, 0, 5, + 0, 7, 1, 1, 4, 4, 3, 4, 4, 5, + 4, 3, 3, 2, 0, 2, 0, 0, 7, 0, + 6, 0, 5, 3, 3 }; @@ -1377,7 +1406,7 @@ yyreduce: { cur_parent = root_parent; } break; - case 16: + case 18: { (yyval.chip_instance) = new_chip_instance((yyvsp[0].string)); chip_enqueue_tail(cur_chip_instance); @@ -1385,57 +1414,99 @@ yyreduce: } break; - case 17: + case 19: { cur_chip_instance = chip_dequeue_tail(); } break; - case 18: + case 20: { (yyval.dev) = new_device(cur_parent, cur_chip_instance, (yyvsp[-2].number), (yyvsp[-1].string), (yyvsp[0].number)); cur_parent = (yyval.dev)->last_bus; } break; - case 19: + case 21: { cur_parent = (yyvsp[-2].dev)->parent; } break; - case 22: + case 24: { add_resource(cur_parent, (yyvsp[-3].number), strtol((yyvsp[-2].string), NULL, 0), strtol((yyvsp[0].string), NULL, 0)); } break; - case 23: + case 25: { add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); } break; - case 24: + case 26: { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-1].string), NULL, 16), strtol((yyvsp[0].string), NULL, 16), 0); } break; - case 25: + case 27: { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-2].string), NULL, 16), strtol((yyvsp[-1].string), NULL, 16), 1); } break; - case 26: + case 28: { add_ioapic_info(cur_parent, strtol((yyvsp[-2].string), NULL, 16), (yyvsp[-1].string), strtol((yyvsp[0].string), NULL, 16)); } break; - case 27: + case 29: { add_slot_desc(cur_parent, (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string)); } break; - case 28: + case 30: { add_slot_desc(cur_parent, (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string), NULL); } break; - case 29: + case 31: { add_slot_desc(cur_parent, (yyvsp[-1].string), (yyvsp[0].string), NULL, NULL); } break; + case 32: + { } + break; + + case 37: + { + cur_field = new_fw_config_field((yyvsp[-2].string), strtoul((yyvsp[-1].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0)); +} + break; + + case 38: + { } + break; + + case 39: + { + cur_field = new_fw_config_field((yyvsp[-1].string), strtoul((yyvsp[0].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0)); +} + break; + + case 40: + { } + break; + + case 41: + { + cur_field = get_fw_config_field((yyvsp[0].string)); +} + break; + + case 42: + { } + break; + + case 43: + { add_fw_config_option(cur_field, (yyvsp[-1].string), strtoul((yyvsp[0].string), NULL, 0)); } + break; + + case 44: + { add_fw_config_probe(cur_parent, (yyvsp[-1].string), (yyvsp[0].string)); } + break; + default: break; diff --git a/util/sconfig/sconfig.tab.h_shipped b/util/sconfig/sconfig.tab.h_shipped index 5fa9d19362..cadd847fa4 100644 --- a/util/sconfig/sconfig.tab.h_shipped +++ b/util/sconfig/sconfig.tab.h_shipped @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.5.4. */ +/* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison interface for Yacc-like parsers in C @@ -34,8 +34,8 @@ /* Undocumented macros, especially those whose name start with YY_, are private implementation details. Do not rely on them. */ -#ifndef YY_YY_HOME_ME_REPOS_COREBOOTORG_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED -# define YY_YY_HOME_ME_REPOS_COREBOOTORG_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED +#ifndef YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED +# define YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -83,7 +83,11 @@ extern int yydebug; USB = 289, MMIO = 290, LPC = 291, - ESPI = 292 + ESPI = 292, + FW_CONFIG_TABLE = 293, + FW_CONFIG_FIELD = 294, + FW_CONFIG_OPTION = 295, + FW_CONFIG_PROBE = 296 }; #endif @@ -109,4 +113,4 @@ extern YYSTYPE yylval; int yyparse (void); -#endif /* !YY_YY_HOME_ME_REPOS_COREBOOTORG_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */ +#endif /* !YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */ diff --git a/util/sconfig/sconfig.y b/util/sconfig/sconfig.y index 161cf81551..57e939d9f0 100755 --- a/util/sconfig/sconfig.y +++ b/util/sconfig/sconfig.y @@ -9,6 +9,7 @@ void yyerror(const char *s); static struct bus *cur_parent; static struct chip_instance *cur_chip_instance; +static struct fw_config_field *cur_field; %} %union { @@ -18,13 +19,13 @@ static struct chip_instance *cur_chip_instance; int number; } -%token CHIP DEVICE REGISTER BOOL STATUS MANDATORY 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 LPC ESPI +%token CHIP DEVICE REGISTER BOOL STATUS MANDATORY 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 LPC ESPI FW_CONFIG_TABLE FW_CONFIG_FIELD FW_CONFIG_OPTION FW_CONFIG_PROBE %% -devtree: { cur_parent = root_parent; } chip; +devtree: { cur_parent = root_parent; } | devtree chip | devtree fw_config_table; chipchildren: chipchildren device | chipchildren chip | chipchildren registers | /* empty */ ; -devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | devicechildren smbios_slot_desc | devicechildren registers | /* empty */ ; +devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | devicechildren smbios_slot_desc | devicechildren registers | devicechildren fw_config_probe | /* empty */ ; chip: CHIP STRING /* == path */ { $<chip_instance>$ = new_chip_instance($<string>2); @@ -69,4 +70,38 @@ smbios_slot_desc: SLOT_DESC STRING STRING STRING smbios_slot_desc: SLOT_DESC STRING STRING { add_slot_desc(cur_parent, $<string>2, $<string>3, NULL, NULL); }; +/* fw_config: firmware configuration table */ +fw_config_table: FW_CONFIG_TABLE fw_config_table_children END { }; + +/* fw_config -> field */ +fw_config_table_children: fw_config_table_children fw_config_field | /* empty */ ; + +/* field -> option */ +fw_config_field_children: fw_config_field_children fw_config_option | /* empty */ ; + +/* field <start-bit> <end-bit> */ +fw_config_field: FW_CONFIG_FIELD STRING NUMBER /* == start bit */ NUMBER /* == end bit */ { + cur_field = new_fw_config_field($<string>2, strtoul($<string>3, NULL, 0), strtoul($<string>4, NULL, 0)); +} + fw_config_field_children END { }; + +/* field <bit> (for single-bit fields) */ +fw_config_field: FW_CONFIG_FIELD STRING NUMBER /* == bit */ { + cur_field = new_fw_config_field($<string>2, strtoul($<string>3, NULL, 0), strtoul($<string>3, NULL, 0)); +} + fw_config_field_children END { }; + +/* field (for adding options to an existing field) */ +fw_config_field: FW_CONFIG_FIELD STRING { + cur_field = get_fw_config_field($<string>2); +} + fw_config_field_children END { }; + +/* option <value> */ +fw_config_option: FW_CONFIG_OPTION STRING NUMBER /* == field value */ + { add_fw_config_option(cur_field, $<string>2, strtoul($<string>3, NULL, 0)); }; + +/* probe <field> <option> */ +fw_config_probe: FW_CONFIG_PROBE STRING /* == field */ STRING /* == option */ + { add_fw_config_probe(cur_parent, $<string>2, $<string>3); } %% |