summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2021-04-28 14:03:07 -0600
committerPatrick Georgi <pgeorgi@google.com>2021-05-03 07:40:57 +0000
commit13e240c60287e46feca94800d2f3302600ad0639 (patch)
treedada49f3262318df1f1f28f0e5ef18d696c84bf1 /Documentation
parent54c4ecb9f26d5913f92d3568093d9cad37b8aab6 (diff)
util/sconfig: Add support for discontiguous FW_CONFIG fields
Sooner or later, some board was going to need extra FW_CONFIG bits for a field that was already in production, so this patch adds support for adding extra (unused) bits to a field. The extra are appended via a syntax like: `field FIELD_NAME START0 END0 | START1 END1 | START2 END2 ...` and the suffixed bits are all treated as if they are contiguous when defining option values. BUG=b:185190978 TEST=Modified volteer fw_config to the following: field AUDIO 8 10 | 29 29 | 31 31 option NONE 0 option MAX98357_ALC5682I_I2S 1 option MAX98373_ALC5682I_I2S 2 option MAX98373_ALC5682_SNDW 3 option MAX98373_ALC5682I_I2S_UP4 4 option MAX98360_ALC5682I_I2S 5 option RT1011_ALC5682I_I2S 6 option AUDIO_FOO 7 option AUDIO_BAR 8 option AUDIO_QUUX 9 option AUDIO_BLAH1 10 option AUDIO_BLAH2 15 option AUDIO_BLAH3 16 option AUDIO_BLAH4 31 end which yielded (in static_fw_config.h): FW_CONFIG_FIELD_AUDIO_MASK 0xa0000700 FW_CONFIG_FIELD_AUDIO_OPTION_NONE_VALUE 0x0 FW_CONFIG_FIELD_AUDIO_OPTION_MAX98357_ALC5682I_I2S_VALUE 0x100 FW_CONFIG_FIELD_AUDIO_OPTION_MAX98373_ALC5682I_I2S_VALUE 0x200 FW_CONFIG_FIELD_AUDIO_OPTION_MAX98373_ALC5682_SNDW_VALUE 0x300 FW_CONFIG_FIELD_AUDIO_OPTION_MAX98373_ALC5682I_I2S_UP4_VALUE 0x400 FW_CONFIG_FIELD_AUDIO_OPTION_MAX98360_ALC5682I_I2S_VALUE 0x500 FW_CONFIG_FIELD_AUDIO_OPTION_RT1011_ALC5682I_I2S_VALUE 0x600 FW_CONFIG_FIELD_AUDIO_OPTION_AUDIO_FOO_VALUE 0x700 FW_CONFIG_FIELD_AUDIO_OPTION_AUDIO_BAR_VALUE 0x20000000 FW_CONFIG_FIELD_AUDIO_OPTION_AUDIO_QUUX_VALUE 0x20000100 FW_CONFIG_FIELD_AUDIO_OPTION_AUDIO_BLAH1_VALUE 0x20000200 FW_CONFIG_FIELD_AUDIO_OPTION_AUDIO_BLAH2_VALUE 0x20000700 FW_CONFIG_FIELD_AUDIO_OPTION_AUDIO_BLAH3_VALUE 0x80000000 FW_CONFIG_FIELD_AUDIO_OPTION_AUDIO_BLAH4_VALUE 0xa0000700 Change-Id: I5ed76706347ee9642198efc77139abdc3af1b8a6 Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52747 Reviewed-by: Duncan Laurie <duncan@iceblink.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/lib/fw_config.md38
1 files changed, 37 insertions, 1 deletions
diff --git a/Documentation/lib/fw_config.md b/Documentation/lib/fw_config.md
index dcf1bb4e95..d5f0bb2d06 100644
--- a/Documentation/lib/fw_config.md
+++ b/Documentation/lib/fw_config.md
@@ -121,12 +121,48 @@ Each field is defined by providing the field name and the start and end bit mark
location in the bitmask. Field names must be at least three characters long in order to
satisfy the sconfig parser requirements and they must be unique with non-overlapping masks.
- field <name> <start-bit> <end-bit> [option...] end
+ field <name> <start-bit> <end-bit> [option...] end
For single-bit fields only one number is needed:
field <name> <bit> [option...] end
+A field definition can also contain multiple sets of bit masks, which can be dis-contiguous.
+They are treated as if they are contiguous when defining option values. This allows for
+extending fields even after the bits after its current masks are occupied.
+
+ field <name> <start-bit0> <end-bit0> | <start-bit1> <end-bit1> | ...
+
+For example, if more audio options need to be supported:
+
+ field AUDIO 3 3
+ option AUDIO_0 0
+ option AUDIO_1 1
+ end
+ field OTHER 4 4
+ ...
+ end
+
+the following can be done:
+
+ field AUDIO 3 3 | 5 5
+ option AUDIO_FOO 0
+ option AUDIO_BLAH 1
+ option AUDIO_BAR 2
+ option AUDIO_BAZ 3
+ end
+ field OTHER 4 4
+ ...
+ end
+
+In that case, the AUDIO masks are extended like so:
+
+ #define FW_CONFIG_FIELD_AUDIO_MASK 0x28
+ #define FW_CONFIG_FIELD_AUDIO_OPTION_AUDIO_FOO_VALUE 0x0
+ #define FW_CONFIG_FIELD_AUDIO_OPTION_AUDIO_BLAH_VALUE 0x8
+ #define FW_CONFIG_FIELD_AUDIO_OPTION_AUDIO_BAR_VALUE 0x20
+ #define FW_CONFIG_FIELD_AUDIO_OPTION_AUDIO_BAz_VALUE 0x28
+
Each `field` definition starts a new block that can be composed of zero or more field options,
and it is terminated with `end`.