From e335c2e02fcf7ee15dd5ae947a19d65390729263 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Wed, 29 Jul 2020 16:28:43 -0700 Subject: sconfig: Allow chipset to provide a base devicetree This change extends the devicetree override one more layer and allows the chipset to provide the base devicetree. This allows the chipset to assign alias names to devices as well as set default register values. This works for both the baseboard devicetree.cb as well as variant overridetree.cb. chipset.cb: device pci 15.0 alias i2c0 off end devicetree.cb: device ref i2c0 on end BUG=b:156957424 Change-Id: Ia7500a62f6211243b519424ef3834b9e7615e2fd Signed-off-by: Duncan Laurie Reviewed-on: https://review.coreboot.org/c/coreboot/+/44037 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber Reviewed-by: Furquan Shaikh --- util/sconfig/lex.yy.c_shipped | 346 ++++++++-------- util/sconfig/main.c | 97 ++++- util/sconfig/sconfig.h | 12 +- util/sconfig/sconfig.l | 1 + util/sconfig/sconfig.tab.c_shipped | 824 +++++++++++++++---------------------- util/sconfig/sconfig.tab.h_shipped | 98 ++--- util/sconfig/sconfig.y | 10 +- 7 files changed, 663 insertions(+), 725 deletions(-) (limited to 'util') diff --git a/util/sconfig/lex.yy.c_shipped b/util/sconfig/lex.yy.c_shipped index fcf5c3ed4f..18b34b5e87 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 48 -#define YY_END_OF_BUFFER 49 +#define YY_NUM_RULES 49 +#define YY_END_OF_BUFFER 50 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -358,31 +358,31 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[202] = +static const flex_int16_t yy_accept[203] = { 0, - 0, 0, 49, 47, 1, 3, 47, 47, 47, 42, - 42, 40, 43, 47, 43, 43, 43, 43, 43, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 1, 3, 47, 0, 47, 47, 0, 2, 42, 43, - 47, 47, 47, 8, 47, 47, 43, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 34, 47, 47, - 47, 47, 47, 47, 14, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 46, 46, 47, 0, 41, 47, - 47, 47, 24, 47, 47, 33, 38, 47, 47, 47, - 47, 47, 21, 47, 47, 32, 47, 30, 47, 47, - - 15, 47, 18, 20, 47, 47, 47, 28, 47, 29, - 7, 47, 0, 44, 47, 4, 47, 47, 47, 31, - 47, 47, 47, 47, 47, 47, 47, 47, 27, 47, - 47, 47, 47, 47, 45, 45, 6, 47, 47, 47, - 11, 47, 47, 47, 47, 47, 22, 47, 47, 13, - 47, 47, 47, 47, 5, 25, 47, 47, 16, 47, - 19, 47, 12, 47, 47, 47, 47, 47, 26, 36, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 9, - 47, 47, 47, 10, 47, 17, 47, 47, 47, 35, - 47, 47, 23, 47, 37, 47, 47, 47, 47, 39, - - 0 + 0, 0, 50, 48, 1, 3, 48, 48, 48, 43, + 43, 41, 44, 48, 44, 44, 44, 44, 44, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 1, 3, 48, 0, 48, 48, 0, 2, 43, 44, + 48, 48, 48, 9, 48, 48, 44, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 35, 48, 48, + 48, 48, 48, 48, 15, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 47, 47, 48, 0, 42, 48, + 48, 48, 25, 48, 48, 34, 39, 48, 48, 48, + 48, 48, 22, 48, 48, 33, 48, 31, 48, 48, + + 16, 48, 19, 21, 48, 8, 48, 48, 29, 48, + 30, 7, 48, 0, 45, 48, 4, 48, 48, 48, + 32, 48, 48, 48, 48, 48, 48, 48, 48, 28, + 48, 48, 48, 48, 48, 46, 46, 6, 48, 48, + 48, 12, 48, 48, 48, 48, 48, 23, 48, 48, + 14, 48, 48, 48, 48, 5, 26, 48, 48, 17, + 48, 20, 48, 13, 48, 48, 48, 48, 48, 27, + 37, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 10, 48, 48, 48, 11, 48, 18, 48, 48, 48, + 36, 48, 48, 24, 48, 38, 48, 48, 48, 48, + + 40, 0 } ; static const YY_CHAR yy_ec[256] = @@ -425,61 +425,61 @@ static const YY_CHAR yy_meta[40] = 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static const flex_int16_t yy_base[209] = +static const flex_int16_t yy_base[210] = { 0, - 0, 0, 274, 0, 271, 275, 269, 38, 42, 39, - 233, 0, 45, 256, 55, 59, 83, 65, 62, 248, - 243, 68, 25, 48, 54, 75, 246, 75, 233, 0, - 263, 275, 106, 259, 111, 76, 260, 275, 0, 110, - 113, 247, 236, 0, 235, 224, 119, 231, 226, 236, - 225, 233, 237, 224, 231, 231, 225, 231, 216, 216, - 226, 216, 218, 220, 0, 207, 215, 209, 209, 214, - 218, 210, 216, 118, 0, 275, 135, 228, 0, 221, - 214, 200, 213, 203, 210, 0, 0, 201, 199, 205, - 202, 202, 0, 200, 190, 0, 194, 0, 198, 188, - - 0, 191, 0, 0, 197, 189, 188, 0, 179, 0, - 0, 206, 205, 0, 176, 0, 189, 188, 181, 0, - 185, 175, 171, 181, 169, 175, 180, 181, 0, 168, - 175, 162, 165, 154, 0, 275, 0, 166, 170, 162, - 0, 161, 163, 159, 161, 166, 0, 150, 155, 0, - 148, 148, 147, 144, 0, 0, 156, 158, 0, 142, - 159, 145, 0, 152, 156, 137, 137, 144, 0, 0, - 143, 122, 121, 119, 130, 116, 126, 116, 108, 0, - 120, 118, 123, 0, 112, 0, 113, 116, 97, 0, - 89, 86, 0, 85, 0, 75, 65, 52, 61, 0, - - 275, 48, 155, 157, 159, 161, 163, 165 + 0, 0, 275, 0, 272, 276, 270, 38, 42, 39, + 234, 0, 45, 257, 55, 59, 83, 65, 62, 249, + 244, 68, 25, 48, 54, 75, 247, 75, 234, 0, + 264, 276, 106, 260, 111, 76, 261, 276, 0, 110, + 113, 248, 237, 0, 236, 225, 119, 232, 227, 237, + 226, 234, 238, 225, 232, 232, 226, 232, 217, 217, + 227, 217, 219, 221, 0, 208, 216, 210, 210, 63, + 220, 212, 218, 118, 0, 276, 135, 230, 0, 223, + 216, 202, 215, 205, 212, 0, 0, 203, 201, 207, + 204, 204, 0, 202, 192, 0, 196, 0, 200, 190, + + 0, 193, 0, 0, 199, 0, 191, 190, 0, 181, + 0, 0, 208, 207, 0, 178, 0, 191, 190, 183, + 0, 187, 177, 173, 183, 171, 177, 182, 183, 0, + 170, 177, 164, 167, 156, 0, 276, 0, 168, 172, + 164, 0, 163, 165, 161, 163, 168, 0, 152, 157, + 0, 150, 150, 149, 146, 0, 0, 158, 160, 0, + 144, 161, 147, 0, 154, 158, 139, 139, 146, 0, + 0, 145, 137, 136, 121, 132, 118, 128, 118, 110, + 0, 122, 120, 125, 0, 114, 0, 115, 118, 110, + 0, 107, 109, 0, 107, 0, 86, 80, 62, 61, + + 0, 276, 48, 155, 157, 159, 161, 163, 165 } ; -static const flex_int16_t yy_def[209] = +static const flex_int16_t yy_def[210] = { 0, - 201, 1, 201, 202, 201, 201, 202, 203, 204, 202, - 10, 202, 10, 202, 10, 10, 10, 10, 10, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 201, 201, 203, 205, 206, 204, 207, 201, 10, 10, - 10, 202, 202, 202, 202, 202, 10, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 201, 206, 208, 41, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 201, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 201, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - - 0, 201, 201, 201, 201, 201, 201, 201 + 202, 1, 202, 203, 202, 202, 203, 204, 205, 203, + 10, 203, 10, 203, 10, 10, 10, 10, 10, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 202, 202, 204, 206, 207, 205, 208, 202, 10, 10, + 10, 203, 203, 203, 203, 203, 10, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 202, 207, 209, 41, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 202, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 202, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + + 203, 0, 202, 202, 202, 202, 202, 202, 202 } ; -static const flex_int16_t yy_nxt[315] = +static const flex_int16_t yy_nxt[316] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 10, 12, 13, 13, 14, 4, 4, 4, 15, 13, 16, 17, @@ -488,73 +488,73 @@ static const flex_int16_t yy_nxt[315] = 34, 60, 35, 37, 38, 39, 39, 39, 30, 40, 40, 40, 40, 40, 61, 40, 40, 40, 40, 40, 40, 40, 40, 40, 62, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 63, 64, 56, 37, 38, 200, - 43, 65, 45, 66, 199, 198, 52, 44, 46, 40, - 40, 40, 50, 67, 197, 57, 58, 51, 53, 59, + 40, 40, 40, 40, 63, 64, 56, 37, 38, 201, + 43, 65, 45, 66, 106, 107, 52, 44, 46, 40, + 40, 40, 50, 67, 200, 57, 58, 51, 53, 59, - 196, 71, 68, 47, 72, 195, 69, 34, 34, 73, + 199, 71, 68, 47, 72, 198, 69, 34, 34, 73, 75, 48, 78, 78, 49, 30, 40, 40, 40, 79, - 79, 79, 194, 79, 79, 40, 40, 40, 193, 79, - 79, 79, 79, 79, 79, 110, 78, 78, 111, 112, - 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, - 182, 181, 180, 179, 84, 33, 33, 36, 36, 34, - 34, 77, 77, 37, 37, 78, 78, 178, 177, 176, - 175, 174, 173, 172, 171, 170, 169, 168, 167, 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, 109, 108, 107, 106, 105, 104, 103, - 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, - 92, 91, 90, 89, 88, 87, 86, 85, 83, 82, - 81, 80, 38, 76, 31, 74, 70, 55, 54, 42, - 41, 32, 31, 201, 3, 201, 201, 201, 201, 201, - 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, - 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, - - 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, - 201, 201, 201, 201 + 79, 79, 197, 79, 79, 40, 40, 40, 196, 79, + 79, 79, 79, 79, 79, 111, 78, 78, 112, 113, + 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, + 185, 184, 183, 182, 84, 33, 33, 36, 36, 34, + 34, 77, 77, 37, 37, 78, 78, 181, 180, 179, + 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, + 168, 167, 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, 110, 109, 108, 105, 104, + 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, + 93, 92, 91, 90, 89, 88, 87, 86, 85, 83, + 82, 81, 80, 38, 76, 31, 74, 70, 55, 54, + 42, 41, 32, 31, 202, 3, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202 } ; -static const flex_int16_t yy_chk[315] = +static const flex_int16_t yy_chk[316] = { 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, 8, - 8, 23, 8, 9, 9, 10, 10, 10, 202, 10, + 8, 23, 8, 9, 9, 10, 10, 10, 203, 10, 10, 13, 13, 13, 23, 10, 10, 10, 10, 10, 10, 15, 15, 15, 24, 16, 16, 16, 19, 19, - 19, 18, 18, 18, 24, 25, 22, 36, 36, 199, - 15, 25, 16, 25, 198, 197, 19, 15, 16, 17, - 17, 17, 18, 26, 196, 22, 22, 18, 19, 22, + 19, 18, 18, 18, 24, 25, 22, 36, 36, 200, + 15, 25, 16, 25, 70, 70, 19, 15, 16, 17, + 17, 17, 18, 26, 199, 22, 22, 18, 19, 22, - 194, 28, 26, 17, 28, 192, 26, 33, 33, 28, + 198, 28, 26, 17, 28, 197, 26, 33, 33, 28, 33, 17, 35, 35, 17, 35, 40, 40, 40, 41, - 41, 41, 191, 41, 41, 47, 47, 47, 189, 41, + 41, 41, 195, 41, 41, 47, 47, 47, 193, 41, 41, 41, 41, 41, 41, 74, 77, 77, 74, 77, - 188, 187, 185, 183, 182, 181, 179, 178, 177, 176, - 175, 174, 173, 172, 47, 203, 203, 204, 204, 205, - 205, 206, 206, 207, 207, 208, 208, 171, 168, 167, - 166, 165, 164, 162, 161, 160, 158, 157, 154, 153, - 152, 151, 149, 148, 146, 145, 144, 143, 142, 140, - 139, 138, 134, 133, 132, 131, 130, 128, 127, 126, - - 125, 124, 123, 122, 121, 119, 118, 117, 115, 113, - 112, 109, 107, 106, 105, 102, 100, 99, 97, 95, - 94, 92, 91, 90, 89, 88, 85, 84, 83, 82, - 81, 80, 78, 73, 72, 71, 70, 69, 68, 67, - 66, 64, 63, 62, 61, 60, 59, 58, 57, 56, - 55, 54, 53, 52, 51, 50, 49, 48, 46, 45, - 43, 42, 37, 34, 31, 29, 27, 21, 20, 14, - 11, 7, 5, 3, 201, 201, 201, 201, 201, 201, - 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, - 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, - - 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, - 201, 201, 201, 201 + 192, 190, 189, 188, 186, 184, 183, 182, 180, 179, + 178, 177, 176, 175, 47, 204, 204, 205, 205, 206, + 206, 207, 207, 208, 208, 209, 209, 174, 173, 172, + 169, 168, 167, 166, 165, 163, 162, 161, 159, 158, + 155, 154, 153, 152, 150, 149, 147, 146, 145, 144, + 143, 141, 140, 139, 135, 134, 133, 132, 131, 129, + + 128, 127, 126, 125, 124, 123, 122, 120, 119, 118, + 116, 114, 113, 110, 108, 107, 105, 102, 100, 99, + 97, 95, 94, 92, 91, 90, 89, 88, 85, 84, + 83, 82, 81, 80, 78, 73, 72, 71, 69, 68, + 67, 66, 64, 63, 62, 61, 60, 59, 58, 57, + 56, 55, 54, 53, 52, 51, 50, 49, 48, 46, + 45, 43, 42, 37, 34, 31, 29, 27, 21, 20, + 14, 11, 7, 5, 3, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + + 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, + 202, 202, 202, 202, 202 } ; static yy_state_type yy_last_accepting_state; @@ -819,13 +819,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 >= 202 ) + if ( yy_current_state >= 203 ) 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] != 275 ); + while ( yy_base[yy_current_state] != 276 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -881,139 +881,139 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -{return(ASSOCIATION);} +{return(REFERENCE);} YY_BREAK case 9: YY_RULE_SETUP -{return(REGISTER);} +{return(ASSOCIATION);} YY_BREAK case 10: YY_RULE_SETUP -{return(FW_CONFIG_TABLE);} +{return(REGISTER);} YY_BREAK case 11: YY_RULE_SETUP -{return(FW_CONFIG_FIELD);} +{return(FW_CONFIG_TABLE);} YY_BREAK case 12: YY_RULE_SETUP -{return(FW_CONFIG_OPTION);} +{return(FW_CONFIG_FIELD);} YY_BREAK case 13: YY_RULE_SETUP -{return(FW_CONFIG_PROBE);} +{return(FW_CONFIG_OPTION);} YY_BREAK case 14: YY_RULE_SETUP -{yylval.number=1; return(BOOL);} +{return(FW_CONFIG_PROBE);} YY_BREAK case 15: YY_RULE_SETUP -{yylval.number=0; return(BOOL);} +{yylval.number=1; return(BOOL);} YY_BREAK case 16: YY_RULE_SETUP -{yylval.number=3; return(STATUS);} +{yylval.number=0; return(BOOL);} YY_BREAK case 17: YY_RULE_SETUP -{yylval.number=5; return(STATUS);} +{yylval.number=3; return(STATUS);} YY_BREAK case 18: YY_RULE_SETUP -{yylval.number=PCI; return(BUS);} +{yylval.number=5; return(STATUS);} YY_BREAK case 19: YY_RULE_SETUP -{yylval.number=IOAPIC; return(BUS);} +{yylval.number=PCI; return(BUS);} YY_BREAK case 20: YY_RULE_SETUP -{yylval.number=PNP; return(BUS);} +{yylval.number=IOAPIC; return(BUS);} YY_BREAK case 21: YY_RULE_SETUP -{yylval.number=I2C; return(BUS);} +{yylval.number=PNP; return(BUS);} YY_BREAK case 22: YY_RULE_SETUP -{yylval.number=APIC; return(BUS);} +{yylval.number=I2C; return(BUS);} YY_BREAK case 23: YY_RULE_SETUP -{yylval.number=CPU_CLUSTER; return(BUS);} +{yylval.number=APIC; return(BUS);} YY_BREAK case 24: YY_RULE_SETUP -{yylval.number=CPU; return(BUS);} +{yylval.number=CPU_CLUSTER; return(BUS);} YY_BREAK case 25: YY_RULE_SETUP -{yylval.number=DOMAIN; return(BUS);} +{yylval.number=CPU; return(BUS);} YY_BREAK case 26: YY_RULE_SETUP -{yylval.number=GENERIC; return(BUS);} +{yylval.number=DOMAIN; return(BUS);} YY_BREAK case 27: YY_RULE_SETUP -{yylval.number=MMIO; return(BUS);} +{yylval.number=GENERIC; return(BUS);} YY_BREAK case 28: YY_RULE_SETUP -{yylval.number=SPI; return(BUS);} +{yylval.number=MMIO; return(BUS);} YY_BREAK case 29: YY_RULE_SETUP -{yylval.number=USB; return(BUS);} +{yylval.number=SPI; return(BUS);} YY_BREAK case 30: YY_RULE_SETUP -{yylval.number=LPC; return(BUS);} +{yylval.number=USB; return(BUS);} YY_BREAK case 31: YY_RULE_SETUP -{yylval.number=ESPI; return(BUS);} +{yylval.number=LPC; return(BUS);} YY_BREAK case 32: YY_RULE_SETUP -{yylval.number=IRQ; return(RESOURCE);} +{yylval.number=ESPI; return(BUS);} YY_BREAK case 33: YY_RULE_SETUP -{yylval.number=DRQ; return(RESOURCE);} +{yylval.number=IRQ; return(RESOURCE);} YY_BREAK case 34: YY_RULE_SETUP -{yylval.number=IO; return(RESOURCE);} +{yylval.number=DRQ; return(RESOURCE);} YY_BREAK case 35: YY_RULE_SETUP -{return(IOAPIC_IRQ);} +{yylval.number=IO; return(RESOURCE);} YY_BREAK case 36: YY_RULE_SETUP -{return(INHERIT);} +{return(IOAPIC_IRQ);} YY_BREAK case 37: YY_RULE_SETUP -{return(SUBSYSTEMID);} +{return(INHERIT);} YY_BREAK case 38: YY_RULE_SETUP -{return(END);} +{return(SUBSYSTEMID);} YY_BREAK case 39: YY_RULE_SETUP -{return(SLOT_DESC);} +{return(END);} YY_BREAK case 40: YY_RULE_SETUP -{return(EQUALS);} +{return(SLOT_DESC);} YY_BREAK case 41: YY_RULE_SETUP -{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} +{return(EQUALS);} YY_BREAK case 42: YY_RULE_SETUP @@ -1025,12 +1025,11 @@ YY_RULE_SETUP YY_BREAK case 44: 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 45: -/* rule 45 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 46: /* rule 46 can match eol */ @@ -1038,11 +1037,16 @@ 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 47: +/* rule 47 can match eol */ YY_RULE_SETUP -{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);} +{yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);} YY_BREAK case 48: YY_RULE_SETUP +{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);} + YY_BREAK +case 49: +YY_RULE_SETUP ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): @@ -1341,7 +1345,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 >= 202 ) + if ( yy_current_state >= 203 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -1369,11 +1373,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 >= 202 ) + if ( yy_current_state >= 203 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 201); + yy_is_jam = (yy_current_state == 202); return yy_is_jam ? 0 : yy_current_state; } diff --git a/util/sconfig/main.c b/util/sconfig/main.c index dbb266b346..bff721548b 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -69,6 +69,9 @@ typedef enum { /* Root device of primary tree. */ static struct device base_root_dev; +/* Root device of chipset tree. */ +static struct device chipset_root_dev; + /* Root device of override tree (if applicable). */ static struct device override_root_dev; @@ -88,6 +91,20 @@ static struct device base_root_dev = { .bus = &base_root_bus, }; +static struct bus chipset_root_bus = { + .id = 0, + .dev = &chipset_root_dev, +}; + +static struct device chipset_root_dev = { + .name = "chipset_root", + .chip_instance = &mainboard_instance, + .path = " .type = DEVICE_PATH_ROOT ", + .parent = &chipset_root_bus, + .enabled = 1, + .bus = &chipset_root_bus, +}; + static struct bus override_root_bus = { .id = 0, .dev = &override_root_dev, @@ -689,28 +706,13 @@ static const struct device *find_alias(const struct device *const parent, return NULL; } -struct device *new_device(struct bus *parent, - struct chip_instance *chip_instance, - const int bustype, const char *devnum, - char *alias, int status) +static struct device *new_device_with_path(struct bus *parent, + struct chip_instance *chip_instance, + const int bustype, int path_a, int path_b, + char *alias, int status) { - char *tmp; - int path_a; - int path_b = 0; struct device *new_d; - /* Check for alias name conflicts. */ - if (alias && find_alias(&base_root_dev, alias)) { - printf("ERROR: Alias already exists: %s\n", alias); - exit(1); - } - - path_a = strtol(devnum, &tmp, 16); - if (*tmp == '.') { - tmp++; - path_b = strtol(tmp, NULL, 16); - } - /* If device is found under parent, no need to allocate new device. */ new_d = get_dev(parent, path_a, path_b, bustype, chip_instance); if (new_d) { @@ -794,6 +796,46 @@ struct device *new_device(struct bus *parent, return new_d; } +struct device *new_device_reference(struct bus *parent, + struct chip_instance *chip_instance, + const char *reference, int status) +{ + const struct device *dev = find_alias(&base_root_dev, reference); + + if (!dev) { + printf("ERROR: Unable to find device reference %s\n", reference); + exit(1); + } + + return new_device_with_path(parent, chip_instance, dev->bustype, dev->path_a, + dev->path_b, NULL, status); +} + +struct device *new_device_raw(struct bus *parent, + struct chip_instance *chip_instance, + const int bustype, const char *devnum, + char *alias, int status) +{ + char *tmp; + int path_a; + int path_b = 0; + + /* Check for alias name conflicts. */ + if (alias && find_alias(root_parent->dev, alias)) { + printf("ERROR: Alias already exists: %s\n", alias); + exit(1); + } + + path_a = strtol(devnum, &tmp, 16); + if (*tmp == '.') { + tmp++; + path_b = strtol(tmp, NULL, 16); + } + + return new_device_with_path(parent, chip_instance, bustype, path_a, path_b, alias, + status); +} + static void new_resource(struct device *dev, int type, int index, int base) { struct resource *r = S_ALLOC(sizeof(struct resource)); @@ -1315,6 +1357,7 @@ static void usage(void) printf(" -r | --output_h : Path to header static.h file (required)\n"); printf(" -m | --mainboard_devtree : Path to mainboard devicetree file (required)\n"); printf(" -o | --override_devtree : Path to override devicetree file (optional)\n"); + printf(" -p | --chipset_devtree : Path to chipset/SOC devicetree file (optional)\n"); exit(1); } @@ -1683,6 +1726,7 @@ int main(int argc, char **argv) static const struct option long_options[] = { { "mainboard_devtree", 1, NULL, 'm' }, { "override_devtree", 1, NULL, 'o' }, + { "chipset_devtree", 1, NULL, 'p' }, { "output_c", 1, NULL, 'c' }, { "output_h", 1, NULL, 'r' }, { "help", 1, NULL, 'h' }, @@ -1690,11 +1734,12 @@ int main(int argc, char **argv) }; const char *override_devtree = NULL; const char *base_devtree = NULL; + const char *chipset_devtree = NULL; const char *outputc = NULL; const char *outputh = NULL; int opt, option_index; - while ((opt = getopt_long(argc, argv, "m:o:c:r:h", long_options, + while ((opt = getopt_long(argc, argv, "m:o:p:c:r:h", long_options, &option_index)) != EOF) { switch (opt) { case 'm': @@ -1703,6 +1748,9 @@ int main(int argc, char **argv) case 'o': override_devtree = strdup(optarg); break; + case 'p': + chipset_devtree = strdup(optarg); + break; case 'c': outputc = strdup(optarg); break; @@ -1718,7 +1766,14 @@ int main(int argc, char **argv) if (!base_devtree || !outputc || !outputh) usage(); - parse_devicetree(base_devtree, &base_root_bus); + if (chipset_devtree) { + /* Use the chipset devicetree as the base, then override + with the mainboard "base" devicetree. */ + parse_devicetree(chipset_devtree, &base_root_bus); + parse_override_devicetree(base_devtree, &chipset_root_dev); + } else { + parse_devicetree(base_devtree, &base_root_bus); + } if (override_devtree) parse_override_devicetree(override_devtree, &override_root_dev); diff --git a/util/sconfig/sconfig.h b/util/sconfig/sconfig.h index 719519e855..e2ff4c786b 100644 --- a/util/sconfig/sconfig.h +++ b/util/sconfig/sconfig.h @@ -175,10 +175,14 @@ struct device { extern struct bus *root_parent; -struct device *new_device(struct bus *parent, - struct chip_instance *chip_instance, - const int bustype, const char *devnum, - char *alias, int status); +struct device *new_device_raw(struct bus *parent, + struct chip_instance *chip_instance, + const int bustype, const char *devnum, + char *alias, int status); + +struct device *new_device_reference(struct bus *parent, + struct chip_instance *chip_instance, + const char *reference, int status); void add_resource(struct bus *bus, int type, int index, int base); diff --git a/util/sconfig/sconfig.l b/util/sconfig/sconfig.l index 0505150263..a772b96b36 100755 --- a/util/sconfig/sconfig.l +++ b/util/sconfig/sconfig.l @@ -15,6 +15,7 @@ chip {return(CHIP);} device {return(DEVICE);} alias {return(ALIAS);} use {return(REFERENCE);} +ref {return(REFERENCE);} as {return(ASSOCIATION);} register {return(REGISTER);} fw_config {return(FW_CONFIG_TABLE);} diff --git a/util/sconfig/sconfig.tab.c_shipped b/util/sconfig/sconfig.tab.c_shipped index 52bb79cbfc..43fd14f090 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.3. */ +/* A Bison parser, made by GNU Bison 3.6.3. */ /* Bison implementation for Yacc-like parsers in C @@ -34,6 +34,10 @@ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -41,14 +45,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ - /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.5.3" +#define YYBISON_VERSION "3.6.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -102,14 +103,6 @@ static struct fw_config_field *cur_field; # endif # endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - /* Use api.header.include to #include this header instead of duplicating it here. */ #ifndef YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED @@ -122,54 +115,59 @@ static struct fw_config_field *cur_field; extern int yydebug; #endif -/* Token type. */ +/* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { - CHIP = 258, - DEVICE = 259, - REGISTER = 260, - ALIAS = 261, - REFERENCE = 262, - ASSOCIATION = 263, - BOOL = 264, - STATUS = 265, - MANDATORY = 266, - BUS = 267, - RESOURCE = 268, - END = 269, - EQUALS = 270, - HEX = 271, - STRING = 272, - PCI = 273, - PNP = 274, - I2C = 275, - APIC = 276, - CPU_CLUSTER = 277, - CPU = 278, - DOMAIN = 279, - IRQ = 280, - DRQ = 281, - SLOT_DESC = 282, - IO = 283, - NUMBER = 284, - SUBSYSTEMID = 285, - INHERIT = 286, - IOAPIC_IRQ = 287, - IOAPIC = 288, - PCIINT = 289, - GENERIC = 290, - SPI = 291, - USB = 292, - MMIO = 293, - LPC = 294, - ESPI = 295, - FW_CONFIG_TABLE = 296, - FW_CONFIG_FIELD = 297, - FW_CONFIG_OPTION = 298, - FW_CONFIG_PROBE = 299 + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + CHIP = 258, /* CHIP */ + DEVICE = 259, /* DEVICE */ + REGISTER = 260, /* REGISTER */ + ALIAS = 261, /* ALIAS */ + REFERENCE = 262, /* REFERENCE */ + ASSOCIATION = 263, /* ASSOCIATION */ + BOOL = 264, /* BOOL */ + STATUS = 265, /* STATUS */ + MANDATORY = 266, /* MANDATORY */ + BUS = 267, /* BUS */ + RESOURCE = 268, /* RESOURCE */ + END = 269, /* END */ + EQUALS = 270, /* EQUALS */ + HEX = 271, /* HEX */ + STRING = 272, /* STRING */ + PCI = 273, /* PCI */ + PNP = 274, /* PNP */ + I2C = 275, /* I2C */ + APIC = 276, /* APIC */ + CPU_CLUSTER = 277, /* CPU_CLUSTER */ + CPU = 278, /* CPU */ + DOMAIN = 279, /* DOMAIN */ + IRQ = 280, /* IRQ */ + DRQ = 281, /* DRQ */ + SLOT_DESC = 282, /* SLOT_DESC */ + IO = 283, /* IO */ + NUMBER = 284, /* NUMBER */ + SUBSYSTEMID = 285, /* SUBSYSTEMID */ + INHERIT = 286, /* INHERIT */ + IOAPIC_IRQ = 287, /* IOAPIC_IRQ */ + IOAPIC = 288, /* IOAPIC */ + PCIINT = 289, /* PCIINT */ + GENERIC = 290, /* GENERIC */ + SPI = 291, /* SPI */ + USB = 292, /* USB */ + MMIO = 293, /* MMIO */ + LPC = 294, /* LPC */ + ESPI = 295, /* ESPI */ + FW_CONFIG_TABLE = 296, /* FW_CONFIG_TABLE */ + FW_CONFIG_FIELD = 297, /* FW_CONFIG_FIELD */ + FW_CONFIG_OPTION = 298, /* FW_CONFIG_OPTION */ + FW_CONFIG_PROBE = 299 /* FW_CONFIG_PROBE */ }; + typedef enum yytokentype yytoken_kind_t; #endif /* Value type. */ @@ -195,6 +193,84 @@ extern YYSTYPE yylval; int yyparse (void); #endif /* !YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */ +/* Symbol kind. */ +enum yysymbol_kind_t +{ + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_CHIP = 3, /* CHIP */ + YYSYMBOL_DEVICE = 4, /* DEVICE */ + YYSYMBOL_REGISTER = 5, /* REGISTER */ + YYSYMBOL_ALIAS = 6, /* ALIAS */ + YYSYMBOL_REFERENCE = 7, /* REFERENCE */ + YYSYMBOL_ASSOCIATION = 8, /* ASSOCIATION */ + YYSYMBOL_BOOL = 9, /* BOOL */ + YYSYMBOL_STATUS = 10, /* STATUS */ + YYSYMBOL_MANDATORY = 11, /* MANDATORY */ + YYSYMBOL_BUS = 12, /* BUS */ + YYSYMBOL_RESOURCE = 13, /* RESOURCE */ + YYSYMBOL_END = 14, /* END */ + YYSYMBOL_EQUALS = 15, /* EQUALS */ + YYSYMBOL_HEX = 16, /* HEX */ + YYSYMBOL_STRING = 17, /* STRING */ + YYSYMBOL_PCI = 18, /* PCI */ + YYSYMBOL_PNP = 19, /* PNP */ + YYSYMBOL_I2C = 20, /* I2C */ + YYSYMBOL_APIC = 21, /* APIC */ + YYSYMBOL_CPU_CLUSTER = 22, /* CPU_CLUSTER */ + YYSYMBOL_CPU = 23, /* CPU */ + YYSYMBOL_DOMAIN = 24, /* DOMAIN */ + YYSYMBOL_IRQ = 25, /* IRQ */ + YYSYMBOL_DRQ = 26, /* DRQ */ + YYSYMBOL_SLOT_DESC = 27, /* SLOT_DESC */ + YYSYMBOL_IO = 28, /* IO */ + YYSYMBOL_NUMBER = 29, /* NUMBER */ + YYSYMBOL_SUBSYSTEMID = 30, /* SUBSYSTEMID */ + YYSYMBOL_INHERIT = 31, /* INHERIT */ + YYSYMBOL_IOAPIC_IRQ = 32, /* IOAPIC_IRQ */ + YYSYMBOL_IOAPIC = 33, /* IOAPIC */ + YYSYMBOL_PCIINT = 34, /* PCIINT */ + YYSYMBOL_GENERIC = 35, /* GENERIC */ + YYSYMBOL_SPI = 36, /* SPI */ + YYSYMBOL_USB = 37, /* USB */ + YYSYMBOL_MMIO = 38, /* MMIO */ + YYSYMBOL_LPC = 39, /* LPC */ + YYSYMBOL_ESPI = 40, /* ESPI */ + YYSYMBOL_FW_CONFIG_TABLE = 41, /* FW_CONFIG_TABLE */ + YYSYMBOL_FW_CONFIG_FIELD = 42, /* FW_CONFIG_FIELD */ + YYSYMBOL_FW_CONFIG_OPTION = 43, /* FW_CONFIG_OPTION */ + YYSYMBOL_FW_CONFIG_PROBE = 44, /* FW_CONFIG_PROBE */ + YYSYMBOL_YYACCEPT = 45, /* $accept */ + YYSYMBOL_devtree = 46, /* devtree */ + YYSYMBOL_chipchildren = 47, /* chipchildren */ + YYSYMBOL_devicechildren = 48, /* devicechildren */ + YYSYMBOL_chip = 49, /* chip */ + YYSYMBOL_50_1 = 50, /* @1 */ + YYSYMBOL_device = 51, /* device */ + YYSYMBOL_52_2 = 52, /* @2 */ + YYSYMBOL_53_3 = 53, /* @3 */ + YYSYMBOL_alias = 54, /* alias */ + YYSYMBOL_status = 55, /* status */ + YYSYMBOL_resource = 56, /* resource */ + YYSYMBOL_reference = 57, /* reference */ + YYSYMBOL_registers = 58, /* registers */ + YYSYMBOL_subsystemid = 59, /* subsystemid */ + YYSYMBOL_ioapic_irq = 60, /* ioapic_irq */ + YYSYMBOL_smbios_slot_desc = 61, /* smbios_slot_desc */ + YYSYMBOL_fw_config_table = 62, /* fw_config_table */ + YYSYMBOL_fw_config_table_children = 63, /* fw_config_table_children */ + YYSYMBOL_fw_config_field_children = 64, /* fw_config_field_children */ + YYSYMBOL_fw_config_field = 65, /* fw_config_field */ + YYSYMBOL_66_4 = 66, /* $@4 */ + YYSYMBOL_67_5 = 67, /* $@5 */ + YYSYMBOL_68_6 = 68, /* $@6 */ + YYSYMBOL_fw_config_option = 69, /* fw_config_option */ + YYSYMBOL_fw_config_probe = 70 /* fw_config_probe */ +}; +typedef enum yysymbol_kind_t yysymbol_kind_t; + @@ -294,6 +370,7 @@ typedef int yytype_uint16; #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + /* Stored state numbers (used for stacks). */ typedef yytype_int8 yy_state_t; @@ -312,6 +389,7 @@ typedef int yy_state_fast_t; # endif #endif + #ifndef YY_ATTRIBUTE_PURE # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) @@ -369,7 +447,7 @@ typedef int yy_state_fast_t; #define YY_ASSERT(E) ((void) (0 && (E))) -#if ! defined yyoverflow || YYERROR_VERBOSE +#if !defined yyoverflow /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -434,8 +512,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - +#endif /* !defined yyoverflow */ #if (! defined yyoverflow \ && (! defined __cplusplus \ @@ -500,25 +577,26 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 64 +#define YYLAST 97 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 45 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 25 +#define YYNNTS 26 /* YYNRULES -- Number of rules. */ -#define YYNRULES 48 +#define YYNRULES 50 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 83 +#define YYNSTATES 89 -#define YYUNDEFTOK 2 #define YYMAXUTOK 299 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ -#define YYTRANSLATE(YYX) \ - (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ + : YYSYMBOL_YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ @@ -562,34 +640,48 @@ static const yytype_int8 yyrline[] = { 0, 24, 24, 24, 24, 26, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 30, - 30, 39, 39, 47, 49, 53, 53, 55, 58, 61, - 64, 67, 70, 73, 76, 79, 83, 86, 86, 89, - 89, 92, 92, 98, 98, 104, 104, 110, 114 + 30, 39, 39, 47, 47, 55, 57, 61, 61, 63, + 66, 69, 72, 75, 78, 81, 84, 87, 91, 94, + 94, 97, 97, 100, 100, 106, 106, 112, 112, 118, + 122 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 0 +/** Accessing symbol of state STATE. */ +#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) + +#if YYDEBUG || 0 +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "CHIP", "DEVICE", "REGISTER", "ALIAS", - "REFERENCE", "ASSOCIATION", "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", "$accept", - "devtree", "chipchildren", "devicechildren", "chip", "@1", "device", - "@2", "alias", "status", "resource", "reference", "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 + "\"end of file\"", "error", "\"invalid token\"", "CHIP", "DEVICE", + "REGISTER", "ALIAS", "REFERENCE", "ASSOCIATION", "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", "$accept", "devtree", "chipchildren", + "devicechildren", "chip", "@1", "device", "@2", "@3", "alias", "status", + "resource", "reference", "registers", "subsystemid", "ioapic_irq", + "smbios_slot_desc", "fw_config_table", "fw_config_table_children", + "fw_config_field_children", "fw_config_field", "$@4", "$@5", "$@6", + "fw_config_option", "fw_config_probe", YY_NULLPTR }; + +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) +{ + return yytname[yysymbol]; +} #endif -# ifdef YYPRINT +#ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ static const yytype_int16 yytoknum[] = @@ -600,9 +692,9 @@ static const yytype_int16 yytoknum[] = 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299 }; -# endif +#endif -#define YYPACT_NINF (-21) +#define YYPACT_NINF (-12) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) @@ -616,15 +708,15 @@ static const yytype_int16 yytoknum[] = STATE-NUM. */ static const yytype_int8 yypact[] = { - -21, 3, -21, -4, -21, -21, -21, -21, -2, -21, - -21, 4, -21, 11, -20, 14, 6, 13, -21, -21, - -21, -21, -21, -1, -21, 2, 17, 26, -21, -21, - -10, 29, 21, 22, -21, -7, -21, 25, -21, 30, - 10, -21, -21, -6, -21, 19, -21, -21, -21, -21, - -21, -21, -21, -3, 20, -21, 33, 23, 24, 34, - -21, -21, -21, -21, -21, -21, -21, -21, 28, 37, - 27, 12, 38, 31, 40, 32, 35, -21, -21, 41, - -21, -21, -21 + -12, 9, -12, 18, -12, -12, -12, -12, 2, -12, + -12, 25, -12, 16, 14, 10, 30, 31, -12, -12, + -12, -12, -12, 17, -12, 32, 22, 3, 44, -12, + -12, -11, 29, 20, 36, 37, -12, -7, -12, 38, + -12, -12, -12, -12, 39, 29, -12, -12, -6, -12, + 28, -12, -12, -12, -12, -12, -3, -12, 33, -12, + 41, 34, 35, 42, -12, -12, -12, -12, -12, -12, + -12, -12, 1, 45, 48, 40, 27, 49, -12, 43, + 50, 46, 47, -12, -12, 51, -12, -12, -12 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -632,31 +724,31 @@ static const yytype_int8 yypact[] = means the default is an error. */ static const yytype_int8 yydefact[] = { - 2, 0, 1, 0, 38, 3, 4, 19, 0, 9, - 36, 0, 37, 0, 45, 0, 0, 0, 20, 6, - 5, 8, 7, 43, 40, 0, 0, 0, 41, 40, - 0, 23, 0, 0, 40, 0, 46, 0, 39, 0, - 0, 29, 28, 0, 44, 0, 24, 25, 26, 21, - 42, 47, 18, 0, 0, 22, 0, 0, 0, 0, - 11, 10, 12, 16, 13, 14, 15, 17, 0, 0, - 0, 0, 0, 0, 35, 30, 0, 48, 27, 34, - 31, 32, 33 + 2, 0, 1, 0, 40, 3, 4, 19, 0, 9, + 38, 0, 39, 0, 47, 0, 0, 0, 20, 6, + 5, 8, 7, 45, 42, 0, 0, 0, 0, 43, + 42, 0, 0, 25, 0, 0, 42, 0, 48, 0, + 41, 27, 28, 23, 0, 0, 31, 30, 0, 46, + 0, 18, 26, 21, 44, 49, 0, 18, 0, 24, + 0, 0, 0, 0, 11, 10, 12, 16, 13, 14, + 15, 17, 0, 0, 0, 0, 0, 0, 22, 0, + 37, 32, 0, 50, 29, 36, 33, 34, 35 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -21, -21, -21, -21, -8, -21, 8, -21, -21, -21, - -21, -21, 9, -21, -21, -21, -21, -21, -12, -21, - -21, -21, -21, -21, -21 + -12, -12, -12, 13, 12, -12, 58, -12, -12, -12, + 52, -12, -12, 60, -12, -12, -12, -12, -12, 4, + -12, -12, -12, -12, -12, -12 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 13, 53, 5, 9, 20, 52, 40, 49, - 62, 21, 22, 64, 65, 66, 6, 8, 30, 12, - 34, 29, 24, 38, 67 + -1, 1, 13, 56, 64, 9, 65, 57, 51, 45, + 43, 66, 21, 67, 68, 69, 70, 6, 8, 31, + 12, 36, 30, 24, 40, 71 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -664,39 +756,45 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int8 yytable[] = { - 3, 15, 16, 2, 36, 19, 3, 44, 50, 23, - 54, 55, 10, 7, 3, 15, 16, 35, 17, 47, - 48, 14, 43, 26, 56, 18, 25, 57, 28, 58, - 27, 31, 32, 37, 33, 39, 37, 37, 41, 42, - 11, 59, 45, 73, 4, 60, 76, 46, 51, 68, - 69, 72, 70, 71, 74, 77, 75, 79, 82, 0, - 78, 61, 63, 80, 81 + 3, 15, 16, 38, 3, 15, 16, 49, 54, 2, + 58, 59, 3, 5, 58, 78, 10, 25, 34, 3, + 15, 16, 26, 17, 60, 19, 44, 61, 60, 62, + 18, 61, 39, 62, 37, 7, 39, 39, 41, 42, + 48, 63, 14, 23, 11, 63, 29, 27, 28, 32, + 4, 33, 35, 46, 47, 50, 52, 55, 74, 77, + 79, 82, 73, 75, 76, 80, 83, 85, 88, 81, + 72, 20, 84, 22, 0, 0, 87, 86, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 53 }; static const yytype_int8 yycheck[] = { - 3, 4, 5, 0, 14, 13, 3, 14, 14, 29, - 13, 14, 14, 17, 3, 4, 5, 29, 7, 9, - 10, 17, 34, 17, 27, 14, 12, 30, 29, 32, - 17, 29, 15, 43, 8, 6, 43, 43, 17, 17, - 42, 44, 17, 15, 41, 53, 34, 17, 29, 29, - 17, 17, 29, 29, 17, 17, 29, 17, 17, -1, - 29, 53, 53, 31, 29 + 3, 4, 5, 14, 3, 4, 5, 14, 14, 0, + 13, 14, 3, 1, 13, 14, 14, 7, 15, 3, + 4, 5, 12, 7, 27, 13, 6, 30, 27, 32, + 14, 30, 43, 32, 30, 17, 43, 43, 9, 10, + 36, 44, 17, 29, 42, 44, 29, 17, 17, 17, + 41, 29, 8, 17, 17, 17, 17, 29, 17, 17, + 15, 34, 29, 29, 29, 17, 17, 17, 17, 29, + 57, 13, 29, 13, -1, -1, 29, 31, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 45 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_int8 yystos[] = { - 0, 46, 0, 3, 41, 49, 61, 17, 62, 50, - 14, 42, 64, 47, 17, 4, 5, 7, 14, 49, - 51, 56, 57, 29, 67, 12, 17, 17, 29, 66, - 63, 29, 15, 8, 65, 63, 14, 43, 68, 6, - 53, 17, 17, 63, 14, 17, 17, 9, 10, 54, - 14, 29, 52, 48, 13, 14, 27, 30, 32, 44, - 49, 51, 55, 57, 58, 59, 60, 69, 29, 17, - 29, 29, 17, 15, 17, 29, 34, 17, 29, 17, - 31, 29, 17 + 0, 46, 0, 3, 41, 49, 62, 17, 63, 50, + 14, 42, 65, 47, 17, 4, 5, 7, 14, 49, + 51, 57, 58, 29, 68, 7, 12, 17, 17, 29, + 67, 64, 17, 29, 15, 8, 66, 64, 14, 43, + 69, 9, 10, 55, 6, 54, 17, 17, 64, 14, + 17, 53, 17, 55, 14, 29, 48, 52, 13, 14, + 27, 30, 32, 44, 49, 51, 56, 58, 59, 60, + 61, 70, 48, 29, 17, 29, 29, 17, 14, 15, + 17, 29, 34, 17, 29, 17, 31, 29, 17 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ @@ -704,9 +802,10 @@ static const yytype_int8 yyr1[] = { 0, 45, 46, 46, 46, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50, - 49, 52, 51, 53, 53, 54, 54, 55, 56, 57, - 58, 58, 59, 60, 60, 60, 61, 62, 62, 63, - 63, 65, 64, 66, 64, 67, 64, 68, 69 + 49, 52, 51, 53, 51, 54, 54, 55, 55, 56, + 57, 58, 59, 59, 60, 61, 61, 61, 62, 63, + 63, 64, 64, 66, 65, 67, 65, 68, 65, 69, + 70 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ @@ -714,16 +813,17 @@ static const yytype_int8 yyr2[] = { 0, 2, 0, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, - 5, 0, 8, 0, 2, 1, 1, 4, 4, 4, - 3, 4, 4, 5, 4, 3, 3, 2, 0, 2, - 0, 0, 7, 0, 6, 0, 5, 3, 3 + 5, 0, 8, 0, 7, 0, 2, 1, 1, 4, + 4, 4, 3, 4, 4, 5, 4, 3, 3, 2, + 0, 2, 0, 0, 7, 0, 6, 0, 5, 3, + 3 }; +enum { YYENOMEM = -2 }; + #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab @@ -749,10 +849,9 @@ static const yytype_int8 yyr2[] = } \ while (0) -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - +/* Backward compatibility with an undocumented macro. + Use YYerror or YYUNDEF. */ +#define YYERRCODE YYUNDEF /* Enable debugging if requested. */ @@ -770,18 +869,18 @@ do { \ } while (0) /* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif +# ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Type, Value); \ + Kind, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) @@ -792,18 +891,19 @@ do { \ `-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { FILE *yyoutput = yyo; YYUSE (yyoutput); if (!yyvaluep) return; # ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyo, yytoknum[yytype], *yyvaluep); + if (yykind < YYNTOKENS) + YYPRINT (yyo, yytoknum[yykind], *yyvaluep); # endif YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); + YYUSE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -813,12 +913,13 @@ yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) `---------------------------*/ static void -yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { YYFPRINTF (yyo, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); - yy_symbol_value_print (yyo, yytype, yyvaluep); + yy_symbol_value_print (yyo, yykind, yyvaluep); YYFPRINTF (yyo, ")"); } @@ -851,7 +952,8 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, + int yyrule) { int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; @@ -863,9 +965,8 @@ yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, - yystos[+yyssp[yyi + 1 - yynrhs]], - &yyvsp[(yyi + 1) - (yynrhs)] - ); + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)]); YYFPRINTF (stderr, "\n"); } } @@ -880,8 +981,8 @@ do { \ multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YYDPRINTF(Args) ((void) 0) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -904,258 +1005,29 @@ int yydebug; #endif -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) -# else -/* Return the length of YYSTR. */ -static YYPTRDIFF_T -yystrlen (const char *yystr) -{ - YYPTRDIFF_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - while ((*yyd++ = *yys++) != '\0') - continue; - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYPTRDIFF_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYPTRDIFF_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - else - goto append; - - append: - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (yyres) - return yystpcpy (yyres, yystr) - yyres; - else - return yystrlen (yystr); -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, - yy_state_t *yyssp, int yytoken) -{ - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat: reported tokens (one for the "unexpected", - one per "expected"). */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Actual size of YYARG. */ - int yycount = 0; - /* Cumulated lengths of YYARG. */ - YYPTRDIFF_T yysize = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[+*yyssp]; - YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - yysize = yysize0; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYPTRDIFF_T yysize1 - = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else - return 2; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - default: /* Avoid compiler warnings. */ - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - /* Don't count the "%s"s in the final size, but reserve room for - the terminator. */ - YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else - return 2; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - ++yyp; - ++yyformat; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +yydestruct (const char *yymsg, + yysymbol_kind_t yykind, YYSTYPE *yyvaluep) { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); + YYUSE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } - - /* The lookahead symbol. */ int yychar; @@ -1165,6 +1037,8 @@ YYSTYPE yylval; int yynerrs; + + /*----------. | yyparse. | `----------*/ @@ -1183,6 +1057,9 @@ yyparse (void) Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ + /* Their size. */ + YYPTRDIFF_T yystacksize; + /* The state stack. */ yy_state_t yyssa[YYINITDEPTH]; yy_state_t *yyss; @@ -1193,22 +1070,16 @@ yyparse (void) YYSTYPE *yyvs; YYSTYPE *yyvsp; - YYPTRDIFF_T yystacksize; - int yyn; + /* The return value of yyparse. */ int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; -#endif + #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) @@ -1216,15 +1087,17 @@ yyparse (void) Keep to zero when no symbol should be popped. */ int yylen = 0; + yynerrs = 0; + yystate = 0; + yyerrstatus = 0; + + yystacksize = YYINITDEPTH; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; @@ -1247,6 +1120,7 @@ yysetstate: YY_IGNORE_USELESS_CAST_BEGIN *yyssp = YY_CAST (yy_state_t, yystate); YY_IGNORE_USELESS_CAST_END + YY_STACK_PRINT (yyss, yyssp); if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE @@ -1292,7 +1166,7 @@ yysetstate: goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } @@ -1331,18 +1205,29 @@ yybackup: /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); + YYDPRINTF ((stderr, "Reading a token\n")); yychar = yylex (); } if (yychar <= YYEOF) { - yychar = yytoken = YYEOF; + yychar = YYEOF; + yytoken = YYSYMBOL_YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } + else if (yychar == YYerror) + { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + yychar = YYUNDEF; + yytoken = YYSYMBOL_YYerror; + goto yyerrlab1; + } else { yytoken = YYTRANSLATE (yychar); @@ -1431,7 +1316,7 @@ yyreduce: case 21: { - (yyval.dev) = new_device(cur_parent, cur_chip_instance, (yyvsp[-3].number), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].number)); + (yyval.dev) = new_device_raw(cur_parent, cur_chip_instance, (yyvsp[-3].number), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].number)); cur_parent = (yyval.dev)->last_bus; } break; @@ -1443,92 +1328,105 @@ yyreduce: break; case 23: + { + (yyval.dev) = new_device_reference(cur_parent, cur_chip_instance, (yyvsp[-1].string), (yyvsp[0].number)); + cur_parent = (yyval.dev)->last_bus; +} + break; + + case 24: + { + cur_parent = (yyvsp[-2].dev)->parent; +} + break; + + case 25: { (yyval.string) = NULL; } break; - case 24: + case 26: { (yyval.string) = (yyvsp[0].string); } break; - case 27: + case 29: { add_resource(cur_parent, (yyvsp[-3].number), strtol((yyvsp[-2].string), NULL, 0), strtol((yyvsp[0].string), NULL, 0)); } break; - case 28: + case 30: { add_reference(cur_chip_instance, (yyvsp[0].string), (yyvsp[-2].string)); } break; - case 29: + case 31: { add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); } break; - case 30: + case 32: { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-1].string), NULL, 16), strtol((yyvsp[0].string), NULL, 16), 0); } break; - case 31: + case 33: { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-2].string), NULL, 16), strtol((yyvsp[-1].string), NULL, 16), 1); } break; - case 32: + case 34: { add_ioapic_info(cur_parent, strtol((yyvsp[-2].string), NULL, 16), (yyvsp[-1].string), strtol((yyvsp[0].string), NULL, 16)); } break; - case 33: + case 35: { add_slot_desc(cur_parent, (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string)); } break; - case 34: + case 36: { add_slot_desc(cur_parent, (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string), NULL); } break; - case 35: + case 37: { add_slot_desc(cur_parent, (yyvsp[-1].string), (yyvsp[0].string), NULL, NULL); } break; - case 36: + case 38: { } break; - case 41: + case 43: { cur_field = new_fw_config_field((yyvsp[-2].string), strtoul((yyvsp[-1].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0)); } break; - case 42: + case 44: { } break; - case 43: + case 45: { cur_field = new_fw_config_field((yyvsp[-1].string), strtoul((yyvsp[0].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0)); } break; - case 44: + case 46: { } break; - case 45: + case 47: { cur_field = get_fw_config_field((yyvsp[0].string)); } break; - case 46: + case 48: { } break; - case 47: + case 49: { add_fw_config_option(cur_field, (yyvsp[-1].string), strtoul((yyvsp[0].string), NULL, 0)); } break; - case 48: + case 50: { add_fw_config_probe(cur_parent, (yyvsp[-1].string), (yyvsp[0].string)); } break; @@ -1547,11 +1445,10 @@ yyreduce: case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; - YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; @@ -1575,50 +1472,14 @@ yyreduce: yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - + yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; -#if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif } - - if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an @@ -1667,13 +1528,14 @@ yyerrorlab: yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ + /* Pop stack until we find a state that shifts the error token. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) { yyn = yytable[yyn]; if (0 < yyn) @@ -1687,7 +1549,7 @@ yyerrlab1: yydestruct ("Error: popping", - yystos[yystate], yyvsp); + YY_ACCESSING_SYMBOL (yystate), yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -1699,7 +1561,7 @@ yyerrlab1: /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -1721,7 +1583,7 @@ yyabortlab: goto yyreturn; -#if !defined yyoverflow || YYERROR_VERBOSE +#if !defined yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1751,17 +1613,15 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[+*yyssp], yyvsp); + YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif + return yyresult; } + diff --git a/util/sconfig/sconfig.tab.h_shipped b/util/sconfig/sconfig.tab.h_shipped index b556bbad13..b05831fc33 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.3. */ +/* A Bison parser, made by GNU Bison 3.6.3. */ /* Bison interface for Yacc-like parsers in C @@ -31,8 +31,9 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ #ifndef YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED # define YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED @@ -44,54 +45,59 @@ extern int yydebug; #endif -/* Token type. */ +/* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { - CHIP = 258, - DEVICE = 259, - REGISTER = 260, - ALIAS = 261, - REFERENCE = 262, - ASSOCIATION = 263, - BOOL = 264, - STATUS = 265, - MANDATORY = 266, - BUS = 267, - RESOURCE = 268, - END = 269, - EQUALS = 270, - HEX = 271, - STRING = 272, - PCI = 273, - PNP = 274, - I2C = 275, - APIC = 276, - CPU_CLUSTER = 277, - CPU = 278, - DOMAIN = 279, - IRQ = 280, - DRQ = 281, - SLOT_DESC = 282, - IO = 283, - NUMBER = 284, - SUBSYSTEMID = 285, - INHERIT = 286, - IOAPIC_IRQ = 287, - IOAPIC = 288, - PCIINT = 289, - GENERIC = 290, - SPI = 291, - USB = 292, - MMIO = 293, - LPC = 294, - ESPI = 295, - FW_CONFIG_TABLE = 296, - FW_CONFIG_FIELD = 297, - FW_CONFIG_OPTION = 298, - FW_CONFIG_PROBE = 299 + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + CHIP = 258, /* CHIP */ + DEVICE = 259, /* DEVICE */ + REGISTER = 260, /* REGISTER */ + ALIAS = 261, /* ALIAS */ + REFERENCE = 262, /* REFERENCE */ + ASSOCIATION = 263, /* ASSOCIATION */ + BOOL = 264, /* BOOL */ + STATUS = 265, /* STATUS */ + MANDATORY = 266, /* MANDATORY */ + BUS = 267, /* BUS */ + RESOURCE = 268, /* RESOURCE */ + END = 269, /* END */ + EQUALS = 270, /* EQUALS */ + HEX = 271, /* HEX */ + STRING = 272, /* STRING */ + PCI = 273, /* PCI */ + PNP = 274, /* PNP */ + I2C = 275, /* I2C */ + APIC = 276, /* APIC */ + CPU_CLUSTER = 277, /* CPU_CLUSTER */ + CPU = 278, /* CPU */ + DOMAIN = 279, /* DOMAIN */ + IRQ = 280, /* IRQ */ + DRQ = 281, /* DRQ */ + SLOT_DESC = 282, /* SLOT_DESC */ + IO = 283, /* IO */ + NUMBER = 284, /* NUMBER */ + SUBSYSTEMID = 285, /* SUBSYSTEMID */ + INHERIT = 286, /* INHERIT */ + IOAPIC_IRQ = 287, /* IOAPIC_IRQ */ + IOAPIC = 288, /* IOAPIC */ + PCIINT = 289, /* PCIINT */ + GENERIC = 290, /* GENERIC */ + SPI = 291, /* SPI */ + USB = 292, /* USB */ + MMIO = 293, /* MMIO */ + LPC = 294, /* LPC */ + ESPI = 295, /* ESPI */ + FW_CONFIG_TABLE = 296, /* FW_CONFIG_TABLE */ + FW_CONFIG_FIELD = 297, /* FW_CONFIG_FIELD */ + FW_CONFIG_OPTION = 298, /* FW_CONFIG_OPTION */ + FW_CONFIG_PROBE = 299 /* FW_CONFIG_PROBE */ }; + typedef enum yytokentype yytoken_kind_t; #endif /* Value type. */ diff --git a/util/sconfig/sconfig.y b/util/sconfig/sconfig.y index d441ff812d..cf71b02f3e 100755 --- a/util/sconfig/sconfig.y +++ b/util/sconfig/sconfig.y @@ -37,13 +37,21 @@ chip: CHIP STRING /* == path */ { }; device: DEVICE BUS NUMBER /* == devnum */ alias status { - $$ = new_device(cur_parent, cur_chip_instance, $2, $3, $4, $5); + $$ = new_device_raw(cur_parent, cur_chip_instance, $2, $3, $4, $5); cur_parent = $$->last_bus; } devicechildren END { cur_parent = $6->parent; }; +device: DEVICE REFERENCE STRING status { + $$ = new_device_reference(cur_parent, cur_chip_instance, $3, $4); + cur_parent = $$->last_bus; +} + devicechildren END { + cur_parent = $5->parent; +}; + alias: /* empty */ { $$ = NULL; } | ALIAS STRING { -- cgit v1.2.3