summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2022-08-06 19:02:59 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-09-15 13:06:47 +0000
commitc0fc38eed8f407d71f714f4d6fe2af0c3501ece4 (patch)
tree0ac92ac61db931ff23fd91205d4fd1e057f368d0 /util
parentf1ba7d6c8f844110c2bc05fa26e4cea9038672db (diff)
sconfig: Allow to specify device operations
Currently we only have runtime mechanisms to assign device operations to a node in our devicetree (with one exception: the root device). The most common method is to map PCI IDs to the device operations with a `struct pci_driver`. Another accustomed way is to let a chip driver assign them. For very common drivers, e.g. those in soc/intel/common/blocks/, the PCI ID lists grew very large and are incredibly error-prone. Often, IDs are missing and sometimes IDs are added almost mechanically without checking the code for compatibility. Maintaining these lists in a central place also reduces flexibility. Now, for onboard devices it is actually unnecessary to assign the device operations at runtime. We already know exactly what operations should be assigned. And since we are using chipset devicetrees, we have a perfect place to put that information. This patch adds a simple mechanism to `sconfig`. It allows us to speci- fy operations per device, e.g. device pci 00.0 alias system_agent on ops system_agent_ops end The operations are given as a C identifier. In this example, we simply assume that a global `struct device_operations system_agent_ops` exists. Change-Id: I2833d2f2450fde3206c33393f58b86fd4280b566 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66483 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'util')
-rw-r--r--util/sconfig/lex.yy.c_shipped368
-rw-r--r--util/sconfig/main.c47
-rw-r--r--util/sconfig/sconfig.h10
-rw-r--r--util/sconfig/sconfig.l1
-rw-r--r--util/sconfig/sconfig.tab.c_shipped312
-rw-r--r--util/sconfig/sconfig.tab.h_shipped11
-rw-r--r--util/sconfig/sconfig.y8
7 files changed, 413 insertions, 344 deletions
diff --git a/util/sconfig/lex.yy.c_shipped b/util/sconfig/lex.yy.c_shipped
index 647ec3d796..3e2bb158c5 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 50
-#define YY_END_OF_BUFFER 51
+#define YY_NUM_RULES 51
+#define YY_END_OF_BUFFER 52
/* 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[210] =
+static const flex_int16_t yy_accept[211] =
{ 0,
- 0, 0, 51, 49, 1, 3, 49, 49, 49, 44,
- 44, 41, 45, 49, 45, 45, 45, 45, 45, 49,
- 49, 49, 49, 49, 49, 49, 49, 49, 49, 42,
- 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, 34, 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, 33, 38, 49, 49, 49,
- 49, 49, 22, 49, 49, 32, 49, 49, 49, 16,
-
- 49, 19, 21, 49, 8, 49, 49, 29, 49, 30,
- 7, 49, 0, 46, 49, 4, 49, 49, 49, 49,
- 49, 49, 31, 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, 36,
- 49, 49, 49, 49, 49, 49, 49, 49, 49, 10,
- 49, 49, 49, 49, 11, 49, 18, 49, 49, 49,
- 49, 35, 49, 49, 49, 24, 49, 49, 37, 49,
-
- 49, 49, 49, 49, 49, 40, 49, 39, 0
+ 0, 0, 52, 50, 1, 3, 50, 50, 50, 45,
+ 45, 42, 46, 50, 46, 46, 46, 46, 46, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 43,
+ 50, 1, 3, 50, 0, 50, 50, 0, 2, 45,
+ 46, 50, 50, 50, 10, 50, 50, 46, 50, 50,
+ 50, 50, 50, 50, 50, 50, 50, 50, 35, 50,
+ 50, 50, 50, 50, 16, 50, 50, 50, 50, 50,
+ 50, 50, 50, 50, 49, 49, 50, 0, 44, 50,
+ 50, 50, 26, 50, 50, 34, 39, 50, 50, 50,
+ 50, 50, 23, 50, 50, 33, 50, 50, 50, 17,
+
+ 7, 50, 20, 22, 50, 9, 50, 50, 30, 50,
+ 31, 8, 50, 0, 47, 50, 4, 50, 50, 50,
+ 50, 50, 50, 32, 50, 50, 50, 50, 50, 29,
+ 50, 50, 50, 50, 50, 48, 48, 6, 50, 50,
+ 50, 13, 50, 50, 50, 50, 50, 24, 50, 50,
+ 15, 50, 50, 50, 50, 5, 27, 50, 50, 18,
+ 50, 21, 50, 14, 50, 50, 50, 50, 50, 28,
+ 37, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+ 11, 50, 50, 50, 50, 12, 50, 19, 50, 50,
+ 50, 50, 36, 50, 50, 50, 25, 50, 50, 38,
+
+ 50, 50, 50, 50, 50, 50, 41, 50, 40, 0
} ;
static const YY_CHAR yy_ec[256] =
@@ -425,140 +425,140 @@ static const YY_CHAR yy_meta[41] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1
} ;
-static const flex_int16_t yy_base[217] =
+static const flex_int16_t yy_base[218] =
{ 0,
- 0, 0, 282, 0, 279, 283, 277, 39, 43, 40,
- 241, 0, 46, 264, 56, 60, 64, 67, 72, 56,
- 252, 74, 259, 39, 70, 59, 254, 77, 241, 0,
- 0, 271, 283, 108, 267, 112, 116, 268, 283, 0,
- 113, 116, 255, 244, 0, 243, 232, 122, 239, 234,
- 244, 242, 246, 233, 235, 239, 239, 233, 239, 224,
- 224, 225, 227, 229, 0, 216, 224, 218, 218, 117,
- 228, 220, 226, 87, 0, 283, 139, 238, 0, 231,
- 224, 210, 223, 213, 220, 0, 0, 210, 216, 213,
- 204, 212, 0, 210, 200, 0, 204, 208, 198, 0,
-
- 201, 0, 0, 207, 0, 199, 198, 0, 189, 0,
- 0, 216, 215, 0, 186, 0, 199, 198, 191, 195,
- 185, 181, 0, 191, 179, 185, 190, 191, 0, 178,
- 185, 172, 175, 164, 0, 283, 0, 176, 180, 172,
- 0, 171, 173, 169, 171, 176, 0, 160, 165, 0,
- 158, 158, 157, 154, 0, 0, 166, 168, 0, 152,
- 169, 155, 0, 162, 166, 147, 147, 154, 0, 0,
- 153, 145, 144, 68, 154, 140, 150, 140, 132, 0,
- 136, 130, 128, 133, 0, 122, 0, 116, 122, 125,
- 117, 0, 132, 113, 126, 0, 120, 127, 0, 104,
-
- 106, 94, 78, 65, 37, 0, 31, 0, 283, 42,
- 158, 160, 162, 164, 166, 168
+ 0, 0, 283, 0, 280, 284, 278, 39, 43, 40,
+ 242, 0, 46, 265, 56, 60, 64, 67, 72, 56,
+ 253, 74, 260, 39, 70, 59, 255, 77, 242, 0,
+ 0, 272, 284, 108, 268, 112, 116, 269, 284, 0,
+ 113, 116, 256, 245, 0, 244, 233, 122, 240, 235,
+ 245, 243, 247, 234, 236, 240, 240, 234, 240, 225,
+ 225, 226, 228, 230, 0, 106, 226, 220, 220, 119,
+ 230, 222, 228, 87, 0, 284, 141, 240, 0, 233,
+ 226, 212, 225, 215, 222, 0, 0, 212, 218, 215,
+ 206, 214, 0, 212, 202, 0, 206, 210, 200, 0,
+
+ 0, 203, 0, 0, 209, 0, 201, 200, 0, 191,
+ 0, 0, 218, 217, 0, 188, 0, 201, 200, 193,
+ 197, 187, 183, 0, 193, 181, 187, 192, 193, 0,
+ 180, 187, 174, 177, 166, 0, 284, 0, 178, 182,
+ 174, 0, 173, 175, 171, 173, 178, 0, 162, 167,
+ 0, 160, 160, 159, 156, 0, 0, 168, 170, 0,
+ 154, 171, 157, 0, 164, 168, 149, 149, 156, 0,
+ 0, 155, 147, 146, 68, 156, 142, 152, 142, 134,
+ 0, 151, 145, 130, 135, 0, 124, 0, 118, 124,
+ 127, 119, 0, 134, 115, 128, 0, 122, 129, 0,
+
+ 104, 106, 94, 78, 65, 37, 0, 31, 0, 284,
+ 42, 158, 160, 162, 164, 166, 168
} ;
-static const flex_int16_t yy_def[217] =
+static const flex_int16_t yy_def[218] =
{ 0,
- 209, 1, 209, 210, 209, 209, 210, 211, 212, 210,
- 10, 210, 10, 210, 10, 10, 10, 10, 10, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
- 210, 209, 209, 211, 213, 214, 212, 215, 209, 10,
- 10, 10, 210, 210, 210, 210, 210, 10, 210, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 209, 214, 216, 42, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
-
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
- 210, 210, 209, 210, 210, 210, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 209, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
- 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
-
- 210, 210, 210, 210, 210, 210, 210, 210, 0, 209,
- 209, 209, 209, 209, 209, 209
+ 210, 1, 210, 211, 210, 210, 211, 212, 213, 211,
+ 10, 211, 10, 211, 10, 10, 10, 10, 10, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+ 211, 210, 210, 212, 214, 215, 213, 216, 210, 10,
+ 10, 10, 211, 211, 211, 211, 211, 10, 211, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 211, 211, 210, 215, 217, 42, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 210, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 211, 211, 211, 210, 211, 211, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
+
+ 211, 211, 211, 211, 211, 211, 211, 211, 211, 0,
+ 210, 210, 210, 210, 210, 210, 210
} ;
-static const flex_int16_t yy_nxt[324] =
+static const flex_int16_t yy_nxt[325] =
{ 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, 30,
- 35, 35, 31, 36, 38, 39, 40, 40, 40, 208,
+ 35, 35, 31, 36, 38, 39, 40, 40, 40, 209,
41, 41, 41, 41, 41, 62, 41, 41, 41, 41,
- 41, 41, 41, 41, 41, 63, 41, 41, 41, 207,
+ 41, 41, 41, 41, 41, 63, 41, 41, 41, 208,
41, 41, 41, 41, 41, 41, 54, 67, 41, 41,
- 41, 44, 57, 46, 48, 55, 68, 181, 45, 47,
- 69, 64, 49, 206, 51, 50, 52, 65, 205, 66,
-
- 182, 58, 59, 71, 110, 60, 72, 111, 53, 35,
- 35, 73, 75, 78, 78, 204, 31, 38, 39, 41,
- 41, 41, 79, 79, 79, 203, 79, 79, 41, 41,
- 41, 202, 79, 79, 79, 79, 79, 79, 105, 106,
- 78, 78, 201, 112, 200, 199, 198, 197, 196, 195,
- 194, 193, 192, 191, 190, 189, 188, 84, 34, 34,
+ 41, 44, 57, 46, 48, 55, 68, 182, 45, 47,
+ 69, 64, 49, 207, 51, 50, 52, 65, 206, 66,
+
+ 183, 58, 59, 71, 111, 60, 72, 112, 53, 35,
+ 35, 73, 75, 78, 78, 205, 31, 38, 39, 41,
+ 41, 41, 79, 79, 79, 204, 79, 79, 41, 41,
+ 41, 203, 79, 79, 79, 79, 79, 79, 101, 102,
+ 106, 107, 78, 78, 202, 113, 201, 200, 199, 198,
+ 197, 196, 195, 194, 193, 192, 191, 84, 34, 34,
37, 37, 35, 35, 77, 77, 38, 38, 78, 78,
- 187, 186, 185, 184, 183, 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, 113, 109, 108, 107, 104, 103, 102, 101,
- 100, 99, 98, 97, 96, 95, 94, 93, 92, 91,
- 90, 89, 88, 87, 86, 85, 83, 82, 81, 80,
- 39, 76, 32, 74, 70, 61, 56, 43, 42, 33,
- 32, 209, 3, 209, 209, 209, 209, 209, 209, 209,
- 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
-
- 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
- 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
- 209, 209, 209
+ 190, 189, 188, 187, 186, 185, 184, 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, 100, 99, 98, 97, 96, 95, 94, 93, 92,
+ 91, 90, 89, 88, 87, 86, 85, 83, 82, 81,
+ 80, 39, 76, 32, 74, 70, 61, 56, 43, 42,
+ 33, 32, 210, 3, 210, 210, 210, 210, 210, 210,
+ 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
+
+ 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
+ 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
+ 210, 210, 210, 210
} ;
-static const flex_int16_t yy_chk[324] =
+static const flex_int16_t yy_chk[325] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 8, 8, 210, 8, 9, 9, 10, 10, 10, 207,
+ 8, 8, 211, 8, 9, 9, 10, 10, 10, 208,
10, 10, 13, 13, 13, 24, 10, 10, 10, 10,
- 10, 10, 15, 15, 15, 24, 16, 16, 16, 205,
+ 10, 10, 15, 15, 15, 24, 16, 16, 16, 206,
17, 17, 17, 18, 18, 18, 20, 26, 19, 19,
- 19, 15, 22, 16, 17, 20, 26, 174, 15, 16,
- 26, 25, 17, 204, 18, 17, 19, 25, 203, 25,
-
- 174, 22, 22, 28, 74, 22, 28, 74, 19, 34,
- 34, 28, 34, 36, 36, 202, 36, 37, 37, 41,
- 41, 41, 42, 42, 42, 201, 42, 42, 48, 48,
- 48, 200, 42, 42, 42, 42, 42, 42, 70, 70,
- 77, 77, 198, 77, 197, 195, 194, 193, 191, 190,
- 189, 188, 186, 184, 183, 182, 181, 48, 211, 211,
- 212, 212, 213, 213, 214, 214, 215, 215, 216, 216,
- 179, 178, 177, 176, 175, 173, 172, 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, 122, 121, 120, 119, 118, 117, 115, 113,
- 112, 109, 107, 106, 104, 101, 99, 98, 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, 47, 46, 44, 43,
- 38, 35, 32, 29, 27, 23, 21, 14, 11, 7,
- 5, 3, 209, 209, 209, 209, 209, 209, 209, 209,
- 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
-
- 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
- 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
- 209, 209, 209
+ 19, 15, 22, 16, 17, 20, 26, 175, 15, 16,
+ 26, 25, 17, 205, 18, 17, 19, 25, 204, 25,
+
+ 175, 22, 22, 28, 74, 22, 28, 74, 19, 34,
+ 34, 28, 34, 36, 36, 203, 36, 37, 37, 41,
+ 41, 41, 42, 42, 42, 202, 42, 42, 48, 48,
+ 48, 201, 42, 42, 42, 42, 42, 42, 66, 66,
+ 70, 70, 77, 77, 199, 77, 198, 196, 195, 194,
+ 192, 191, 190, 189, 187, 185, 184, 48, 212, 212,
+ 213, 213, 214, 214, 215, 215, 216, 216, 217, 217,
+ 183, 182, 180, 179, 178, 177, 176, 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, 123, 122, 121, 120, 119, 118,
+ 116, 114, 113, 110, 108, 107, 105, 102, 99, 98,
+ 97, 95, 94, 92, 91, 90, 89, 88, 85, 84,
+ 83, 82, 81, 80, 78, 73, 72, 71, 69, 68,
+ 67, 64, 63, 62, 61, 60, 59, 58, 57, 56,
+ 55, 54, 53, 52, 51, 50, 49, 47, 46, 44,
+ 43, 38, 35, 32, 29, 27, 23, 21, 14, 11,
+ 7, 5, 3, 210, 210, 210, 210, 210, 210, 210,
+ 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
+
+ 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
+ 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
+ 210, 210, 210, 210
} ;
static yy_state_type yy_last_accepting_state;
@@ -823,13 +823,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 >= 210 )
+ if ( yy_current_state >= 211 )
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] != 283 );
+ while ( yy_base[yy_current_state] != 284 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -881,7 +881,7 @@ YY_RULE_SETUP
YY_BREAK
case 7:
YY_RULE_SETUP
-{return(REFERENCE);}
+{return(OPS);}
YY_BREAK
case 8:
YY_RULE_SETUP
@@ -889,143 +889,143 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
-{return(ASSOCIATION);}
+{return(REFERENCE);}
YY_BREAK
case 10:
YY_RULE_SETUP
-{return(REGISTER);}
+{return(ASSOCIATION);}
YY_BREAK
case 11:
YY_RULE_SETUP
-{return(FW_CONFIG_TABLE);}
+{return(REGISTER);}
YY_BREAK
case 12:
YY_RULE_SETUP
-{return(FW_CONFIG_FIELD);}
+{return(FW_CONFIG_TABLE);}
YY_BREAK
case 13:
YY_RULE_SETUP
-{return(FW_CONFIG_OPTION);}
+{return(FW_CONFIG_FIELD);}
YY_BREAK
case 14:
YY_RULE_SETUP
-{return(FW_CONFIG_PROBE);}
+{return(FW_CONFIG_OPTION);}
YY_BREAK
case 15:
YY_RULE_SETUP
-{yylval.number=1; return(BOOL);}
+{return(FW_CONFIG_PROBE);}
YY_BREAK
case 16:
YY_RULE_SETUP
-{yylval.number=0; return(BOOL);}
+{yylval.number=1; return(BOOL);}
YY_BREAK
case 17:
YY_RULE_SETUP
-{yylval.number=3; return(STATUS);}
+{yylval.number=0; return(BOOL);}
YY_BREAK
case 18:
YY_RULE_SETUP
-{yylval.number=5; return(STATUS);}
+{yylval.number=3; return(STATUS);}
YY_BREAK
case 19:
YY_RULE_SETUP
-{yylval.number=PCI; return(BUS);}
+{yylval.number=5; return(STATUS);}
YY_BREAK
case 20:
YY_RULE_SETUP
-{yylval.number=IOAPIC; return(BUS);}
+{yylval.number=PCI; return(BUS);}
YY_BREAK
case 21:
YY_RULE_SETUP
-{yylval.number=PNP; return(BUS);}
+{yylval.number=IOAPIC; return(BUS);}
YY_BREAK
case 22:
YY_RULE_SETUP
-{yylval.number=I2C; return(BUS);}
+{yylval.number=PNP; return(BUS);}
YY_BREAK
case 23:
YY_RULE_SETUP
-{yylval.number=APIC; return(BUS);}
+{yylval.number=I2C; return(BUS);}
YY_BREAK
case 24:
YY_RULE_SETUP
-{yylval.number=CPU_CLUSTER; return(BUS);}
+{yylval.number=APIC; return(BUS);}
YY_BREAK
case 25:
YY_RULE_SETUP
-{yylval.number=CPU; return(BUS);}
+{yylval.number=CPU_CLUSTER; return(BUS);}
YY_BREAK
case 26:
YY_RULE_SETUP
-{yylval.number=DOMAIN; return(BUS);}
+{yylval.number=CPU; return(BUS);}
YY_BREAK
case 27:
YY_RULE_SETUP
-{yylval.number=GENERIC; return(BUS);}
+{yylval.number=DOMAIN; return(BUS);}
YY_BREAK
case 28:
YY_RULE_SETUP
-{yylval.number=MMIO; return(BUS);}
+{yylval.number=GENERIC; return(BUS);}
YY_BREAK
case 29:
YY_RULE_SETUP
-{yylval.number=SPI; return(BUS);}
+{yylval.number=MMIO; return(BUS);}
YY_BREAK
case 30:
YY_RULE_SETUP
-{yylval.number=USB; return(BUS);}
+{yylval.number=SPI; return(BUS);}
YY_BREAK
case 31:
YY_RULE_SETUP
-{yylval.number=GPIO; return(BUS);}
+{yylval.number=USB; return(BUS);}
YY_BREAK
case 32:
YY_RULE_SETUP
-{yylval.number=IRQ; return(RESOURCE);}
+{yylval.number=GPIO; 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(SMBIOS_DEV_INFO);}
+{return(SLOT_DESC);}
YY_BREAK
case 41:
YY_RULE_SETUP
-{return(EQUALS);}
+{return(SMBIOS_DEV_INFO);}
YY_BREAK
case 42:
YY_RULE_SETUP
-{return(PIPE);}
+{return(EQUALS);}
YY_BREAK
case 43:
YY_RULE_SETUP
-{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
+{return(PIPE);}
YY_BREAK
case 44:
YY_RULE_SETUP
@@ -1037,12 +1037,11 @@ YY_RULE_SETUP
YY_BREAK
case 46:
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 47:
-/* rule 47 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 48:
/* rule 48 can match eol */
@@ -1050,11 +1049,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 49:
+/* rule 49 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 50:
YY_RULE_SETUP
+{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);}
+ YY_BREAK
+case 51:
+YY_RULE_SETUP
ECHO;
YY_BREAK
case YY_STATE_EOF(INITIAL):
@@ -1353,7 +1357,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 >= 210 )
+ if ( yy_current_state >= 211 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -1381,11 +1385,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 >= 210 )
+ if ( yy_current_state >= 211 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- yy_is_jam = (yy_current_state == 209);
+ yy_is_jam = (yy_current_state == 210);
return yy_is_jam ? 0 : yy_current_state;
}
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 6648254d0a..0833d388e5 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -148,6 +148,9 @@ struct queue_entry {
struct queue_entry *prev;
};
+/* Global list of all `struct device_operations` identifiers to declare. */
+static struct identifier *device_operations;
+
#define S_ALLOC(_s) s_alloc(__func__, _s)
static void *s_alloc(const char *f, size_t s)
@@ -696,6 +699,30 @@ static int emit_fw_config_probe(FILE *fil, struct device *dev)
return 0;
}
+/* Enqueue identifier to list with head `*it`, if not already present. */
+void add_identifier(struct identifier **it, const char *id)
+{
+ for (; *it != NULL; it = &(*it)->next) {
+ if (!strcmp((*it)->id, id))
+ return;
+ }
+
+ *it = S_ALLOC(sizeof(**it));
+ (*it)->id = id;
+}
+
+void add_device_ops(struct bus *bus, char *ops_id)
+{
+ if (bus->dev->ops_id) {
+ printf("ERROR: Device operations may only be specified once,\n"
+ " found '%s', '%s'.\n", bus->dev->ops_id, ops_id);
+ exit(1);
+ }
+
+ add_identifier(&device_operations, ops_id);
+ bus->dev->ops_id = ops_id;
+}
+
/*
* Allocate a new bus for the provided device.
* - If this is the first bus being allocated under this device, then its id
@@ -1262,10 +1289,13 @@ static void pass1(FILE *fil, FILE *head, struct device *ptr, struct device *next
fprintf(fil, "#if !DEVTREE_EARLY\n");
/*
- * ops field is set to default_dev_ops_root only for the root
- * device. For all other devices, it is set by the driver at runtime.
+ * ops field can be set in the devicetree. If unspecified, it is set
+ * to default_dev_ops_root only for the root device, other devices
+ * get it set by the driver at runtime.
*/
- if (ptr == &base_root_dev)
+ if (ptr->ops_id)
+ fprintf(fil, "\t.ops = &%s,\n", ptr->ops_id);
+ else if (ptr == &base_root_dev)
fprintf(fil, "\t.ops = &default_dev_ops_root,\n");
else
fprintf(fil, "\t.ops = NULL,\n");
@@ -1477,6 +1507,12 @@ static void emit_chip_configs(FILE *fil)
}
}
+static void emit_identifiers(FILE *fil, const char *decl, const struct identifier *it)
+{
+ for (; it != NULL; it = it->next)
+ fprintf(fil, "extern %s %s;\n", decl, it->id);
+}
+
static void inherit_subsystem_ids(FILE *file, FILE *head, struct device *dev,
struct device *next)
{
@@ -1854,6 +1890,10 @@ static void update_device(struct device *base_dev, struct device *override_dev)
*/
override_dev->chip_instance->base_chip_instance = get_chip_instance(base_dev);
+ /* Allow to override the ops of a device */
+ if (override_dev->ops_id)
+ base_dev->ops_id = override_dev->ops_id;
+
/*
* Now that the device properties are all copied over, look at each bus
* of the override device and run override_devicetree in a recursive
@@ -1970,6 +2010,7 @@ static void generate_outputc(FILE *f, const char *static_header)
fprintf(f, "#include <fw_config.h>\n");
fprintf(f, "#include <%s>\n", static_header);
emit_chip_headers(f, chip_header.next);
+ emit_identifiers(f, "struct device_operations", device_operations);
fprintf(f, "\n#define STORAGE static __maybe_unused DEVTREE_CONST\n\n");
walk_device_tree(NULL, NULL, &base_root_dev, inherit_subsystem_ids);
diff --git a/util/sconfig/sconfig.h b/util/sconfig/sconfig.h
index 5b50cc0158..c2a43af5cf 100644
--- a/util/sconfig/sconfig.h
+++ b/util/sconfig/sconfig.h
@@ -57,6 +57,11 @@ struct fw_config_probe {
struct fw_config_probe *next;
};
+struct identifier {
+ const char *id;
+ struct identifier *next;
+};
+
struct chip;
struct chip_instance {
/* Monotonically increasing ID for each chip instance. */
@@ -165,6 +170,9 @@ struct device {
/* Pointer to last bus under this device. */
struct bus *last_bus;
+ /* Global identifier of the ops for this device. */
+ char *ops_id;
+
/* SMBIOS slot type */
char *smbios_slot_type;
@@ -236,3 +244,5 @@ void add_fw_config_probe(struct bus *bus, const char *field, const char *option)
void append_fw_config_bits(struct fw_config_field_bits **bits,
unsigned int start_bit, unsigned int end_bit);
+
+void add_device_ops(struct bus *, char *ops_id);
diff --git a/util/sconfig/sconfig.l b/util/sconfig/sconfig.l
index 0997ff6444..5ff144b445 100644
--- a/util/sconfig/sconfig.l
+++ b/util/sconfig/sconfig.l
@@ -14,6 +14,7 @@ int linenum = 0;
chip {return(CHIP);}
device {return(DEVICE);}
alias {return(ALIAS);}
+ops {return(OPS);}
use {return(REFERENCE);}
ref {return(REFERENCE);}
as {return(ASSOCIATION);}
diff --git a/util/sconfig/sconfig.tab.c_shipped b/util/sconfig/sconfig.tab.c_shipped
index c319a79527..3df31a721b 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.8.1. */
+/* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison implementation for Yacc-like parsers in C
@@ -46,10 +46,10 @@
USER NAME SPACE" below. */
/* Identify Bison output, and Bison version. */
-#define YYBISON 30801
+#define YYBISON 30802
/* Bison version string. */
-#define YYBISON_VERSION "3.8.1"
+#define YYBISON_VERSION "3.8.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -156,38 +156,40 @@ enum yysymbol_kind_t
YYSYMBOL_FW_CONFIG_OPTION = 43, /* FW_CONFIG_OPTION */
YYSYMBOL_FW_CONFIG_PROBE = 44, /* FW_CONFIG_PROBE */
YYSYMBOL_PIPE = 45, /* PIPE */
- YYSYMBOL_YYACCEPT = 46, /* $accept */
- YYSYMBOL_devtree = 47, /* devtree */
- YYSYMBOL_chipchild_nondev = 48, /* chipchild_nondev */
- YYSYMBOL_chipchild = 49, /* chipchild */
- YYSYMBOL_chipchildren = 50, /* chipchildren */
- YYSYMBOL_chipchildren_dev = 51, /* chipchildren_dev */
- YYSYMBOL_devicechildren = 52, /* devicechildren */
- YYSYMBOL_chip = 53, /* chip */
- YYSYMBOL_54_1 = 54, /* @1 */
- YYSYMBOL_device = 55, /* device */
- YYSYMBOL_56_2 = 56, /* @2 */
- YYSYMBOL_57_3 = 57, /* @3 */
- YYSYMBOL_alias = 58, /* alias */
- YYSYMBOL_status = 59, /* status */
- YYSYMBOL_resource = 60, /* resource */
- YYSYMBOL_reference = 61, /* reference */
- YYSYMBOL_registers = 62, /* registers */
- YYSYMBOL_subsystemid = 63, /* subsystemid */
- YYSYMBOL_ioapic_irq = 64, /* ioapic_irq */
- YYSYMBOL_smbios_slot_desc = 65, /* smbios_slot_desc */
- YYSYMBOL_smbios_dev_info = 66, /* smbios_dev_info */
- YYSYMBOL_fw_config_table = 67, /* fw_config_table */
- YYSYMBOL_fw_config_table_children = 68, /* fw_config_table_children */
- YYSYMBOL_fw_config_field_children = 69, /* fw_config_field_children */
- YYSYMBOL_fw_config_field_bits = 70, /* fw_config_field_bits */
- YYSYMBOL_fw_config_field_bits_repeating = 71, /* fw_config_field_bits_repeating */
- YYSYMBOL_fw_config_field = 72, /* fw_config_field */
- YYSYMBOL_73_4 = 73, /* $@4 */
- YYSYMBOL_74_5 = 74, /* $@5 */
- YYSYMBOL_75_6 = 75, /* $@6 */
- YYSYMBOL_fw_config_option = 76, /* fw_config_option */
- YYSYMBOL_fw_config_probe = 77 /* fw_config_probe */
+ YYSYMBOL_OPS = 46, /* OPS */
+ YYSYMBOL_YYACCEPT = 47, /* $accept */
+ YYSYMBOL_devtree = 48, /* devtree */
+ YYSYMBOL_chipchild_nondev = 49, /* chipchild_nondev */
+ YYSYMBOL_chipchild = 50, /* chipchild */
+ YYSYMBOL_chipchildren = 51, /* chipchildren */
+ YYSYMBOL_chipchildren_dev = 52, /* chipchildren_dev */
+ YYSYMBOL_devicechildren = 53, /* devicechildren */
+ YYSYMBOL_chip = 54, /* chip */
+ YYSYMBOL_55_1 = 55, /* @1 */
+ YYSYMBOL_device = 56, /* device */
+ YYSYMBOL_57_2 = 57, /* @2 */
+ YYSYMBOL_58_3 = 58, /* @3 */
+ YYSYMBOL_alias = 59, /* alias */
+ YYSYMBOL_status = 60, /* status */
+ YYSYMBOL_resource = 61, /* resource */
+ YYSYMBOL_reference = 62, /* reference */
+ YYSYMBOL_registers = 63, /* registers */
+ YYSYMBOL_subsystemid = 64, /* subsystemid */
+ YYSYMBOL_ioapic_irq = 65, /* ioapic_irq */
+ YYSYMBOL_smbios_slot_desc = 66, /* smbios_slot_desc */
+ YYSYMBOL_smbios_dev_info = 67, /* smbios_dev_info */
+ YYSYMBOL_fw_config_table = 68, /* fw_config_table */
+ YYSYMBOL_fw_config_table_children = 69, /* fw_config_table_children */
+ YYSYMBOL_fw_config_field_children = 70, /* fw_config_field_children */
+ YYSYMBOL_fw_config_field_bits = 71, /* fw_config_field_bits */
+ YYSYMBOL_fw_config_field_bits_repeating = 72, /* fw_config_field_bits_repeating */
+ YYSYMBOL_fw_config_field = 73, /* fw_config_field */
+ YYSYMBOL_74_4 = 74, /* $@4 */
+ YYSYMBOL_75_5 = 75, /* $@5 */
+ YYSYMBOL_76_6 = 76, /* $@6 */
+ YYSYMBOL_fw_config_option = 77, /* fw_config_option */
+ YYSYMBOL_fw_config_probe = 78, /* fw_config_probe */
+ YYSYMBOL_ops = 79 /* ops */
};
typedef enum yysymbol_kind_t yysymbol_kind_t;
@@ -515,19 +517,19 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 98
+#define YYLAST 101
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 46
+#define YYNTOKENS 47
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 32
+#define YYNNTS 33
/* YYNRULES -- Number of rules. */
-#define YYNRULES 60
+#define YYNRULES 62
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 105
+#define YYNSTATES 108
/* YYMAXUTOK -- Last valid token kind. */
-#define YYMAXUTOK 300
+#define YYMAXUTOK 301
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
@@ -571,7 +573,7 @@ static const yytype_int8 yytranslate[] =
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,
- 45
+ 45, 46
};
#if YYDEBUG
@@ -580,11 +582,11 @@ static const yytype_uint8 yyrline[] =
{
0, 26, 26, 26, 26, 29, 29, 29, 30, 30,
31, 31, 32, 32, 34, 34, 34, 34, 34, 34,
- 34, 34, 34, 34, 36, 36, 45, 45, 53, 53,
- 61, 63, 67, 67, 69, 72, 75, 78, 81, 84,
- 87, 90, 93, 96, 99, 103, 106, 106, 109, 109,
- 112, 118, 118, 121, 120, 125, 125, 133, 133, 139,
- 143
+ 34, 34, 34, 34, 34, 36, 36, 45, 45, 53,
+ 53, 61, 63, 67, 67, 69, 72, 75, 78, 81,
+ 84, 87, 90, 93, 96, 99, 103, 106, 106, 109,
+ 109, 112, 118, 118, 121, 120, 125, 125, 133, 133,
+ 139, 143, 146
};
#endif
@@ -607,15 +609,15 @@ static const char *const yytname[] =
"SLOT_DESC", "SMBIOS_DEV_INFO", "IO", "NUMBER", "SUBSYSTEMID", "INHERIT",
"IOAPIC_IRQ", "IOAPIC", "PCIINT", "GENERIC", "SPI", "USB", "MMIO",
"GPIO", "FW_CONFIG_TABLE", "FW_CONFIG_FIELD", "FW_CONFIG_OPTION",
- "FW_CONFIG_PROBE", "PIPE", "$accept", "devtree", "chipchild_nondev",
- "chipchild", "chipchildren", "chipchildren_dev", "devicechildren",
- "chip", "@1", "device", "@2", "@3", "alias", "status", "resource",
- "reference", "registers", "subsystemid", "ioapic_irq",
+ "FW_CONFIG_PROBE", "PIPE", "OPS", "$accept", "devtree",
+ "chipchild_nondev", "chipchild", "chipchildren", "chipchildren_dev",
+ "devicechildren", "chip", "@1", "device", "@2", "@3", "alias", "status",
+ "resource", "reference", "registers", "subsystemid", "ioapic_irq",
"smbios_slot_desc", "smbios_dev_info", "fw_config_table",
"fw_config_table_children", "fw_config_field_children",
"fw_config_field_bits", "fw_config_field_bits_repeating",
"fw_config_field", "$@4", "$@5", "$@6", "fw_config_option",
- "fw_config_probe", YY_NULLPTR
+ "fw_config_probe", "ops", YY_NULLPTR
};
static const char *
@@ -625,7 +627,7 @@ yysymbol_name (yysymbol_kind_t yysymbol)
}
#endif
-#define YYPACT_NINF (-45)
+#define YYPACT_NINF (-57)
#define yypact_value_is_default(Yyn) \
((Yyn) == YYPACT_NINF)
@@ -639,17 +641,17 @@ yysymbol_name (yysymbol_kind_t yysymbol)
STATE-NUM. */
static const yytype_int8 yypact[] =
{
- -45, 6, -45, 4, -45, -45, -45, -45, -12, 45,
- -45, 15, -45, 11, 17, 18, 45, -3, -45, -45,
- -45, -45, 16, 34, 23, 14, 46, -45, -45, 45,
- 25, 19, -45, 10, 51, 42, 43, -45, -45, -45,
- -45, -45, 31, -45, -7, -45, -45, -45, 49, 10,
- -45, -45, -6, 25, 19, -45, -45, 50, -45, -45,
- -45, -45, -45, -45, -2, 32, 0, -45, -45, -45,
- 33, -45, 52, 38, 40, 41, 55, -45, -45, -45,
- -45, -45, -45, -45, -45, -45, 12, 58, 57, 59,
- 47, 44, 61, -45, 53, 63, -45, 54, 60, -45,
- -45, 64, -45, -45, -45
+ -57, 6, -57, 2, -57, -57, -57, -57, -12, 45,
+ -57, 4, -57, 11, 5, 7, 45, -3, -57, -57,
+ -57, -57, 21, 18, 25, 14, 34, -57, -57, 45,
+ 27, 16, -57, 44, 53, 46, 47, -57, -57, -57,
+ -57, -57, 32, -57, -7, -57, -57, -57, 49, 44,
+ -57, -57, -6, 27, 16, -57, -57, 50, -57, -57,
+ -57, -57, -57, -57, -2, 38, 0, -57, -57, -57,
+ 39, -57, 54, 40, 42, 43, 57, 58, -57, -57,
+ -57, -57, -57, -57, -57, -57, -57, -57, 12, 61,
+ 60, 62, 48, 51, 63, -57, -57, 52, 64, -57,
+ 56, 55, -57, -57, 66, -57, -57, -57
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -657,35 +659,35 @@ static const yytype_int8 yypact[] =
means the default is an error. */
static const yytype_int8 yydefact[] =
{
- 2, 0, 1, 0, 47, 3, 4, 24, 0, 0,
- 45, 0, 46, 0, 0, 0, 0, 0, 5, 11,
- 7, 6, 57, 0, 0, 0, 0, 13, 25, 12,
- 55, 52, 49, 0, 30, 0, 0, 9, 10, 8,
- 50, 49, 0, 53, 0, 32, 33, 28, 0, 0,
- 36, 35, 0, 0, 52, 49, 58, 0, 48, 23,
- 31, 26, 56, 51, 0, 0, 0, 23, 54, 59,
- 0, 29, 0, 0, 0, 0, 0, 15, 14, 16,
- 21, 17, 18, 19, 20, 22, 0, 0, 0, 44,
- 0, 0, 0, 27, 0, 42, 43, 37, 0, 60,
- 34, 41, 38, 39, 40
+ 2, 0, 1, 0, 48, 3, 4, 25, 0, 0,
+ 46, 0, 47, 0, 0, 0, 0, 0, 5, 11,
+ 7, 6, 58, 0, 0, 0, 0, 13, 26, 12,
+ 56, 53, 50, 0, 31, 0, 0, 9, 10, 8,
+ 51, 50, 0, 54, 0, 33, 34, 29, 0, 0,
+ 37, 36, 0, 0, 53, 50, 59, 0, 49, 24,
+ 32, 27, 57, 52, 0, 0, 0, 24, 55, 60,
+ 0, 30, 0, 0, 0, 0, 0, 0, 15, 14,
+ 16, 21, 17, 18, 19, 20, 22, 23, 0, 0,
+ 0, 45, 0, 0, 0, 62, 28, 0, 43, 44,
+ 38, 0, 61, 35, 42, 39, 40, 41
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -45, -45, 62, -45, -45, 66, 8, -1, -45, -28,
- -45, -45, -45, 35, -45, -45, -44, -45, -45, -45,
- -45, -45, -45, -31, 56, 39, -45, -45, -45, -45,
- -45, -45
+ -57, -57, 65, -57, -57, 68, 22, -1, -57, -28,
+ -57, -57, -57, 41, -57, -57, -56, -57, -57, -57,
+ -57, -57, -57, -21, 59, 37, -57, -57, -57, -57,
+ -57, -57, -57
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
0, 1, 16, 38, 29, 17, 66, 18, 9, 19,
- 67, 59, 49, 47, 79, 20, 21, 81, 82, 83,
- 84, 6, 8, 44, 31, 43, 12, 55, 41, 32,
- 58, 85
+ 67, 59, 49, 47, 80, 20, 21, 82, 83, 84,
+ 85, 6, 8, 44, 31, 43, 12, 55, 41, 32,
+ 58, 86, 87
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -694,58 +696,60 @@ static const yytype_int8 yydefgoto[] =
static const yytype_int8 yytable[] =
{
5, 39, 10, 3, 13, 14, 2, 56, 62, 3,
- 52, 28, 68, 70, 71, 3, 13, 14, 23, 45,
- 46, 7, 80, 24, 64, 70, 93, 72, 73, 35,
- 11, 74, 22, 75, 25, 26, 57, 57, 78, 72,
- 73, 57, 80, 74, 76, 75, 30, 4, 3, 13,
- 14, 33, 15, 34, 36, 40, 76, 48, 78, 50,
- 51, 53, 69, 87, 42, 77, 60, 65, 89, 88,
- 90, 91, 92, 94, 95, 86, 96, 97, 99, 98,
- 101, 104, 27, 100, 61, 77, 102, 0, 0, 0,
- 103, 37, 0, 63, 0, 0, 0, 0, 54
+ 81, 28, 68, 70, 71, 3, 13, 14, 23, 7,
+ 52, 22, 25, 24, 26, 70, 96, 72, 73, 35,
+ 11, 74, 81, 75, 64, 33, 57, 57, 79, 72,
+ 73, 57, 36, 74, 76, 75, 77, 4, 3, 13,
+ 14, 30, 15, 45, 46, 34, 76, 40, 77, 48,
+ 79, 42, 53, 50, 51, 78, 60, 65, 69, 89,
+ 91, 90, 92, 93, 94, 95, 97, 98, 100, 99,
+ 102, 104, 103, 107, 27, 106, 101, 78, 105, 88,
+ 61, 63, 0, 0, 37, 0, 0, 0, 0, 0,
+ 0, 54
};
static const yytype_int8 yycheck[] =
{
1, 29, 14, 3, 4, 5, 0, 14, 14, 3,
- 41, 14, 14, 13, 14, 3, 4, 5, 7, 9,
- 10, 17, 66, 12, 55, 13, 14, 27, 28, 15,
- 42, 31, 17, 33, 17, 17, 43, 43, 66, 27,
- 28, 43, 86, 31, 44, 33, 30, 41, 3, 4,
- 5, 17, 7, 30, 8, 30, 44, 6, 86, 17,
- 17, 30, 30, 30, 45, 66, 17, 17, 30, 17,
- 30, 30, 17, 15, 17, 67, 17, 30, 17, 35,
- 17, 17, 16, 30, 49, 86, 32, -1, -1, -1,
- 30, 29, -1, 54, -1, -1, -1, -1, 42
+ 66, 14, 14, 13, 14, 3, 4, 5, 7, 17,
+ 41, 17, 17, 12, 17, 13, 14, 27, 28, 15,
+ 42, 31, 88, 33, 55, 17, 43, 43, 66, 27,
+ 28, 43, 8, 31, 44, 33, 46, 41, 3, 4,
+ 5, 30, 7, 9, 10, 30, 44, 30, 46, 6,
+ 88, 45, 30, 17, 17, 66, 17, 17, 30, 30,
+ 30, 17, 30, 30, 17, 17, 15, 17, 30, 17,
+ 17, 17, 30, 17, 16, 30, 35, 88, 32, 67,
+ 49, 54, -1, -1, 29, -1, -1, -1, -1, -1,
+ -1, 42
};
/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
state STATE-NUM. */
static const yytype_int8 yystos[] =
{
- 0, 47, 0, 3, 41, 53, 67, 17, 68, 54,
- 14, 42, 72, 4, 5, 7, 48, 51, 53, 55,
- 61, 62, 17, 7, 12, 17, 17, 51, 14, 50,
- 30, 70, 75, 17, 30, 15, 8, 48, 49, 55,
- 30, 74, 45, 71, 69, 9, 10, 59, 6, 58,
- 17, 17, 69, 30, 70, 73, 14, 43, 76, 57,
- 17, 59, 14, 71, 69, 17, 52, 56, 14, 30,
- 13, 14, 27, 28, 31, 33, 44, 53, 55, 60,
- 62, 63, 64, 65, 66, 77, 52, 30, 17, 30,
- 30, 30, 17, 14, 15, 17, 17, 30, 35, 17,
- 30, 17, 32, 30, 17
+ 0, 48, 0, 3, 41, 54, 68, 17, 69, 55,
+ 14, 42, 73, 4, 5, 7, 49, 52, 54, 56,
+ 62, 63, 17, 7, 12, 17, 17, 52, 14, 51,
+ 30, 71, 76, 17, 30, 15, 8, 49, 50, 56,
+ 30, 75, 45, 72, 70, 9, 10, 60, 6, 59,
+ 17, 17, 70, 30, 71, 74, 14, 43, 77, 58,
+ 17, 60, 14, 72, 70, 17, 53, 57, 14, 30,
+ 13, 14, 27, 28, 31, 33, 44, 46, 54, 56,
+ 61, 63, 64, 65, 66, 67, 78, 79, 53, 30,
+ 17, 30, 30, 30, 17, 17, 14, 15, 17, 17,
+ 30, 35, 17, 30, 17, 32, 30, 17
};
/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
static const yytype_int8 yyr1[] =
{
- 0, 46, 47, 47, 47, 48, 48, 48, 49, 49,
- 50, 50, 51, 51, 52, 52, 52, 52, 52, 52,
- 52, 52, 52, 52, 54, 53, 56, 55, 57, 55,
- 58, 58, 59, 59, 60, 61, 62, 63, 63, 64,
- 65, 65, 65, 66, 66, 67, 68, 68, 69, 69,
- 70, 71, 71, 73, 72, 74, 72, 75, 72, 76,
- 77
+ 0, 47, 48, 48, 48, 49, 49, 49, 50, 50,
+ 51, 51, 52, 52, 53, 53, 53, 53, 53, 53,
+ 53, 53, 53, 53, 53, 55, 54, 57, 56, 58,
+ 56, 59, 59, 60, 60, 61, 62, 63, 64, 64,
+ 65, 66, 66, 66, 67, 67, 68, 69, 69, 70,
+ 70, 71, 72, 72, 74, 73, 75, 73, 76, 73,
+ 77, 78, 79
};
/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
@@ -753,11 +757,11 @@ static const yytype_int8 yyr2[] =
{
0, 2, 0, 2, 2, 1, 1, 1, 1, 1,
2, 0, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 0, 0, 5, 0, 8, 0, 7,
- 0, 2, 1, 1, 4, 4, 4, 3, 4, 4,
- 5, 4, 3, 3, 2, 3, 2, 0, 2, 0,
- 2, 3, 0, 0, 7, 0, 6, 0, 5, 3,
- 3
+ 2, 2, 2, 2, 0, 0, 5, 0, 8, 0,
+ 7, 0, 2, 1, 1, 4, 4, 4, 3, 4,
+ 4, 5, 4, 3, 3, 2, 3, 2, 0, 2,
+ 0, 2, 3, 0, 0, 7, 0, 6, 0, 5,
+ 3, 3, 2
};
@@ -1224,7 +1228,7 @@ yyreduce:
{ cur_parent = root_parent; }
break;
- case 24: /* @1: %empty */
+ case 25: /* @1: %empty */
{
(yyval.chip_instance) = new_chip_instance((yyvsp[0].string));
chip_enqueue_tail(cur_chip_instance);
@@ -1232,113 +1236,113 @@ yyreduce:
}
break;
- case 25: /* chip: CHIP STRING @1 chipchildren_dev END */
+ case 26: /* chip: CHIP STRING @1 chipchildren_dev END */
{
cur_chip_instance = chip_dequeue_tail();
}
break;
- case 26: /* @2: %empty */
+ case 27: /* @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 27: /* device: DEVICE BUS NUMBER alias status @2 devicechildren END */
+ case 28: /* device: DEVICE BUS NUMBER alias status @2 devicechildren END */
{
cur_parent = (yyvsp[-2].dev)->parent;
}
break;
- case 28: /* @3: %empty */
+ case 29: /* @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 29: /* device: DEVICE REFERENCE STRING status @3 devicechildren END */
+ case 30: /* device: DEVICE REFERENCE STRING status @3 devicechildren END */
{
cur_parent = (yyvsp[-2].dev)->parent;
}
break;
- case 30: /* alias: %empty */
+ case 31: /* alias: %empty */
{
(yyval.string) = NULL;
}
break;
- case 31: /* alias: ALIAS STRING */
+ case 32: /* alias: ALIAS STRING */
{
(yyval.string) = (yyvsp[0].string);
}
break;
- case 34: /* resource: RESOURCE NUMBER EQUALS NUMBER */
+ case 35: /* 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 35: /* reference: REFERENCE STRING ASSOCIATION STRING */
+ case 36: /* reference: REFERENCE STRING ASSOCIATION STRING */
{ add_reference(cur_chip_instance, (yyvsp[0].string), (yyvsp[-2].string)); }
break;
- case 36: /* registers: REGISTER STRING EQUALS STRING */
+ case 37: /* registers: REGISTER STRING EQUALS STRING */
{ add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); }
break;
- case 37: /* subsystemid: SUBSYSTEMID NUMBER NUMBER */
+ case 38: /* 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 38: /* subsystemid: SUBSYSTEMID NUMBER NUMBER INHERIT */
+ case 39: /* 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 39: /* ioapic_irq: IOAPIC_IRQ NUMBER PCIINT NUMBER */
+ case 40: /* 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 40: /* smbios_slot_desc: SLOT_DESC STRING STRING STRING STRING */
+ case 41: /* 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 41: /* smbios_slot_desc: SLOT_DESC STRING STRING STRING */
+ case 42: /* 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 42: /* smbios_slot_desc: SLOT_DESC STRING STRING */
+ case 43: /* smbios_slot_desc: SLOT_DESC STRING STRING */
{ add_slot_desc(cur_parent, (yyvsp[-1].string), (yyvsp[0].string), NULL, NULL); }
break;
- case 43: /* smbios_dev_info: SMBIOS_DEV_INFO NUMBER STRING */
+ case 44: /* smbios_dev_info: SMBIOS_DEV_INFO NUMBER STRING */
{ add_smbios_dev_info(cur_parent, strtol((yyvsp[-1].string), NULL, 0), (yyvsp[0].string)); }
break;
- case 44: /* smbios_dev_info: SMBIOS_DEV_INFO NUMBER */
+ case 45: /* smbios_dev_info: SMBIOS_DEV_INFO NUMBER */
{ add_smbios_dev_info(cur_parent, strtol((yyvsp[0].string), NULL, 0), NULL); }
break;
- case 45: /* fw_config_table: FW_CONFIG_TABLE fw_config_table_children END */
+ case 46: /* fw_config_table: FW_CONFIG_TABLE fw_config_table_children END */
{ }
break;
- case 50: /* fw_config_field_bits: NUMBER NUMBER */
+ case 51: /* fw_config_field_bits: NUMBER NUMBER */
{
append_fw_config_bits(&cur_bits, strtoul((yyvsp[-1].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0));
}
break;
- case 53: /* $@4: %empty */
+ case 54: /* $@4: %empty */
{ cur_field = new_fw_config_field((yyvsp[-2].string), cur_bits); }
break;
- case 54: /* fw_config_field: FW_CONFIG_FIELD STRING fw_config_field_bits fw_config_field_bits_repeating $@4 fw_config_field_children END */
+ case 55: /* fw_config_field: FW_CONFIG_FIELD STRING fw_config_field_bits fw_config_field_bits_repeating $@4 fw_config_field_children END */
{ cur_bits = NULL; }
break;
- case 55: /* $@5: %empty */
+ case 56: /* $@5: %empty */
{
cur_bits = NULL;
append_fw_config_bits(&cur_bits, strtoul((yyvsp[0].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0));
@@ -1346,28 +1350,32 @@ yyreduce:
}
break;
- case 56: /* fw_config_field: FW_CONFIG_FIELD STRING NUMBER $@5 fw_config_field_children END */
+ case 57: /* fw_config_field: FW_CONFIG_FIELD STRING NUMBER $@5 fw_config_field_children END */
{ cur_bits = NULL; }
break;
- case 57: /* $@6: %empty */
+ case 58: /* $@6: %empty */
{
cur_field = get_fw_config_field((yyvsp[0].string));
}
break;
- case 58: /* fw_config_field: FW_CONFIG_FIELD STRING $@6 fw_config_field_children END */
+ case 59: /* fw_config_field: FW_CONFIG_FIELD STRING $@6 fw_config_field_children END */
{ cur_bits = NULL; }
break;
- case 59: /* fw_config_option: FW_CONFIG_OPTION STRING NUMBER */
+ case 60: /* 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 60: /* fw_config_probe: FW_CONFIG_PROBE STRING STRING */
+ case 61: /* fw_config_probe: FW_CONFIG_PROBE STRING STRING */
{ add_fw_config_probe(cur_parent, (yyvsp[-1].string), (yyvsp[0].string)); }
break;
+ case 62: /* ops: OPS STRING */
+ { add_device_ops(cur_parent, (yyvsp[0].string)); }
+ break;
+
default: break;
diff --git a/util/sconfig/sconfig.tab.h_shipped b/util/sconfig/sconfig.tab.h_shipped
index fb14adcf1d..a35b64bdb9 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.8.1. */
+/* A Bison parser, made by GNU Bison 3.8.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_HOME_USUARIO_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
-# define YY_YY_HOME_USUARIO_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
+#ifndef YY_YY_HOME_ICON_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
+# define YY_YY_HOME_ICON_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
@@ -96,7 +96,8 @@ extern int yydebug;
FW_CONFIG_FIELD = 297, /* FW_CONFIG_FIELD */
FW_CONFIG_OPTION = 298, /* FW_CONFIG_OPTION */
FW_CONFIG_PROBE = 299, /* FW_CONFIG_PROBE */
- PIPE = 300 /* PIPE */
+ PIPE = 300, /* PIPE */
+ OPS = 301 /* OPS */
};
typedef enum yytokentype yytoken_kind_t;
#endif
@@ -125,4 +126,4 @@ extern YYSTYPE yylval;
int yyparse (void);
-#endif /* !YY_YY_HOME_USUARIO_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */
+#endif /* !YY_YY_HOME_ICON_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */
diff --git a/util/sconfig/sconfig.y b/util/sconfig/sconfig.y
index 1b611e4b85..fb5409f662 100644
--- a/util/sconfig/sconfig.y
+++ b/util/sconfig/sconfig.y
@@ -21,7 +21,7 @@ static struct fw_config_field_bits *cur_bits;
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 SMBIOS_DEV_INFO IO NUMBER SUBSYSTEMID INHERIT IOAPIC_IRQ IOAPIC PCIINT GENERIC SPI USB MMIO GPIO FW_CONFIG_TABLE FW_CONFIG_FIELD FW_CONFIG_OPTION FW_CONFIG_PROBE PIPE
+%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 SMBIOS_DEV_INFO IO NUMBER SUBSYSTEMID INHERIT IOAPIC_IRQ IOAPIC PCIINT GENERIC SPI USB MMIO GPIO FW_CONFIG_TABLE FW_CONFIG_FIELD FW_CONFIG_OPTION FW_CONFIG_PROBE PIPE OPS
%%
devtree: { cur_parent = root_parent; } | devtree chip | devtree fw_config_table;
@@ -31,7 +31,7 @@ chipchild: device | chipchild_nondev;
chipchildren: chipchildren chipchild | /* empty */ ;
chipchildren_dev: device chipchildren | chipchild_nondev chipchildren_dev;
-devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | devicechildren smbios_slot_desc | devicechildren smbios_dev_info | devicechildren registers | devicechildren fw_config_probe | /* empty */ ;
+devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | devicechildren smbios_slot_desc | devicechildren smbios_dev_info | devicechildren registers | devicechildren fw_config_probe | devicechildren ops | /* empty */ ;
chip: CHIP STRING /* == path */ {
$<chip_instance>$ = new_chip_instance($<string>2);
@@ -142,4 +142,8 @@ fw_config_option: FW_CONFIG_OPTION STRING NUMBER /* == field value */
/* probe <field> <option> */
fw_config_probe: FW_CONFIG_PROBE STRING /* == field */ STRING /* == option */
{ add_fw_config_probe(cur_parent, $<string>2, $<string>3); }
+
+ops: OPS STRING /* == global identifier */
+ { add_device_ops(cur_parent, $<string>2); }
+
%%