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

Function process_one_line

util/amdfwtool/data_parse.c:508–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506}
507
508static uint8_t process_one_line(char *oneline, regmatch_t *match, char *dir,
509 amd_cb_config *cb_config)
510{
511 char *path_filename, *fn = &(oneline[match[FW_FILE].rm_so]);
512 char *fw_type_str = &(oneline[match[FW_TYPE].rm_so]);
513 regoff_t ch_lvl_index = match[OPT_LEVEL].rm_so == match[OPT_LEVEL].rm_eo ?
514 -1 : match[OPT_LEVEL].rm_so;
515 regoff_t ch_hash_tbl_index =
516 match[OPT_HASH_TABLE_ID].rm_so == match[OPT_HASH_TABLE_ID].rm_eo ?
517 -1 : match[OPT_HASH_TABLE_ID].rm_so;
518 regoff_t ch_fwid_type_index = match[OPT_FWID_TYPE].rm_so == match[OPT_FWID_TYPE].rm_eo ?
519 -1 : match[OPT_FWID_TYPE].rm_so;
520 char ch_lvl = get_level_from_config(oneline, ch_lvl_index, cb_config);
521 uint8_t ch_hash_tbl = get_hash_tbl_id(oneline, ch_hash_tbl_index);
522 fwid_type_t ch_fwid_type = get_fwid_type(oneline, ch_fwid_type_index);
523
524 path_filename = malloc(MAX_LINE_SIZE * 2 + 2);
525 if (strchr(fn, '/'))
526 snprintf(path_filename, MAX_LINE_SIZE * 2 + 2, "%.*s",
527 MAX_LINE_SIZE, fn);
528 else
529 snprintf(path_filename, MAX_LINE_SIZE * 2 + 2, "%.*s/%.*s",
530 MAX_LINE_SIZE, dir, MAX_LINE_SIZE, fn);
531
532 if (find_register_fw_filename_psp_dir(fw_type_str, path_filename,
533 ch_lvl, ch_hash_tbl, ch_fwid_type, cb_config) == 0) {
534 if (find_register_fw_filename_bios_dir(fw_type_str, path_filename,
535 ch_lvl, cb_config) == 0) {
536 fprintf(stderr, "Module's name \"%s\" is not valid\n", fw_type_str);
537 return 0; /* Stop parsing. */
538 }
539 }
540 return 1;
541}
542
543#define FW_LOCATION "FIRMWARE_LOCATION"
544#define SOC_NAME "SOC_NAME"

Callers 1

process_configFunction · 0.85

Calls 9

get_level_from_configFunction · 0.85
get_hash_tbl_idFunction · 0.85
get_fwid_typeFunction · 0.85
fprintfFunction · 0.85
mallocFunction · 0.50
strchrFunction · 0.50
snprintfFunction · 0.50

Tested by

no test coverage detected