From dbb667ac08f8283eb38861151f971efd46736ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Niew=C3=B6hner?= Date: Fri, 11 Dec 2020 21:26:02 +0100 Subject: device + util/sconfig: introduce new device `gpio` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce a new device `gpio` that is going to be used for generic abstraction of gpio operations in the devicetree. The general idea behind this is that every chip can have gpios that shall be accessible in a very generic way by any driver through the devicetree. The chip that implements the chip-specific gpio operations has to assign them to the generic device operations struct, which then gets assigned to the gpio device during device probing. See CB:48583 for how this gets done for the SoCs using intelblocks/gpio. The gpio device then can be added to the devicetree with an alias name like in the following example: chip soc/whateverlake device gpio 0 alias soc_gpio on end ... end Any driver that requires access to this gpio device needs to have a device pointer (or multiple) and an option for specifying the gpio to be used in its chip config like this: struct drivers_ipmi_config { ... DEVTREE_CONST struct device *gpio_dev; u16 post_complete_gpio; ... }; The device `soc_gpio` can then be linked to the chip driver's `gpio_dev` above by using the syntax `use ... as ...`, which was introduced in commit 8e1ea52: chip drivers/ipmi use soc_gpio as gpio_dev register "bmc_jumper_gpio" = "GPP_D22" ... end The IPMI driver can then use the generic gpio operations without any knowlege of the chip's specifics: unsigned int gpio_val; const struct gpio_operations *gpio_ops; gpio_ops = dev_get_gpio_ops(conf->gpio_dev); gpio_val = gpio_ops->get(conf->bmc_jumper_gpio); For a full example have a look at CB:48096 and CB:48095. This change adds the new device type to sconfig and adds generic gpio operations to the `device_operations` struct. Also, a helper for getting the gpio operations from a device after checking them for NULL pointers gets added. Successfully tested on Supermicro X11SSM-F with CB:48097, X11SSH-TF with CB:48711 and OCP DeltaLake with CB:48672. Change-Id: Ic4572ad8b37bd1afd2fb213b2c67fb8aec536786 Tested-by: Johnny Lin Tested-by: Michael Niewöhner Tested-by: Patrick Rudolph Signed-off-by: Michael Niewöhner Reviewed-on: https://review.coreboot.org/c/coreboot/+/48582 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- util/sconfig/lex.yy.c_shipped | 316 +++++++++++++++---------------- util/sconfig/main.c | 4 + util/sconfig/sconfig.l | 1 + util/sconfig/sconfig.tab.c_shipped | 372 ++++++++++++++----------------------- util/sconfig/sconfig.tab.h_shipped | 19 +- util/sconfig/sconfig.y | 2 +- 6 files changed, 312 insertions(+), 402 deletions(-) (limited to 'util/sconfig') diff --git a/util/sconfig/lex.yy.c_shipped b/util/sconfig/lex.yy.c_shipped index 18b34b5e87..c3d985945a 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 49 -#define YY_END_OF_BUFFER 50 +#define YY_NUM_RULES 50 +#define YY_END_OF_BUFFER 51 /* 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[203] = +static const flex_int16_t yy_accept[206] = { 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 + 0, 0, 51, 49, 1, 3, 49, 49, 49, 44, + 44, 42, 45, 49, 45, 45, 45, 45, 45, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 1, 3, 49, 0, 49, 49, 0, 2, 44, 45, + 49, 49, 49, 9, 49, 49, 45, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 36, 49, + 49, 49, 49, 49, 49, 15, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 48, 48, 49, 0, 43, + 49, 49, 49, 25, 49, 49, 35, 40, 49, 49, + 49, 49, 49, 49, 22, 49, 49, 34, 49, 31, + + 49, 49, 16, 49, 19, 21, 49, 8, 49, 49, + 29, 49, 30, 7, 49, 0, 46, 49, 4, 49, + 49, 49, 32, 49, 49, 49, 33, 49, 49, 49, + 49, 49, 28, 49, 49, 49, 49, 49, 47, 47, + 6, 49, 49, 49, 12, 49, 49, 49, 49, 49, + 23, 49, 49, 14, 49, 49, 49, 49, 5, 26, + 49, 49, 17, 49, 20, 49, 13, 49, 49, 49, + 49, 49, 27, 38, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 10, 49, 49, 49, 11, 49, 18, + 49, 49, 49, 37, 49, 49, 24, 49, 39, 49, + + 49, 49, 49, 41, 0 } ; static const YY_CHAR yy_ec[256] = @@ -425,136 +425,138 @@ static const YY_CHAR yy_meta[40] = 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static const flex_int16_t yy_base[210] = +static const flex_int16_t yy_base[213] = { 0, - 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 + 0, 0, 278, 0, 275, 279, 273, 38, 42, 39, + 237, 0, 45, 260, 55, 59, 83, 65, 62, 54, + 248, 68, 25, 59, 73, 86, 251, 81, 238, 0, + 268, 279, 77, 264, 104, 117, 265, 279, 0, 114, + 117, 252, 241, 0, 240, 229, 123, 236, 231, 241, + 230, 238, 242, 229, 231, 235, 235, 229, 235, 220, + 220, 230, 220, 222, 224, 0, 211, 219, 213, 213, + 118, 223, 215, 221, 92, 0, 279, 140, 233, 0, + 226, 219, 205, 218, 208, 215, 0, 0, 206, 204, + 210, 207, 198, 206, 0, 204, 194, 0, 198, 0, + + 202, 192, 0, 195, 0, 0, 201, 0, 193, 192, + 0, 183, 0, 0, 210, 209, 0, 180, 0, 193, + 192, 185, 0, 189, 179, 175, 0, 185, 173, 179, + 184, 185, 0, 172, 179, 166, 169, 158, 0, 279, + 0, 170, 174, 166, 0, 165, 167, 163, 165, 170, + 0, 154, 159, 0, 152, 152, 151, 148, 0, 0, + 160, 162, 0, 146, 163, 149, 0, 156, 160, 141, + 141, 148, 0, 0, 147, 126, 125, 123, 134, 120, + 130, 120, 112, 0, 124, 122, 127, 0, 116, 0, + 117, 119, 101, 0, 93, 97, 0, 86, 0, 74, + + 64, 45, 46, 0, 279, 48, 159, 161, 163, 165, + 167, 169 } ; -static const flex_int16_t yy_def[210] = +static const flex_int16_t yy_def[213] = { 0, - 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 + 205, 1, 205, 206, 205, 205, 206, 207, 208, 206, + 10, 206, 10, 206, 10, 10, 10, 10, 10, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 205, 205, 207, 209, 210, 208, 211, 205, 10, 10, + 10, 206, 206, 206, 206, 206, 10, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 205, 210, 212, 41, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 205, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 205, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + + 206, 206, 206, 206, 0, 205, 205, 205, 205, 205, + 205, 205 } ; -static const flex_int16_t yy_nxt[316] = +static const flex_int16_t yy_nxt[319] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 10, 12, 13, 13, 14, 4, 4, 4, 15, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 4, 25, 26, 4, 27, 28, 4, 29, 4, 4, 4, 4, 34, - 34, 60, 35, 37, 38, 39, 39, 39, 30, 40, - 40, 40, 40, 40, 61, 40, 40, 40, 40, 40, + 34, 61, 35, 37, 38, 39, 39, 39, 30, 40, 40, 40, 40, 40, 62, 40, 40, 40, 40, 40, - 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, - - 199, 71, 68, 47, 72, 198, 69, 34, 34, 73, - 75, 48, 78, 78, 49, 30, 40, 40, 40, 79, - 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 + 40, 40, 40, 40, 204, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 54, 63, 57, 203, 34, 34, + 43, 76, 45, 55, 202, 64, 52, 44, 46, 40, + 40, 40, 50, 201, 65, 58, 59, 51, 53, 60, + + 66, 200, 67, 47, 68, 79, 79, 72, 30, 113, + 73, 48, 114, 69, 49, 74, 199, 70, 37, 38, + 40, 40, 40, 80, 80, 80, 198, 80, 80, 40, + 40, 40, 197, 80, 80, 80, 80, 80, 80, 108, + 109, 79, 79, 196, 115, 195, 194, 193, 192, 191, + 190, 189, 188, 187, 186, 185, 184, 183, 85, 33, + 33, 36, 36, 34, 34, 78, 78, 37, 37, 79, + 79, 182, 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, 112, 111, + 110, 107, 106, 105, 104, 103, 102, 101, 100, 99, + 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, + 88, 87, 86, 84, 83, 82, 81, 38, 77, 31, + 75, 71, 56, 42, 41, 32, 31, 205, 3, 205, + 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, + 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, + + 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, + 205, 205, 205, 205, 205, 205, 205, 205 } ; -static const flex_int16_t yy_chk[316] = +static const flex_int16_t yy_chk[319] = { 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, 203, 10, + 8, 23, 8, 9, 9, 10, 10, 10, 206, 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, 200, - 15, 25, 16, 25, 70, 70, 19, 15, 16, 17, - 17, 17, 18, 26, 199, 22, 22, 18, 19, 22, - - 198, 28, 26, 17, 28, 197, 26, 33, 33, 28, - 33, 17, 35, 35, 17, 35, 40, 40, 40, 41, - 41, 41, 195, 41, 41, 47, 47, 47, 193, 41, - 41, 41, 41, 41, 41, 74, 77, 77, 74, 77, - 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 + 10, 15, 15, 15, 203, 16, 16, 16, 19, 19, + 19, 18, 18, 18, 20, 24, 22, 202, 33, 33, + 15, 33, 16, 20, 201, 24, 19, 15, 16, 17, + 17, 17, 18, 200, 25, 22, 22, 18, 19, 22, + + 25, 198, 25, 17, 26, 35, 35, 28, 35, 75, + 28, 17, 75, 26, 17, 28, 196, 26, 36, 36, + 40, 40, 40, 41, 41, 41, 195, 41, 41, 47, + 47, 47, 193, 41, 41, 41, 41, 41, 41, 71, + 71, 78, 78, 192, 78, 191, 189, 187, 186, 185, + 183, 182, 181, 180, 179, 178, 177, 176, 47, 207, + 207, 208, 208, 209, 209, 210, 210, 211, 211, 212, + 212, 175, 172, 171, 170, 169, 168, 166, 165, 164, + 162, 161, 158, 157, 156, 155, 153, 152, 150, 149, + 148, 147, 146, 144, 143, 142, 138, 137, 136, 135, + + 134, 132, 131, 130, 129, 128, 126, 125, 124, 122, + 121, 120, 118, 116, 115, 112, 110, 109, 107, 104, + 102, 101, 99, 97, 96, 94, 93, 92, 91, 90, + 89, 86, 85, 84, 83, 82, 81, 79, 74, 73, + 72, 70, 69, 68, 67, 65, 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, 14, 11, 7, 5, 3, 205, 205, + 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, + 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, + + 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, + 205, 205, 205, 205, 205, 205, 205, 205 } ; static yy_state_type yy_last_accepting_state; @@ -819,13 +821,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 >= 203 ) + if ( yy_current_state >= 206 ) 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] != 276 ); + while ( yy_base[yy_current_state] != 279 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -981,43 +983,43 @@ YY_RULE_SETUP YY_BREAK case 33: YY_RULE_SETUP -{yylval.number=IRQ; return(RESOURCE);} +{yylval.number=GPIO; return(BUS);} YY_BREAK case 34: YY_RULE_SETUP -{yylval.number=DRQ; return(RESOURCE);} +{yylval.number=IRQ; return(RESOURCE);} YY_BREAK case 35: YY_RULE_SETUP -{yylval.number=IO; return(RESOURCE);} +{yylval.number=DRQ; return(RESOURCE);} YY_BREAK case 36: YY_RULE_SETUP -{return(IOAPIC_IRQ);} +{yylval.number=IO; return(RESOURCE);} YY_BREAK case 37: YY_RULE_SETUP -{return(INHERIT);} +{return(IOAPIC_IRQ);} YY_BREAK case 38: YY_RULE_SETUP -{return(SUBSYSTEMID);} +{return(INHERIT);} YY_BREAK case 39: YY_RULE_SETUP -{return(END);} +{return(SUBSYSTEMID);} YY_BREAK case 40: YY_RULE_SETUP -{return(SLOT_DESC);} +{return(END);} YY_BREAK case 41: YY_RULE_SETUP -{return(EQUALS);} +{return(SLOT_DESC);} YY_BREAK case 42: YY_RULE_SETUP -{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} +{return(EQUALS);} YY_BREAK case 43: YY_RULE_SETUP @@ -1029,12 +1031,11 @@ YY_RULE_SETUP YY_BREAK case 45: 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 46: -/* rule 46 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 47: /* rule 47 can match eol */ @@ -1042,11 +1043,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 48: +/* rule 48 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 49: YY_RULE_SETUP +{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);} + YY_BREAK +case 50: +YY_RULE_SETUP ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): @@ -1345,7 +1351,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 >= 203 ) + if ( yy_current_state >= 206 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -1373,11 +1379,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 >= 203 ) + if ( yy_current_state >= 206 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 202); + yy_is_jam = (yy_current_state == 205); return yy_is_jam ? 0 : yy_current_state; } diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 815bfc7e55..175b926c5f 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -793,6 +793,10 @@ static struct device *new_device_with_path(struct bus *parent, case LPC: new_d->path = ".type=DEVICE_PATH_LPC,{.lpc={ .addr = 0x%x }}"; break; + + case GPIO: + new_d->path = ".type=DEVICE_PATH_GPIO,{.gpio={ .id = 0x%x }}"; + break; } return new_d; diff --git a/util/sconfig/sconfig.l b/util/sconfig/sconfig.l index a772b96b36..5bdc52b692 100755 --- a/util/sconfig/sconfig.l +++ b/util/sconfig/sconfig.l @@ -40,6 +40,7 @@ spi {yylval.number=SPI; return(BUS);} usb {yylval.number=USB; return(BUS);} lpc {yylval.number=LPC; return(BUS);} espi {yylval.number=ESPI; return(BUS);} +gpio {yylval.number=GPIO; return(BUS);} irq {yylval.number=IRQ; return(RESOURCE);} drq {yylval.number=DRQ; return(RESOURCE);} io {yylval.number=IO; return(RESOURCE);} diff --git a/util/sconfig/sconfig.tab.c_shipped b/util/sconfig/sconfig.tab.c_shipped index 43fd14f090..a8d1e1db1f 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.6.3. */ +/* A Bison parser, made by GNU Bison 3.7.2. */ /* Bison implementation for Yacc-like parsers in C @@ -49,7 +49,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.6.3" +#define YYBISON_VERSION "3.7.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -71,6 +71,7 @@ /* sconfig, coreboot device tree compiler */ /* SPDX-License-Identifier: GPL-2.0-only */ +#include #include "sconfig.h" int yylex(); @@ -103,96 +104,7 @@ static struct fw_config_field *cur_field; # endif # 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 -# define YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; -#endif - -/* Token kinds. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - 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. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -union YYSTYPE -{ - - struct device *dev; - struct chip_instance *chip_instance; - char *string; - int number; - - -}; -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE yylval; - -int yyparse (void); - -#endif /* !YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */ +#include "sconfig.tab.h_shipped" /* Symbol kind. */ enum yysymbol_kind_t { @@ -238,36 +150,37 @@ enum yysymbol_kind_t 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 */ + YYSYMBOL_GPIO = 41, /* GPIO */ + YYSYMBOL_FW_CONFIG_TABLE = 42, /* FW_CONFIG_TABLE */ + YYSYMBOL_FW_CONFIG_FIELD = 43, /* FW_CONFIG_FIELD */ + YYSYMBOL_FW_CONFIG_OPTION = 44, /* FW_CONFIG_OPTION */ + YYSYMBOL_FW_CONFIG_PROBE = 45, /* FW_CONFIG_PROBE */ + YYSYMBOL_YYACCEPT = 46, /* $accept */ + YYSYMBOL_devtree = 47, /* devtree */ + YYSYMBOL_chipchildren = 48, /* chipchildren */ + YYSYMBOL_devicechildren = 49, /* devicechildren */ + YYSYMBOL_chip = 50, /* chip */ + YYSYMBOL_51_1 = 51, /* @1 */ + YYSYMBOL_device = 52, /* device */ + YYSYMBOL_53_2 = 53, /* @2 */ + YYSYMBOL_54_3 = 54, /* @3 */ + YYSYMBOL_alias = 55, /* alias */ + YYSYMBOL_status = 56, /* status */ + YYSYMBOL_resource = 57, /* resource */ + YYSYMBOL_reference = 58, /* reference */ + YYSYMBOL_registers = 59, /* registers */ + YYSYMBOL_subsystemid = 60, /* subsystemid */ + YYSYMBOL_ioapic_irq = 61, /* ioapic_irq */ + YYSYMBOL_smbios_slot_desc = 62, /* smbios_slot_desc */ + YYSYMBOL_fw_config_table = 63, /* fw_config_table */ + YYSYMBOL_fw_config_table_children = 64, /* fw_config_table_children */ + YYSYMBOL_fw_config_field_children = 65, /* fw_config_field_children */ + YYSYMBOL_fw_config_field = 66, /* fw_config_field */ + YYSYMBOL_67_4 = 67, /* $@4 */ + YYSYMBOL_68_5 = 68, /* $@5 */ + YYSYMBOL_69_6 = 69, /* $@6 */ + YYSYMBOL_fw_config_option = 70, /* fw_config_option */ + YYSYMBOL_fw_config_probe = 71 /* fw_config_probe */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; @@ -577,10 +490,10 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 97 +#define YYLAST 79 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 45 +#define YYNTOKENS 46 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 26 /* YYNRULES -- Number of rules. */ @@ -588,7 +501,8 @@ union yyalloc /* YYNSTATES -- Number of states. */ #define YYNSTATES 89 -#define YYMAXUTOK 299 +/* YYMAXUTOK -- Last valid token kind. */ +#define YYMAXUTOK 300 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM @@ -631,19 +545,20 @@ 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, 38, 39, 40, 41, 42, 43, 44 + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 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, 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 + 0, 25, 25, 25, 25, 27, 27, 27, 27, 27, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 31, + 31, 40, 40, 48, 48, 56, 58, 62, 62, 64, + 67, 70, 73, 76, 79, 82, 85, 88, 92, 95, + 95, 98, 98, 101, 101, 107, 107, 113, 113, 119, + 123 }; #endif @@ -665,7 +580,7 @@ static const char *const yytname[] = "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", + "GPIO", "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", @@ -690,11 +605,11 @@ static const yytype_int16 yytoknum[] = 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, 293, 294, - 295, 296, 297, 298, 299 + 295, 296, 297, 298, 299, 300 }; #endif -#define YYPACT_NINF (-12) +#define YYPACT_NINF (-15) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) @@ -708,15 +623,15 @@ static const yytype_int16 yytoknum[] = STATE-NUM. */ static const yytype_int8 yypact[] = { - -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 + -15, 9, -15, 0, -15, -15, -15, -15, -11, -15, + -15, 2, -15, 45, -8, 13, 6, 19, -15, -15, + -15, -15, -15, 10, -15, 23, 12, 11, 36, -15, + -15, -7, 25, 39, 30, 37, -15, -6, -15, 38, + -15, -15, -15, -15, 40, 25, -15, -15, -1, -15, + 24, -15, -15, -15, -15, -15, -3, -15, 27, -15, + 41, 31, 32, 46, -15, -15, -15, -15, -15, -15, + -15, -15, 1, 47, 48, 35, 33, 49, -15, 42, + 51, 43, 44, -15, -15, 52, -15, -15, -15 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -738,9 +653,9 @@ static const yytype_int8 yydefact[] = /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -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 + -15, -15, -15, 15, 17, -15, 57, -15, -15, -15, + 34, -15, -15, 62, -15, -15, -15, -15, -15, -14, + -15, -15, -15, -15, -15, -15 }; /* YYDEFGOTO[NTERM-NUM]. */ @@ -756,56 +671,52 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int8 yytable[] = { - 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 + 3, 15, 16, 10, 3, 15, 16, 38, 49, 2, + 58, 59, 3, 54, 58, 78, 37, 7, 5, 14, + 25, 23, 48, 27, 60, 26, 34, 61, 60, 62, + 19, 61, 11, 62, 41, 42, 28, 39, 39, 29, + 32, 33, 63, 39, 35, 44, 63, 46, 3, 15, + 16, 4, 17, 55, 47, 50, 73, 52, 74, 18, + 75, 76, 79, 77, 81, 80, 83, 82, 85, 88, + 20, 84, 72, 87, 86, 22, 0, 0, 0, 53 }; static const yytype_int8 yycheck[] = { 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 + 13, 14, 3, 14, 13, 14, 30, 17, 1, 17, + 7, 29, 36, 17, 27, 12, 15, 30, 27, 32, + 13, 30, 43, 32, 9, 10, 17, 44, 44, 29, + 17, 29, 45, 44, 8, 6, 45, 17, 3, 4, + 5, 42, 7, 29, 17, 17, 29, 17, 17, 14, + 29, 29, 15, 17, 29, 17, 17, 34, 17, 17, + 13, 29, 57, 29, 31, 13, -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, 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, + 0, 47, 0, 3, 42, 50, 63, 17, 64, 51, + 14, 43, 66, 48, 17, 4, 5, 7, 14, 50, + 52, 58, 59, 29, 69, 7, 12, 17, 17, 29, + 68, 65, 17, 29, 15, 8, 67, 65, 14, 44, + 70, 9, 10, 56, 6, 55, 17, 17, 65, 14, + 17, 54, 17, 56, 14, 29, 49, 53, 13, 14, + 27, 30, 32, 45, 50, 52, 57, 59, 60, 61, + 62, 71, 49, 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. */ 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, 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 + 0, 46, 47, 47, 47, 48, 48, 48, 48, 48, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 51, + 50, 53, 52, 54, 52, 55, 55, 56, 56, 57, + 58, 59, 60, 60, 61, 62, 62, 62, 63, 64, + 64, 65, 65, 67, 66, 68, 66, 69, 66, 70, + 71 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ @@ -1028,7 +939,7 @@ yydestruct (const char *yymsg, } -/* The lookahead symbol. */ +/* Lookahead token kind. */ int yychar; /* The semantic value of the lookahead symbol. */ @@ -1046,34 +957,30 @@ int yynerrs; int yyparse (void) { - yy_state_fast_t yystate; + yy_state_fast_t yystate = 0; /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; + int yyerrstatus = 0; - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow + /* Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* Their size. */ - YYPTRDIFF_T yystacksize; + YYPTRDIFF_T yystacksize = YYINITDEPTH; - /* The state stack. */ + /* The state stack: array, bottom, top. */ yy_state_t yyssa[YYINITDEPTH]; - yy_state_t *yyss; - yy_state_t *yyssp; + yy_state_t *yyss = yyssa; + yy_state_t *yyssp = yyss; - /* The semantic value stack. */ + /* The semantic value stack: array, bottom, top. */ YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp = yyvs; int yyn; /* The return value of yyparse. */ int yyresult; - /* Lookahead token as an internal (translated) token number. */ + /* Lookahead symbol kind. */ yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; /* The variables used to return semantic value and location from the action routines. */ @@ -1087,15 +994,6 @@ 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; - - YYDPRINTF ((stderr, "Starting parse\n")); yychar = YYEMPTY; /* Cause a token to be read. */ @@ -1296,11 +1194,11 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: + case 2: /* devtree: %empty */ { cur_parent = root_parent; } break; - case 19: + case 19: /* @1: %empty */ { (yyval.chip_instance) = new_chip_instance((yyvsp[0].string)); chip_enqueue_tail(cur_chip_instance); @@ -1308,125 +1206,125 @@ yyreduce: } break; - case 20: + case 20: /* chip: CHIP STRING @1 chipchildren END */ { cur_chip_instance = chip_dequeue_tail(); } break; - case 21: + case 21: /* @2: %empty */ { (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; - case 22: + case 22: /* device: DEVICE BUS NUMBER alias status @2 devicechildren END */ { cur_parent = (yyvsp[-2].dev)->parent; } break; - case 23: + case 23: /* @3: %empty */ { (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: + case 24: /* device: DEVICE REFERENCE STRING status @3 devicechildren END */ { cur_parent = (yyvsp[-2].dev)->parent; } break; - case 25: + case 25: /* alias: %empty */ { (yyval.string) = NULL; } break; - case 26: + case 26: /* alias: ALIAS STRING */ { (yyval.string) = (yyvsp[0].string); } break; - case 29: + case 29: /* resource: RESOURCE NUMBER EQUALS NUMBER */ { add_resource(cur_parent, (yyvsp[-3].number), strtol((yyvsp[-2].string), NULL, 0), strtol((yyvsp[0].string), NULL, 0)); } break; - case 30: + case 30: /* reference: REFERENCE STRING ASSOCIATION STRING */ { add_reference(cur_chip_instance, (yyvsp[0].string), (yyvsp[-2].string)); } break; - case 31: + case 31: /* registers: REGISTER STRING EQUALS STRING */ { add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); } break; - case 32: + case 32: /* subsystemid: SUBSYSTEMID NUMBER NUMBER */ { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-1].string), NULL, 16), strtol((yyvsp[0].string), NULL, 16), 0); } break; - case 33: + case 33: /* subsystemid: SUBSYSTEMID NUMBER NUMBER INHERIT */ { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-2].string), NULL, 16), strtol((yyvsp[-1].string), NULL, 16), 1); } break; - case 34: + case 34: /* ioapic_irq: IOAPIC_IRQ NUMBER PCIINT NUMBER */ { add_ioapic_info(cur_parent, strtol((yyvsp[-2].string), NULL, 16), (yyvsp[-1].string), strtol((yyvsp[0].string), NULL, 16)); } break; - case 35: + case 35: /* smbios_slot_desc: SLOT_DESC STRING STRING STRING STRING */ { add_slot_desc(cur_parent, (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string)); } break; - case 36: + case 36: /* smbios_slot_desc: SLOT_DESC STRING STRING STRING */ { add_slot_desc(cur_parent, (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string), NULL); } break; - case 37: + case 37: /* smbios_slot_desc: SLOT_DESC STRING STRING */ { add_slot_desc(cur_parent, (yyvsp[-1].string), (yyvsp[0].string), NULL, NULL); } break; - case 38: + case 38: /* fw_config_table: FW_CONFIG_TABLE fw_config_table_children END */ { } break; - case 43: + case 43: /* $@4: %empty */ { cur_field = new_fw_config_field((yyvsp[-2].string), strtoul((yyvsp[-1].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0)); } break; - case 44: + case 44: /* fw_config_field: FW_CONFIG_FIELD STRING NUMBER NUMBER $@4 fw_config_field_children END */ { } break; - case 45: + case 45: /* $@5: %empty */ { cur_field = new_fw_config_field((yyvsp[-1].string), strtoul((yyvsp[0].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0)); } break; - case 46: + case 46: /* fw_config_field: FW_CONFIG_FIELD STRING NUMBER $@5 fw_config_field_children END */ { } break; - case 47: + case 47: /* $@6: %empty */ { cur_field = get_fw_config_field((yyvsp[0].string)); } break; - case 48: + case 48: /* fw_config_field: FW_CONFIG_FIELD STRING $@6 fw_config_field_children END */ { } break; - case 49: - { add_fw_config_option(cur_field, (yyvsp[-1].string), strtoul((yyvsp[0].string), NULL, 0)); } + case 49: /* fw_config_option: FW_CONFIG_OPTION STRING NUMBER */ + { add_fw_config_option(cur_field, (yyvsp[-1].string), strtoull((yyvsp[0].string), NULL, 0)); } break; - case 50: + case 50: /* fw_config_probe: FW_CONFIG_PROBE STRING STRING */ { add_fw_config_probe(cur_parent, (yyvsp[-1].string), (yyvsp[0].string)); } break; @@ -1590,13 +1488,13 @@ yyabortlab: yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; - /* Fall through. */ + goto yyreturn; #endif -/*-----------------------------------------------------. -| yyreturn -- parsing is finished, return the result. | -`-----------------------------------------------------*/ +/*-------------------------------------------------------. +| yyreturn -- parsing is finished, clean up and return. | +`-------------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { diff --git a/util/sconfig/sconfig.tab.h_shipped b/util/sconfig/sconfig.tab.h_shipped index b05831fc33..6983c3bb76 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.6.3. */ +/* A Bison parser, made by GNU Bison 3.7.2. */ /* Bison interface for Yacc-like parsers in C @@ -35,8 +35,8 @@ 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 +#ifndef YY_YY_HOME_C0D3_SRC_COREBOOT_GIT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED +# define YY_YY_HOME_C0D3_SRC_COREBOOT_GIT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -92,10 +92,11 @@ extern int yydebug; 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 */ + GPIO = 296, /* GPIO */ + FW_CONFIG_TABLE = 297, /* FW_CONFIG_TABLE */ + FW_CONFIG_FIELD = 298, /* FW_CONFIG_FIELD */ + FW_CONFIG_OPTION = 299, /* FW_CONFIG_OPTION */ + FW_CONFIG_PROBE = 300 /* FW_CONFIG_PROBE */ }; typedef enum yytokentype yytoken_kind_t; #endif @@ -108,7 +109,7 @@ union YYSTYPE struct device *dev; struct chip_instance *chip_instance; char *string; - int number; + uint64_t number; }; @@ -122,4 +123,4 @@ extern YYSTYPE yylval; int yyparse (void); -#endif /* !YY_YY_SRC_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */ +#endif /* !YY_YY_HOME_C0D3_SRC_COREBOOT_GIT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */ diff --git a/util/sconfig/sconfig.y b/util/sconfig/sconfig.y index 84dfe248fd..8e0379183c 100755 --- a/util/sconfig/sconfig.y +++ b/util/sconfig/sconfig.y @@ -20,7 +20,7 @@ static struct fw_config_field *cur_field; uint64_t number; } -%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 +%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 GPIO FW_CONFIG_TABLE FW_CONFIG_FIELD FW_CONFIG_OPTION FW_CONFIG_PROBE %% devtree: { cur_parent = root_parent; } | devtree chip | devtree fw_config_table; -- cgit v1.2.3