diff options
author | Zheng Bao <fishbaozi@gmail.com> | 2024-04-07 19:43:52 +0800 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-09-12 12:59:11 +0000 |
commit | 13a4e4402b5e66e36717e9308930b5c283285c17 (patch) | |
tree | 4c810f137a55627b9496d195143fc4b41f2f30a5 /util | |
parent | 138dc601f764a253b669f2c055cf45a43bb231c6 (diff) |
amdfwtool: Add a unified function to add combo entries
TEST=Binary identical test on all AMD SOC platform with use_combo
Change-Id: I41c5c6fb5acf92604dd06becf1eda680a1fab545
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84131
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/amdfwtool/amdfwtool.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 97ca0dfeee..7ed13c9764 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1471,6 +1471,20 @@ static void integrate_bios_firmwares(context *ctx, ctx->current_table = current_table_save; } +static void add_combo_entry(void *combo_dir, void *dir, uint32_t combo_index, + context *ctx, amd_cb_config *cb_config) +{ + psp_combo_directory *cdir = combo_dir; + assert_fw_entry(combo_index, MAX_COMBO_ENTRIES, ctx); + /* 0 -Compare PSP ID, 1 -Compare chip family ID */ + cdir->entries[combo_index].id_sel = 0; + cdir->entries[combo_index].id = get_psp_id(cb_config->soc_id); + cdir->entries[combo_index].lvl2_addr = + BUFF_TO_RUN_MODE(*ctx, dir, AMD_ADDR_REL_BIOS); + + fill_dir_header(combo_dir, combo_index + 1, ctx); +} + static int set_efs_table(uint8_t soc_id, amd_cb_config *cb_config, embedded_firmware *amd_romsig) { @@ -1761,14 +1775,7 @@ int main(int argc, char **argv) fill_psp_directory_to_efs(ctx.amd_romsig_ptr, ctx.pspdir, &ctx, &cb_config); } else if (cb_config.use_combo && !cb_config.combo_new_rab) { fill_psp_directory_to_efs(ctx.amd_romsig_ptr, ctx.psp_combo_dir, &ctx, &cb_config); - /* 0 -Compare PSP ID, 1 -Compare chip family ID */ - assert_fw_entry(combo_index, MAX_COMBO_ENTRIES, &ctx); - ctx.psp_combo_dir->entries[combo_index].id_sel = 0; - ctx.psp_combo_dir->entries[combo_index].id = get_psp_id(cb_config.soc_id); - ctx.psp_combo_dir->entries[combo_index].lvl2_addr = - BUFF_TO_RUN_MODE(ctx, ctx.pspdir, AMD_ADDR_REL_BIOS); - - fill_dir_header(ctx.psp_combo_dir, combo_index + 1, &ctx); + add_combo_entry(ctx.psp_combo_dir, ctx.pspdir, combo_index, &ctx, &cb_config); } if (have_bios_tables(amd_bios_table)) { @@ -1801,14 +1808,7 @@ int main(int argc, char **argv) */ fill_bios_directory_to_efs(ctx.amd_romsig_ptr, ctx.bhd_combo_dir, &ctx, &cb_config); - assert_fw_entry(combo_index, MAX_COMBO_ENTRIES, &ctx); - ctx.bhd_combo_dir->entries[combo_index].id_sel = 0; - ctx.bhd_combo_dir->entries[combo_index].id = - get_psp_id(cb_config.soc_id); - ctx.bhd_combo_dir->entries[combo_index].lvl2_addr = - BUFF_TO_RUN_MODE(ctx, ctx.biosdir, AMD_ADDR_REL_BIOS); - - fill_dir_header(ctx.bhd_combo_dir, combo_index + 1, &ctx); + add_combo_entry(ctx.bhd_combo_dir, ctx.biosdir, combo_index, &ctx, &cb_config); } } if (cb_config.debug) |