summaryrefslogtreecommitdiffstats
path: root/src/include/fw_config.h
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2021-05-20 22:30:02 -0700
committerTim Wawrzynczak <twawrzynczak@chromium.org>2021-05-24 16:55:27 +0000
commit665891e3a8daafe04494fd4ac2dba49a99840a3a (patch)
tree35ab5cdf9b2e04380cae1faea6df1499088295a8 /src/include/fw_config.h
parente59ad2e0da6298a12b3d54f0a7f17c87a973910d (diff)
downloadcoreboot-665891e3a8daafe04494fd4ac2dba49a99840a3a.tar.gz
coreboot-665891e3a8daafe04494fd4ac2dba49a99840a3a.tar.bz2
coreboot-665891e3a8daafe04494fd4ac2dba49a99840a3a.zip
fw_config: Add helper function `fw_config_probe_dev`
This change adds a helper function `fw_config_probe_dev()` that allows the caller to check if any of the probe conditions are true for any given device. If device has no probe conditions or a matching probe condition, then it returns true and provides the matching probe condition back to caller (if provided with a valid pointer). Else, it returns false. When fw_config support is disabled, this function always returns true. Change-Id: Ic2dae338e6fbd7755feb23ca86c50c42103f349b Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/54751 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/include/fw_config.h')
-rw-r--r--src/include/fw_config.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/include/fw_config.h b/src/include/fw_config.h
index b7028713587d..7a8ad3048213 100644
--- a/src/include/fw_config.h
+++ b/src/include/fw_config.h
@@ -70,6 +70,16 @@ bool fw_config_is_provisioned(void);
*/
const struct fw_config *fw_config_get_found(uint64_t field_mask);
+/**
+ * fw_config_probe_dev() - Check if any of the probe conditions are true for given device.
+ * @dev: Device for which probe conditions are checked
+ * @matching_probe: If any probe condition match, then the matching probe condition is returned
+ * to the caller.
+ * Return %true if device has no probing conditions or if a matching probe condition is
+ * encountered, %false otherwise.
+ */
+bool fw_config_probe_dev(const struct device *dev, const struct fw_config **matching_probe);
+
#else
static inline bool fw_config_probe(const struct fw_config *match)
@@ -78,6 +88,15 @@ static inline bool fw_config_probe(const struct fw_config *match)
return true;
}
+static inline bool fw_config_probe_dev(const struct device *dev,
+ const struct fw_config **matching_probe)
+{
+ /* Always return true when probing with disabled fw_config. */
+ if (matching_probe)
+ *matching_probe = NULL;
+ return true;
+}
+
#endif /* CONFIG(FW_CONFIG) */
#endif /* __FW_CONFIG__ */