diff --git a/src/include/fw_config.h b/src/include/fw_config.h index 1e1652efb6..266490bc7e 100644 --- a/src/include/fw_config.h +++ b/src/include/fw_config.h @@ -71,6 +71,20 @@ static inline bool fw_config_is_provisioned(void) */ uint64_t fw_config_get_field(const struct fw_config_field *field); +/** + * fw_config_probe_mainboard_override() - Mainboard hook to override specific probes + * @match: Structure containing field and option to probe + * @result: Output parameter - set to the probe result if this probe was handled + * + * Return: %true if this probe was handled, %false otherwise + * + * Mainboards can override this function to handle specific fw_config probes + * (e.g., based on CFR/CMOS options). If a probe is handled, return %true and + * set *result to the desired probe result. If not handled, return %false and + * the standard fw_config logic will be used. + */ +bool fw_config_probe_mainboard_override(const struct fw_config *match, bool *result); + /** * fw_config_probe() - Check if field and option matches. * @match: Structure containing field and option to probe. diff --git a/src/lib/fw_config.c b/src/lib/fw_config.c index 74f3f8bc41..b2c1cd491d 100644 --- a/src/lib/fw_config.c +++ b/src/lib/fw_config.c @@ -72,8 +72,19 @@ uint64_t fw_config_get_field(const struct fw_config_field *field) return value; } +bool __weak fw_config_probe_mainboard_override(const struct fw_config *match, bool *result) +{ + return false; +} + bool fw_config_probe(const struct fw_config *match) { + bool result; + + /* Give mainboard a chance to override this probe */ + if (fw_config_probe_mainboard_override(match, &result)) + return result; + /* If fw_config is not provisioned, then there is nothing to match. */ if (!fw_config_is_provisioned()) return false;