SMBIOS/SCONFIG: Allow devtree-defined Type 41 entries

Introduce the `smbios_dev_info` devicetree keyword to specify the
instance ID and RefDes (Reference Designation) of onboard devices.

Example syntax:

 device pci 1c.0 on	# PCIe Port #1
 	device pci 00.0 on
 		smbios_dev_info 6
 	end
 end
 device pci 1c.1 on	# PCIe Port #2
 	device pci 00.0 on
 		smbios_dev_info 42 "PCIe-PCI Time Machine"
 	end
 end

The `SMBIOS_TYPE41_PROVIDED_BY_DEVTREE` Kconfig option enables using
this syntax to control the generated Type 41 entries. When this option
is enabled, Type 41 entries are only autogenerated for devices with a
defined instance ID. This avoids having to keep track of which instance
IDs have been used for every device class.

Using `smbios_dev_info` when `SMBIOS_TYPE41_PROVIDED_BY_DEVTREE` is not
enabled will result in a build-time error, as the syntax is meaningless
in this case. This is done with preprocessor guards around the Type 41
members in `struct device` and the code which uses the guarded members.
Although the preprocessor usage isn't particularly elegant, adjusting
the devicetree syntax and/or grammar depending on a Kconfig option is
probably even worse.

Change-Id: Iecca9ada6ee1000674cb5dd7afd5c309d8e1a64b
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57370
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Angel Pons
2021-09-03 16:51:40 +02:00
committed by Patrick Georgi
parent bb03e763de
commit 437da71d0a
10 changed files with 492 additions and 386 deletions

View File

@ -785,6 +785,21 @@ config GENERATE_SMBIOS_TABLES
If unsure, say Y. If unsure, say Y.
config SMBIOS_TYPE41_PROVIDED_BY_DEVTREE
bool
depends on ARCH_X86
help
If enabled, only generate SMBIOS Type 41 entries for PCI devices in
the devicetree for which Type 41 information is provided, e.g. with
the `smbios_dev_info` devicetree syntax. This is useful to manually
assign specific instance IDs to onboard devices irrespective of the
device traversal order. It is assumed that instance IDs for devices
of the same class are unique.
When disabled, coreboot autogenerates SMBIOS Type 41 entries for all
appropriate PCI devices in the devicetree. Instance IDs are assigned
successive numbers from a monotonically increasing counter, with one
counter for each device class.
config SMBIOS_PROVIDED_BY_MOBO config SMBIOS_PROVIDED_BY_MOBO
bool bool
default n default n

View File

@ -1177,30 +1177,55 @@ static u8 smbios_get_device_type_from_dev(struct device *dev)
} }
} }
static bool smbios_get_type41_instance_id(struct device *dev, u8 device_type, u8 *instance_id)
{
#if CONFIG(SMBIOS_TYPE41_PROVIDED_BY_DEVTREE)
*instance_id = dev->smbios_instance_id;
return dev->smbios_instance_id_valid;
#else
static u8 type41_inst_cnt[SMBIOS_DEVICE_TYPE_COUNT + 1] = {};
if (device_type == SMBIOS_DEVICE_TYPE_OTHER ||
device_type == SMBIOS_DEVICE_TYPE_UNKNOWN)
return false;
if (device_type > SMBIOS_DEVICE_TYPE_COUNT)
return false;
*instance_id = type41_inst_cnt[device_type]++;
return true;
#endif
}
static const char *smbios_get_type41_refdes(struct device *dev)
{
#if CONFIG(SMBIOS_TYPE41_PROVIDED_BY_DEVTREE)
if (dev->smbios_refdes)
return dev->smbios_refdes;
#endif
return get_pci_subclass_name(dev);
}
static int smbios_generate_type41_from_devtree(struct device *dev, int *handle, static int smbios_generate_type41_from_devtree(struct device *dev, int *handle,
unsigned long *current) unsigned long *current)
{ {
static u8 type41_inst_cnt[SMBIOS_DEVICE_TYPE_COUNT + 1] = {};
if (dev->path.type != DEVICE_PATH_PCI) if (dev->path.type != DEVICE_PATH_PCI)
return 0; return 0;
if (!dev->on_mainboard) if (!dev->on_mainboard)
return 0; return 0;
u8 device_type = smbios_get_device_type_from_dev(dev); const u8 device_type = smbios_get_device_type_from_dev(dev);
if (device_type == SMBIOS_DEVICE_TYPE_OTHER || u8 instance_id;
device_type == SMBIOS_DEVICE_TYPE_UNKNOWN)
if (!smbios_get_type41_instance_id(dev, device_type, &instance_id))
return 0; return 0;
if (device_type > SMBIOS_DEVICE_TYPE_COUNT) const char *name = smbios_get_type41_refdes(dev);
return 0;
const char *name = get_pci_subclass_name(dev);
return smbios_write_type41(current, handle, return smbios_write_type41(current, handle,
name, // name name, // name
type41_inst_cnt[device_type]++, // inst instance_id, // inst
0, // segment 0, // segment
dev->bus->secondary, //bus dev->bus->secondary, //bus
PCI_SLOT(dev->path.pci.devfn), // device PCI_SLOT(dev->path.pci.devfn), // device

View File

@ -148,6 +148,17 @@ struct device {
u8 smbios_slot_data_width; u8 smbios_slot_data_width;
u8 smbios_slot_length; u8 smbios_slot_length;
const char *smbios_slot_designation; const char *smbios_slot_designation;
#if CONFIG(SMBIOS_TYPE41_PROVIDED_BY_DEVTREE)
/*
* These fields are intentionally guarded so that attempts to use
* the corresponding devicetree syntax without selecting the Kconfig
* option result in build-time errors. Smaller size is a side effect.
*/
bool smbios_instance_id_valid;
u8 smbios_instance_id;
const char *smbios_refdes;
#endif
#endif #endif
#endif #endif
DEVTREE_CONST void *chip_info; DEVTREE_CONST void *chip_info;

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 49 #define YY_NUM_RULES 50
#define YY_END_OF_BUFFER 50 #define YY_END_OF_BUFFER 51
/* 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,31 +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[202] = static const flex_int16_t yy_accept[210] =
{ 0, { 0,
0, 0, 50, 48, 1, 3, 48, 48, 48, 43, 0, 0, 51, 49, 1, 3, 49, 49, 49, 44,
43, 40, 44, 48, 44, 44, 44, 44, 44, 48, 44, 41, 45, 49, 45, 45, 45, 45, 45, 49,
48, 48, 48, 48, 48, 48, 48, 48, 48, 41, 49, 49, 49, 49, 49, 49, 49, 49, 49, 42,
48, 1, 3, 48, 0, 48, 48, 0, 2, 43, 49, 1, 3, 49, 0, 49, 49, 0, 2, 44,
44, 48, 48, 48, 9, 48, 48, 44, 48, 48, 45, 49, 49, 49, 9, 49, 49, 45, 49, 49,
48, 48, 48, 48, 48, 48, 48, 48, 34, 48, 49, 49, 49, 49, 49, 49, 49, 49, 34, 49,
48, 48, 48, 48, 15, 48, 48, 48, 48, 48, 49, 49, 49, 49, 15, 49, 49, 49, 49, 49,
48, 48, 48, 48, 47, 47, 48, 0, 42, 48, 49, 49, 49, 49, 48, 48, 49, 0, 43, 49,
48, 48, 25, 48, 48, 33, 38, 48, 48, 48, 49, 49, 25, 49, 49, 33, 38, 49, 49, 49,
48, 48, 22, 48, 48, 32, 48, 48, 48, 16, 49, 49, 22, 49, 49, 32, 49, 49, 49, 16,
48, 19, 21, 48, 8, 48, 48, 29, 48, 30, 49, 19, 21, 49, 8, 49, 49, 29, 49, 30,
7, 48, 0, 45, 48, 4, 48, 48, 48, 48, 7, 49, 0, 46, 49, 4, 49, 49, 49, 49,
48, 48, 31, 48, 48, 48, 48, 48, 28, 48, 49, 49, 31, 49, 49, 49, 49, 49, 28, 49,
48, 48, 48, 48, 46, 46, 6, 48, 48, 48, 49, 49, 49, 49, 47, 47, 6, 49, 49, 49,
12, 48, 48, 48, 48, 48, 23, 48, 48, 14, 12, 49, 49, 49, 49, 49, 23, 49, 49, 14,
48, 48, 48, 48, 5, 26, 48, 48, 17, 48, 49, 49, 49, 49, 5, 26, 49, 49, 17, 49,
20, 48, 13, 48, 48, 48, 48, 48, 27, 36, 20, 49, 13, 49, 49, 49, 49, 49, 27, 36,
48, 48, 48, 48, 48, 48, 48, 48, 48, 10, 49, 49, 49, 49, 49, 49, 49, 49, 49, 10,
48, 48, 48, 11, 48, 18, 48, 48, 48, 35, 49, 49, 49, 49, 11, 49, 18, 49, 49, 49,
48, 48, 24, 48, 37, 48, 48, 48, 48, 39, 49, 35, 49, 49, 49, 24, 49, 49, 37, 49,
0 49, 49, 49, 49, 49, 40, 49, 39, 0
} ; } ;
static const YY_CHAR yy_ec[256] = static const YY_CHAR yy_ec[256] =
@ -425,136 +425,140 @@ static const YY_CHAR yy_meta[41] =
1, 1, 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[209] = static const flex_int16_t yy_base[217] =
{ 0, { 0,
0, 0, 274, 0, 271, 275, 269, 39, 43, 40, 0, 0, 282, 0, 279, 283, 277, 39, 43, 40,
233, 0, 46, 256, 56, 60, 64, 67, 72, 56, 241, 0, 46, 264, 56, 60, 64, 67, 72, 56,
244, 74, 251, 39, 70, 59, 246, 77, 233, 0, 252, 74, 259, 39, 70, 59, 254, 77, 241, 0,
0, 263, 275, 108, 259, 112, 116, 260, 275, 0, 0, 271, 283, 108, 267, 112, 116, 268, 283, 0,
113, 116, 247, 236, 0, 235, 224, 122, 231, 226, 113, 116, 255, 244, 0, 243, 232, 122, 239, 234,
236, 234, 238, 225, 227, 231, 231, 225, 231, 216, 244, 242, 246, 233, 235, 239, 239, 233, 239, 224,
216, 217, 219, 221, 0, 208, 216, 210, 210, 117, 224, 225, 227, 229, 0, 216, 224, 218, 218, 117,
220, 212, 218, 87, 0, 275, 139, 230, 0, 223, 228, 220, 226, 87, 0, 283, 139, 238, 0, 231,
216, 202, 215, 205, 212, 0, 0, 202, 208, 205, 224, 210, 223, 213, 220, 0, 0, 210, 216, 213,
196, 204, 0, 202, 192, 0, 196, 200, 190, 0, 204, 212, 0, 210, 200, 0, 204, 208, 198, 0,
193, 0, 0, 199, 0, 191, 190, 0, 181, 0, 201, 0, 0, 207, 0, 199, 198, 0, 189, 0,
0, 208, 207, 0, 178, 0, 191, 190, 183, 187, 0, 216, 215, 0, 186, 0, 199, 198, 191, 195,
177, 173, 0, 183, 171, 177, 182, 183, 0, 170, 185, 181, 0, 191, 179, 185, 190, 191, 0, 178,
177, 164, 167, 156, 0, 275, 0, 168, 172, 164, 185, 172, 175, 164, 0, 283, 0, 176, 180, 172,
0, 163, 165, 161, 163, 168, 0, 152, 157, 0, 0, 171, 173, 169, 171, 176, 0, 160, 165, 0,
150, 150, 149, 146, 0, 0, 158, 160, 0, 144, 158, 158, 157, 154, 0, 0, 166, 168, 0, 152,
161, 147, 0, 154, 158, 139, 139, 146, 0, 0, 169, 155, 0, 162, 166, 147, 147, 154, 0, 0,
132, 124, 123, 121, 132, 118, 128, 118, 110, 0, 153, 145, 144, 68, 154, 140, 150, 140, 132, 0,
122, 120, 125, 0, 114, 0, 114, 107, 94, 0, 136, 130, 128, 133, 0, 122, 0, 116, 122, 125,
82, 81, 0, 83, 0, 74, 67, 37, 31, 0, 117, 0, 132, 113, 126, 0, 120, 127, 0, 104,
275, 42, 158, 160, 162, 164, 166, 168 106, 94, 78, 65, 37, 0, 31, 0, 283, 42,
158, 160, 162, 164, 166, 168
} ; } ;
static const flex_int16_t yy_def[209] = static const flex_int16_t yy_def[217] =
{ 0, { 0,
201, 1, 201, 202, 201, 201, 202, 203, 204, 202, 209, 1, 209, 210, 209, 209, 210, 211, 212, 210,
10, 202, 10, 202, 10, 10, 10, 10, 10, 202, 10, 210, 10, 210, 10, 10, 10, 10, 10, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
202, 201, 201, 203, 205, 206, 204, 207, 201, 10, 210, 209, 209, 211, 213, 214, 212, 215, 209, 10,
10, 10, 202, 202, 202, 202, 202, 10, 202, 202, 10, 10, 210, 210, 210, 210, 210, 10, 210, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
202, 202, 202, 202, 202, 201, 206, 208, 42, 202, 210, 210, 210, 210, 210, 209, 214, 216, 42, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
202, 202, 201, 202, 202, 202, 202, 202, 202, 202, 210, 210, 209, 210, 210, 210, 210, 210, 210, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
202, 202, 202, 202, 202, 201, 202, 202, 202, 202, 210, 210, 210, 210, 210, 209, 210, 210, 210, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
0, 201, 201, 201, 201, 201, 201, 201 210, 210, 210, 210, 210, 210, 210, 210, 0, 209,
209, 209, 209, 209, 209, 209
} ; } ;
static const flex_int16_t yy_nxt[316] = static const flex_int16_t yy_nxt[324] =
{ 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, 15, 13, 16, 17, 13, 13, 14, 4, 4, 4, 15, 13, 16, 17,
18, 19, 20, 21, 22, 23, 24, 4, 25, 26, 18, 19, 20, 21, 22, 23, 24, 4, 25, 26,
4, 27, 28, 4, 29, 4, 4, 4, 4, 30, 4, 27, 28, 4, 29, 4, 4, 4, 4, 30,
35, 35, 31, 36, 38, 39, 40, 40, 40, 200, 35, 35, 31, 36, 38, 39, 40, 40, 40, 208,
41, 41, 41, 41, 41, 62, 41, 41, 41, 41, 41, 41, 41, 41, 41, 62, 41, 41, 41, 41,
41, 41, 41, 41, 41, 63, 41, 41, 41, 199, 41, 41, 41, 41, 41, 63, 41, 41, 41, 207,
41, 41, 41, 41, 41, 41, 54, 67, 41, 41, 41, 41, 41, 41, 41, 41, 54, 67, 41, 41,
41, 44, 57, 46, 48, 55, 68, 198, 45, 47, 41, 44, 57, 46, 48, 55, 68, 181, 45, 47,
69, 64, 49, 197, 51, 50, 52, 65, 196, 66, 69, 64, 49, 206, 51, 50, 52, 65, 205, 66,
195, 58, 59, 71, 110, 60, 72, 111, 53, 35, 182, 58, 59, 71, 110, 60, 72, 111, 53, 35,
35, 73, 75, 78, 78, 194, 31, 38, 39, 41, 35, 73, 75, 78, 78, 204, 31, 38, 39, 41,
41, 41, 79, 79, 79, 193, 79, 79, 41, 41, 41, 41, 79, 79, 79, 203, 79, 79, 41, 41,
41, 192, 79, 79, 79, 79, 79, 79, 105, 106, 41, 202, 79, 79, 79, 79, 79, 79, 105, 106,
78, 78, 191, 112, 190, 189, 188, 187, 186, 185, 78, 78, 201, 112, 200, 199, 198, 197, 196, 195,
184, 183, 182, 181, 180, 179, 178, 84, 34, 34, 194, 193, 192, 191, 190, 189, 188, 84, 34, 34,
37, 37, 35, 35, 77, 77, 38, 38, 78, 78, 37, 37, 35, 35, 77, 77, 38, 38, 78, 78,
177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 187, 186, 185, 184, 183, 180, 179, 178, 177, 176,
167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166,
157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156,
147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146,
137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136,
127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126,
117, 116, 115, 114, 113, 109, 108, 107, 104, 103, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116,
102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 115, 114, 113, 109, 108, 107, 104, 103, 102, 101,
92, 91, 90, 89, 88, 87, 86, 85, 83, 82, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91,
81, 80, 39, 76, 32, 74, 70, 61, 56, 43, 90, 89, 88, 87, 86, 85, 83, 82, 81, 80,
42, 33, 32, 201, 3, 201, 201, 201, 201, 201, 39, 76, 32, 74, 70, 61, 56, 43, 42, 33,
201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 32, 209, 3, 209, 209, 209, 209, 209, 209, 209,
201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
201, 201, 201, 201, 201 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
209, 209, 209
} ; } ;
static const flex_int16_t yy_chk[316] = static const flex_int16_t yy_chk[324] =
{ 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
8, 8, 202, 8, 9, 9, 10, 10, 10, 199, 8, 8, 210, 8, 9, 9, 10, 10, 10, 207,
10, 10, 13, 13, 13, 24, 10, 10, 10, 10, 10, 10, 13, 13, 13, 24, 10, 10, 10, 10,
10, 10, 15, 15, 15, 24, 16, 16, 16, 198, 10, 10, 15, 15, 15, 24, 16, 16, 16, 205,
17, 17, 17, 18, 18, 18, 20, 26, 19, 19, 17, 17, 17, 18, 18, 18, 20, 26, 19, 19,
19, 15, 22, 16, 17, 20, 26, 197, 15, 16, 19, 15, 22, 16, 17, 20, 26, 174, 15, 16,
26, 25, 17, 196, 18, 17, 19, 25, 194, 25, 26, 25, 17, 204, 18, 17, 19, 25, 203, 25,
192, 22, 22, 28, 74, 22, 28, 74, 19, 34, 174, 22, 22, 28, 74, 22, 28, 74, 19, 34,
34, 28, 34, 36, 36, 191, 36, 37, 37, 41, 34, 28, 34, 36, 36, 202, 36, 37, 37, 41,
41, 41, 42, 42, 42, 189, 42, 42, 48, 48, 41, 41, 42, 42, 42, 201, 42, 42, 48, 48,
48, 188, 42, 42, 42, 42, 42, 42, 70, 70, 48, 200, 42, 42, 42, 42, 42, 42, 70, 70,
77, 77, 187, 77, 185, 183, 182, 181, 179, 178, 77, 77, 198, 77, 197, 195, 194, 193, 191, 190,
177, 176, 175, 174, 173, 172, 171, 48, 203, 203, 189, 188, 186, 184, 183, 182, 181, 48, 211, 211,
204, 204, 205, 205, 206, 206, 207, 207, 208, 208, 212, 212, 213, 213, 214, 214, 215, 215, 216, 216,
168, 167, 166, 165, 164, 162, 161, 160, 158, 157, 179, 178, 177, 176, 175, 173, 172, 171, 168, 167,
154, 153, 152, 151, 149, 148, 146, 145, 144, 143, 166, 165, 164, 162, 161, 160, 158, 157, 154, 153,
142, 140, 139, 138, 134, 133, 132, 131, 130, 128, 152, 151, 149, 148, 146, 145, 144, 143, 142, 140,
127, 126, 125, 124, 122, 121, 120, 119, 118, 117, 139, 138, 134, 133, 132, 131, 130, 128, 127, 126,
115, 113, 112, 109, 107, 106, 104, 101, 99, 98, 125, 124, 122, 121, 120, 119, 118, 117, 115, 113,
97, 95, 94, 92, 91, 90, 89, 88, 85, 84, 112, 109, 107, 106, 104, 101, 99, 98, 97, 95,
83, 82, 81, 80, 78, 73, 72, 71, 69, 68, 94, 92, 91, 90, 89, 88, 85, 84, 83, 82,
67, 66, 64, 63, 62, 61, 60, 59, 58, 57, 81, 80, 78, 73, 72, 71, 69, 68, 67, 66,
56, 55, 54, 53, 52, 51, 50, 49, 47, 46, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55,
44, 43, 38, 35, 32, 29, 27, 23, 21, 14, 54, 53, 52, 51, 50, 49, 47, 46, 44, 43,
11, 7, 5, 3, 201, 201, 201, 201, 201, 201, 38, 35, 32, 29, 27, 23, 21, 14, 11, 7,
201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 5, 3, 209, 209, 209, 209, 209, 209, 209, 209,
201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
201, 201, 201, 201, 201 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
209, 209, 209
} ; } ;
static yy_state_type yy_last_accepting_state; static yy_state_type yy_last_accepting_state;
@ -819,13 +823,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 >= 202 ) if ( yy_current_state >= 210 )
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] != 275 ); while ( yy_base[yy_current_state] != 283 );
yy_find_action: yy_find_action:
yy_act = yy_accept[yy_current_state]; yy_act = yy_accept[yy_current_state];
@ -1009,15 +1013,15 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 40: case 40:
YY_RULE_SETUP YY_RULE_SETUP
{return(EQUALS);} {return(SMBIOS_DEV_INFO);}
YY_BREAK YY_BREAK
case 41: case 41:
YY_RULE_SETUP YY_RULE_SETUP
{return(PIPE);} {return(EQUALS);}
YY_BREAK YY_BREAK
case 42: case 42:
YY_RULE_SETUP YY_RULE_SETUP
{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} {return(PIPE);}
YY_BREAK YY_BREAK
case 43: case 43:
YY_RULE_SETUP YY_RULE_SETUP
@ -1029,12 +1033,11 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 45: case 45:
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 46: case 46:
/* rule 46 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(PCIINT);}
YY_BREAK YY_BREAK
case 47: case 47:
/* rule 47 can match eol */ /* rule 47 can match eol */
@ -1042,10 +1045,15 @@ 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 48: case 48:
/* rule 48 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 49:
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 49: case 50:
YY_RULE_SETUP YY_RULE_SETUP
ECHO; ECHO;
YY_BREAK YY_BREAK
@ -1345,7 +1353,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 >= 202 ) if ( yy_current_state >= 210 )
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];
@ -1373,11 +1381,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 >= 202 ) if ( yy_current_state >= 210 )
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 == 201); yy_is_jam = (yy_current_state == 209);
return yy_is_jam ? 0 : yy_current_state; return yy_is_jam ? 0 : yy_current_state;
} }

View File

@ -1023,6 +1023,25 @@ void add_slot_desc(struct bus *bus, char *type, char *length, char *designation,
dev->smbios_slot_designation = designation; dev->smbios_slot_designation = designation;
} }
void add_smbios_dev_info(struct bus *bus, long instance_id, const char *refdes)
{
struct device *dev = bus->dev;
if (dev->bustype != PCI && dev->bustype != DOMAIN) {
printf("ERROR: 'dev_info' only allowed for PCI devices\n");
exit(1);
}
if (instance_id < 0 || instance_id > UINT8_MAX) {
printf("ERROR: SMBIOS dev info instance ID '%ld' out of range\n", instance_id);
exit(1);
}
dev->smbios_instance_id_valid = 1;
dev->smbios_instance_id = (unsigned int)instance_id;
dev->smbios_refdes = refdes;
}
void add_pci_subsystem_ids(struct bus *bus, int vendor, int device, void add_pci_subsystem_ids(struct bus *bus, int vendor, int device,
int inherit) int inherit)
{ {
@ -1135,6 +1154,14 @@ static void emit_smbios_data(FILE *fil, struct device *ptr)
fprintf(fil, "\t.smbios_slot_length = %s,\n", fprintf(fil, "\t.smbios_slot_length = %s,\n",
ptr->smbios_slot_length); ptr->smbios_slot_length);
/* Fill in SMBIOS type41 fields */
if (ptr->smbios_instance_id_valid) {
fprintf(fil, "\t.smbios_instance_id_valid = true,\n");
fprintf(fil, "\t.smbios_instance_id = %u,\n", ptr->smbios_instance_id);
if (ptr->smbios_refdes)
fprintf(fil, "\t.smbios_refdes = \"%s\",\n", ptr->smbios_refdes);
}
fprintf(fil, "#endif\n"); fprintf(fil, "#endif\n");
fprintf(fil, "#endif\n"); fprintf(fil, "#endif\n");
} }

View File

@ -177,6 +177,11 @@ struct device {
/* SMBIOS slot length */ /* SMBIOS slot length */
char *smbios_slot_length; char *smbios_slot_length;
/* SMBIOS type41 fields */
int smbios_instance_id_valid;
unsigned int smbios_instance_id;
const char *smbios_refdes;
/* List of field+option to probe. */ /* List of field+option to probe. */
struct fw_config_probe *probe; struct fw_config_probe *probe;
}; };
@ -203,6 +208,8 @@ void add_ioapic_info(struct bus *bus, int apicid, const char *_srcpin,
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);
void add_smbios_dev_info(struct bus *bus, long instance_id, const char *refdes);
void yyrestart(FILE *input_file); void yyrestart(FILE *input_file);
/* Add chip data to tail of queue. */ /* Add chip data to tail of queue. */

View File

@ -47,6 +47,7 @@ inherit {return(INHERIT);}
subsystemid {return(SUBSYSTEMID);} subsystemid {return(SUBSYSTEMID);}
end {return(END);} end {return(END);}
smbios_slot_desc {return(SLOT_DESC);} smbios_slot_desc {return(SLOT_DESC);}
smbios_dev_info {return(SMBIOS_DEV_INFO);}
= {return(EQUALS);} = {return(EQUALS);}
\| {return(PIPE);} \| {return(PIPE);}
0x[0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} 0x[0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}

View File

@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.7.6. */ /* A Bison parser, made by GNU Bison 3.8.1. */
/* Bison implementation for Yacc-like parsers in C /* Bison implementation for Yacc-like parsers in C
@ -46,10 +46,10 @@
USER NAME SPACE" below. */ USER NAME SPACE" below. */
/* Identify Bison output, and Bison version. */ /* Identify Bison output, and Bison version. */
#define YYBISON 30706 #define YYBISON 30801
/* Bison version string. */ /* Bison version string. */
#define YYBISON_VERSION "3.7.6" #define YYBISON_VERSION "3.8.1"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
@ -138,54 +138,56 @@ enum yysymbol_kind_t
YYSYMBOL_IRQ = 25, /* IRQ */ YYSYMBOL_IRQ = 25, /* IRQ */
YYSYMBOL_DRQ = 26, /* DRQ */ YYSYMBOL_DRQ = 26, /* DRQ */
YYSYMBOL_SLOT_DESC = 27, /* SLOT_DESC */ YYSYMBOL_SLOT_DESC = 27, /* SLOT_DESC */
YYSYMBOL_IO = 28, /* IO */ YYSYMBOL_SMBIOS_DEV_INFO = 28, /* SMBIOS_DEV_INFO */
YYSYMBOL_NUMBER = 29, /* NUMBER */ YYSYMBOL_IO = 29, /* IO */
YYSYMBOL_SUBSYSTEMID = 30, /* SUBSYSTEMID */ YYSYMBOL_NUMBER = 30, /* NUMBER */
YYSYMBOL_INHERIT = 31, /* INHERIT */ YYSYMBOL_SUBSYSTEMID = 31, /* SUBSYSTEMID */
YYSYMBOL_IOAPIC_IRQ = 32, /* IOAPIC_IRQ */ YYSYMBOL_INHERIT = 32, /* INHERIT */
YYSYMBOL_IOAPIC = 33, /* IOAPIC */ YYSYMBOL_IOAPIC_IRQ = 33, /* IOAPIC_IRQ */
YYSYMBOL_PCIINT = 34, /* PCIINT */ YYSYMBOL_IOAPIC = 34, /* IOAPIC */
YYSYMBOL_GENERIC = 35, /* GENERIC */ YYSYMBOL_PCIINT = 35, /* PCIINT */
YYSYMBOL_SPI = 36, /* SPI */ YYSYMBOL_GENERIC = 36, /* GENERIC */
YYSYMBOL_USB = 37, /* USB */ YYSYMBOL_SPI = 37, /* SPI */
YYSYMBOL_MMIO = 38, /* MMIO */ YYSYMBOL_USB = 38, /* USB */
YYSYMBOL_GPIO = 39, /* GPIO */ YYSYMBOL_MMIO = 39, /* MMIO */
YYSYMBOL_FW_CONFIG_TABLE = 40, /* FW_CONFIG_TABLE */ YYSYMBOL_GPIO = 40, /* GPIO */
YYSYMBOL_FW_CONFIG_FIELD = 41, /* FW_CONFIG_FIELD */ YYSYMBOL_FW_CONFIG_TABLE = 41, /* FW_CONFIG_TABLE */
YYSYMBOL_FW_CONFIG_OPTION = 42, /* FW_CONFIG_OPTION */ YYSYMBOL_FW_CONFIG_FIELD = 42, /* FW_CONFIG_FIELD */
YYSYMBOL_FW_CONFIG_PROBE = 43, /* FW_CONFIG_PROBE */ YYSYMBOL_FW_CONFIG_OPTION = 43, /* FW_CONFIG_OPTION */
YYSYMBOL_PIPE = 44, /* PIPE */ YYSYMBOL_FW_CONFIG_PROBE = 44, /* FW_CONFIG_PROBE */
YYSYMBOL_YYACCEPT = 45, /* $accept */ YYSYMBOL_PIPE = 45, /* PIPE */
YYSYMBOL_devtree = 46, /* devtree */ YYSYMBOL_YYACCEPT = 46, /* $accept */
YYSYMBOL_chipchild_nondev = 47, /* chipchild_nondev */ YYSYMBOL_devtree = 47, /* devtree */
YYSYMBOL_chipchild = 48, /* chipchild */ YYSYMBOL_chipchild_nondev = 48, /* chipchild_nondev */
YYSYMBOL_chipchildren = 49, /* chipchildren */ YYSYMBOL_chipchild = 49, /* chipchild */
YYSYMBOL_chipchildren_dev = 50, /* chipchildren_dev */ YYSYMBOL_chipchildren = 50, /* chipchildren */
YYSYMBOL_devicechildren = 51, /* devicechildren */ YYSYMBOL_chipchildren_dev = 51, /* chipchildren_dev */
YYSYMBOL_chip = 52, /* chip */ YYSYMBOL_devicechildren = 52, /* devicechildren */
YYSYMBOL_53_1 = 53, /* @1 */ YYSYMBOL_chip = 53, /* chip */
YYSYMBOL_device = 54, /* device */ YYSYMBOL_54_1 = 54, /* @1 */
YYSYMBOL_55_2 = 55, /* @2 */ YYSYMBOL_device = 55, /* device */
YYSYMBOL_56_3 = 56, /* @3 */ YYSYMBOL_56_2 = 56, /* @2 */
YYSYMBOL_alias = 57, /* alias */ YYSYMBOL_57_3 = 57, /* @3 */
YYSYMBOL_status = 58, /* status */ YYSYMBOL_alias = 58, /* alias */
YYSYMBOL_resource = 59, /* resource */ YYSYMBOL_status = 59, /* status */
YYSYMBOL_reference = 60, /* reference */ YYSYMBOL_resource = 60, /* resource */
YYSYMBOL_registers = 61, /* registers */ YYSYMBOL_reference = 61, /* reference */
YYSYMBOL_subsystemid = 62, /* subsystemid */ YYSYMBOL_registers = 62, /* registers */
YYSYMBOL_ioapic_irq = 63, /* ioapic_irq */ YYSYMBOL_subsystemid = 63, /* subsystemid */
YYSYMBOL_smbios_slot_desc = 64, /* smbios_slot_desc */ YYSYMBOL_ioapic_irq = 64, /* ioapic_irq */
YYSYMBOL_fw_config_table = 65, /* fw_config_table */ YYSYMBOL_smbios_slot_desc = 65, /* smbios_slot_desc */
YYSYMBOL_fw_config_table_children = 66, /* fw_config_table_children */ YYSYMBOL_smbios_dev_info = 66, /* smbios_dev_info */
YYSYMBOL_fw_config_field_children = 67, /* fw_config_field_children */ YYSYMBOL_fw_config_table = 67, /* fw_config_table */
YYSYMBOL_fw_config_field_bits = 68, /* fw_config_field_bits */ YYSYMBOL_fw_config_table_children = 68, /* fw_config_table_children */
YYSYMBOL_fw_config_field_bits_repeating = 69, /* fw_config_field_bits_repeating */ YYSYMBOL_fw_config_field_children = 69, /* fw_config_field_children */
YYSYMBOL_fw_config_field = 70, /* fw_config_field */ YYSYMBOL_fw_config_field_bits = 70, /* fw_config_field_bits */
YYSYMBOL_71_4 = 71, /* $@4 */ YYSYMBOL_fw_config_field_bits_repeating = 71, /* fw_config_field_bits_repeating */
YYSYMBOL_72_5 = 72, /* $@5 */ YYSYMBOL_fw_config_field = 72, /* fw_config_field */
YYSYMBOL_73_6 = 73, /* $@6 */ YYSYMBOL_73_4 = 73, /* $@4 */
YYSYMBOL_fw_config_option = 74, /* fw_config_option */ YYSYMBOL_74_5 = 74, /* $@5 */
YYSYMBOL_fw_config_probe = 75 /* fw_config_probe */ YYSYMBOL_75_6 = 75, /* $@6 */
YYSYMBOL_fw_config_option = 76, /* fw_config_option */
YYSYMBOL_fw_config_probe = 77 /* fw_config_probe */
}; };
typedef enum yysymbol_kind_t yysymbol_kind_t; typedef enum yysymbol_kind_t yysymbol_kind_t;
@ -343,12 +345,18 @@ typedef int yy_state_fast_t;
# define YY_USE(E) /* empty */ # define YY_USE(E) /* empty */
#endif #endif
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */ /* Suppress an incorrect diagnostic about yylval being uninitialized. */
#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
# else
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# endif
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop") _Pragma ("GCC diagnostic pop")
#else #else
@ -507,19 +515,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 90 #define YYLAST 98
/* YYNTOKENS -- Number of terminals. */ /* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 45 #define YYNTOKENS 46
/* YYNNTS -- Number of nonterminals. */ /* YYNNTS -- Number of nonterminals. */
#define YYNNTS 31 #define YYNNTS 32
/* YYNRULES -- Number of rules. */ /* YYNRULES -- Number of rules. */
#define YYNRULES 57 #define YYNRULES 60
/* YYNSTATES -- Number of states. */ /* YYNSTATES -- Number of states. */
#define YYNSTATES 101 #define YYNSTATES 105
/* YYMAXUTOK -- Last valid token kind. */ /* YYMAXUTOK -- Last valid token kind. */
#define YYMAXUTOK 299 #define YYMAXUTOK 300
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
@ -562,7 +570,8 @@ 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, 42, 43, 44 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45
}; };
#if YYDEBUG #if YYDEBUG
@ -571,10 +580,11 @@ static const yytype_uint8 yyrline[] =
{ {
0, 26, 26, 26, 26, 29, 29, 29, 30, 30, 0, 26, 26, 26, 26, 29, 29, 29, 30, 30,
31, 31, 32, 32, 34, 34, 34, 34, 34, 34, 31, 31, 32, 32, 34, 34, 34, 34, 34, 34,
34, 34, 34, 36, 36, 45, 45, 53, 53, 61, 34, 34, 34, 34, 36, 36, 45, 45, 53, 53,
63, 67, 67, 69, 72, 75, 78, 81, 84, 87, 61, 63, 67, 67, 69, 72, 75, 78, 81, 84,
90, 93, 97, 100, 100, 103, 103, 106, 112, 112, 87, 90, 93, 96, 99, 103, 106, 106, 109, 109,
115, 114, 119, 119, 127, 127, 133, 137 112, 118, 118, 121, 120, 125, 125, 133, 133, 139,
143
}; };
#endif #endif
@ -594,17 +604,18 @@ static const char *const yytname[] =
"REGISTER", "ALIAS", "REFERENCE", "ASSOCIATION", "BOOL", "STATUS", "REGISTER", "ALIAS", "REFERENCE", "ASSOCIATION", "BOOL", "STATUS",
"MANDATORY", "BUS", "RESOURCE", "END", "EQUALS", "HEX", "STRING", "PCI", "MANDATORY", "BUS", "RESOURCE", "END", "EQUALS", "HEX", "STRING", "PCI",
"PNP", "I2C", "APIC", "CPU_CLUSTER", "CPU", "DOMAIN", "IRQ", "DRQ", "PNP", "I2C", "APIC", "CPU_CLUSTER", "CPU", "DOMAIN", "IRQ", "DRQ",
"SLOT_DESC", "IO", "NUMBER", "SUBSYSTEMID", "INHERIT", "IOAPIC_IRQ", "SLOT_DESC", "SMBIOS_DEV_INFO", "IO", "NUMBER", "SUBSYSTEMID", "INHERIT",
"IOAPIC", "PCIINT", "GENERIC", "SPI", "USB", "MMIO", "GPIO", "IOAPIC_IRQ", "IOAPIC", "PCIINT", "GENERIC", "SPI", "USB", "MMIO",
"FW_CONFIG_TABLE", "FW_CONFIG_FIELD", "FW_CONFIG_OPTION", "GPIO", "FW_CONFIG_TABLE", "FW_CONFIG_FIELD", "FW_CONFIG_OPTION",
"FW_CONFIG_PROBE", "PIPE", "$accept", "devtree", "chipchild_nondev", "FW_CONFIG_PROBE", "PIPE", "$accept", "devtree", "chipchild_nondev",
"chipchild", "chipchildren", "chipchildren_dev", "devicechildren", "chipchild", "chipchildren", "chipchildren_dev", "devicechildren",
"chip", "@1", "device", "@2", "@3", "alias", "status", "resource", "chip", "@1", "device", "@2", "@3", "alias", "status", "resource",
"reference", "registers", "subsystemid", "ioapic_irq", "reference", "registers", "subsystemid", "ioapic_irq",
"smbios_slot_desc", "fw_config_table", "fw_config_table_children", "smbios_slot_desc", "smbios_dev_info", "fw_config_table",
"fw_config_field_children", "fw_config_field_bits", "fw_config_table_children", "fw_config_field_children",
"fw_config_field_bits_repeating", "fw_config_field", "$@4", "$@5", "$@6", "fw_config_field_bits", "fw_config_field_bits_repeating",
"fw_config_option", "fw_config_probe", YY_NULLPTR "fw_config_field", "$@4", "$@5", "$@6", "fw_config_option",
"fw_config_probe", YY_NULLPTR
}; };
static const char * static const char *
@ -614,20 +625,7 @@ yysymbol_name (yysymbol_kind_t yysymbol)
} }
#endif #endif
#ifdef YYPRINT #define YYPACT_NINF (-45)
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
(internal) symbol number NUM (which must be that of a token). */
static const yytype_int16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299
};
#endif
#define YYPACT_NINF (-61)
#define yypact_value_is_default(Yyn) \ #define yypact_value_is_default(Yyn) \
((Yyn) == YYPACT_NINF) ((Yyn) == YYPACT_NINF)
@ -641,17 +639,17 @@ static const yytype_int16 yytoknum[] =
STATE-NUM. */ STATE-NUM. */
static const yytype_int8 yypact[] = static const yytype_int8 yypact[] =
{ {
-61, 12, -61, -7, -61, -61, -61, -61, -12, 46, -45, 6, -45, 4, -45, -45, -45, -45, -12, 45,
-61, 8, -61, 14, 11, 18, 46, 23, -61, -61, -45, 15, -45, 11, 17, 18, 45, -3, -45, -45,
-61, -61, 16, 24, 17, 25, 34, -61, -61, 46, -45, -45, 16, 34, 23, 14, 46, -45, -45, 45,
26, 10, -61, 13, 51, 41, 42, -61, -61, -61, 25, 19, -45, 10, 51, 42, 43, -45, -45, -45,
-61, -61, 31, -61, -3, -61, -61, -61, 44, 13, -45, -45, 31, -45, -7, -45, -45, -45, 49, 10,
-61, -61, 2, 26, 10, -61, -61, 45, -61, -61, -45, -45, -6, 25, 19, -45, -45, 50, -45, -45,
-61, -61, -61, -61, 6, 35, 0, -61, -61, -61, -45, -45, -45, -45, -2, 32, 0, -45, -45, -45,
37, -61, 50, 39, 40, 53, -61, -61, -61, -61, 33, -45, 52, 38, 40, 41, 55, -45, -45, -45,
-61, -61, -61, -61, 4, 48, 54, 43, 47, 56, -45, -45, -45, -45, -45, -45, 12, 58, 57, 59,
-61, 49, 57, 55, 58, -61, -61, 59, -61, -61, 47, 44, 61, -45, 53, 63, -45, 54, 60, -45,
-61 -45, 64, -45, -45, -45
}; };
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@ -659,35 +657,35 @@ 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, 44, 3, 4, 23, 0, 0, 2, 0, 1, 0, 47, 3, 4, 24, 0, 0,
42, 0, 43, 0, 0, 0, 0, 0, 5, 11, 45, 0, 46, 0, 0, 0, 0, 0, 5, 11,
7, 6, 54, 0, 0, 0, 0, 13, 24, 12, 7, 6, 57, 0, 0, 0, 0, 13, 25, 12,
52, 49, 46, 0, 29, 0, 0, 9, 10, 8, 55, 52, 49, 0, 30, 0, 0, 9, 10, 8,
47, 46, 0, 50, 0, 31, 32, 27, 0, 0, 50, 49, 0, 53, 0, 32, 33, 28, 0, 0,
35, 34, 0, 0, 49, 46, 55, 0, 45, 22, 36, 35, 0, 0, 52, 49, 58, 0, 48, 23,
30, 25, 53, 48, 0, 0, 0, 22, 51, 56, 31, 26, 56, 51, 0, 0, 0, 23, 54, 59,
0, 28, 0, 0, 0, 0, 15, 14, 16, 20, 0, 29, 0, 0, 0, 0, 0, 15, 14, 16,
17, 18, 19, 21, 0, 0, 0, 0, 0, 0, 21, 17, 18, 19, 20, 22, 0, 0, 0, 44,
26, 0, 41, 36, 0, 57, 33, 40, 37, 38, 0, 0, 0, 27, 0, 42, 43, 37, 0, 60,
39 34, 41, 38, 39, 40
}; };
/* YYPGOTO[NTERM-NUM]. */ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] = static const yytype_int8 yypgoto[] =
{ {
-61, -61, 60, -61, -61, 61, 15, -1, -61, -28, -45, -45, 62, -45, -45, 66, 8, -1, -45, -28,
-61, -61, -61, 30, -61, -61, -60, -61, -61, -61, -45, -45, -45, 35, -45, -45, -44, -45, -45, -45,
-61, -61, -22, 33, 36, -61, -61, -61, -61, -61, -45, -45, -45, -31, 56, 39, -45, -45, -45, -45,
-61 -45, -45
}; };
/* YYDEFGOTO[NTERM-NUM]. */ /* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] = static const yytype_int8 yydefgoto[] =
{ {
0, 1, 16, 38, 29, 17, 66, 18, 9, 19, 0, 1, 16, 38, 29, 17, 66, 18, 9, 19,
67, 59, 49, 47, 78, 20, 21, 80, 81, 82, 67, 59, 49, 47, 79, 20, 21, 81, 82, 83,
6, 8, 44, 31, 43, 12, 55, 41, 32, 58, 84, 6, 8, 44, 31, 43, 12, 55, 41, 32,
83 58, 85
}; };
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@ -695,69 +693,71 @@ 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[] =
{ {
5, 39, 10, 3, 13, 14, 79, 3, 13, 14, 5, 39, 10, 3, 13, 14, 2, 56, 62, 3,
7, 56, 2, 70, 71, 3, 62, 70, 90, 52, 52, 28, 68, 70, 71, 3, 13, 14, 23, 45,
68, 23, 45, 46, 79, 22, 24, 72, 25, 11, 46, 7, 80, 24, 64, 70, 93, 72, 73, 35,
73, 72, 74, 64, 73, 26, 74, 28, 77, 57, 11, 74, 22, 75, 25, 26, 57, 57, 78, 72,
35, 33, 36, 75, 57, 30, 34, 75, 57, 3, 73, 57, 80, 74, 76, 75, 30, 4, 3, 13,
13, 14, 4, 15, 42, 40, 77, 48, 50, 51, 14, 33, 15, 34, 36, 40, 76, 48, 78, 50,
53, 60, 65, 91, 69, 76, 85, 86, 87, 88, 51, 53, 69, 87, 42, 77, 60, 65, 89, 88,
89, 92, 93, 95, 97, 54, 100, 27, 96, 61, 90, 91, 92, 94, 95, 86, 96, 97, 99, 98,
0, 94, 84, 76, 0, 0, 98, 99, 0, 37, 101, 104, 27, 100, 61, 77, 102, 0, 0, 0,
63 103, 37, 0, 63, 0, 0, 0, 0, 54
}; };
static const yytype_int8 yycheck[] = static const yytype_int8 yycheck[] =
{ {
1, 29, 14, 3, 4, 5, 66, 3, 4, 5, 1, 29, 14, 3, 4, 5, 0, 14, 14, 3,
17, 14, 0, 13, 14, 3, 14, 13, 14, 41, 41, 14, 14, 13, 14, 3, 4, 5, 7, 9,
14, 7, 9, 10, 84, 17, 12, 27, 17, 41, 10, 17, 66, 12, 55, 13, 14, 27, 28, 15,
30, 27, 32, 55, 30, 17, 32, 14, 66, 42, 42, 31, 17, 33, 17, 17, 43, 43, 66, 27,
15, 17, 8, 43, 42, 29, 29, 43, 42, 3, 28, 43, 86, 31, 44, 33, 30, 41, 3, 4,
4, 5, 40, 7, 44, 29, 84, 6, 17, 17, 5, 17, 7, 30, 8, 30, 44, 6, 86, 17,
29, 17, 17, 15, 29, 66, 29, 17, 29, 29, 17, 30, 30, 30, 45, 66, 17, 17, 30, 17,
17, 17, 29, 17, 17, 42, 17, 16, 29, 49, 30, 30, 17, 15, 17, 67, 17, 30, 17, 35,
-1, 34, 67, 84, -1, -1, 31, 29, -1, 29, 17, 17, 16, 30, 49, 86, 32, -1, -1, -1,
54 30, 29, -1, 54, -1, -1, -1, -1, 42
}; };
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
symbol of state STATE-NUM. */ state STATE-NUM. */
static const yytype_int8 yystos[] = static const yytype_int8 yystos[] =
{ {
0, 46, 0, 3, 40, 52, 65, 17, 66, 53, 0, 47, 0, 3, 41, 53, 67, 17, 68, 54,
14, 41, 70, 4, 5, 7, 47, 50, 52, 54, 14, 42, 72, 4, 5, 7, 48, 51, 53, 55,
60, 61, 17, 7, 12, 17, 17, 50, 14, 49, 61, 62, 17, 7, 12, 17, 17, 51, 14, 50,
29, 68, 73, 17, 29, 15, 8, 47, 48, 54, 30, 70, 75, 17, 30, 15, 8, 48, 49, 55,
29, 72, 44, 69, 67, 9, 10, 58, 6, 57, 30, 74, 45, 71, 69, 9, 10, 59, 6, 58,
17, 17, 67, 29, 68, 71, 14, 42, 74, 56, 17, 17, 69, 30, 70, 73, 14, 43, 76, 57,
17, 58, 14, 69, 67, 17, 51, 55, 14, 29, 17, 59, 14, 71, 69, 17, 52, 56, 14, 30,
13, 14, 27, 30, 32, 43, 52, 54, 59, 61, 13, 14, 27, 28, 31, 33, 44, 53, 55, 60,
62, 63, 64, 75, 51, 29, 17, 29, 29, 17, 62, 63, 64, 65, 66, 77, 52, 30, 17, 30,
14, 15, 17, 29, 34, 17, 29, 17, 31, 29, 30, 30, 17, 14, 15, 17, 17, 30, 35, 17,
17 30, 17, 32, 30, 17
}; };
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
static const yytype_int8 yyr1[] = static const yytype_int8 yyr1[] =
{ {
0, 45, 46, 46, 46, 47, 47, 47, 48, 48, 0, 46, 47, 47, 47, 48, 48, 48, 49, 49,
49, 49, 50, 50, 51, 51, 51, 51, 51, 51, 50, 50, 51, 51, 52, 52, 52, 52, 52, 52,
51, 51, 51, 53, 52, 55, 54, 56, 54, 57, 52, 52, 52, 52, 54, 53, 56, 55, 57, 55,
57, 58, 58, 59, 60, 61, 62, 62, 63, 64, 58, 58, 59, 59, 60, 61, 62, 63, 63, 64,
64, 64, 65, 66, 66, 67, 67, 68, 69, 69, 65, 65, 65, 66, 66, 67, 68, 68, 69, 69,
71, 70, 72, 70, 73, 70, 74, 75 70, 71, 71, 73, 72, 74, 72, 75, 72, 76,
77
}; };
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
static const yytype_int8 yyr2[] = static const yytype_int8 yyr2[] =
{ {
0, 2, 0, 2, 2, 1, 1, 1, 1, 1, 0, 2, 0, 2, 2, 1, 1, 1, 1, 1,
2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 0, 0, 5, 0, 8, 0, 7, 0, 2, 2, 2, 0, 0, 5, 0, 8, 0, 7,
2, 1, 1, 4, 4, 4, 3, 4, 4, 5, 0, 2, 1, 1, 4, 4, 4, 3, 4, 4,
4, 3, 3, 2, 0, 2, 0, 2, 3, 0, 5, 4, 3, 3, 2, 3, 2, 0, 2, 0,
0, 7, 0, 6, 0, 5, 3, 3 2, 3, 0, 0, 7, 0, 6, 0, 5, 3,
3
}; };
@ -769,6 +769,7 @@ enum { YYENOMEM = -2 };
#define YYACCEPT goto yyacceptlab #define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab #define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab #define YYERROR goto yyerrorlab
#define YYNOMEM goto yyexhaustedlab
#define YYRECOVERING() (!!yyerrstatus) #define YYRECOVERING() (!!yyerrstatus)
@ -809,10 +810,7 @@ do { \
YYFPRINTF Args; \ YYFPRINTF Args; \
} while (0) } while (0)
/* This macro is provided for backward compatibility. */
# ifndef YY_LOCATION_PRINT
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
@ -839,10 +837,6 @@ yy_symbol_value_print (FILE *yyo,
YY_USE (yyoutput); YY_USE (yyoutput);
if (!yyvaluep) if (!yyvaluep)
return; return;
# ifdef YYPRINT
if (yykind < YYNTOKENS)
YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
# endif
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YY_USE (yykind); YY_USE (yykind);
YY_IGNORE_MAYBE_UNINITIALIZED_END YY_IGNORE_MAYBE_UNINITIALIZED_END
@ -1027,6 +1021,7 @@ yyparse (void)
YYDPRINTF ((stderr, "Starting parse\n")); YYDPRINTF ((stderr, "Starting parse\n"));
yychar = YYEMPTY; /* Cause a token to be read. */ yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate; goto yysetstate;
@ -1052,7 +1047,7 @@ yysetstate:
if (yyss + yystacksize - 1 <= yyssp) if (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE #if !defined yyoverflow && !defined YYSTACK_RELOCATE
goto yyexhaustedlab; YYNOMEM;
#else #else
{ {
/* Get the current used size of the three stacks, in elements. */ /* Get the current used size of the three stacks, in elements. */
@ -1080,7 +1075,7 @@ yysetstate:
# else /* defined YYSTACK_RELOCATE */ # else /* defined YYSTACK_RELOCATE */
/* Extend the stack our own way. */ /* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize) if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab; YYNOMEM;
yystacksize *= 2; yystacksize *= 2;
if (YYMAXDEPTH < yystacksize) if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH; yystacksize = YYMAXDEPTH;
@ -1091,7 +1086,7 @@ yysetstate:
YY_CAST (union yyalloc *, YY_CAST (union yyalloc *,
YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
if (! yyptr) if (! yyptr)
goto yyexhaustedlab; YYNOMEM;
YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs); YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE # undef YYSTACK_RELOCATE
@ -1113,6 +1108,7 @@ yysetstate:
} }
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
if (yystate == YYFINAL) if (yystate == YYFINAL)
YYACCEPT; YYACCEPT;
@ -1228,7 +1224,7 @@ yyreduce:
{ cur_parent = root_parent; } { cur_parent = root_parent; }
break; break;
case 23: /* @1: %empty */ case 24: /* @1: %empty */
{ {
(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);
@ -1236,105 +1232,113 @@ yyreduce:
} }
break; break;
case 24: /* chip: CHIP STRING @1 chipchildren_dev END */ case 25: /* chip: CHIP STRING @1 chipchildren_dev END */
{ {
cur_chip_instance = chip_dequeue_tail(); cur_chip_instance = chip_dequeue_tail();
} }
break; break;
case 25: /* @2: %empty */ case 26: /* @2: %empty */
{ {
(yyval.dev) = new_device_raw(cur_parent, cur_chip_instance, (yyvsp[-3].number), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].number)); (yyval.dev) = new_device_raw(cur_parent, cur_chip_instance, (yyvsp[-3].number), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].number));
cur_parent = (yyval.dev)->last_bus; cur_parent = (yyval.dev)->last_bus;
} }
break; break;
case 26: /* device: DEVICE BUS NUMBER alias status @2 devicechildren END */ case 27: /* device: DEVICE BUS NUMBER alias status @2 devicechildren END */
{ {
cur_parent = (yyvsp[-2].dev)->parent; cur_parent = (yyvsp[-2].dev)->parent;
} }
break; break;
case 27: /* @3: %empty */ case 28: /* @3: %empty */
{ {
(yyval.dev) = new_device_reference(cur_parent, cur_chip_instance, (yyvsp[-1].string), (yyvsp[0].number)); (yyval.dev) = new_device_reference(cur_parent, cur_chip_instance, (yyvsp[-1].string), (yyvsp[0].number));
cur_parent = (yyval.dev)->last_bus; cur_parent = (yyval.dev)->last_bus;
} }
break; break;
case 28: /* device: DEVICE REFERENCE STRING status @3 devicechildren END */ case 29: /* device: DEVICE REFERENCE STRING status @3 devicechildren END */
{ {
cur_parent = (yyvsp[-2].dev)->parent; cur_parent = (yyvsp[-2].dev)->parent;
} }
break; break;
case 29: /* alias: %empty */ case 30: /* alias: %empty */
{ {
(yyval.string) = NULL; (yyval.string) = NULL;
} }
break; break;
case 30: /* alias: ALIAS STRING */ case 31: /* alias: ALIAS STRING */
{ {
(yyval.string) = (yyvsp[0].string); (yyval.string) = (yyvsp[0].string);
} }
break; break;
case 33: /* resource: RESOURCE NUMBER EQUALS NUMBER */ case 34: /* resource: RESOURCE NUMBER EQUALS NUMBER */
{ add_resource(cur_parent, (yyvsp[-3].number), strtol((yyvsp[-2].string), NULL, 0), strtol((yyvsp[0].string), NULL, 0)); } { add_resource(cur_parent, (yyvsp[-3].number), strtol((yyvsp[-2].string), NULL, 0), strtol((yyvsp[0].string), NULL, 0)); }
break; break;
case 34: /* reference: REFERENCE STRING ASSOCIATION STRING */ case 35: /* reference: REFERENCE STRING ASSOCIATION STRING */
{ add_reference(cur_chip_instance, (yyvsp[0].string), (yyvsp[-2].string)); } { add_reference(cur_chip_instance, (yyvsp[0].string), (yyvsp[-2].string)); }
break; break;
case 35: /* registers: REGISTER STRING EQUALS STRING */ case 36: /* registers: REGISTER STRING EQUALS STRING */
{ add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); } { add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); }
break; break;
case 36: /* subsystemid: SUBSYSTEMID NUMBER NUMBER */ case 37: /* subsystemid: SUBSYSTEMID NUMBER NUMBER */
{ add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-1].string), NULL, 16), strtol((yyvsp[0].string), NULL, 16), 0); } { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-1].string), NULL, 16), strtol((yyvsp[0].string), NULL, 16), 0); }
break; break;
case 37: /* subsystemid: SUBSYSTEMID NUMBER NUMBER INHERIT */ case 38: /* subsystemid: SUBSYSTEMID NUMBER NUMBER INHERIT */
{ add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-2].string), NULL, 16), strtol((yyvsp[-1].string), NULL, 16), 1); } { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-2].string), NULL, 16), strtol((yyvsp[-1].string), NULL, 16), 1); }
break; break;
case 38: /* ioapic_irq: IOAPIC_IRQ NUMBER PCIINT NUMBER */ case 39: /* 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)); } { add_ioapic_info(cur_parent, strtol((yyvsp[-2].string), NULL, 16), (yyvsp[-1].string), strtol((yyvsp[0].string), NULL, 16)); }
break; break;
case 39: /* smbios_slot_desc: SLOT_DESC STRING STRING STRING STRING */ case 40: /* 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)); } { add_slot_desc(cur_parent, (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string)); }
break; break;
case 40: /* smbios_slot_desc: SLOT_DESC STRING STRING STRING */ case 41: /* smbios_slot_desc: SLOT_DESC STRING STRING STRING */
{ add_slot_desc(cur_parent, (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string), NULL); } { add_slot_desc(cur_parent, (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string), NULL); }
break; break;
case 41: /* smbios_slot_desc: SLOT_DESC STRING STRING */ case 42: /* smbios_slot_desc: SLOT_DESC STRING STRING */
{ add_slot_desc(cur_parent, (yyvsp[-1].string), (yyvsp[0].string), NULL, NULL); } { add_slot_desc(cur_parent, (yyvsp[-1].string), (yyvsp[0].string), NULL, NULL); }
break; break;
case 42: /* fw_config_table: FW_CONFIG_TABLE fw_config_table_children END */ case 43: /* 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 */
{ 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 */
{ } { }
break; break;
case 47: /* fw_config_field_bits: NUMBER NUMBER */ case 50: /* fw_config_field_bits: NUMBER NUMBER */
{ {
append_fw_config_bits(&cur_bits, strtoul((yyvsp[-1].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0)); append_fw_config_bits(&cur_bits, strtoul((yyvsp[-1].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0));
} }
break; break;
case 50: /* $@4: %empty */ case 53: /* $@4: %empty */
{ cur_field = new_fw_config_field((yyvsp[-2].string), cur_bits); } { cur_field = new_fw_config_field((yyvsp[-2].string), cur_bits); }
break; break;
case 51: /* fw_config_field: FW_CONFIG_FIELD STRING fw_config_field_bits fw_config_field_bits_repeating $@4 fw_config_field_children END */ case 54: /* 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; } { cur_bits = NULL; }
break; break;
case 52: /* $@5: %empty */ case 55: /* $@5: %empty */
{ {
cur_bits = NULL; cur_bits = NULL;
append_fw_config_bits(&cur_bits, strtoul((yyvsp[0].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0)); append_fw_config_bits(&cur_bits, strtoul((yyvsp[0].string), NULL, 0), strtoul((yyvsp[0].string), NULL, 0));
@ -1342,25 +1346,25 @@ yyreduce:
} }
break; break;
case 53: /* fw_config_field: FW_CONFIG_FIELD STRING NUMBER $@5 fw_config_field_children END */ case 56: /* fw_config_field: FW_CONFIG_FIELD STRING NUMBER $@5 fw_config_field_children END */
{ cur_bits = NULL; } { cur_bits = NULL; }
break; break;
case 54: /* $@6: %empty */ case 57: /* $@6: %empty */
{ {
cur_field = get_fw_config_field((yyvsp[0].string)); cur_field = get_fw_config_field((yyvsp[0].string));
} }
break; break;
case 55: /* fw_config_field: FW_CONFIG_FIELD STRING $@6 fw_config_field_children END */ case 58: /* fw_config_field: FW_CONFIG_FIELD STRING $@6 fw_config_field_children END */
{ cur_bits = NULL; } { cur_bits = NULL; }
break; break;
case 56: /* fw_config_option: FW_CONFIG_OPTION STRING NUMBER */ case 59: /* fw_config_option: FW_CONFIG_OPTION STRING NUMBER */
{ add_fw_config_option(cur_field, (yyvsp[-1].string), strtoull((yyvsp[0].string), NULL, 0)); } { add_fw_config_option(cur_field, (yyvsp[-1].string), strtoull((yyvsp[0].string), NULL, 0)); }
break; break;
case 57: /* fw_config_probe: FW_CONFIG_PROBE STRING STRING */ case 60: /* fw_config_probe: FW_CONFIG_PROBE STRING STRING */
{ 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;
@ -1446,6 +1450,7 @@ yyerrorlab:
label yyerrorlab therefore never appears in user code. */ label yyerrorlab therefore never appears in user code. */
if (0) if (0)
YYERROR; YYERROR;
++yynerrs;
/* Do not reclaim the symbols of the rule whose action triggered /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */ this YYERROR. */
@ -1506,7 +1511,7 @@ yyerrlab1:
`-------------------------------------*/ `-------------------------------------*/
yyacceptlab: yyacceptlab:
yyresult = 0; yyresult = 0;
goto yyreturn; goto yyreturnlab;
/*-----------------------------------. /*-----------------------------------.
@ -1514,24 +1519,22 @@ yyacceptlab:
`-----------------------------------*/ `-----------------------------------*/
yyabortlab: yyabortlab:
yyresult = 1; yyresult = 1;
goto yyreturn; goto yyreturnlab;
#if !defined yyoverflow /*-----------------------------------------------------------.
/*-------------------------------------------------. | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
| yyexhaustedlab -- memory exhaustion comes here. | `-----------------------------------------------------------*/
`-------------------------------------------------*/
yyexhaustedlab: yyexhaustedlab:
yyerror (YY_("memory exhausted")); yyerror (YY_("memory exhausted"));
yyresult = 2; yyresult = 2;
goto yyreturn; goto yyreturnlab;
#endif
/*-------------------------------------------------------. /*----------------------------------------------------------.
| yyreturn -- parsing is finished, clean up and return. | | yyreturnlab -- parsing is finished, clean up and return. |
`-------------------------------------------------------*/ `----------------------------------------------------------*/
yyreturn: yyreturnlab:
if (yychar != YYEMPTY) if (yychar != YYEMPTY)
{ {
/* Make sure we have latest lookahead translation. See comments at /* Make sure we have latest lookahead translation. See comments at

View File

@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.7.6. */ /* A Bison parser, made by GNU Bison 3.8.1. */
/* Bison interface for Yacc-like parsers in C /* Bison interface for Yacc-like parsers in C
@ -35,8 +35,8 @@
especially those whose name start with YY_ or yy_. They are especially those whose name start with YY_ or yy_. They are
private implementation details that can be changed or removed. */ private implementation details that can be changed or removed. */
#ifndef YY_YY_HOME_ICON_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED #ifndef YY_YY_HOME_USUARIO_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
# define YY_YY_HOME_ICON_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED # define YY_YY_HOME_USUARIO_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
/* Debug traces. */ /* Debug traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG 0 # define YYDEBUG 0
@ -79,23 +79,24 @@ extern int yydebug;
IRQ = 280, /* IRQ */ IRQ = 280, /* IRQ */
DRQ = 281, /* DRQ */ DRQ = 281, /* DRQ */
SLOT_DESC = 282, /* SLOT_DESC */ SLOT_DESC = 282, /* SLOT_DESC */
IO = 283, /* IO */ SMBIOS_DEV_INFO = 283, /* SMBIOS_DEV_INFO */
NUMBER = 284, /* NUMBER */ IO = 284, /* IO */
SUBSYSTEMID = 285, /* SUBSYSTEMID */ NUMBER = 285, /* NUMBER */
INHERIT = 286, /* INHERIT */ SUBSYSTEMID = 286, /* SUBSYSTEMID */
IOAPIC_IRQ = 287, /* IOAPIC_IRQ */ INHERIT = 287, /* INHERIT */
IOAPIC = 288, /* IOAPIC */ IOAPIC_IRQ = 288, /* IOAPIC_IRQ */
PCIINT = 289, /* PCIINT */ IOAPIC = 289, /* IOAPIC */
GENERIC = 290, /* GENERIC */ PCIINT = 290, /* PCIINT */
SPI = 291, /* SPI */ GENERIC = 291, /* GENERIC */
USB = 292, /* USB */ SPI = 292, /* SPI */
MMIO = 293, /* MMIO */ USB = 293, /* USB */
GPIO = 294, /* GPIO */ MMIO = 294, /* MMIO */
FW_CONFIG_TABLE = 295, /* FW_CONFIG_TABLE */ GPIO = 295, /* GPIO */
FW_CONFIG_FIELD = 296, /* FW_CONFIG_FIELD */ FW_CONFIG_TABLE = 296, /* FW_CONFIG_TABLE */
FW_CONFIG_OPTION = 297, /* FW_CONFIG_OPTION */ FW_CONFIG_FIELD = 297, /* FW_CONFIG_FIELD */
FW_CONFIG_PROBE = 298, /* FW_CONFIG_PROBE */ FW_CONFIG_OPTION = 298, /* FW_CONFIG_OPTION */
PIPE = 299 /* PIPE */ FW_CONFIG_PROBE = 299, /* FW_CONFIG_PROBE */
PIPE = 300 /* PIPE */
}; };
typedef enum yytokentype yytoken_kind_t; typedef enum yytokentype yytoken_kind_t;
#endif #endif
@ -120,6 +121,8 @@ typedef union YYSTYPE YYSTYPE;
extern YYSTYPE yylval; extern YYSTYPE yylval;
int yyparse (void); int yyparse (void);
#endif /* !YY_YY_HOME_ICON_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */
#endif /* !YY_YY_HOME_USUARIO_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */

View File

@ -21,7 +21,7 @@ static struct fw_config_field_bits *cur_bits;
uint64_t number; uint64_t number;
} }
%token CHIP DEVICE REGISTER ALIAS REFERENCE ASSOCIATION BOOL STATUS MANDATORY BUS RESOURCE END EQUALS HEX STRING PCI PNP I2C APIC CPU_CLUSTER CPU DOMAIN IRQ DRQ SLOT_DESC IO NUMBER SUBSYSTEMID INHERIT IOAPIC_IRQ IOAPIC PCIINT GENERIC SPI USB MMIO 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
%% %%
devtree: { cur_parent = root_parent; } | devtree chip | devtree fw_config_table; devtree: { cur_parent = root_parent; } | devtree chip | devtree fw_config_table;
@ -31,7 +31,7 @@ chipchild: device | chipchild_nondev;
chipchildren: chipchildren chipchild | /* empty */ ; chipchildren: chipchildren chipchild | /* empty */ ;
chipchildren_dev: device chipchildren | chipchild_nondev chipchildren_dev; 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 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 | /* empty */ ;
chip: CHIP STRING /* == path */ { chip: CHIP STRING /* == path */ {
$<chip_instance>$ = new_chip_instance($<string>2); $<chip_instance>$ = new_chip_instance($<string>2);
@ -93,6 +93,12 @@ smbios_slot_desc: SLOT_DESC STRING STRING STRING
smbios_slot_desc: SLOT_DESC STRING STRING smbios_slot_desc: SLOT_DESC STRING STRING
{ add_slot_desc(cur_parent, $<string>2, $<string>3, NULL, NULL); }; { add_slot_desc(cur_parent, $<string>2, $<string>3, NULL, NULL); };
smbios_dev_info: SMBIOS_DEV_INFO NUMBER STRING
{ add_smbios_dev_info(cur_parent, strtol($<string>2, NULL, 0), $<string>3); };
smbios_dev_info: SMBIOS_DEV_INFO NUMBER
{ add_smbios_dev_info(cur_parent, strtol($<string>2, NULL, 0), NULL); };
/* fw_config: firmware configuration table */ /* fw_config: firmware configuration table */
fw_config_table: FW_CONFIG_TABLE fw_config_table_children END { }; fw_config_table: FW_CONFIG_TABLE fw_config_table_children END { };