From 473bc8c892c3acf6b1a222a09a53d5a190611bba Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Tue, 24 Nov 2020 10:33:00 -0700 Subject: fw_config: Use UNDEFINED_FW_CONFIG to mean unprovisioned A mainboard might want to configure some things differently when a device is in an unprovisioned state. In the case when fw_config comes from the Chromium EC, an unprovisioned device will not have a FW_CONFIG tag in its CBI. This patch will set the fw_config value to UNDEFINED_FW_CONFIG in the case of an error retrieving the value, as well as adding a function, `fw_config_is_provisioned()` to indicate the provisioning status. BUG=none TEST=remove fw_config from chromium EC CBI, add code to mainboard to print return value of fw_config_is_provisioned() (`0`), add fw_config back to CBI, run same test and see `1`. Signed-off-by: Tim Wawrzynczak Change-Id: Ib3046233667e97a5f78961fabacbeb3099b3d442 Reviewed-on: https://review.coreboot.org/c/coreboot/+/47956 Reviewed-by: Furquan Shaikh Reviewed-by: Nick Vaccaro Tested-by: build bot (Jenkins) --- src/include/fw_config.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/include') diff --git a/src/include/fw_config.h b/src/include/fw_config.h index 3c8772598e..b702871358 100644 --- a/src/include/fw_config.h +++ b/src/include/fw_config.h @@ -56,6 +56,12 @@ bool fw_config_probe(const struct fw_config *match); */ void fw_config_for_each_found(void (*cb)(const struct fw_config *config, void *arg), void *arg); +/** + * fw_config_is_provisioned() - Determine if FW_CONFIG has been provisioned. + * Return %true if FW_CONFIG has been provisioned, %false otherwise. + */ +bool fw_config_is_provisioned(void); + /** * fw_config_get_found() - Return a pointer to the fw_config struct for a given field. * @field_mask: A field mask from static.h, e.g., FW_CONFIG_FIELD_FEATURE_MASK -- cgit v1.2.3