sconfig: Allow to link devices to other device's drivers

Rarely, the driver of one device needs to know about another device
that can be anywhere in the device hierarchy. Current applications
boil down to EEPROMs that store information that is consumed by some
code (e.g. MAC address).

The idea is to give device nodes in the `devicetree.cb` an alias that
can later be used to link it to a device driver's `config` structure.
The driver has to declare a field of type `struct device *`, e.g.

    struct some_chip_driver_config {
            DEVTREE_CONST struct device *needed_eeprom;
    };

In the devicetree, the referenced device gets an alias, e.g.

    device i2c 0x50 alias my_eeprom on end

The author of the devicetree is free to choose any alias name that
is unique in the devicetree. Later, when configuring the driver the
alias can be used to link the device with the field of a driver's
config:

    chip some/chip/driver
            use my_eeprom as needed_eeprom
    end

Override devices can add an alias if it does not exist, but cannot
change the alias for a device that already exists.

Alias names are checked for conflicts both in the base tree and in the
override tree.

References are resolved after the tree is parsed so aliases and
references do not need to be in a specific order in the tree.

Change-Id: I058a319f9b968924fbef9485a96c9e3f900a3ee8
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35456
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Nico Huber 2020-06-03 10:20:07 -07:00 committed by Tim Wawrzynczak
parent ad7c8ffba9
commit 8e1ea525d1
7 changed files with 538 additions and 385 deletions

View File

@ -349,8 +349,8 @@ static void yynoreturn yy_fatal_error ( const char* msg );
(yy_hold_char) = *yy_cp; \ (yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \ *yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp; (yy_c_buf_p) = yy_cp;
#define YY_NUM_RULES 45 #define YY_NUM_RULES 48
#define YY_END_OF_BUFFER 46 #define YY_END_OF_BUFFER 49
/* This struct is not used in this scanner, /* This struct is not used in this scanner,
but its presence is necessary. */ but its presence is necessary. */
struct yy_trans_info struct yy_trans_info
@ -358,30 +358,31 @@ struct yy_trans_info
flex_int32_t yy_verify; flex_int32_t yy_verify;
flex_int32_t yy_nxt; flex_int32_t yy_nxt;
}; };
static const flex_int16_t yy_accept[195] = static const flex_int16_t yy_accept[202] =
{ 0, { 0,
0, 0, 46, 44, 1, 3, 44, 44, 44, 39, 0, 0, 49, 47, 1, 3, 47, 47, 47, 42,
39, 37, 40, 44, 40, 40, 40, 40, 44, 44, 42, 40, 43, 47, 43, 43, 43, 43, 43, 47,
44, 44, 44, 44, 44, 44, 44, 44, 44, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
3, 44, 0, 44, 44, 0, 2, 39, 40, 44, 1, 3, 47, 0, 47, 47, 0, 2, 42, 43,
44, 44, 44, 40, 44, 44, 44, 44, 44, 44, 47, 47, 47, 8, 47, 47, 43, 47, 47, 47,
44, 44, 44, 44, 31, 44, 44, 44, 44, 44, 47, 47, 47, 47, 47, 47, 47, 34, 47, 47,
44, 11, 44, 44, 44, 44, 44, 44, 44, 44, 47, 47, 47, 47, 14, 47, 47, 47, 47, 47,
44, 43, 43, 44, 0, 38, 44, 44, 21, 44, 47, 47, 47, 47, 46, 46, 47, 0, 41, 47,
44, 30, 35, 44, 44, 44, 44, 44, 18, 44, 47, 47, 24, 47, 47, 33, 38, 47, 47, 47,
44, 29, 44, 27, 44, 44, 12, 44, 15, 17, 47, 47, 21, 47, 47, 32, 47, 30, 47, 47,
44, 44, 44, 25, 44, 26, 44, 0, 41, 4, 15, 47, 18, 20, 47, 47, 47, 28, 47, 29,
44, 44, 44, 28, 44, 44, 44, 44, 44, 44, 7, 47, 0, 44, 47, 4, 47, 47, 47, 31,
44, 44, 24, 44, 44, 44, 44, 44, 42, 42, 47, 47, 47, 47, 47, 47, 47, 47, 27, 47,
44, 44, 44, 8, 44, 44, 44, 44, 44, 19, 47, 47, 47, 47, 45, 45, 6, 47, 47, 47,
44, 44, 10, 44, 44, 44, 44, 5, 22, 44, 11, 47, 47, 47, 47, 47, 22, 47, 47, 13,
44, 13, 44, 16, 44, 9, 44, 44, 44, 44, 47, 47, 47, 47, 5, 25, 47, 47, 16, 47,
44, 23, 33, 44, 44, 44, 44, 44, 44, 44, 19, 47, 12, 47, 47, 47, 47, 47, 26, 36,
44, 44, 6, 44, 44, 44, 7, 44, 14, 44, 47, 47, 47, 47, 47, 47, 47, 47, 47, 9,
44, 44, 32, 44, 44, 20, 44, 34, 44, 44, 47, 47, 47, 10, 47, 17, 47, 47, 47, 35,
44, 44, 36, 0 47, 47, 23, 47, 37, 47, 47, 47, 47, 39,
0
} ; } ;
static const YY_CHAR yy_ec[256] = static const YY_CHAR yy_ec[256] =
@ -424,134 +425,136 @@ static const YY_CHAR yy_meta[40] =
1, 1, 1, 1, 1, 1, 1, 1, 1 1, 1, 1, 1, 1, 1, 1, 1, 1
} ; } ;
static const flex_int16_t yy_base[202] = static const flex_int16_t yy_base[209] =
{ 0, { 0,
0, 0, 265, 0, 262, 266, 260, 38, 42, 39, 0, 0, 274, 0, 271, 275, 269, 38, 42, 39,
224, 0, 45, 247, 55, 79, 61, 58, 239, 234, 233, 0, 45, 256, 55, 59, 83, 65, 62, 248,
46, 54, 55, 68, 73, 237, 46, 224, 0, 254, 243, 68, 25, 48, 54, 75, 246, 75, 233, 0,
266, 101, 250, 107, 111, 251, 266, 0, 108, 111, 263, 275, 106, 259, 111, 76, 260, 275, 0, 110,
238, 227, 216, 117, 223, 218, 228, 217, 225, 229, 113, 247, 236, 0, 235, 224, 119, 231, 226, 236,
216, 223, 223, 217, 223, 208, 208, 218, 208, 210, 225, 233, 237, 224, 231, 231, 225, 231, 216, 216,
212, 0, 199, 207, 201, 201, 206, 210, 202, 208, 226, 216, 218, 220, 0, 207, 215, 209, 209, 214,
207, 0, 266, 132, 219, 0, 212, 192, 205, 195, 218, 210, 216, 118, 0, 275, 135, 228, 0, 221,
202, 0, 0, 193, 191, 197, 194, 194, 0, 192, 214, 200, 213, 203, 210, 0, 0, 201, 199, 205,
182, 0, 186, 0, 190, 180, 0, 183, 0, 0, 202, 202, 0, 200, 190, 0, 194, 0, 198, 188,
189, 181, 180, 0, 171, 0, 198, 197, 0, 0, 0, 191, 0, 0, 197, 189, 188, 0, 179, 0,
182, 181, 174, 0, 178, 168, 164, 174, 162, 168, 0, 206, 205, 0, 176, 0, 189, 188, 181, 0,
173, 174, 0, 161, 168, 155, 158, 147, 0, 266, 185, 175, 171, 181, 169, 175, 180, 181, 0, 168,
159, 163, 155, 0, 154, 156, 152, 154, 159, 0, 175, 162, 165, 154, 0, 275, 0, 166, 170, 162,
143, 148, 0, 141, 141, 140, 137, 0, 0, 149, 0, 161, 163, 159, 161, 166, 0, 150, 155, 0,
151, 0, 135, 152, 138, 0, 145, 136, 117, 117, 148, 148, 147, 144, 0, 0, 156, 158, 0, 142,
124, 0, 0, 123, 115, 114, 112, 123, 109, 119, 159, 145, 0, 152, 156, 137, 137, 144, 0, 0,
109, 101, 0, 113, 111, 115, 0, 96, 0, 92, 143, 122, 121, 119, 130, 116, 126, 116, 108, 0,
82, 70, 0, 65, 77, 0, 77, 0, 71, 59, 120, 118, 123, 0, 112, 0, 113, 116, 97, 0,
44, 30, 0, 266, 41, 153, 155, 157, 159, 161, 89, 86, 0, 85, 0, 75, 65, 52, 61, 0,
163 275, 48, 155, 157, 159, 161, 163, 165
} ; } ;
static const flex_int16_t yy_def[202] = static const flex_int16_t yy_def[209] =
{ 0, { 0,
194, 1, 194, 195, 194, 194, 195, 196, 197, 195, 201, 1, 201, 202, 201, 201, 202, 203, 204, 202,
10, 195, 10, 195, 10, 10, 10, 10, 195, 195, 10, 202, 10, 202, 10, 10, 10, 10, 10, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 194, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
194, 196, 198, 199, 197, 200, 194, 10, 10, 10, 201, 201, 203, 205, 206, 204, 207, 201, 10, 10,
195, 195, 195, 10, 195, 195, 195, 195, 195, 195, 10, 202, 202, 202, 202, 202, 10, 202, 202, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
195, 195, 194, 199, 201, 40, 195, 195, 195, 195, 202, 202, 202, 202, 202, 201, 206, 208, 41, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
195, 195, 195, 195, 195, 195, 195, 194, 195, 195, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 202, 202, 201, 202, 202, 202, 202, 202, 202, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 194, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 202, 202, 202, 202, 202, 201, 202, 202, 202, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
195, 195, 195, 0, 194, 194, 194, 194, 194, 194, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
194 0, 201, 201, 201, 201, 201, 201, 201
} ; } ;
static const flex_int16_t yy_nxt[306] = static const flex_int16_t yy_nxt[315] =
{ 0, { 0,
4, 5, 6, 7, 8, 9, 10, 11, 10, 12, 4, 5, 6, 7, 8, 9, 10, 11, 10, 12,
13, 13, 14, 4, 4, 4, 13, 13, 15, 16, 13, 13, 14, 4, 4, 4, 15, 13, 16, 17,
17, 18, 19, 20, 21, 22, 23, 4, 24, 25, 18, 19, 20, 21, 22, 23, 24, 4, 25, 26,
4, 26, 27, 4, 28, 4, 4, 4, 4, 33, 4, 27, 28, 4, 29, 4, 4, 4, 4, 34,
33, 29, 34, 36, 37, 38, 38, 38, 193, 39, 34, 60, 35, 37, 38, 39, 39, 39, 30, 40,
39, 39, 39, 39, 53, 39, 39, 39, 39, 39, 40, 40, 40, 40, 61, 40, 40, 40, 40, 40,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 62, 40, 40, 40, 40, 40,
57, 59, 68, 54, 55, 69, 192, 56, 42, 191, 40, 40, 40, 40, 63, 64, 56, 37, 38, 200,
70, 60, 49, 58, 43, 39, 39, 39, 47, 61, 43, 65, 45, 66, 199, 198, 52, 44, 46, 40,
190, 64, 189, 48, 50, 62, 188, 63, 187, 44, 40, 40, 50, 67, 197, 57, 58, 51, 53, 59,
65, 186, 33, 33, 66, 72, 185, 45, 75, 75, 196, 71, 68, 47, 72, 195, 69, 34, 34, 73,
46, 29, 36, 37, 39, 39, 39, 76, 76, 76, 75, 48, 78, 78, 49, 30, 40, 40, 40, 79,
184, 76, 76, 39, 39, 39, 183, 76, 76, 76, 79, 79, 194, 79, 79, 40, 40, 40, 193, 79,
76, 76, 76, 75, 75, 182, 107, 181, 180, 179, 79, 79, 79, 79, 79, 110, 78, 78, 111, 112,
178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183,
168, 167, 80, 32, 32, 35, 35, 33, 33, 74, 182, 181, 180, 179, 84, 33, 33, 36, 36, 34,
74, 36, 36, 75, 75, 166, 165, 164, 163, 162, 34, 77, 77, 37, 37, 78, 78, 178, 177, 176,
161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166,
151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156,
141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146,
131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136,
121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126,
111, 110, 109, 108, 106, 105, 104, 103, 102, 101, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116,
100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 115, 114, 113, 109, 108, 107, 106, 105, 104, 103,
90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93,
79, 78, 77, 37, 73, 30, 71, 67, 52, 51, 92, 91, 90, 89, 88, 87, 86, 85, 83, 82,
41, 40, 31, 30, 194, 3, 194, 194, 194, 194, 81, 80, 38, 76, 31, 74, 70, 55, 54, 42,
194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 41, 32, 31, 201, 3, 201, 201, 201, 201, 201,
194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
194, 194, 194, 194, 194 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
201, 201, 201, 201
} ; } ;
static const flex_int16_t yy_chk[306] = static const flex_int16_t yy_chk[315] =
{ 0, { 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8,
8, 195, 8, 9, 9, 10, 10, 10, 192, 10, 8, 23, 8, 9, 9, 10, 10, 10, 202, 10,
10, 13, 13, 13, 21, 10, 10, 10, 10, 10, 10, 13, 13, 13, 23, 10, 10, 10, 10, 10,
10, 15, 15, 15, 18, 18, 18, 17, 17, 17, 10, 15, 15, 15, 24, 16, 16, 16, 19, 19,
22, 23, 27, 21, 21, 27, 191, 21, 15, 190, 19, 18, 18, 18, 24, 25, 22, 36, 36, 199,
27, 23, 18, 22, 15, 16, 16, 16, 17, 24, 15, 25, 16, 25, 198, 197, 19, 15, 16, 17,
189, 25, 187, 17, 18, 24, 185, 24, 184, 16, 17, 17, 18, 26, 196, 22, 22, 18, 19, 22,
25, 182, 32, 32, 25, 32, 181, 16, 34, 34, 194, 28, 26, 17, 28, 192, 26, 33, 33, 28,
16, 34, 35, 35, 39, 39, 39, 40, 40, 40, 33, 17, 35, 35, 17, 35, 40, 40, 40, 41,
180, 40, 40, 44, 44, 44, 178, 40, 40, 40, 41, 41, 191, 41, 41, 47, 47, 47, 189, 41,
40, 40, 40, 74, 74, 176, 74, 175, 174, 172, 41, 41, 41, 41, 41, 74, 77, 77, 74, 77,
171, 170, 169, 168, 167, 166, 165, 164, 161, 160, 188, 187, 185, 183, 182, 181, 179, 178, 177, 176,
159, 158, 44, 196, 196, 197, 197, 198, 198, 199, 175, 174, 173, 172, 47, 203, 203, 204, 204, 205,
199, 200, 200, 201, 201, 157, 155, 154, 153, 151, 205, 206, 206, 207, 207, 208, 208, 171, 168, 167,
150, 147, 146, 145, 144, 142, 141, 139, 138, 137, 166, 165, 164, 162, 161, 160, 158, 157, 154, 153,
136, 135, 133, 132, 131, 128, 127, 126, 125, 124, 152, 151, 149, 148, 146, 145, 144, 143, 142, 140,
122, 121, 120, 119, 118, 117, 116, 115, 113, 112, 139, 138, 134, 133, 132, 131, 130, 128, 127, 126,
111, 108, 107, 105, 103, 102, 101, 98, 96, 95, 125, 124, 123, 122, 121, 119, 118, 117, 115, 113,
93, 91, 90, 88, 87, 86, 85, 84, 81, 80, 112, 109, 107, 106, 105, 102, 100, 99, 97, 95,
79, 78, 77, 75, 71, 70, 69, 68, 67, 66, 94, 92, 91, 90, 89, 88, 85, 84, 83, 82,
65, 64, 63, 61, 60, 59, 58, 57, 56, 55, 81, 80, 78, 73, 72, 71, 70, 69, 68, 67,
54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 66, 64, 63, 62, 61, 60, 59, 58, 57, 56,
43, 42, 41, 36, 33, 30, 28, 26, 20, 19, 55, 54, 53, 52, 51, 50, 49, 48, 46, 45,
14, 11, 7, 5, 3, 194, 194, 194, 194, 194, 43, 42, 37, 34, 31, 29, 27, 21, 20, 14,
194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 11, 7, 5, 3, 201, 201, 201, 201, 201, 201,
194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
194, 194, 194, 194, 194 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
201, 201, 201, 201
} ; } ;
static yy_state_type yy_last_accepting_state; static yy_state_type yy_last_accepting_state;
@ -816,13 +819,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 195 ) if ( yy_current_state >= 202 )
yy_c = yy_meta[yy_c]; yy_c = yy_meta[yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp; ++yy_cp;
} }
while ( yy_base[yy_current_state] != 266 ); while ( yy_base[yy_current_state] != 275 );
yy_find_action: yy_find_action:
yy_act = yy_accept[yy_current_state]; yy_act = yy_accept[yy_current_state];
@ -870,163 +873,175 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 6: case 6:
YY_RULE_SETUP YY_RULE_SETUP
{return(REGISTER);} {return(ALIAS);}
YY_BREAK YY_BREAK
case 7: case 7:
YY_RULE_SETUP YY_RULE_SETUP
{return(FW_CONFIG_TABLE);} {return(REFERENCE);}
YY_BREAK YY_BREAK
case 8: case 8:
YY_RULE_SETUP YY_RULE_SETUP
{return(FW_CONFIG_FIELD);} {return(ASSOCIATION);}
YY_BREAK YY_BREAK
case 9: case 9:
YY_RULE_SETUP YY_RULE_SETUP
{return(FW_CONFIG_OPTION);} {return(REGISTER);}
YY_BREAK YY_BREAK
case 10: case 10:
YY_RULE_SETUP YY_RULE_SETUP
{return(FW_CONFIG_PROBE);} {return(FW_CONFIG_TABLE);}
YY_BREAK YY_BREAK
case 11: case 11:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=1; return(BOOL);} {return(FW_CONFIG_FIELD);}
YY_BREAK YY_BREAK
case 12: case 12:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=0; return(BOOL);} {return(FW_CONFIG_OPTION);}
YY_BREAK YY_BREAK
case 13: case 13:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=3; return(STATUS);} {return(FW_CONFIG_PROBE);}
YY_BREAK YY_BREAK
case 14: case 14:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=5; return(STATUS);} {yylval.number=1; return(BOOL);}
YY_BREAK YY_BREAK
case 15: case 15:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=PCI; return(BUS);} {yylval.number=0; return(BOOL);}
YY_BREAK YY_BREAK
case 16: case 16:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=IOAPIC; return(BUS);} {yylval.number=3; return(STATUS);}
YY_BREAK YY_BREAK
case 17: case 17:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=PNP; return(BUS);} {yylval.number=5; return(STATUS);}
YY_BREAK YY_BREAK
case 18: case 18:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=I2C; return(BUS);} {yylval.number=PCI; return(BUS);}
YY_BREAK YY_BREAK
case 19: case 19:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=APIC; return(BUS);} {yylval.number=IOAPIC; return(BUS);}
YY_BREAK YY_BREAK
case 20: case 20:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=CPU_CLUSTER; return(BUS);} {yylval.number=PNP; return(BUS);}
YY_BREAK YY_BREAK
case 21: case 21:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=CPU; return(BUS);} {yylval.number=I2C; return(BUS);}
YY_BREAK YY_BREAK
case 22: case 22:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=DOMAIN; return(BUS);} {yylval.number=APIC; return(BUS);}
YY_BREAK YY_BREAK
case 23: case 23:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=GENERIC; return(BUS);} {yylval.number=CPU_CLUSTER; return(BUS);}
YY_BREAK YY_BREAK
case 24: case 24:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=MMIO; return(BUS);} {yylval.number=CPU; return(BUS);}
YY_BREAK YY_BREAK
case 25: case 25:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=SPI; return(BUS);} {yylval.number=DOMAIN; return(BUS);}
YY_BREAK YY_BREAK
case 26: case 26:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=USB; return(BUS);} {yylval.number=GENERIC; return(BUS);}
YY_BREAK YY_BREAK
case 27: case 27:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=LPC; return(BUS);} {yylval.number=MMIO; return(BUS);}
YY_BREAK YY_BREAK
case 28: case 28:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=ESPI; return(BUS);} {yylval.number=SPI; return(BUS);}
YY_BREAK YY_BREAK
case 29: case 29:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=IRQ; return(RESOURCE);} {yylval.number=USB; return(BUS);}
YY_BREAK YY_BREAK
case 30: case 30:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=DRQ; return(RESOURCE);} {yylval.number=LPC; return(BUS);}
YY_BREAK YY_BREAK
case 31: case 31:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=IO; return(RESOURCE);} {yylval.number=ESPI; return(BUS);}
YY_BREAK YY_BREAK
case 32: case 32:
YY_RULE_SETUP YY_RULE_SETUP
{return(IOAPIC_IRQ);} {yylval.number=IRQ; return(RESOURCE);}
YY_BREAK YY_BREAK
case 33: case 33:
YY_RULE_SETUP YY_RULE_SETUP
{return(INHERIT);} {yylval.number=DRQ; return(RESOURCE);}
YY_BREAK YY_BREAK
case 34: case 34:
YY_RULE_SETUP YY_RULE_SETUP
{return(SUBSYSTEMID);} {yylval.number=IO; return(RESOURCE);}
YY_BREAK YY_BREAK
case 35: case 35:
YY_RULE_SETUP YY_RULE_SETUP
{return(END);} {return(IOAPIC_IRQ);}
YY_BREAK YY_BREAK
case 36: case 36:
YY_RULE_SETUP YY_RULE_SETUP
{return(SLOT_DESC);} {return(INHERIT);}
YY_BREAK YY_BREAK
case 37: case 37:
YY_RULE_SETUP YY_RULE_SETUP
{return(EQUALS);} {return(SUBSYSTEMID);}
YY_BREAK YY_BREAK
case 38: case 38:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} {return(END);}
YY_BREAK YY_BREAK
case 39: case 39:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} {return(SLOT_DESC);}
YY_BREAK YY_BREAK
case 40: case 40:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} {return(EQUALS);}
YY_BREAK YY_BREAK
case 41: case 41:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);} {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
YY_BREAK YY_BREAK
case 42: case 42:
/* rule 42 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
{yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);} {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
YY_BREAK YY_BREAK
case 43: case 43:
/* rule 43 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
{yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);} {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
YY_BREAK YY_BREAK
case 44: case 44:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);} {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);}
YY_BREAK YY_BREAK
case 45: 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);}
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);}
YY_BREAK
case 47:
YY_RULE_SETUP
{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);}
YY_BREAK
case 48:
YY_RULE_SETUP YY_RULE_SETUP
ECHO; ECHO;
YY_BREAK YY_BREAK
@ -1326,7 +1341,7 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 195 ) if ( yy_current_state >= 202 )
yy_c = yy_meta[yy_c]; yy_c = yy_meta[yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@ -1354,11 +1369,11 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 195 ) if ( yy_current_state >= 202 )
yy_c = yy_meta[yy_c]; yy_c = yy_meta[yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
yy_is_jam = (yy_current_state == 194); yy_is_jam = (yy_current_state == 201);
return yy_is_jam ? 0 : yy_current_state; return yy_is_jam ? 0 : yy_current_state;
} }

View File

@ -669,16 +669,41 @@ static void set_new_child(struct bus *parent, struct device *child)
child->parent = parent; child->parent = parent;
} }
static const struct device *find_alias(const struct device *const parent,
const char *const alias)
{
if (parent->alias && !strcmp(parent->alias, alias))
return parent;
const struct bus *bus;
for (bus = parent->bus; bus; bus = bus->next_bus) {
const struct device *child;
for (child = bus->children; child; child = child->sibling) {
const struct device *const ret = find_alias(child, alias);
if (ret)
return ret;
}
}
return NULL;
}
struct device *new_device(struct bus *parent, struct device *new_device(struct bus *parent,
struct chip_instance *chip_instance, struct chip_instance *chip_instance,
const int bustype, const char *devnum, const int bustype, const char *devnum,
int status) char *alias, int status)
{ {
char *tmp; char *tmp;
int path_a; int path_a;
int path_b = 0; int path_b = 0;
struct device *new_d; 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); path_a = strtol(devnum, &tmp, 16);
if (*tmp == '.') { if (*tmp == '.') {
tmp++; tmp++;
@ -698,6 +723,7 @@ struct device *new_device(struct bus *parent,
new_d->path_a = path_a; new_d->path_a = path_a;
new_d->path_b = path_b; new_d->path_b = path_b;
new_d->alias = alias;
new_d->enabled = status & 0x01; new_d->enabled = status & 0x01;
new_d->hidden = (status >> 1) & 0x01; new_d->hidden = (status >> 1) & 0x01;
@ -819,6 +845,35 @@ void add_register(struct chip_instance *chip_instance, char *name, char *val)
add_reg(&chip_instance->reg, name, val); add_reg(&chip_instance->reg, name, val);
} }
void add_reference(struct chip_instance *const chip_instance,
char *const name, char *const alias)
{
add_reg(&chip_instance->ref, name, alias);
}
static void set_reference(struct chip_instance *const chip_instance,
char *const name, char *const alias)
{
const struct device *const dev = find_alias(&base_root_dev, alias);
if (!dev) {
printf("ERROR: Cannot find device alias '%s'.\n", alias);
exit(1);
}
char *const ref_name = S_ALLOC(strlen(dev->name) + 2);
sprintf(ref_name, "&%s", dev->name);
add_register(chip_instance, name, ref_name);
}
static void update_references(FILE *file, FILE *head, struct device *dev,
struct device *next)
{
struct reg *ref;
for (ref = dev->chip_instance->ref; ref; ref = ref->next)
set_reference(dev->chip_instance, ref->key, ref->value);
}
void add_slot_desc(struct bus *bus, char *type, char *length, char *designation, void add_slot_desc(struct bus *bus, char *type, char *length, char *designation,
char *data_width) char *data_width)
{ {
@ -1203,16 +1258,12 @@ static void emit_chip_instance(FILE *fil, struct chip_instance *instance)
fprintf(fil, "};\n\n"); fprintf(fil, "};\n\n");
} }
static void emit_chips(FILE *fil) static void emit_chip_configs(FILE *fil)
{ {
struct chip *chip = chip_header.next; struct chip *chip = chip_header.next;
struct chip_instance *instance; struct chip_instance *instance;
int chip_id; int chip_id;
emit_chip_headers(fil, chip);
fprintf(fil, "\n#define STORAGE static __unused DEVTREE_CONST\n\n");
for (; chip; chip = chip->next) { for (; chip; chip = chip->next) {
if (!chip->chiph_exists) if (!chip->chiph_exists)
continue; continue;
@ -1337,9 +1388,9 @@ static void update_resource(struct device *dev, struct resource *res)
* Add register to chip instance. If register is already present, then update * Add register to chip instance. If register is already present, then update
* its value. If not, then add a new register to the chip instance. * its value. If not, then add a new register to the chip instance.
*/ */
static void update_register(struct chip_instance *c, struct reg *reg) static void update_register(struct reg **const head, struct reg *reg)
{ {
struct reg *base_reg = c->reg; struct reg *base_reg = *head;
while (base_reg) { while (base_reg) {
if (!strcmp(base_reg->key, reg->key)) { if (!strcmp(base_reg->key, reg->key)) {
@ -1349,7 +1400,7 @@ static void update_register(struct chip_instance *c, struct reg *reg)
base_reg = base_reg->next; base_reg = base_reg->next;
} }
add_register(c, reg->key, reg->value); add_reg(head, reg->key, reg->value);
} }
static void override_devicetree(struct bus *base_parent, static void override_devicetree(struct bus *base_parent,
@ -1422,6 +1473,19 @@ static void override_devicetree(struct bus *base_parent,
* | | | * | | |
* +-----------------------------------------------------------------+ * +-----------------------------------------------------------------+
* | | | * | | |
* | ref | Each reference that is present in override |
* | | device is copied over to base device with |
* | | the same rules as registers. |
* | | |
* +-----------------------------------------------------------------+
* | | |
* | alias | Base device alias is copied to override. |
* | | Override devices cannot change/remove an |
* | | existing alias, but they can add an alias |
* | | if one does not exist. |
* | | |
* +-----------------------------------------------------------------+
* | | |
* | chip_instance | Each register of chip_instance is copied | * | chip_instance | Each register of chip_instance is copied |
* | | over from override device to base device: | * | | over from override device to base device: |
* | | 1. If register with same key is present in | * | | 1. If register with same key is present in |
@ -1492,10 +1556,34 @@ static void update_device(struct device *base_dev, struct device *override_dev)
*/ */
struct reg *reg = override_dev->chip_instance->reg; struct reg *reg = override_dev->chip_instance->reg;
while (reg) { while (reg) {
update_register(base_dev->chip_instance, reg); update_register(&base_dev->chip_instance->reg, reg);
reg = reg->next; reg = reg->next;
} }
/* Copy references just as with registers. */
reg = override_dev->chip_instance->ref;
while (reg) {
update_register(&base_dev->chip_instance->ref, reg);
reg = reg->next;
}
/* Check for alias name conflicts. */
if (override_dev->alias && find_alias(&base_root_dev, override_dev->alias)) {
printf("ERROR: alias already exists: %s\n", override_dev->alias);
exit(1);
}
/*
* Copy alias from base device.
*
* Override devices cannot change/remove an existing alias,
* but they can add an alias to a device if one does not exist yet.
*/
if (base_dev->alias)
override_dev->alias = base_dev->alias;
else
base_dev->alias = override_dev->alias;
/* /*
* Use probe list from override device in place of base device, in order * Use probe list from override device in place of base device, in order
* to allow an override to remove a probe from the base device. * to allow an override to remove a probe from the base device.
@ -1631,12 +1719,15 @@ int main(int argc, char **argv)
fprintf(autogen, "#include <device/device.h>\n"); fprintf(autogen, "#include <device/device.h>\n");
fprintf(autogen, "#include <device/pci.h>\n\n"); fprintf(autogen, "#include <device/pci.h>\n\n");
fprintf(autogen, "#include <static.h>\n"); fprintf(autogen, "#include <static.h>\n");
emit_chip_headers(autogen, chip_header.next);
emit_chips(autogen); fprintf(autogen, "\n#define STORAGE static __unused DEVTREE_CONST\n\n");
walk_device_tree(autogen, autohead, &base_root_dev, inherit_subsystem_ids); walk_device_tree(autogen, autohead, &base_root_dev, inherit_subsystem_ids);
fprintf(autogen, "\n/* pass 0 */\n"); fprintf(autogen, "\n/* pass 0 */\n");
walk_device_tree(autogen, autohead, &base_root_dev, pass0); walk_device_tree(autogen, autohead, &base_root_dev, pass0);
walk_device_tree(autogen, autohead, &base_root_dev, update_references);
fprintf(autogen, "\n/* chip configs */\n");
emit_chip_configs(autogen);
fprintf(autogen, "\n/* pass 1 */\n"); fprintf(autogen, "\n/* pass 1 */\n");
walk_device_tree(autogen, autohead, &base_root_dev, pass1); walk_device_tree(autogen, autohead, &base_root_dev, pass1);

View File

@ -57,6 +57,9 @@ struct chip_instance {
/* Pointer to registers for this chip. */ /* Pointer to registers for this chip. */
struct reg *reg; struct reg *reg;
/* Pointer to references for this chip. */
struct reg *ref;
/* Pointer to chip of which this is instance. */ /* Pointer to chip of which this is instance. */
struct chip *chip; struct chip *chip;
@ -123,6 +126,9 @@ struct device {
/* Name of this device. */ /* Name of this device. */
char *name; char *name;
/* Alias of this device (for internal references) */
char *alias;
/* Path of this device. */ /* Path of this device. */
char *path; char *path;
int path_a; int path_a;
@ -172,7 +178,7 @@ extern struct bus *root_parent;
struct device *new_device(struct bus *parent, struct device *new_device(struct bus *parent,
struct chip_instance *chip_instance, struct chip_instance *chip_instance,
const int bustype, const char *devnum, const int bustype, const char *devnum,
int status); char *alias, int status);
void add_resource(struct bus *bus, int type, int index, int base); void add_resource(struct bus *bus, int type, int index, int base);
@ -195,6 +201,7 @@ void *chip_dequeue_tail(void);
struct chip_instance *new_chip_instance(char *path); struct chip_instance *new_chip_instance(char *path);
void add_register(struct chip_instance *chip, char *name, char *val); void add_register(struct chip_instance *chip, char *name, char *val);
void add_reference(struct chip_instance *chip, char *name, char *alias);
struct fw_config_field *get_fw_config_field(const char *name); struct fw_config_field *get_fw_config_field(const char *name);

View File

@ -13,6 +13,9 @@ int linenum = 0;
\r?\n {linenum++;} \r?\n {linenum++;}
chip {return(CHIP);} chip {return(CHIP);}
device {return(DEVICE);} device {return(DEVICE);}
alias {return(ALIAS);}
use {return(REFERENCE);}
as {return(ASSOCIATION);}
register {return(REGISTER);} register {return(REGISTER);}
fw_config {return(FW_CONFIG_TABLE);} fw_config {return(FW_CONFIG_TABLE);}
field {return(FW_CONFIG_FIELD);} field {return(FW_CONFIG_FIELD);}

View File

@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.5.1. */ /* A Bison parser, made by GNU Bison 3.5.3. */
/* Bison implementation for Yacc-like parsers in C /* Bison implementation for Yacc-like parsers in C
@ -48,7 +48,7 @@
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "3.5.1" #define YYBISON_VERSION "3.5.3"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
@ -130,42 +130,45 @@ extern int yydebug;
CHIP = 258, CHIP = 258,
DEVICE = 259, DEVICE = 259,
REGISTER = 260, REGISTER = 260,
BOOL = 261, ALIAS = 261,
STATUS = 262, REFERENCE = 262,
MANDATORY = 263, ASSOCIATION = 263,
BUS = 264, BOOL = 264,
RESOURCE = 265, STATUS = 265,
END = 266, MANDATORY = 266,
EQUALS = 267, BUS = 267,
HEX = 268, RESOURCE = 268,
STRING = 269, END = 269,
PCI = 270, EQUALS = 270,
PNP = 271, HEX = 271,
I2C = 272, STRING = 272,
APIC = 273, PCI = 273,
CPU_CLUSTER = 274, PNP = 274,
CPU = 275, I2C = 275,
DOMAIN = 276, APIC = 276,
IRQ = 277, CPU_CLUSTER = 277,
DRQ = 278, CPU = 278,
SLOT_DESC = 279, DOMAIN = 279,
IO = 280, IRQ = 280,
NUMBER = 281, DRQ = 281,
SUBSYSTEMID = 282, SLOT_DESC = 282,
INHERIT = 283, IO = 283,
IOAPIC_IRQ = 284, NUMBER = 284,
IOAPIC = 285, SUBSYSTEMID = 285,
PCIINT = 286, INHERIT = 286,
GENERIC = 287, IOAPIC_IRQ = 287,
SPI = 288, IOAPIC = 288,
USB = 289, PCIINT = 289,
MMIO = 290, GENERIC = 290,
LPC = 291, SPI = 291,
ESPI = 292, USB = 292,
FW_CONFIG_TABLE = 293, MMIO = 293,
FW_CONFIG_FIELD = 294, LPC = 294,
FW_CONFIG_OPTION = 295, ESPI = 295,
FW_CONFIG_PROBE = 296 FW_CONFIG_TABLE = 296,
FW_CONFIG_FIELD = 297,
FW_CONFIG_OPTION = 298,
FW_CONFIG_PROBE = 299
}; };
#endif #endif
@ -497,19 +500,19 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */ /* YYFINAL -- State number of the termination state. */
#define YYFINAL 2 #define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */ /* YYLAST -- Last index in YYTABLE. */
#define YYLAST 58 #define YYLAST 64
/* YYNTOKENS -- Number of terminals. */ /* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 42 #define YYNTOKENS 45
/* YYNNTS -- Number of nonterminals. */ /* YYNNTS -- Number of nonterminals. */
#define YYNNTS 23 #define YYNNTS 25
/* YYNRULES -- Number of rules. */ /* YYNRULES -- Number of rules. */
#define YYNRULES 44 #define YYNRULES 48
/* YYNSTATES -- Number of states. */ /* YYNSTATES -- Number of states. */
#define YYNSTATES 75 #define YYNSTATES 83
#define YYUNDEFTOK 2 #define YYUNDEFTOK 2
#define YYMAXUTOK 296 #define YYMAXUTOK 299
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
@ -550,18 +553,18 @@ static const yytype_int8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
}; };
#if YYDEBUG #if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_int8 yyrline[] = static const yytype_int8 yyrline[] =
{ {
0, 24, 24, 24, 24, 26, 26, 26, 26, 28, 0, 24, 24, 24, 24, 26, 26, 26, 26, 26,
28, 28, 28, 28, 28, 28, 28, 28, 30, 30, 28, 28, 28, 28, 28, 28, 28, 28, 28, 30,
39, 39, 47, 47, 49, 52, 55, 58, 61, 64, 30, 39, 39, 47, 49, 53, 53, 55, 58, 61,
67, 70, 74, 77, 77, 80, 80, 83, 83, 89, 64, 67, 70, 73, 76, 79, 83, 86, 86, 89,
89, 95, 95, 101, 105 89, 92, 92, 98, 98, 104, 104, 110, 114
}; };
#endif #endif
@ -570,18 +573,19 @@ static const yytype_int8 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] = static const char *const yytname[] =
{ {
"$end", "error", "$undefined", "CHIP", "DEVICE", "REGISTER", "BOOL", "$end", "error", "$undefined", "CHIP", "DEVICE", "REGISTER", "ALIAS",
"STATUS", "MANDATORY", "BUS", "RESOURCE", "END", "EQUALS", "HEX", "REFERENCE", "ASSOCIATION", "BOOL", "STATUS", "MANDATORY", "BUS",
"STRING", "PCI", "PNP", "I2C", "APIC", "CPU_CLUSTER", "CPU", "DOMAIN", "RESOURCE", "END", "EQUALS", "HEX", "STRING", "PCI", "PNP", "I2C",
"IRQ", "DRQ", "SLOT_DESC", "IO", "NUMBER", "SUBSYSTEMID", "INHERIT", "APIC", "CPU_CLUSTER", "CPU", "DOMAIN", "IRQ", "DRQ", "SLOT_DESC", "IO",
"IOAPIC_IRQ", "IOAPIC", "PCIINT", "GENERIC", "SPI", "USB", "MMIO", "LPC", "NUMBER", "SUBSYSTEMID", "INHERIT", "IOAPIC_IRQ", "IOAPIC", "PCIINT",
"ESPI", "FW_CONFIG_TABLE", "FW_CONFIG_FIELD", "FW_CONFIG_OPTION", "GENERIC", "SPI", "USB", "MMIO", "LPC", "ESPI", "FW_CONFIG_TABLE",
"FW_CONFIG_PROBE", "$accept", "devtree", "chipchildren", "FW_CONFIG_FIELD", "FW_CONFIG_OPTION", "FW_CONFIG_PROBE", "$accept",
"devicechildren", "chip", "@1", "device", "@2", "status", "resource", "devtree", "chipchildren", "devicechildren", "chip", "@1", "device",
"registers", "subsystemid", "ioapic_irq", "smbios_slot_desc", "@2", "alias", "status", "resource", "reference", "registers",
"fw_config_table", "fw_config_table_children", "subsystemid", "ioapic_irq", "smbios_slot_desc", "fw_config_table",
"fw_config_field_children", "fw_config_field", "$@3", "$@4", "$@5", "fw_config_table_children", "fw_config_field_children",
"fw_config_option", "fw_config_probe", YY_NULLPTR "fw_config_field", "$@3", "$@4", "$@5", "fw_config_option",
"fw_config_probe", YY_NULLPTR
}; };
#endif #endif
@ -594,11 +598,11 @@ static const yytype_int16 yytoknum[] =
265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296 295, 296, 297, 298, 299
}; };
# endif # endif
#define YYPACT_NINF (-12) #define YYPACT_NINF (-21)
#define yypact_value_is_default(Yyn) \ #define yypact_value_is_default(Yyn) \
((Yyn) == YYPACT_NINF) ((Yyn) == YYPACT_NINF)
@ -612,14 +616,15 @@ static const yytype_int16 yytoknum[] =
STATE-NUM. */ STATE-NUM. */
static const yytype_int8 yypact[] = static const yytype_int8 yypact[] =
{ {
-12, 3, -12, 4, -12, -12, -12, -12, -2, -12, -21, 3, -21, -4, -21, -21, -21, -21, -2, -21,
-12, 8, -12, 9, 1, 14, 11, -12, -12, -12, -21, 4, -21, 11, -20, 14, 6, 13, -21, -21,
-12, 2, -12, 5, 17, -12, -12, -6, 10, 16, -21, -21, -21, -1, -21, 2, 17, 26, -21, -21,
-12, -1, -12, 18, -12, -12, -12, -12, -12, 0, -10, 29, 21, 22, -21, -7, -21, 25, -21, 30,
-12, 7, -12, -12, -12, -3, 19, -12, 21, 20, 10, -21, -21, -6, -21, 19, -21, -21, -21, -21,
22, 28, -12, -12, -12, -12, -12, -12, -12, -12, -21, -21, -21, -3, 20, -21, 33, 23, 24, 34,
31, 30, 23, 24, 33, 25, 36, 26, 27, -12, -21, -21, -21, -21, -21, -21, -21, -21, 28, 37,
-12, 38, -12, -12, -12 27, 12, 38, 31, 40, 32, 35, -21, -21, 41,
-21, -21, -21
}; };
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@ -627,30 +632,31 @@ static const yytype_int8 yypact[] =
means the default is an error. */ means the default is an error. */
static const yytype_int8 yydefact[] = static const yytype_int8 yydefact[] =
{ {
2, 0, 1, 0, 34, 3, 4, 18, 0, 8, 2, 0, 1, 0, 38, 3, 4, 19, 0, 9,
32, 0, 33, 0, 41, 0, 0, 19, 6, 5, 36, 0, 37, 0, 45, 0, 0, 0, 20, 6,
7, 39, 36, 0, 0, 37, 36, 0, 0, 0, 5, 8, 7, 43, 40, 0, 0, 0, 41, 40,
36, 0, 42, 0, 35, 22, 23, 20, 25, 0, 0, 23, 0, 0, 40, 0, 46, 0, 39, 0,
40, 0, 17, 38, 43, 0, 0, 21, 0, 0, 0, 29, 28, 0, 44, 0, 24, 25, 26, 21,
0, 0, 10, 9, 11, 15, 12, 13, 14, 16, 42, 47, 18, 0, 0, 22, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 31, 26, 0, 44, 11, 10, 12, 16, 13, 14, 15, 17, 0, 0,
24, 30, 27, 28, 29 0, 0, 0, 0, 35, 30, 0, 48, 27, 34,
31, 32, 33
}; };
/* YYPGOTO[NTERM-NUM]. */ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] = static const yytype_int8 yypgoto[] =
{ {
-12, -12, -12, -12, -9, -12, 12, -12, -12, -12, -21, -21, -21, -21, -8, -21, 8, -21, -21, -21,
13, -12, -12, -12, -12, -12, -11, -12, -12, -12, -21, -21, 9, -21, -21, -21, -21, -21, -12, -21,
-12, -12, -12 -21, -21, -21, -21, -21
}; };
/* YYDEFGOTO[NTERM-NUM]. */ /* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] = static const yytype_int8 yydefgoto[] =
{ {
-1, 1, 13, 45, 5, 9, 19, 42, 37, 54, -1, 1, 13, 53, 5, 9, 20, 52, 40, 49,
20, 56, 57, 58, 6, 8, 27, 12, 30, 26, 62, 21, 22, 64, 65, 66, 6, 8, 30, 12,
22, 34, 59 34, 29, 24, 38, 67
}; };
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@ -658,56 +664,59 @@ static const yytype_int8 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int8 yytable[] = static const yytype_int8 yytable[] =
{ {
3, 15, 16, 2, 18, 32, 3, 46, 47, 10, 3, 15, 16, 2, 36, 19, 3, 44, 50, 23,
40, 43, 3, 15, 16, 31, 35, 36, 7, 39, 54, 55, 10, 7, 3, 15, 16, 35, 17, 47,
17, 48, 14, 23, 49, 24, 50, 21, 25, 29, 48, 14, 43, 26, 56, 18, 25, 57, 28, 58,
38, 28, 41, 44, 33, 61, 52, 11, 51, 33, 27, 31, 32, 37, 33, 39, 37, 37, 41, 42,
33, 4, 64, 65, 66, 60, 62, 69, 63, 67, 11, 59, 45, 73, 4, 60, 76, 46, 51, 68,
71, 70, 74, 73, 72, 68, 0, 53, 55 69, 72, 70, 71, 74, 77, 75, 79, 82, 0,
78, 61, 63, 80, 81
}; };
static const yytype_int8 yycheck[] = static const yytype_int8 yycheck[] =
{ {
3, 4, 5, 0, 13, 11, 3, 10, 11, 11, 3, 4, 5, 0, 14, 13, 3, 14, 14, 29,
11, 11, 3, 4, 5, 26, 6, 7, 14, 30, 13, 14, 14, 17, 3, 4, 5, 29, 7, 9,
11, 24, 14, 9, 27, 14, 29, 26, 26, 12, 10, 17, 34, 17, 27, 14, 12, 30, 29, 32,
14, 26, 14, 26, 40, 14, 45, 39, 41, 40, 17, 29, 15, 43, 8, 6, 43, 43, 17, 17,
40, 38, 14, 12, 14, 26, 26, 14, 26, 26, 42, 44, 17, 15, 41, 53, 34, 17, 29, 29,
14, 26, 14, 26, 28, 31, -1, 45, 45 17, 17, 29, 29, 17, 17, 29, 17, 17, -1,
29, 53, 53, 31, 29
}; };
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */ symbol of state STATE-NUM. */
static const yytype_int8 yystos[] = static const yytype_int8 yystos[] =
{ {
0, 43, 0, 3, 38, 46, 56, 14, 57, 47, 0, 46, 0, 3, 41, 49, 61, 17, 62, 50,
11, 39, 59, 44, 14, 4, 5, 11, 46, 48, 14, 42, 64, 47, 17, 4, 5, 7, 14, 49,
52, 26, 62, 9, 14, 26, 61, 58, 26, 12, 51, 56, 57, 29, 67, 12, 17, 17, 29, 66,
60, 58, 11, 40, 63, 6, 7, 50, 14, 58, 63, 29, 15, 8, 65, 63, 14, 43, 68, 6,
11, 14, 49, 11, 26, 45, 10, 11, 24, 27, 53, 17, 17, 63, 14, 17, 17, 9, 10, 54,
29, 41, 46, 48, 51, 52, 53, 54, 55, 64, 14, 29, 52, 48, 13, 14, 27, 30, 32, 44,
26, 14, 26, 26, 14, 12, 14, 26, 31, 14, 49, 51, 55, 57, 58, 59, 60, 69, 29, 17,
26, 14, 28, 26, 14 29, 29, 17, 15, 17, 29, 34, 17, 29, 17,
31, 29, 17
}; };
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_int8 yyr1[] = static const yytype_int8 yyr1[] =
{ {
0, 42, 43, 43, 43, 44, 44, 44, 44, 45, 0, 45, 46, 46, 46, 47, 47, 47, 47, 47,
45, 45, 45, 45, 45, 45, 45, 45, 47, 46, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50,
49, 48, 50, 50, 51, 52, 53, 53, 54, 55, 49, 52, 51, 53, 53, 54, 54, 55, 56, 57,
55, 55, 56, 57, 57, 58, 58, 60, 59, 61, 58, 58, 59, 60, 60, 60, 61, 62, 62, 63,
59, 62, 59, 63, 64 63, 65, 64, 66, 64, 67, 64, 68, 69
}; };
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_int8 yyr2[] = static const yytype_int8 yyr2[] =
{ {
0, 2, 0, 2, 2, 2, 2, 2, 0, 2, 0, 2, 0, 2, 2, 2, 2, 2, 2, 0,
2, 2, 2, 2, 2, 2, 2, 0, 0, 5, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0,
0, 7, 1, 1, 4, 4, 3, 4, 4, 5, 5, 0, 8, 0, 2, 1, 1, 4, 4, 4,
4, 3, 3, 2, 0, 2, 0, 0, 7, 0, 3, 4, 4, 5, 4, 3, 3, 2, 0, 2,
6, 0, 5, 3, 3 0, 0, 7, 0, 6, 0, 5, 3, 3
}; };
@ -1406,7 +1415,7 @@ yyreduce:
{ cur_parent = root_parent; } { cur_parent = root_parent; }
break; break;
case 18: case 19:
{ {
(yyval.chip_instance) = new_chip_instance((yyvsp[0].string)); (yyval.chip_instance) = new_chip_instance((yyvsp[0].string));
chip_enqueue_tail(cur_chip_instance); chip_enqueue_tail(cur_chip_instance);
@ -1414,84 +1423,80 @@ yyreduce:
} }
break; break;
case 19: case 20:
{ {
cur_chip_instance = chip_dequeue_tail(); cur_chip_instance = chip_dequeue_tail();
} }
break; break;
case 20: case 21:
{ {
(yyval.dev) = new_device(cur_parent, cur_chip_instance, (yyvsp[-2].number), (yyvsp[-1].string), (yyvsp[0].number)); (yyval.dev) = new_device(cur_parent, cur_chip_instance, (yyvsp[-3].number), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].number));
cur_parent = (yyval.dev)->last_bus; cur_parent = (yyval.dev)->last_bus;
} }
break; break;
case 21: case 22:
{ {
cur_parent = (yyvsp[-2].dev)->parent; cur_parent = (yyvsp[-2].dev)->parent;
} }
break; break;
case 23:
{
(yyval.string) = NULL;
}
break;
case 24: case 24:
{ add_resource(cur_parent, (yyvsp[-3].number), strtol((yyvsp[-2].string), NULL, 0), strtol((yyvsp[0].string), NULL, 0)); } {
break; (yyval.string) = (yyvsp[0].string);
}
case 25:
{ add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); }
break;
case 26:
{ add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-1].string), NULL, 16), strtol((yyvsp[0].string), NULL, 16), 0); }
break; break;
case 27: case 27:
{ add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-2].string), NULL, 16), strtol((yyvsp[-1].string), NULL, 16), 1); } { add_resource(cur_parent, (yyvsp[-3].number), strtol((yyvsp[-2].string), NULL, 0), strtol((yyvsp[0].string), NULL, 0)); }
break; break;
case 28: case 28:
{ add_ioapic_info(cur_parent, strtol((yyvsp[-2].string), NULL, 16), (yyvsp[-1].string), strtol((yyvsp[0].string), NULL, 16)); } { add_reference(cur_chip_instance, (yyvsp[0].string), (yyvsp[-2].string)); }
break; break;
case 29: case 29:
{ add_slot_desc(cur_parent, (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string)); } { add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); }
break; break;
case 30: case 30:
{ add_slot_desc(cur_parent, (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string), NULL); } { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-1].string), NULL, 16), strtol((yyvsp[0].string), NULL, 16), 0); }
break; break;
case 31: case 31:
{ add_slot_desc(cur_parent, (yyvsp[-1].string), (yyvsp[0].string), NULL, NULL); } { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-2].string), NULL, 16), strtol((yyvsp[-1].string), NULL, 16), 1); }
break; break;
case 32: case 32:
{ } { add_ioapic_info(cur_parent, strtol((yyvsp[-2].string), NULL, 16), (yyvsp[-1].string), strtol((yyvsp[0].string), NULL, 16)); }
break; break;
case 37: case 33:
{ { add_slot_desc(cur_parent, (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string)); }
cur_field = new_fw_config_field((yyvsp[-2].string), strtoul((yyvsp[-1].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0));
}
break; break;
case 38: case 34:
{ } { add_slot_desc(cur_parent, (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string), NULL); }
break; break;
case 39: case 35:
{ { add_slot_desc(cur_parent, (yyvsp[-1].string), (yyvsp[0].string), NULL, NULL); }
cur_field = new_fw_config_field((yyvsp[-1].string), strtoul((yyvsp[0].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0));
}
break; break;
case 40: case 36:
{ } { }
break; break;
case 41: case 41:
{ {
cur_field = get_fw_config_field((yyvsp[0].string)); cur_field = new_fw_config_field((yyvsp[-2].string), strtoul((yyvsp[-1].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0));
} }
break; break;
@ -1500,10 +1505,30 @@ yyreduce:
break; break;
case 43: case 43:
{ add_fw_config_option(cur_field, (yyvsp[-1].string), strtoul((yyvsp[0].string), NULL, 0)); } {
cur_field = new_fw_config_field((yyvsp[-1].string), strtoul((yyvsp[0].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0));
}
break; break;
case 44: case 44:
{ }
break;
case 45:
{
cur_field = get_fw_config_field((yyvsp[0].string));
}
break;
case 46:
{ }
break;
case 47:
{ add_fw_config_option(cur_field, (yyvsp[-1].string), strtoul((yyvsp[0].string), NULL, 0)); }
break;
case 48:
{ add_fw_config_probe(cur_parent, (yyvsp[-1].string), (yyvsp[0].string)); } { add_fw_config_probe(cur_parent, (yyvsp[-1].string), (yyvsp[0].string)); }
break; break;

View File

@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.5.1. */ /* A Bison parser, made by GNU Bison 3.5.3. */
/* Bison interface for Yacc-like parsers in C /* Bison interface for Yacc-like parsers in C
@ -52,42 +52,45 @@ extern int yydebug;
CHIP = 258, CHIP = 258,
DEVICE = 259, DEVICE = 259,
REGISTER = 260, REGISTER = 260,
BOOL = 261, ALIAS = 261,
STATUS = 262, REFERENCE = 262,
MANDATORY = 263, ASSOCIATION = 263,
BUS = 264, BOOL = 264,
RESOURCE = 265, STATUS = 265,
END = 266, MANDATORY = 266,
EQUALS = 267, BUS = 267,
HEX = 268, RESOURCE = 268,
STRING = 269, END = 269,
PCI = 270, EQUALS = 270,
PNP = 271, HEX = 271,
I2C = 272, STRING = 272,
APIC = 273, PCI = 273,
CPU_CLUSTER = 274, PNP = 274,
CPU = 275, I2C = 275,
DOMAIN = 276, APIC = 276,
IRQ = 277, CPU_CLUSTER = 277,
DRQ = 278, CPU = 278,
SLOT_DESC = 279, DOMAIN = 279,
IO = 280, IRQ = 280,
NUMBER = 281, DRQ = 281,
SUBSYSTEMID = 282, SLOT_DESC = 282,
INHERIT = 283, IO = 283,
IOAPIC_IRQ = 284, NUMBER = 284,
IOAPIC = 285, SUBSYSTEMID = 285,
PCIINT = 286, INHERIT = 286,
GENERIC = 287, IOAPIC_IRQ = 287,
SPI = 288, IOAPIC = 288,
USB = 289, PCIINT = 289,
MMIO = 290, GENERIC = 290,
LPC = 291, SPI = 291,
ESPI = 292, USB = 292,
FW_CONFIG_TABLE = 293, MMIO = 293,
FW_CONFIG_FIELD = 294, LPC = 294,
FW_CONFIG_OPTION = 295, ESPI = 295,
FW_CONFIG_PROBE = 296 FW_CONFIG_TABLE = 296,
FW_CONFIG_FIELD = 297,
FW_CONFIG_OPTION = 298,
FW_CONFIG_PROBE = 299
}; };
#endif #endif

View File

@ -19,11 +19,11 @@ static struct fw_config_field *cur_field;
int number; int number;
} }
%token CHIP DEVICE REGISTER BOOL STATUS MANDATORY BUS RESOURCE END EQUALS HEX STRING PCI PNP I2C APIC CPU_CLUSTER CPU DOMAIN IRQ DRQ SLOT_DESC IO NUMBER SUBSYSTEMID INHERIT IOAPIC_IRQ IOAPIC PCIINT GENERIC SPI USB MMIO LPC ESPI 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 FW_CONFIG_TABLE FW_CONFIG_FIELD FW_CONFIG_OPTION FW_CONFIG_PROBE
%% %%
devtree: { cur_parent = root_parent; } | devtree chip | devtree fw_config_table; devtree: { cur_parent = root_parent; } | devtree chip | devtree fw_config_table;
chipchildren: chipchildren device | chipchildren chip | chipchildren registers | /* empty */ ; chipchildren: chipchildren device | chipchildren chip | chipchildren registers | chipchildren reference | /* empty */ ;
devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | devicechildren smbios_slot_desc | devicechildren registers | devicechildren fw_config_probe | /* empty */ ; devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | devicechildren smbios_slot_desc | devicechildren registers | devicechildren fw_config_probe | /* empty */ ;
@ -36,12 +36,18 @@ chip: CHIP STRING /* == path */ {
cur_chip_instance = chip_dequeue_tail(); cur_chip_instance = chip_dequeue_tail();
}; };
device: DEVICE BUS NUMBER /* == devnum */ status { device: DEVICE BUS NUMBER /* == devnum */ alias status {
$<dev>$ = new_device(cur_parent, cur_chip_instance, $<number>2, $<string>3, $<number>4); $<dev>$ = new_device(cur_parent, cur_chip_instance, $<number>2, $<string>3, $<string>4, $<number>5);
cur_parent = $<dev>$->last_bus; cur_parent = $<dev>$->last_bus;
} }
devicechildren END { devicechildren END {
cur_parent = $<dev>5->parent; cur_parent = $<dev>6->parent;
};
alias: /* empty */ {
$<string>$ = NULL;
} | ALIAS STRING {
$<string>$ = $<string>2;
}; };
status: BOOL | STATUS ; status: BOOL | STATUS ;
@ -49,6 +55,9 @@ status: BOOL | STATUS ;
resource: RESOURCE NUMBER /* == resnum */ EQUALS NUMBER /* == resval */ resource: RESOURCE NUMBER /* == resnum */ EQUALS NUMBER /* == resval */
{ add_resource(cur_parent, $<number>1, strtol($<string>2, NULL, 0), strtol($<string>4, NULL, 0)); } ; { add_resource(cur_parent, $<number>1, strtol($<string>2, NULL, 0), strtol($<string>4, NULL, 0)); } ;
reference: REFERENCE STRING /* == alias */ ASSOCIATION STRING /* == field in chip config */
{ add_reference(cur_chip_instance, $<string>4, $<string>2); } ;
registers: REGISTER STRING /* == regname */ EQUALS STRING /* == regval */ registers: REGISTER STRING /* == regname */ EQUALS STRING /* == regval */
{ add_register(cur_chip_instance, $<string>2, $<string>4); } ; { add_register(cur_chip_instance, $<string>2, $<string>4); } ;