util/sconfig: Add LPC and ESPI buses

Picasso has an LPC and eSPI bridge on the same PCI DEVFN. They can both
be active at the same time. This adds a way to specify which devices
belong on which bus.

i.e.,
device pci 14.3 on  # - D14F3 bridge
	device espi 0 on
		chip ec/google/chromeec
			device pnp 0c09.0 on end
		end
	end
	device lpc 0 on
	end
end

BUG=b:154445472
TEST=Built trembyle and saw static.c contained the espi bus.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I0c2f40813c05680f72e5f30cbb13617e8f994841
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41099
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Raul E Rangel 2020-05-06 11:47:04 -06:00 committed by Patrick Georgi
parent 5819eab5a6
commit 3f3f53cd5e
9 changed files with 200 additions and 147 deletions

View File

@ -156,6 +156,12 @@ static int path_eq(const struct device_path *path1,
case DEVICE_PATH_MMIO: case DEVICE_PATH_MMIO:
equal = (path1->mmio.addr == path2->mmio.addr); equal = (path1->mmio.addr == path2->mmio.addr);
break; break;
case DEVICE_PATH_ESPI:
equal = (path1->espi.addr == path2->espi.addr);
break;
case DEVICE_PATH_LPC:
equal = (path1->lpc.addr == path2->lpc.addr);
break;
default: default:
printk(BIOS_ERR, "Unknown device type: %d\n", path1->type); printk(BIOS_ERR, "Unknown device type: %d\n", path1->type);
break; break;

View File

@ -215,6 +215,14 @@ const char *dev_path(const struct device *dev)
snprintf(buffer, sizeof(buffer), "MMIO: %08lx", snprintf(buffer, sizeof(buffer), "MMIO: %08lx",
dev->path.mmio.addr); dev->path.mmio.addr);
break; break;
case DEVICE_PATH_ESPI:
snprintf(buffer, sizeof(buffer), "ESPI: %08lx",
dev->path.espi.addr);
break;
case DEVICE_PATH_LPC:
snprintf(buffer, sizeof(buffer), "LPC: %08lx",
dev->path.lpc.addr);
break;
default: default:
printk(BIOS_ERR, "Unknown device path type: %d\n", printk(BIOS_ERR, "Unknown device path type: %d\n",
dev->path.type); dev->path.type);

View File

@ -19,6 +19,8 @@ enum device_path_type {
DEVICE_PATH_SPI, DEVICE_PATH_SPI,
DEVICE_PATH_USB, DEVICE_PATH_USB,
DEVICE_PATH_MMIO, DEVICE_PATH_MMIO,
DEVICE_PATH_ESPI,
DEVICE_PATH_LPC,
/* /*
* When adding path types to this table, please also update the * When adding path types to this table, please also update the
@ -42,6 +44,8 @@ enum device_path_type {
"DEVICE_PATH_SPI", \ "DEVICE_PATH_SPI", \
"DEVICE_PATH_USB", \ "DEVICE_PATH_USB", \
"DEVICE_PATH_MMIO", \ "DEVICE_PATH_MMIO", \
"DEVICE_PATH_ESPI", \
"DEVICE_PATH_LPC", \
} }
struct domain_path { struct domain_path {
@ -104,6 +108,14 @@ struct mmio_path {
uintptr_t addr; uintptr_t addr;
}; };
struct espi_path {
uintptr_t addr;
};
struct lpc_path {
uintptr_t addr;
};
struct device_path { struct device_path {
enum device_path_type type; enum device_path_type type;
union { union {
@ -120,6 +132,8 @@ struct device_path {
struct spi_path spi; struct spi_path spi;
struct usb_path usb; struct usb_path usb;
struct mmio_path mmio; struct mmio_path mmio;
struct espi_path espi;
struct lpc_path lpc;
}; };
}; };

View File

@ -159,8 +159,10 @@ extern FILE *yyin, *yyout;
#define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2 #define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n) #define YY_LESS_LINENO(n)
#define YY_LINENO_REWIND_TO(ptr) #define YY_LINENO_REWIND_TO(ptr)
/* Return all but the first "n" matched characters back to the input stream. */ /* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \ #define yyless(n) \
do \ do \
@ -347,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 39 #define YY_NUM_RULES 41
#define YY_END_OF_BUFFER 40 #define YY_END_OF_BUFFER 42
/* 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
@ -356,26 +358,27 @@ 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[168] = static const flex_int16_t yy_accept[173] =
{ 0, { 0,
0, 0, 40, 38, 1, 3, 38, 38, 38, 33, 0, 0, 42, 40, 1, 3, 40, 40, 40, 35,
33, 31, 34, 38, 34, 34, 34, 38, 38, 38, 35, 33, 36, 40, 36, 36, 36, 40, 40, 40,
38, 38, 38, 38, 38, 38, 38, 38, 1, 3, 40, 40, 40, 40, 40, 40, 40, 40, 1, 3,
38, 0, 38, 38, 0, 2, 33, 34, 38, 38, 40, 0, 40, 40, 0, 2, 35, 36, 40, 40,
38, 38, 34, 38, 38, 38, 38, 38, 38, 38, 40, 40, 36, 40, 40, 40, 40, 40, 40, 40,
25, 38, 38, 38, 38, 38, 7, 38, 38, 38, 40, 27, 40, 40, 40, 40, 40, 40, 7, 40,
38, 38, 38, 38, 37, 37, 38, 0, 32, 38, 40, 40, 40, 40, 40, 40, 39, 39, 40, 0,
38, 17, 38, 38, 24, 29, 38, 38, 14, 38, 34, 40, 40, 17, 40, 40, 26, 31, 40, 40,
38, 23, 38, 38, 38, 8, 11, 13, 38, 38, 40, 14, 40, 40, 25, 40, 23, 40, 40, 8,
21, 38, 22, 38, 0, 35, 4, 38, 38, 38, 11, 13, 40, 40, 21, 40, 22, 40, 0, 37,
38, 38, 38, 38, 38, 38, 20, 38, 38, 38, 4, 40, 40, 40, 24, 40, 40, 40, 40, 40,
36, 36, 38, 38, 38, 38, 38, 38, 38, 15, 40, 20, 40, 40, 40, 38, 38, 40, 40, 40,
38, 38, 38, 38, 38, 5, 18, 38, 9, 38, 40, 40, 40, 40, 15, 40, 40, 40, 40, 40,
12, 38, 38, 38, 38, 38, 19, 27, 38, 38, 5, 18, 40, 9, 40, 12, 40, 40, 40, 40,
38, 38, 38, 38, 38, 38, 6, 38, 38, 38, 40, 19, 29, 40, 40, 40, 40, 40, 40, 40,
38, 10, 38, 38, 38, 26, 38, 38, 16, 38, 40, 6, 40, 40, 40, 40, 10, 40, 40, 40,
28, 38, 38, 38, 38, 30, 0 28, 40, 40, 16, 40, 30, 40, 40, 40, 40,
32, 0
} ; } ;
static const YY_CHAR yy_ec[256] = static const YY_CHAR yy_ec[256] =
@ -418,118 +421,118 @@ static const YY_CHAR yy_meta[39] =
1, 1, 1, 1, 1, 1, 1, 1 1, 1, 1, 1, 1, 1, 1, 1
} ; } ;
static const flex_int16_t yy_base[175] = static const flex_int16_t yy_base[180] =
{ 0, { 0,
0, 0, 235, 0, 232, 236, 230, 37, 41, 38, 0, 0, 240, 0, 237, 241, 235, 37, 41, 38,
195, 0, 44, 217, 54, 78, 60, 209, 204, 45, 200, 0, 44, 222, 54, 78, 60, 214, 209, 45,
211, 48, 42, 52, 206, 62, 193, 0, 223, 236, 49, 48, 42, 52, 212, 62, 199, 0, 229, 241,
88, 219, 93, 79, 220, 236, 0, 93, 104, 207, 93, 225, 98, 79, 226, 241, 0, 97, 104, 213,
196, 185, 96, 192, 187, 197, 188, 195, 195, 189, 202, 191, 110, 198, 193, 203, 192, 193, 200, 200,
195, 180, 180, 181, 183, 185, 0, 181, 175, 181, 194, 200, 185, 185, 195, 185, 187, 189, 0, 185,
185, 177, 183, 182, 0, 236, 115, 194, 0, 187, 179, 185, 189, 181, 187, 186, 0, 241, 125, 198,
167, 180, 170, 177, 0, 0, 172, 172, 0, 170, 0, 191, 171, 184, 174, 181, 0, 0, 172, 175,
160, 0, 164, 168, 158, 0, 0, 0, 161, 160, 175, 0, 173, 163, 0, 167, 0, 171, 161, 0,
0, 151, 0, 178, 177, 0, 0, 162, 161, 154, 0, 0, 164, 163, 0, 154, 0, 181, 180, 0,
146, 156, 144, 150, 155, 156, 0, 139, 142, 132, 0, 165, 164, 157, 0, 149, 159, 147, 153, 158,
0, 236, 143, 147, 139, 141, 137, 139, 144, 0, 159, 0, 142, 145, 135, 0, 241, 146, 150, 142,
128, 127, 127, 126, 123, 0, 0, 138, 0, 122, 144, 140, 142, 147, 0, 131, 130, 130, 129, 126,
139, 125, 132, 136, 117, 117, 0, 0, 124, 116, 0, 0, 141, 0, 125, 129, 115, 122, 126, 107,
115, 113, 124, 97, 98, 91, 0, 102, 100, 98, 107, 0, 0, 114, 106, 105, 103, 114, 100, 101,
83, 0, 80, 83, 74, 0, 60, 63, 0, 63, 94, 0, 105, 102, 99, 83, 0, 80, 83, 70,
0, 56, 51, 33, 29, 0, 236, 40, 132, 134, 0, 60, 71, 0, 74, 0, 63, 55, 39, 29,
136, 138, 140, 142 0, 241, 40, 146, 148, 150, 152, 154, 156
} ; } ;
static const flex_int16_t yy_def[175] = static const flex_int16_t yy_def[180] =
{ 0, { 0,
167, 1, 167, 168, 167, 167, 168, 169, 170, 168, 172, 1, 172, 173, 172, 172, 173, 174, 175, 173,
10, 168, 10, 168, 10, 10, 10, 168, 168, 168, 10, 173, 10, 173, 10, 10, 10, 173, 173, 173,
168, 168, 168, 168, 168, 168, 168, 168, 167, 167, 173, 173, 173, 173, 173, 173, 173, 173, 172, 172,
169, 171, 172, 170, 173, 167, 10, 10, 10, 168, 174, 176, 177, 175, 178, 172, 10, 10, 10, 173,
168, 168, 10, 168, 168, 168, 168, 168, 168, 168, 173, 173, 10, 173, 173, 173, 173, 173, 173, 173,
168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
168, 168, 168, 168, 168, 167, 172, 174, 39, 168, 173, 173, 173, 173, 173, 173, 173, 172, 177, 179,
168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 39, 173, 173, 173, 173, 173, 173, 173, 173, 173,
168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
168, 168, 168, 168, 167, 168, 168, 168, 168, 168, 173, 173, 173, 173, 173, 173, 173, 173, 172, 173,
168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
168, 167, 168, 168, 168, 168, 168, 168, 168, 168, 173, 173, 173, 173, 173, 173, 172, 173, 173, 173,
168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
168, 168, 168, 168, 168, 168, 0, 167, 167, 167, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
167, 167, 167, 167 173, 0, 172, 172, 172, 172, 172, 172, 172
} ; } ;
static const flex_int16_t yy_nxt[275] = static const flex_int16_t yy_nxt[280] =
{ 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, 13, 13, 15, 16,
17, 13, 18, 19, 20, 21, 22, 4, 23, 24, 17, 13, 18, 19, 20, 21, 22, 4, 23, 24,
4, 25, 26, 4, 27, 4, 4, 4, 32, 32, 4, 25, 26, 4, 27, 4, 4, 4, 32, 32,
28, 33, 35, 36, 37, 37, 37, 166, 38, 38, 28, 33, 35, 36, 37, 37, 37, 171, 38, 38,
38, 38, 38, 49, 38, 38, 38, 38, 38, 38, 38, 38, 38, 50, 38, 38, 38, 38, 38, 38,
38, 38, 38, 56, 54, 165, 38, 38, 38, 57, 38, 38, 38, 58, 56, 54, 38, 38, 38, 59,
58, 164, 50, 51, 55, 163, 52, 41, 162, 59, 60, 170, 51, 52, 57, 169, 53, 41, 55, 61,
35, 36, 161, 42, 38, 38, 38, 46, 61, 32, 35, 36, 168, 42, 38, 38, 38, 46, 63, 167,
32, 62, 65, 160, 68, 68, 63, 28, 43, 38, 166, 64, 47, 165, 32, 32, 65, 67, 43, 70,
38, 38, 38, 38, 38, 159, 44, 158, 157, 45, 70, 164, 28, 38, 38, 38, 44, 163, 162, 45,
69, 69, 69, 156, 69, 69, 68, 68, 155, 94, 71, 71, 71, 161, 71, 71, 38, 38, 38, 160,
69, 69, 69, 69, 69, 69, 154, 153, 152, 151, 71, 71, 71, 71, 71, 71, 70, 70, 159, 98,
150, 73, 31, 31, 34, 34, 32, 32, 67, 67, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149,
35, 35, 68, 68, 149, 148, 147, 146, 145, 144, 148, 147, 146, 145, 144, 75, 31, 31, 34, 34,
143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 32, 32, 69, 69, 35, 35, 70, 70, 143, 142,
133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132,
123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122,
113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112,
103, 102, 101, 100, 99, 98, 97, 96, 95, 93, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102,
92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 101, 100, 99, 97, 96, 95, 94, 93, 92, 91,
82, 81, 80, 79, 78, 77, 76, 75, 74, 72, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81,
71, 70, 36, 66, 29, 64, 60, 53, 48, 47, 80, 79, 78, 77, 76, 74, 73, 72, 36, 68,
40, 39, 30, 29, 167, 3, 167, 167, 167, 167, 29, 66, 62, 49, 48, 40, 39, 30, 29, 172,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 3, 172, 172, 172, 172, 172, 172, 172, 172, 172,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
167, 167, 167, 167 172, 172, 172, 172, 172, 172, 172, 172, 172
} ; } ;
static const flex_int16_t yy_chk[275] = static const flex_int16_t yy_chk[280] =
{ 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, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8,
168, 8, 9, 9, 10, 10, 10, 165, 10, 10, 173, 8, 9, 9, 10, 10, 10, 170, 10, 10,
13, 13, 13, 20, 10, 10, 10, 10, 10, 10, 13, 13, 13, 20, 10, 10, 10, 10, 10, 10,
15, 15, 15, 23, 22, 164, 17, 17, 17, 23, 15, 15, 15, 23, 22, 21, 17, 17, 17, 23,
24, 163, 20, 20, 22, 162, 20, 15, 160, 24, 24, 169, 20, 20, 22, 168, 20, 15, 21, 24,
34, 34, 158, 15, 16, 16, 16, 17, 26, 31, 34, 34, 167, 15, 16, 16, 16, 17, 26, 165,
31, 26, 31, 157, 33, 33, 26, 33, 16, 38, 163, 26, 17, 162, 31, 31, 26, 31, 16, 33,
38, 38, 43, 43, 43, 155, 16, 154, 153, 16, 33, 160, 33, 38, 38, 38, 16, 159, 158, 16,
39, 39, 39, 151, 39, 39, 67, 67, 150, 67, 39, 39, 39, 156, 39, 39, 43, 43, 43, 155,
39, 39, 39, 39, 39, 39, 149, 148, 146, 145, 39, 39, 39, 39, 39, 39, 69, 69, 154, 69,
144, 43, 169, 169, 170, 170, 171, 171, 172, 172, 153, 151, 150, 149, 148, 147, 146, 145, 144, 141,
173, 173, 174, 174, 143, 142, 141, 140, 139, 136, 140, 139, 138, 137, 136, 43, 174, 174, 175, 175,
135, 134, 133, 132, 131, 130, 128, 125, 124, 123, 176, 176, 177, 177, 178, 178, 179, 179, 135, 133,
122, 121, 119, 118, 117, 116, 115, 114, 113, 110, 130, 129, 128, 127, 126, 124, 123, 122, 121, 120,
109, 108, 106, 105, 104, 103, 102, 101, 100, 99, 119, 118, 115, 114, 113, 111, 110, 109, 108, 107,
98, 95, 94, 92, 90, 89, 85, 84, 83, 81, 106, 104, 103, 102, 99, 98, 96, 94, 93, 89,
80, 78, 77, 74, 73, 72, 71, 70, 68, 64, 88, 86, 84, 83, 81, 80, 79, 76, 75, 74,
63, 62, 61, 60, 59, 58, 56, 55, 54, 53, 73, 72, 70, 66, 65, 64, 63, 62, 61, 60,
52, 51, 50, 49, 48, 47, 46, 45, 44, 42, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49,
41, 40, 35, 32, 29, 27, 25, 21, 19, 18, 48, 47, 46, 45, 44, 42, 41, 40, 35, 32,
14, 11, 7, 5, 3, 167, 167, 167, 167, 167, 29, 27, 25, 19, 18, 14, 11, 7, 5, 3,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
167, 167, 167, 167 172, 172, 172, 172, 172, 172, 172, 172, 172
} ; } ;
static yy_state_type yy_last_accepting_state; static yy_state_type yy_last_accepting_state;
@ -807,13 +810,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 >= 168 ) if ( yy_current_state >= 173 )
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] != 236 ); while ( yy_base[yy_current_state] != 241 );
yy_find_action: yy_find_action:
yy_act = yy_accept[yy_current_state]; yy_act = yy_accept[yy_current_state];
@ -929,47 +932,47 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 23: case 23:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=IRQ; return(RESOURCE);} {yylval.number=LPC; return(BUS);}
YY_BREAK YY_BREAK
case 24: case 24:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=DRQ; return(RESOURCE);} {yylval.number=ESPI; return(BUS);}
YY_BREAK YY_BREAK
case 25: case 25:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.number=IO; return(RESOURCE);} {yylval.number=IRQ; return(RESOURCE);}
YY_BREAK YY_BREAK
case 26: case 26:
YY_RULE_SETUP YY_RULE_SETUP
{return(IOAPIC_IRQ);} {yylval.number=DRQ; return(RESOURCE);}
YY_BREAK YY_BREAK
case 27: case 27:
YY_RULE_SETUP YY_RULE_SETUP
{return(INHERIT);} {yylval.number=IO; return(RESOURCE);}
YY_BREAK YY_BREAK
case 28: case 28:
YY_RULE_SETUP YY_RULE_SETUP
{return(SUBSYSTEMID);} {return(IOAPIC_IRQ);}
YY_BREAK YY_BREAK
case 29: case 29:
YY_RULE_SETUP YY_RULE_SETUP
{return(END);} {return(INHERIT);}
YY_BREAK YY_BREAK
case 30: case 30:
YY_RULE_SETUP YY_RULE_SETUP
{return(SLOT_DESC);} {return(SUBSYSTEMID);}
YY_BREAK YY_BREAK
case 31: case 31:
YY_RULE_SETUP YY_RULE_SETUP
{return(EQUALS);} {return(END);}
YY_BREAK YY_BREAK
case 32: case 32:
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 33: case 33:
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 34: case 34:
YY_RULE_SETUP YY_RULE_SETUP
@ -977,23 +980,31 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 35: case 35:
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 36: case 36:
/* rule 36 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 37: case 37:
/* rule 37 can match eol */ YY_RULE_SETUP
{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);}
YY_BREAK
case 38:
/* rule 38 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+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
YY_BREAK YY_BREAK
case 38: case 39:
/* rule 39 can match eol */
YY_RULE_SETUP
{yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
YY_BREAK
case 40:
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(STRING);}
YY_BREAK YY_BREAK
case 39: case 41:
YY_RULE_SETUP YY_RULE_SETUP
ECHO; ECHO;
YY_BREAK YY_BREAK
@ -1293,7 +1304,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 >= 168 ) if ( yy_current_state >= 173 )
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];
@ -1321,11 +1332,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 >= 168 ) if ( yy_current_state >= 173 )
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 == 167); yy_is_jam = (yy_current_state == 172);
return yy_is_jam ? 0 : yy_current_state; return yy_is_jam ? 0 : yy_current_state;
} }

View File

@ -493,6 +493,14 @@ struct device *new_device(struct bus *parent,
case MMIO: case MMIO:
new_d->path = ".type=DEVICE_PATH_MMIO,{.mmio={ .addr = 0x%x }}"; new_d->path = ".type=DEVICE_PATH_MMIO,{.mmio={ .addr = 0x%x }}";
break; break;
case ESPI:
new_d->path = ".type=DEVICE_PATH_ESPI,{.espi={ .addr = 0x%x }}";
break;
case LPC:
new_d->path = ".type=DEVICE_PATH_LPC,{.lpc={ .addr = 0x%x }}";
break;
} }
return new_d; return new_d;

View File

@ -30,6 +30,8 @@ generic {yylval.number=GENERIC; return(BUS);}
mmio {yylval.number=MMIO; return(BUS);} mmio {yylval.number=MMIO; return(BUS);}
spi {yylval.number=SPI; return(BUS);} spi {yylval.number=SPI; return(BUS);}
usb {yylval.number=USB; return(BUS);} usb {yylval.number=USB; return(BUS);}
lpc {yylval.number=LPC; return(BUS);}
espi {yylval.number=ESPI; return(BUS);}
irq {yylval.number=IRQ; return(RESOURCE);} irq {yylval.number=IRQ; return(RESOURCE);}
drq {yylval.number=DRQ; return(RESOURCE);} drq {yylval.number=DRQ; return(RESOURCE);}
io {yylval.number=IO; return(RESOURCE);} io {yylval.number=IO; return(RESOURCE);}

View File

@ -158,7 +158,9 @@ extern int yydebug;
GENERIC = 287, GENERIC = 287,
SPI = 288, SPI = 288,
USB = 289, USB = 289,
MMIO = 290 MMIO = 290,
LPC = 291,
ESPI = 292
}; };
#endif #endif
@ -493,7 +495,7 @@ union yyalloc
#define YYLAST 45 #define YYLAST 45
/* YYNTOKENS -- Number of terminals. */ /* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 36 #define YYNTOKENS 38
/* YYNNTS -- Number of nonterminals. */ /* YYNNTS -- Number of nonterminals. */
#define YYNNTS 15 #define YYNNTS 15
/* YYNRULES -- Number of rules. */ /* YYNRULES -- Number of rules. */
@ -502,7 +504,7 @@ union yyalloc
#define YYNSTATES 50 #define YYNSTATES 50
#define YYUNDEFTOK 2 #define YYUNDEFTOK 2
#define YYMAXUTOK 290 #define YYMAXUTOK 292
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
@ -543,7 +545,7 @@ 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 35, 36, 37
}; };
#if YYDEBUG #if YYDEBUG
@ -565,10 +567,10 @@ static const char *const yytname[] =
"STATUS", "MANDATORY", "BUS", "RESOURCE", "END", "EQUALS", "HEX", "STATUS", "MANDATORY", "BUS", "RESOURCE", "END", "EQUALS", "HEX",
"STRING", "PCI", "PNP", "I2C", "APIC", "CPU_CLUSTER", "CPU", "DOMAIN", "STRING", "PCI", "PNP", "I2C", "APIC", "CPU_CLUSTER", "CPU", "DOMAIN",
"IRQ", "DRQ", "SLOT_DESC", "IO", "NUMBER", "SUBSYSTEMID", "INHERIT", "IRQ", "DRQ", "SLOT_DESC", "IO", "NUMBER", "SUBSYSTEMID", "INHERIT",
"IOAPIC_IRQ", "IOAPIC", "PCIINT", "GENERIC", "SPI", "USB", "MMIO", "IOAPIC_IRQ", "IOAPIC", "PCIINT", "GENERIC", "SPI", "USB", "MMIO", "LPC",
"$accept", "devtree", "$@1", "chipchildren", "devicechildren", "chip", "ESPI", "$accept", "devtree", "$@1", "chipchildren", "devicechildren",
"@2", "device", "@3", "status", "resource", "registers", "subsystemid", "chip", "@2", "device", "@3", "status", "resource", "registers",
"ioapic_irq", "smbios_slot_desc", YY_NULLPTR "subsystemid", "ioapic_irq", "smbios_slot_desc", YY_NULLPTR
}; };
#endif #endif
@ -580,7 +582,7 @@ static const yytype_int16 yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
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 285, 286, 287, 288, 289, 290, 291, 292
}; };
# endif # endif
@ -656,19 +658,19 @@ static const yytype_int8 yycheck[] =
symbol of state STATE-NUM. */ symbol of state STATE-NUM. */
static const yytype_int8 yystos[] = static const yytype_int8 yystos[] =
{ {
0, 37, 38, 0, 3, 41, 14, 42, 39, 4, 0, 39, 40, 0, 3, 43, 14, 44, 41, 4,
5, 11, 41, 43, 47, 9, 14, 26, 12, 6, 5, 11, 43, 45, 49, 9, 14, 26, 12, 6,
7, 45, 14, 44, 40, 10, 11, 24, 27, 29, 7, 47, 14, 46, 42, 10, 11, 24, 27, 29,
41, 43, 46, 47, 48, 49, 50, 26, 14, 26, 43, 45, 48, 49, 50, 51, 52, 26, 14, 26,
26, 12, 14, 26, 31, 26, 14, 28, 26, 14 26, 12, 14, 26, 31, 26, 14, 28, 26, 14
}; };
/* 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, 36, 38, 37, 39, 39, 39, 39, 40, 40, 0, 38, 40, 39, 41, 41, 41, 41, 42, 42,
40, 40, 40, 40, 40, 40, 42, 41, 44, 43, 42, 42, 42, 42, 42, 42, 44, 43, 46, 45,
45, 45, 46, 47, 48, 48, 49, 50, 50, 50 47, 47, 48, 49, 50, 50, 51, 52, 52, 52
}; };
/* 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. */

View File

@ -81,7 +81,9 @@ extern int yydebug;
GENERIC = 287, GENERIC = 287,
SPI = 288, SPI = 288,
USB = 289, USB = 289,
MMIO = 290 MMIO = 290,
LPC = 291,
ESPI = 292
}; };
#endif #endif

View File

@ -18,7 +18,7 @@ static struct chip_instance *cur_chip_instance;
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 %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
%% %%
devtree: { cur_parent = root_parent; } chip; devtree: { cur_parent = root_parent; } chip;