summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2021-05-20 22:08:57 -0700
committerTim Wawrzynczak <twawrzynczak@chromium.org>2021-05-24 16:55:08 +0000
commit17298c09de7cee2e191fae6e3353a6032999cf8f (patch)
tree038f6ae3ca53f4c4f48b811d1cfa7c26de759b91 /src
parent5621a1e567fd983995593beae42cab991f43b361 (diff)
fw_config: Return false in `fw_config_probe` in unprovisioned case
fw_config is unprovisioned in the factory for the first boot. This is the only case where fw_config is left unprovisioned. On first boot in factory, fw_config gets correctly provisioned by the factory toolkit. When fw_config is unprovisioned, it is not always possible to make a guess which device to enable/disable since there can be certain conflicting devices which can never be enabled at the same time. That is the reason the original implementation of fw_config library kept fw_config as 0 when it was unprovisioned. CB:47956 ("fw_config: Use UNDEFINED_FW_CONFIG to mean unprovisioned") added support for a special unprovisioned value to allow any callers to identify this factory boot condition and take any appropriate action required for this boot (Ideally, this would just involve configuring any boot devices essential to getting to OS. All other non-essential devices can be kept disabled until fw_config is properly provisioned). However, CB:47956 missed handling the `fw_config_probe()` function and resulted in silent change in behavior. This change fixes the regression introduced by CB:47956 and returns `false` in `fw_config_probe()` if fw_config is not provisioned yet. Change-Id: Ic22cd650d3eb3a6016fa2e2775ea8272405ee23b Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/54750 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com> Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/lib/fw_config.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/fw_config.c b/src/lib/fw_config.c
index 2c4c6b290c..7412f383e1 100644
--- a/src/lib/fw_config.c
+++ b/src/lib/fw_config.c
@@ -50,6 +50,10 @@ uint64_t fw_config_get(void)
bool fw_config_probe(const struct fw_config *match)
{
+ /* If fw_config is not provisioned, then there is nothing to match. */
+ if (!fw_config_is_provisioned())
+ return false;
+
/* Compare to system value. */
if ((fw_config_get() & match->mask) == match->value) {
if (match->field_name && match->option_name)