19 static bool fw_config_value_initialized;
22 if (fw_config_value_initialized)
23 return fw_config_value;
24 fw_config_value_initialized =
true;
28 if (
CONFIG(FW_CONFIG_SOURCE_CHROMEEC_CBI)) {
39 if (
cbfs_load(CONFIG_CBFS_PREFIX
"/fw_config", &fw_config_value,
40 sizeof(fw_config_value)) !=
sizeof(fw_config_value))
51 fw_config_value = vpd_value;
59 return fw_config_value;
93 *matching_probe =
NULL;
99 for (probe = dev->
probe_list; probe && probe->
mask != 0; probe++) {
104 *matching_probe = probe;
117 #define MAX_CACHE_ELEMENTS (8 * sizeof(uint64_t))
119 static const struct fw_config *cached_configs[MAX_CACHE_ELEMENTS];
130 config = cached_configs[probe_index(field_mask)];
141 for (i = 0; i < MAX_CACHE_ELEMENTS; ++i)
142 if (cached_configs[i])
143 cb(cached_configs[i],
arg);
146 static void fw_config_init(
void *unused)
160 cached_configs[probe_index(probe->
mask)] = probe;
#define assert(statement)
static size_t cbfs_load(const char *name, void *buf, size_t size)
#define printk(level,...)
DEVTREE_CONST struct device *DEVTREE_CONST all_devices
Linked list of ALL devices.
const char * dev_path(const struct device *dev)
int google_chromeec_cbi_get_fw_config(uint64_t *fw_config)
#define UNDEFINED_FW_CONFIG
uint64_t fw_config_get(void)
fw_config_get() - Provide firmware configuration value.
bool fw_config_probe_dev(const struct device *dev, const struct fw_config **matching_probe)
bool fw_config_is_provisioned(void)
bool fw_config_probe(const struct fw_config *match)
static int __ffs64(u64 x)
#define BIOS_INFO
BIOS_INFO - Expected events.
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL)
unsigned long long uint64_t
DEVTREE_CONST struct fw_config * probe_list
DEVTREE_CONST struct device * next
struct fw_config - Firmware configuration field and option.
bool vpd_get_int(const char *const key, const enum vpd_region region, int *const val)