Nico Huber would like Furquan Shaikh, Patrick Georgi, Angel Pons, Arthur Heymans, Kyösti Mälkki and Aaron Durbin to review this change.

View Change

[RFC] util/sconfig: Add per-device configuration

Similar to the `register` entries for chip drivers, allow to store a
configuration struct per device. This should help the ever growing
chips in two ways: First, it should overcome the psychological issue
that nobody is going to use the `chip` mechanism for configuration
unless a device is really on a separate chip. And second, by having
a separate struct per device, we can directly query this struct from
a common driver, even if not the whole chip is covered by common code.

The current implementation borrows some logic from the `register`
entries, but groups all key-value pairs in a `config` section, e.g.:

device generic 0.0 on
config drivers/vendor/model
key = value
paradox = same_value
end
end

Similar to chip drivers, this example would require a
`drivers/vendor/model/config.h` with a struct named
`drivers_vendor_model_config` containing `key` and `paradox`
fields, and definitions for `value` and `same_value`.

Change-Id: I25f46e774bb6d26d0e6b77f9bd96d80581412655
Signed-off-by: Nico Huber <nico.h@gmx.de>
---
M src/include/device/device.h
M util/sconfig/lex.yy.c_shipped
M util/sconfig/main.c
M util/sconfig/sconfig.h
M util/sconfig/sconfig.l
M util/sconfig/sconfig.tab.c_shipped
M util/sconfig/sconfig.tab.h_shipped
M util/sconfig/sconfig.y
8 files changed, 391 insertions(+), 310 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/41745/1
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 46efbfe..23abc72 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -139,6 +139,7 @@
struct device_operations *ops;
struct chip_operations *chip_ops;
const char *name;
+ const void *config;
#if CONFIG(GENERATE_SMBIOS_TABLES)
u8 smbios_slot_type;
u8 smbios_slot_data_width;
diff --git a/util/sconfig/lex.yy.c_shipped b/util/sconfig/lex.yy.c_shipped
index 61928e6..e7059b7 100644
--- a/util/sconfig/lex.yy.c_shipped
+++ b/util/sconfig/lex.yy.c_shipped
@@ -349,8 +349,8 @@
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
-#define YY_NUM_RULES 41
-#define YY_END_OF_BUFFER 42
+#define YY_NUM_RULES 42
+#define YY_END_OF_BUFFER 43
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -358,27 +358,27 @@
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static const flex_int16_t yy_accept[173] =
+static const flex_int16_t yy_accept[178] =
{ 0,
- 0, 0, 42, 40, 1, 3, 40, 40, 40, 35,
- 35, 33, 36, 40, 36, 36, 36, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 1, 3,
- 40, 0, 40, 40, 0, 2, 35, 36, 40, 40,
- 40, 40, 36, 40, 40, 40, 40, 40, 40, 40,
- 40, 27, 40, 40, 40, 40, 40, 40, 7, 40,
- 40, 40, 40, 40, 40, 40, 39, 39, 40, 0,
- 34, 40, 40, 17, 40, 40, 26, 31, 40, 40,
- 40, 14, 40, 40, 25, 40, 23, 40, 40, 8,
- 11, 13, 40, 40, 21, 40, 22, 40, 0, 37,
+ 0, 0, 43, 41, 1, 3, 41, 41, 41, 36,
+ 36, 34, 37, 41, 37, 37, 37, 41, 41, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 1, 3,
+ 41, 0, 41, 41, 0, 2, 36, 37, 41, 41,
+ 41, 41, 41, 37, 41, 41, 41, 41, 41, 41,
+ 41, 41, 28, 41, 41, 41, 41, 41, 41, 8,
+ 41, 41, 41, 41, 41, 41, 41, 40, 40, 41,
+ 0, 35, 41, 41, 41, 18, 41, 41, 27, 32,
+ 41, 41, 41, 15, 41, 41, 26, 41, 24, 41,
+ 41, 9, 12, 14, 41, 41, 22, 41, 23, 41,

- 4, 40, 40, 40, 24, 40, 40, 40, 40, 40,
- 40, 20, 40, 40, 40, 38, 38, 40, 40, 40,
- 40, 40, 40, 40, 15, 40, 40, 40, 40, 40,
- 5, 18, 40, 9, 40, 12, 40, 40, 40, 40,
- 40, 19, 29, 40, 40, 40, 40, 40, 40, 40,
- 40, 6, 40, 40, 40, 40, 10, 40, 40, 40,
- 28, 40, 40, 16, 40, 30, 40, 40, 40, 40,
- 32, 0
+ 0, 38, 4, 41, 41, 41, 41, 25, 41, 41,
+ 41, 41, 41, 41, 21, 41, 41, 41, 39, 39,
+ 41, 41, 41, 41, 41, 41, 41, 41, 16, 41,
+ 41, 41, 41, 6, 41, 5, 19, 41, 10, 41,
+ 13, 41, 41, 41, 41, 41, 20, 30, 41, 41,
+ 41, 41, 41, 41, 41, 41, 7, 41, 41, 41,
+ 41, 11, 41, 41, 41, 29, 41, 41, 17, 41,
+ 31, 41, 41, 41, 41, 33, 0
} ;

static const YY_CHAR yy_ec[256] =
@@ -421,118 +421,122 @@
1, 1, 1, 1, 1, 1, 1, 1
} ;

-static const flex_int16_t yy_base[180] =
+static const flex_int16_t yy_base[185] =
{ 0,
- 0, 0, 240, 0, 237, 241, 235, 37, 41, 38,
- 200, 0, 44, 222, 54, 78, 60, 214, 209, 45,
- 49, 48, 42, 52, 212, 62, 199, 0, 229, 241,
- 93, 225, 98, 79, 226, 241, 0, 97, 104, 213,
- 202, 191, 110, 198, 193, 203, 192, 193, 200, 200,
- 194, 200, 185, 185, 195, 185, 187, 189, 0, 185,
- 179, 185, 189, 181, 187, 186, 0, 241, 125, 198,
- 0, 191, 171, 184, 174, 181, 0, 0, 172, 175,
- 175, 0, 173, 163, 0, 167, 0, 171, 161, 0,
- 0, 0, 164, 163, 0, 154, 0, 181, 180, 0,
+ 0, 0, 245, 0, 242, 246, 240, 37, 41, 38,
+ 205, 0, 44, 227, 54, 78, 60, 219, 214, 45,
+ 49, 48, 42, 52, 217, 62, 204, 0, 234, 246,
+ 93, 230, 98, 79, 231, 246, 0, 97, 104, 218,
+ 207, 203, 195, 110, 202, 197, 207, 196, 197, 204,
+ 204, 198, 204, 189, 189, 199, 189, 191, 193, 0,
+ 189, 183, 189, 193, 185, 191, 190, 0, 246, 125,
+ 202, 0, 195, 175, 182, 187, 177, 184, 0, 0,
+ 175, 178, 178, 0, 176, 166, 0, 170, 0, 174,
+ 164, 0, 0, 0, 167, 166, 0, 157, 0, 184,

- 0, 165, 164, 157, 0, 149, 159, 147, 153, 158,
- 159, 0, 142, 145, 135, 0, 241, 146, 150, 142,
- 144, 140, 142, 147, 0, 131, 130, 130, 129, 126,
- 0, 0, 141, 0, 125, 129, 115, 122, 126, 107,
- 107, 0, 0, 114, 106, 105, 103, 114, 100, 101,
- 94, 0, 105, 102, 99, 83, 0, 80, 83, 70,
- 0, 60, 71, 0, 74, 0, 63, 55, 39, 29,
- 0, 241, 40, 146, 148, 150, 152, 154, 156
+ 183, 0, 0, 162, 167, 166, 159, 0, 151, 161,
+ 149, 155, 160, 161, 0, 144, 147, 137, 0, 246,
+ 151, 147, 151, 143, 145, 141, 143, 148, 0, 132,
+ 131, 131, 130, 0, 127, 0, 0, 142, 0, 126,
+ 143, 116, 123, 127, 108, 108, 0, 0, 115, 107,
+ 106, 104, 115, 101, 102, 95, 0, 106, 104, 108,
+ 89, 0, 85, 84, 76, 0, 68, 74, 0, 75,
+ 0, 70, 55, 39, 29, 0, 246, 40, 146, 148,
+ 150, 152, 154, 156
} ;

-static const flex_int16_t yy_def[180] =
+static const flex_int16_t yy_def[185] =
{ 0,
- 172, 1, 172, 173, 172, 172, 173, 174, 175, 173,
- 10, 173, 10, 173, 10, 10, 10, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 172, 172,
- 174, 176, 177, 175, 178, 172, 10, 10, 10, 173,
- 173, 173, 10, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 172, 177, 179,
- 39, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 172, 173,
+ 177, 1, 177, 178, 177, 177, 178, 179, 180, 178,
+ 10, 178, 10, 178, 10, 10, 10, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 177, 177,
+ 179, 181, 182, 180, 183, 177, 10, 10, 10, 178,
+ 178, 178, 178, 10, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 177, 182,
+ 184, 39, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,

- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 172, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 0, 172, 172, 172, 172, 172, 172, 172
+ 177, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 177,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 0, 177, 177, 177,
+ 177, 177, 177, 177
} ;

-static const flex_int16_t yy_nxt[280] =
+static const flex_int16_t yy_nxt[285] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 10, 12,
13, 13, 14, 4, 4, 4, 13, 13, 15, 16,
17, 13, 18, 19, 20, 21, 22, 4, 23, 24,
4, 25, 26, 4, 27, 4, 4, 4, 32, 32,
- 28, 33, 35, 36, 37, 37, 37, 171, 38, 38,
- 38, 38, 38, 50, 38, 38, 38, 38, 38, 38,
- 38, 38, 38, 58, 56, 54, 38, 38, 38, 59,
- 60, 170, 51, 52, 57, 169, 53, 41, 55, 61,
- 35, 36, 168, 42, 38, 38, 38, 46, 63, 167,
- 166, 64, 47, 165, 32, 32, 65, 67, 43, 70,
+ 28, 33, 35, 36, 37, 37, 37, 176, 38, 38,
+ 38, 38, 38, 51, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 59, 57, 55, 38, 38, 38, 60,
+ 61, 175, 52, 53, 58, 174, 54, 41, 56, 62,
+ 35, 36, 42, 43, 38, 38, 38, 47, 64, 173,
+ 172, 65, 48, 171, 32, 32, 66, 68, 44, 71,

- 70, 164, 28, 38, 38, 38, 44, 163, 162, 45,
- 71, 71, 71, 161, 71, 71, 38, 38, 38, 160,
- 71, 71, 71, 71, 71, 71, 70, 70, 159, 98,
- 158, 157, 156, 155, 154, 153, 152, 151, 150, 149,
- 148, 147, 146, 145, 144, 75, 31, 31, 34, 34,
- 32, 32, 69, 69, 35, 35, 70, 70, 143, 142,
- 141, 140, 139, 138, 137, 136, 135, 134, 133, 132,
- 131, 130, 129, 128, 127, 126, 125, 124, 123, 122,
- 121, 120, 119, 118, 117, 116, 115, 114, 113, 112,
- 111, 110, 109, 108, 107, 106, 105, 104, 103, 102,
+ 71, 170, 28, 38, 38, 38, 45, 169, 168, 46,
+ 72, 72, 72, 167, 72, 72, 38, 38, 38, 166,
+ 72, 72, 72, 72, 72, 72, 71, 71, 165, 100,
+ 164, 163, 162, 161, 160, 159, 158, 157, 156, 155,
+ 154, 153, 152, 151, 150, 77, 31, 31, 34, 34,
+ 32, 32, 70, 70, 35, 35, 71, 71, 149, 148,
+ 147, 146, 145, 144, 143, 142, 141, 140, 139, 138,
+ 137, 136, 135, 134, 133, 132, 131, 130, 129, 128,
+ 127, 126, 125, 124, 123, 122, 121, 120, 119, 118,
+ 117, 116, 115, 114, 113, 112, 111, 110, 109, 108,

- 101, 100, 99, 97, 96, 95, 94, 93, 92, 91,
- 90, 89, 88, 87, 86, 85, 84, 83, 82, 81,
- 80, 79, 78, 77, 76, 74, 73, 72, 36, 68,
- 29, 66, 62, 49, 48, 40, 39, 30, 29, 172,
- 3, 172, 172, 172, 172, 172, 172, 172, 172, 172,
- 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
- 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
- 172, 172, 172, 172, 172, 172, 172, 172, 172
+ 107, 106, 105, 104, 103, 102, 101, 99, 98, 97,
+ 96, 95, 94, 93, 92, 91, 90, 89, 88, 87,
+ 86, 85, 84, 83, 82, 81, 80, 79, 78, 76,
+ 75, 74, 73, 36, 69, 29, 67, 63, 50, 49,
+ 40, 39, 30, 29, 177, 3, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177
} ;

-static const flex_int16_t yy_chk[280] =
+static const flex_int16_t yy_chk[285] =
{ 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, 8, 8,
- 173, 8, 9, 9, 10, 10, 10, 170, 10, 10,
+ 178, 8, 9, 9, 10, 10, 10, 175, 10, 10,
13, 13, 13, 20, 10, 10, 10, 10, 10, 10,
15, 15, 15, 23, 22, 21, 17, 17, 17, 23,
- 24, 169, 20, 20, 22, 168, 20, 15, 21, 24,
- 34, 34, 167, 15, 16, 16, 16, 17, 26, 165,
- 163, 26, 17, 162, 31, 31, 26, 31, 16, 33,
+ 24, 174, 20, 20, 22, 173, 20, 15, 21, 24,
+ 34, 34, 15, 15, 16, 16, 16, 17, 26, 172,
+ 170, 26, 17, 168, 31, 31, 26, 31, 16, 33,

- 33, 160, 33, 38, 38, 38, 16, 159, 158, 16,
- 39, 39, 39, 156, 39, 39, 43, 43, 43, 155,
- 39, 39, 39, 39, 39, 39, 69, 69, 154, 69,
- 153, 151, 150, 149, 148, 147, 146, 145, 144, 141,
- 140, 139, 138, 137, 136, 43, 174, 174, 175, 175,
- 176, 176, 177, 177, 178, 178, 179, 179, 135, 133,
- 130, 129, 128, 127, 126, 124, 123, 122, 121, 120,
- 119, 118, 115, 114, 113, 111, 110, 109, 108, 107,
- 106, 104, 103, 102, 99, 98, 96, 94, 93, 89,
- 88, 86, 84, 83, 81, 80, 79, 76, 75, 74,
+ 33, 167, 33, 38, 38, 38, 16, 165, 164, 16,
+ 39, 39, 39, 163, 39, 39, 44, 44, 44, 161,
+ 39, 39, 39, 39, 39, 39, 70, 70, 160, 70,
+ 159, 158, 156, 155, 154, 153, 152, 151, 150, 149,
+ 146, 145, 144, 143, 142, 44, 179, 179, 180, 180,
+ 181, 181, 182, 182, 183, 183, 184, 184, 141, 140,
+ 138, 135, 133, 132, 131, 130, 128, 127, 126, 125,
+ 124, 123, 122, 121, 118, 117, 116, 114, 113, 112,
+ 111, 110, 109, 107, 106, 105, 104, 101, 100, 98,
+ 96, 95, 91, 90, 88, 86, 85, 83, 82, 81,

- 73, 72, 70, 66, 65, 64, 63, 62, 61, 60,
- 58, 57, 56, 55, 54, 53, 52, 51, 50, 49,
- 48, 47, 46, 45, 44, 42, 41, 40, 35, 32,
- 29, 27, 25, 19, 18, 14, 11, 7, 5, 3,
- 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
- 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
- 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
- 172, 172, 172, 172, 172, 172, 172, 172, 172
+ 78, 77, 76, 75, 74, 73, 71, 67, 66, 65,
+ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54,
+ 53, 52, 51, 50, 49, 48, 47, 46, 45, 43,
+ 42, 41, 40, 35, 32, 29, 27, 25, 19, 18,
+ 14, 11, 7, 5, 3, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177
} ;

static yy_state_type yy_last_accepting_state;
@@ -549,21 +553,8 @@
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
-/*
- * sconfig, coreboot device tree compiler
- *
- * Copyright (C) 2010 coresystems GmbH
- * written by Patrick Georgi <patrick@georgi-clan.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+/* sconfig, coreboot device tree compiler */
+/* SPDX-License-Identifier: GPL-2.0-only */

#include "sconfig.tab.h"

@@ -810,13 +801,13 @@
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 173 )
+ if ( yy_current_state >= 178 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 241 );
+ while ( yy_base[yy_current_state] != 246 );

yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -864,119 +855,119 @@
YY_BREAK
case 6:
YY_RULE_SETUP
-{return(REGISTER);}
+{return(CONFIG);}
YY_BREAK
case 7:
YY_RULE_SETUP
-{yylval.number=1; return(BOOL);}
+{return(REGISTER);}
YY_BREAK
case 8:
YY_RULE_SETUP
-{yylval.number=0; return(BOOL);}
+{yylval.number=1; return(BOOL);}
YY_BREAK
case 9:
YY_RULE_SETUP
-{yylval.number=3; return(STATUS);}
+{yylval.number=0; return(BOOL);}
YY_BREAK
case 10:
YY_RULE_SETUP
-{yylval.number=5; return(STATUS);}
+{yylval.number=3; return(STATUS);}
YY_BREAK
case 11:
YY_RULE_SETUP
-{yylval.number=PCI; return(BUS);}
+{yylval.number=5; return(STATUS);}
YY_BREAK
case 12:
YY_RULE_SETUP
-{yylval.number=IOAPIC; return(BUS);}
+{yylval.number=PCI; return(BUS);}
YY_BREAK
case 13:
YY_RULE_SETUP
-{yylval.number=PNP; return(BUS);}
+{yylval.number=IOAPIC; return(BUS);}
YY_BREAK
case 14:
YY_RULE_SETUP
-{yylval.number=I2C; return(BUS);}
+{yylval.number=PNP; return(BUS);}
YY_BREAK
case 15:
YY_RULE_SETUP
-{yylval.number=APIC; return(BUS);}
+{yylval.number=I2C; return(BUS);}
YY_BREAK
case 16:
YY_RULE_SETUP
-{yylval.number=CPU_CLUSTER; return(BUS);}
+{yylval.number=APIC; return(BUS);}
YY_BREAK
case 17:
YY_RULE_SETUP
-{yylval.number=CPU; return(BUS);}
+{yylval.number=CPU_CLUSTER; return(BUS);}
YY_BREAK
case 18:
YY_RULE_SETUP
-{yylval.number=DOMAIN; return(BUS);}
+{yylval.number=CPU; return(BUS);}
YY_BREAK
case 19:
YY_RULE_SETUP
-{yylval.number=GENERIC; return(BUS);}
+{yylval.number=DOMAIN; return(BUS);}
YY_BREAK
case 20:
YY_RULE_SETUP
-{yylval.number=MMIO; return(BUS);}
+{yylval.number=GENERIC; return(BUS);}
YY_BREAK
case 21:
YY_RULE_SETUP
-{yylval.number=SPI; return(BUS);}
+{yylval.number=MMIO; return(BUS);}
YY_BREAK
case 22:
YY_RULE_SETUP
-{yylval.number=USB; return(BUS);}
+{yylval.number=SPI; return(BUS);}
YY_BREAK
case 23:
YY_RULE_SETUP
-{yylval.number=LPC; return(BUS);}
+{yylval.number=USB; return(BUS);}
YY_BREAK
case 24:
YY_RULE_SETUP
-{yylval.number=ESPI; return(BUS);}
+{yylval.number=LPC; return(BUS);}
YY_BREAK
case 25:
YY_RULE_SETUP
-{yylval.number=IRQ; return(RESOURCE);}
+{yylval.number=ESPI; return(BUS);}
YY_BREAK
case 26:
YY_RULE_SETUP
-{yylval.number=DRQ; return(RESOURCE);}
+{yylval.number=IRQ; return(RESOURCE);}
YY_BREAK
case 27:
YY_RULE_SETUP
-{yylval.number=IO; return(RESOURCE);}
+{yylval.number=DRQ; return(RESOURCE);}
YY_BREAK
case 28:
YY_RULE_SETUP
-{return(IOAPIC_IRQ);}
+{yylval.number=IO; return(RESOURCE);}
YY_BREAK
case 29:
YY_RULE_SETUP
-{return(INHERIT);}
+{return(IOAPIC_IRQ);}
YY_BREAK
case 30:
YY_RULE_SETUP
-{return(SUBSYSTEMID);}
+{return(INHERIT);}
YY_BREAK
case 31:
YY_RULE_SETUP
-{return(END);}
+{return(SUBSYSTEMID);}
YY_BREAK
case 32:
YY_RULE_SETUP
-{return(SLOT_DESC);}
+{return(END);}
YY_BREAK
case 33:
YY_RULE_SETUP
-{return(EQUALS);}
+{return(SLOT_DESC);}
YY_BREAK
case 34:
YY_RULE_SETUP
-{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
+{return(EQUALS);}
YY_BREAK
case 35:
YY_RULE_SETUP
@@ -988,12 +979,11 @@
YY_BREAK
case 37:
YY_RULE_SETUP
-{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);}
+{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
YY_BREAK
case 38:
-/* rule 38 can match eol */
YY_RULE_SETUP
-{yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
+{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);}
YY_BREAK
case 39:
/* rule 39 can match eol */
@@ -1001,10 +991,15 @@
{yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
YY_BREAK
case 40:
+/* rule 40 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 41:
YY_RULE_SETUP
{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);}
YY_BREAK
-case 41:
+case 42:
YY_RULE_SETUP
ECHO;
YY_BREAK
@@ -1304,7 +1299,7 @@
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 173 )
+ if ( yy_current_state >= 178 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -1332,11 +1327,11 @@
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 173 )
+ if ( yy_current_state >= 178 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- yy_is_jam = (yy_current_state == 172);
+ yy_is_jam = (yy_current_state == 177);

return yy_is_jam ? 0 : yy_current_state;
}
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 0d8f7f8..0e033d9 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -528,6 +528,12 @@
new_resource(bus->dev, type, index, base);
}

+void set_config_path(struct bus *bus, char *path)
+{
+ bus->dev->config_path = path;
+ bus->dev->config_path_underscore = translate_name(path, UNSLASH);
+}
+
static void add_reg(struct reg **const head, char *const name, char *const val)
{
struct reg *const r = S_ALLOC(sizeof(struct reg));
@@ -540,7 +546,7 @@
for (cur = *head; cur != NULL; prev = cur, cur = cur->next) {
const int sort = strcmp(r->key, cur->key);
if (sort == 0) {
- printf("ERROR: duplicate 'register' key.\n");
+ printf("ERROR: duplicate key '%s'.\n", name);
exit(1);
}
if (sort < 0)
@@ -553,6 +559,11 @@
*head = r;
}

+void add_setting(struct bus *bus, char *name, char *val)
+{
+ add_reg(&bus->dev->settings, name, val);
+}
+
void add_register(struct chip_instance *chip_instance, char *name, char *val)
{
add_reg(&chip_instance->reg, name, val);
@@ -644,6 +655,9 @@
ptr->name = name;

fprintf(fil, "STORAGE struct device %s;\n", ptr->name);
+ if (ptr->config_path)
+ fprintf(fil, "STORAGE struct %s_config %s_config;\n",
+ ptr->config_path_underscore, ptr->name);
if (ptr->res)
fprintf(fil, "STORAGE struct resource %s_res[];\n",
ptr->name);
@@ -659,6 +673,22 @@
ptr->name);
}

+static void emit_config(FILE *fil, struct device *ptr)
+{
+ struct reg *r;
+
+ if (ptr->config_path == NULL)
+ return;
+
+ fprintf(fil, "STORAGE struct %s_config %s_config = {\n",
+ ptr->config_path_underscore, ptr->name);
+
+ for (r = ptr->settings; r != NULL; r = r->next)
+ fprintf(fil, "\t.%s = %s,\n", r->key, r->value);
+
+ fprintf(fil, "};\n");
+}
+
static void emit_resources(FILE *fil, struct device *ptr)
{
if (ptr->res == NULL)
@@ -748,6 +778,8 @@
fprintf(fil, "\t.ops = &default_dev_ops_root,\n");
else
fprintf(fil, "\t.ops = NULL,\n");
+ if (ptr->config_path)
+ fprintf(fil, "\t.config = &%s_config,\n", ptr->name);
fprintf(fil, "#endif\n");
fprintf(fil, "\t.bus = &%s_links[%d],\n", ptr->parent->dev->name,
ptr->parent->id);
@@ -826,6 +858,7 @@
}
fprintf(fil, "};\n");

+ emit_config(fil, ptr);
emit_resources(fil, ptr);

if (has_children)
@@ -1301,6 +1334,12 @@
}
}

+static void emit_config_headers(FILE *file, FILE *head, struct device *dev, struct device *next)
+{
+ if (dev->config_path)
+ fprintf(file, "#include \"%s/config.h\"\n", dev->config_path);
+}
+
int main(int argc, char **argv)
{
if ((argc < MANDATORY_ARG_COUNT) || (argc > TOTAL_ARG_COUNT))
@@ -1346,6 +1385,8 @@

fprintf(autogen, "#include <device/device.h>\n");
fprintf(autogen, "#include <device/pci.h>\n\n");
+ walk_device_tree(autogen, autohead, &base_root_dev, emit_config_headers);
+ fprintf(autogen, "\n");

emit_chips(autogen);

diff --git a/util/sconfig/sconfig.h b/util/sconfig/sconfig.h
index a960b7f..bd97d240 100644
--- a/util/sconfig/sconfig.h
+++ b/util/sconfig/sconfig.h
@@ -125,6 +125,11 @@
/* Pointer to chip instance for this device. */
struct chip_instance *chip_instance;

+ /* Path of config and settings. */
+ char *config_path;
+ char *config_path_underscore;
+ struct reg *settings;
+
/* Pointer to list of buses under this device. */
struct bus *bus;
/* Pointer to last bus under this device. */
@@ -150,6 +155,9 @@
const int bustype, const char *devnum,
int status);

+void set_config_path(struct bus *bus, char *path);
+void add_setting(struct bus *bus, char *name, char *val);
+
void add_resource(struct bus *bus, int type, int index, int base);

void add_pci_subsystem_ids(struct bus *bus, int vendor, int device,
diff --git a/util/sconfig/sconfig.l b/util/sconfig/sconfig.l
index 5ac5057..f0b1efd 100755
--- a/util/sconfig/sconfig.l
+++ b/util/sconfig/sconfig.l
@@ -13,6 +13,7 @@
\r?\n {linenum++;}
chip {return(CHIP);}
device {return(DEVICE);}
+config {return(CONFIG);}
register {return(REGISTER);}
on {yylval.number=1; return(BOOL);}
off {yylval.number=0; return(BOOL);}
diff --git a/util/sconfig/sconfig.tab.c_shipped b/util/sconfig/sconfig.tab.c_shipped
index 2bae43b..b0d79bd 100644
--- a/util/sconfig/sconfig.tab.c_shipped
+++ b/util/sconfig/sconfig.tab.c_shipped
@@ -111,8 +111,8 @@

/* Use api.header.include to #include this header
instead of duplicating it here. */
-#ifndef YY_YY_HOME_ME_REPOS_COREBOOTORG_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
-# define YY_YY_HOME_ME_REPOS_COREBOOTORG_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
+#ifndef YY_YY_HOME_ICON_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
+# define YY_YY_HOME_ICON_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
@@ -128,39 +128,40 @@
{
CHIP = 258,
DEVICE = 259,
- REGISTER = 260,
- BOOL = 261,
- STATUS = 262,
- MANDATORY = 263,
- BUS = 264,
- RESOURCE = 265,
- END = 266,
- EQUALS = 267,
- HEX = 268,
- STRING = 269,
- PCI = 270,
- PNP = 271,
- I2C = 272,
- APIC = 273,
- CPU_CLUSTER = 274,
- CPU = 275,
- DOMAIN = 276,
- IRQ = 277,
- DRQ = 278,
- SLOT_DESC = 279,
- IO = 280,
- NUMBER = 281,
- SUBSYSTEMID = 282,
- INHERIT = 283,
- IOAPIC_IRQ = 284,
- IOAPIC = 285,
- PCIINT = 286,
- GENERIC = 287,
- SPI = 288,
- USB = 289,
- MMIO = 290,
- LPC = 291,
- ESPI = 292
+ CONFIG = 260,
+ REGISTER = 261,
+ BOOL = 262,
+ STATUS = 263,
+ MANDATORY = 264,
+ BUS = 265,
+ RESOURCE = 266,
+ END = 267,
+ EQUALS = 268,
+ HEX = 269,
+ STRING = 270,
+ PCI = 271,
+ PNP = 272,
+ I2C = 273,
+ APIC = 274,
+ CPU_CLUSTER = 275,
+ CPU = 276,
+ DOMAIN = 277,
+ IRQ = 278,
+ DRQ = 279,
+ SLOT_DESC = 280,
+ IO = 281,
+ NUMBER = 282,
+ SUBSYSTEMID = 283,
+ INHERIT = 284,
+ IOAPIC_IRQ = 285,
+ IOAPIC = 286,
+ PCIINT = 287,
+ GENERIC = 288,
+ SPI = 289,
+ USB = 290,
+ MMIO = 291,
+ LPC = 292,
+ ESPI = 293
};
#endif

@@ -186,7 +187,7 @@

int yyparse (void);

-#endif /* !YY_YY_HOME_ME_REPOS_COREBOOTORG_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */
+#endif /* !YY_YY_HOME_ICON_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */



@@ -492,19 +493,19 @@
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 3
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 45
+#define YYLAST 55

/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 38
+#define YYNTOKENS 39
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 15
+#define YYNNTS 19
/* YYNRULES -- Number of rules. */
-#define YYNRULES 29
+#define YYNRULES 35
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 50
+#define YYNSTATES 61

#define YYUNDEFTOK 2
-#define YYMAXUTOK 292
+#define YYMAXUTOK 293


/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
@@ -545,16 +546,17 @@
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37
+ 35, 36, 37, 38
};

#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_int8 yyrline[] =
{
- 0, 36, 36, 36, 38, 38, 38, 38, 40, 40,
- 40, 40, 40, 40, 40, 40, 42, 42, 51, 51,
- 59, 59, 61, 64, 67, 70, 73, 76, 79, 82
+ 0, 23, 23, 23, 25, 25, 25, 25, 27, 27,
+ 27, 27, 27, 27, 27, 27, 29, 29, 31, 31,
+ 40, 40, 48, 48, 50, 50, 53, 56, 59, 62,
+ 65, 68, 71, 74, 77, 80
};
#endif

@@ -563,14 +565,15 @@
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "CHIP", "DEVICE", "REGISTER", "BOOL",
- "STATUS", "MANDATORY", "BUS", "RESOURCE", "END", "EQUALS", "HEX",
+ "$end", "error", "$undefined", "CHIP", "DEVICE", "CONFIG", "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", "$accept", "devtree", "$@1", "chipchildren", "devicechildren",
- "chip", "@2", "device", "@3", "status", "resource", "registers",
- "subsystemid", "ioapic_irq", "smbios_slot_desc", YY_NULLPTR
+ "settings", "chip", "@2", "device", "@3", "status", "config", "$@4",
+ "setting", "resource", "registers", "subsystemid", "ioapic_irq",
+ "smbios_slot_desc", YY_NULLPTR
};
#endif

@@ -582,11 +585,11 @@
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
+ 285, 286, 287, 288, 289, 290, 291, 292, 293
};
# endif

-#define YYPACT_NINF (-10)
+#define YYPACT_NINF (-16)

#define yypact_value_is_default(Yyn) \
((Yyn) == YYPACT_NINF)
@@ -600,11 +603,13 @@
STATE-NUM. */
static const yytype_int8 yypact[] =
{
- -10, 11, 10, -10, 0, -10, -10, -10, 1, 6,
- 2, -10, -10, -10, -10, -9, 8, 3, 4, -10,
- -10, -10, -10, -10, -3, -4, -10, 9, -1, 5,
- -10, -10, -10, -10, -10, -10, -10, 15, 14, 7,
- -2, 12, 16, 13, 17, -10, 18, -10, -10, -10
+ -16, 6, 7, -16, 2, -16, -16, -16, 1, 9,
+ 3, -16, -16, -16, -16, -15, 10, 8, 5, -16,
+ -16, -16, -16, 19, 11, -16, -16, -3, 13, 4,
+ -16, 14, 12, 15, -16, -16, -16, -16, -16, -16,
+ -16, 17, -1, -16, 20, 21, 16, 0, 22, -16,
+ -16, 18, 23, 24, 25, -16, -16, 26, -16, -16,
+ -16
};

/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -612,25 +617,27 @@
means the default is an error. */
static const yytype_int8 yydefact[] =
{
- 2, 0, 0, 1, 0, 3, 16, 7, 0, 0,
- 0, 17, 5, 4, 6, 0, 0, 0, 0, 20,
- 21, 18, 23, 15, 0, 0, 19, 0, 0, 0,
- 9, 8, 10, 14, 11, 12, 13, 0, 0, 0,
- 0, 0, 29, 24, 0, 22, 28, 25, 26, 27
+ 2, 0, 0, 1, 0, 3, 18, 7, 0, 0,
+ 0, 19, 5, 4, 6, 0, 0, 0, 0, 22,
+ 23, 20, 29, 26, 0, 15, 24, 0, 0, 0,
+ 21, 0, 0, 0, 9, 8, 10, 14, 11, 12,
+ 13, 0, 0, 17, 0, 0, 0, 0, 0, 25,
+ 16, 0, 35, 30, 0, 27, 28, 34, 31, 32,
+ 33
};

/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -10, -10, -10, -10, -10, -5, -10, 20, -10, -10,
- -10, 21, -10, -10, -10
+ -16, -16, -16, -16, -16, -16, -6, -16, 27, -16,
+ -16, -16, -16, -8, -16, 28, -16, -16, -16
};

/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 1, 2, 8, 24, 5, 7, 13, 23, 21,
- 32, 14, 34, 35, 36
+ -1, 1, 2, 8, 27, 42, 5, 7, 13, 23,
+ 21, 25, 28, 43, 36, 14, 38, 39, 40
};

/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -638,47 +645,53 @@
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int8 yytable[] =
{
- 4, 9, 10, 12, 4, 9, 10, 25, 26, 19,
- 20, 3, 11, 4, 6, 15, 16, 17, 22, 30,
- 18, 27, 37, 38, 28, 39, 29, 41, 42, 44,
- 46, 40, 49, 43, 0, 0, 0, 0, 45, 0,
- 0, 47, 0, 48, 31, 33
+ 4, 9, 12, 10, 4, 9, 3, 10, 29, 30,
+ 4, 49, 17, 11, 41, 19, 20, 6, 16, 15,
+ 22, 34, 31, 18, 24, 32, 26, 33, 41, 45,
+ 48, 44, 54, 51, 50, 0, 52, 55, 57, 46,
+ 0, 60, 47, 53, 0, 56, 0, 0, 0, 0,
+ 0, 0, 59, 58, 35, 37
};

static const yytype_int8 yycheck[] =
{
- 3, 4, 5, 8, 3, 4, 5, 10, 11, 6,
- 7, 0, 11, 3, 14, 9, 14, 26, 14, 24,
- 12, 24, 26, 14, 27, 26, 29, 12, 14, 31,
- 14, 26, 14, 26, -1, -1, -1, -1, 26, -1,
- -1, 28, -1, 26, 24, 24
+ 3, 4, 8, 6, 3, 4, 0, 6, 11, 12,
+ 3, 12, 27, 12, 15, 7, 8, 15, 15, 10,
+ 15, 27, 25, 13, 5, 28, 15, 30, 15, 15,
+ 13, 27, 32, 13, 42, -1, 15, 15, 15, 27,
+ -1, 15, 27, 27, -1, 27, -1, -1, -1, -1,
+ -1, -1, 27, 29, 27, 27
};

/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_int8 yystos[] =
{
- 0, 39, 40, 0, 3, 43, 14, 44, 41, 4,
- 5, 11, 43, 45, 49, 9, 14, 26, 12, 6,
- 7, 47, 14, 46, 42, 10, 11, 24, 27, 29,
- 43, 45, 48, 49, 50, 51, 52, 26, 14, 26,
- 26, 12, 14, 26, 31, 26, 14, 28, 26, 14
+ 0, 40, 41, 0, 3, 45, 15, 46, 42, 4,
+ 6, 12, 45, 47, 54, 10, 15, 27, 13, 7,
+ 8, 49, 15, 48, 5, 50, 15, 43, 51, 11,
+ 12, 25, 28, 30, 45, 47, 53, 54, 55, 56,
+ 57, 15, 44, 52, 27, 15, 27, 27, 13, 12,
+ 52, 13, 15, 27, 32, 15, 27, 15, 29, 27,
+ 15
};

/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_int8 yyr1[] =
{
- 0, 38, 40, 39, 41, 41, 41, 41, 42, 42,
- 42, 42, 42, 42, 42, 42, 44, 43, 46, 45,
- 47, 47, 48, 49, 50, 50, 51, 52, 52, 52
+ 0, 39, 41, 40, 42, 42, 42, 42, 43, 43,
+ 43, 43, 43, 43, 43, 43, 44, 44, 46, 45,
+ 48, 47, 49, 49, 51, 50, 50, 52, 53, 54,
+ 55, 55, 56, 57, 57, 57
};

/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_int8 yyr2[] =
{
0, 2, 0, 2, 2, 2, 2, 0, 2, 2,
- 2, 2, 2, 2, 2, 0, 0, 5, 0, 7,
- 1, 1, 4, 4, 3, 4, 4, 5, 4, 3
+ 2, 2, 2, 2, 2, 0, 2, 1, 0, 5,
+ 0, 8, 1, 1, 0, 5, 0, 3, 4, 4,
+ 3, 4, 4, 5, 4, 3
};


@@ -1377,7 +1390,7 @@
{ cur_parent = root_parent; }
break;

- case 16:
+ case 18:
{
(yyval.chip_instance) = new_chip_instance((yyvsp[0].string));
chip_enqueue_tail(cur_chip_instance);
@@ -1385,54 +1398,64 @@
}
break;

- case 17:
+ case 19:
{
cur_chip_instance = chip_dequeue_tail();
}
break;

- case 18:
+ case 20:
{
(yyval.dev) = new_device(cur_parent, cur_chip_instance, (yyvsp[-2].number), (yyvsp[-1].string), (yyvsp[0].number));
cur_parent = (yyval.dev)->last_bus;
}
break;

- case 19:
- {
- cur_parent = (yyvsp[-2].dev)->parent;
+ case 21:
+ {
+ cur_parent = (yyvsp[-3].dev)->parent;
}
break;

- case 22:
- { add_resource(cur_parent, (yyvsp[-3].number), strtol((yyvsp[-2].string), NULL, 0), strtol((yyvsp[0].string), NULL, 0)); }
- break;
-
- case 23:
- { add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); }
- break;
-
case 24:
- { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-1].string), NULL, 16), strtol((yyvsp[0].string), NULL, 16), 0); }
- break;
-
- case 25:
- { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-2].string), NULL, 16), strtol((yyvsp[-1].string), NULL, 16), 1); }
- break;
-
- case 26:
- { add_ioapic_info(cur_parent, strtol((yyvsp[-2].string), NULL, 16), (yyvsp[-1].string), strtol((yyvsp[0].string), NULL, 16)); }
+ {
+ set_config_path(cur_parent, (yyvsp[0].string));
+}
break;

case 27:
- { add_slot_desc(cur_parent, (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string)); }
+ { add_setting(cur_parent, (yyvsp[-2].string), (yyvsp[0].string)); }
break;

case 28:
- { add_slot_desc(cur_parent, (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string), NULL); }
+ { add_resource(cur_parent, (yyvsp[-3].number), strtol((yyvsp[-2].string), NULL, 0), strtol((yyvsp[0].string), NULL, 0)); }
break;

case 29:
+ { add_register(cur_chip_instance, (yyvsp[-2].string), (yyvsp[0].string)); }
+ break;
+
+ case 30:
+ { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-1].string), NULL, 16), strtol((yyvsp[0].string), NULL, 16), 0); }
+ break;
+
+ case 31:
+ { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[-2].string), NULL, 16), strtol((yyvsp[-1].string), NULL, 16), 1); }
+ break;
+
+ case 32:
+ { add_ioapic_info(cur_parent, strtol((yyvsp[-2].string), NULL, 16), (yyvsp[-1].string), strtol((yyvsp[0].string), NULL, 16)); }
+ break;
+
+ case 33:
+ { add_slot_desc(cur_parent, (yyvsp[-3].string), (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string)); }
+ break;
+
+ case 34:
+ { add_slot_desc(cur_parent, (yyvsp[-2].string), (yyvsp[-1].string), (yyvsp[0].string), NULL); }
+ break;
+
+ case 35:
{ add_slot_desc(cur_parent, (yyvsp[-1].string), (yyvsp[0].string), NULL, NULL); }
break;

diff --git a/util/sconfig/sconfig.tab.h_shipped b/util/sconfig/sconfig.tab.h_shipped
index 5fa9d19..cb68de9 100644
--- a/util/sconfig/sconfig.tab.h_shipped
+++ b/util/sconfig/sconfig.tab.h_shipped
@@ -34,8 +34,8 @@
/* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */

-#ifndef YY_YY_HOME_ME_REPOS_COREBOOTORG_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
-# define YY_YY_HOME_ME_REPOS_COREBOOTORG_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
+#ifndef YY_YY_HOME_ICON_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
+# define YY_YY_HOME_ICON_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
@@ -51,39 +51,40 @@
{
CHIP = 258,
DEVICE = 259,
- REGISTER = 260,
- BOOL = 261,
- STATUS = 262,
- MANDATORY = 263,
- BUS = 264,
- RESOURCE = 265,
- END = 266,
- EQUALS = 267,
- HEX = 268,
- STRING = 269,
- PCI = 270,
- PNP = 271,
- I2C = 272,
- APIC = 273,
- CPU_CLUSTER = 274,
- CPU = 275,
- DOMAIN = 276,
- IRQ = 277,
- DRQ = 278,
- SLOT_DESC = 279,
- IO = 280,
- NUMBER = 281,
- SUBSYSTEMID = 282,
- INHERIT = 283,
- IOAPIC_IRQ = 284,
- IOAPIC = 285,
- PCIINT = 286,
- GENERIC = 287,
- SPI = 288,
- USB = 289,
- MMIO = 290,
- LPC = 291,
- ESPI = 292
+ CONFIG = 260,
+ REGISTER = 261,
+ BOOL = 262,
+ STATUS = 263,
+ MANDATORY = 264,
+ BUS = 265,
+ RESOURCE = 266,
+ END = 267,
+ EQUALS = 268,
+ HEX = 269,
+ STRING = 270,
+ PCI = 271,
+ PNP = 272,
+ I2C = 273,
+ APIC = 274,
+ CPU_CLUSTER = 275,
+ CPU = 276,
+ DOMAIN = 277,
+ IRQ = 278,
+ DRQ = 279,
+ SLOT_DESC = 280,
+ IO = 281,
+ NUMBER = 282,
+ SUBSYSTEMID = 283,
+ INHERIT = 284,
+ IOAPIC_IRQ = 285,
+ IOAPIC = 286,
+ PCIINT = 287,
+ GENERIC = 288,
+ SPI = 289,
+ USB = 290,
+ MMIO = 291,
+ LPC = 292,
+ ESPI = 293
};
#endif

@@ -109,4 +110,4 @@

int yyparse (void);

-#endif /* !YY_YY_HOME_ME_REPOS_COREBOOTORG_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */
+#endif /* !YY_YY_HOME_ICON_COREBOOT_UTIL_SCONFIG_SCONFIG_TAB_H_SHIPPED_INCLUDED */
diff --git a/util/sconfig/sconfig.y b/util/sconfig/sconfig.y
index 161cf81..defa96f 100755
--- a/util/sconfig/sconfig.y
+++ b/util/sconfig/sconfig.y
@@ -18,7 +18,7 @@
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
+%token CHIP DEVICE CONFIG 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;

@@ -26,6 +26,8 @@

devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | devicechildren smbios_slot_desc | devicechildren registers | /* empty */ ;

+settings: settings setting | setting;
+
chip: CHIP STRING /* == path */ {
$<chip_instance>$ = new_chip_instance($<string>2);
chip_enqueue_tail(cur_chip_instance);
@@ -39,12 +41,21 @@
$<dev>$ = new_device(cur_parent, cur_chip_instance, $<number>2, $<string>3, $<number>4);
cur_parent = $<dev>$->last_bus;
}
- devicechildren END {
+ config devicechildren END {
cur_parent = $<dev>5->parent;
};

status: BOOL | STATUS ;

+config: CONFIG STRING /* == path */ {
+ set_config_path(cur_parent, $<string>2);
+}
+ settings END | /* empty */
+;
+
+setting: STRING /* == identifier */ EQUALS STRING /* == value */
+ { add_setting(cur_parent, $<string>1, $<string>3); } ;
+
resource: RESOURCE NUMBER /* == resnum */ EQUALS NUMBER /* == resval */
{ add_resource(cur_parent, $<number>1, strtol($<string>2, NULL, 0), strtol($<string>4, NULL, 0)); } ;


To view, visit change 41745. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I25f46e774bb6d26d0e6b77f9bd96d80581412655
Gerrit-Change-Number: 41745
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Aaron Durbin <adurbin@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Furquan Shaikh <furquan@google.com>
Gerrit-Reviewer: Kyösti Mälkki <kyosti.malkki@gmail.com>
Gerrit-Reviewer: Martin Roth <martinroth@google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-MessageType: newchange