MCPcopy Create free account
hub / github.com/coreboot/coreboot / lookup_cmos_enum_core

Function lookup_cmos_enum_core

payloads/libpayload/drivers/options.c:238–254  ·  view source on GitHub ↗

Either value or text must be NULL. Returns the field that matches "the other" for a given config_id */

Source from the content-addressed store, hash-verified

236
237/* Either value or text must be NULL. Returns the field that matches "the other" for a given config_id */
238static struct cb_cmos_enums *lookup_cmos_enum_core(struct cb_cmos_option_table *option_table, int config_id, const u8 *value, const char *text)
239{
240 int len = strnlen(text, CB_CMOS_MAX_TEXT_LENGTH);
241
242 /* CMOS enums are located after CMOS entries. */
243 struct cb_cmos_enums *cmos_enum;
244 for ( cmos_enum = first_cmos_enum_of_id(option_table, config_id);
245 cmos_enum;
246 cmos_enum = next_cmos_enum_of_id(cmos_enum, config_id)) {
247 if (((value == NULL) || (cmos_enum->value == *value)) &&
248 ((text == NULL) || (memcmp((const char*)cmos_enum->text, text, len) == 0))) {
249 return cmos_enum;
250 }
251 }
252
253 return NULL;
254}
255
256static struct cb_cmos_enums *lookup_cmos_enum_by_value(struct cb_cmos_option_table *option_table, int config_id, const u8 *value)
257{

Callers 2

Calls 4

strnlenFunction · 0.85
first_cmos_enum_of_idFunction · 0.85
next_cmos_enum_of_idFunction · 0.85
memcmpFunction · 0.50

Tested by

no test coverage detected