From b2ae6a5a3a22d45f27e649d24777ae36f031f0ee Mon Sep 17 00:00:00 2001 From: Zheng Bao Date: Thu, 18 Aug 2022 15:45:27 +0800 Subject: amdfwtool: combo: Create the combo header earlier There will be a loop to set up the combo layout. The combo header only needs to be created once. This change is actually to move the creation of combo header outside of the loop. Change-Id: If6ba3d10dfc598133b9adbbb2b6658f356455608 Signed-off-by: Zheng Bao Reviewed-on: https://review.coreboot.org/c/coreboot/+/66854 Reviewed-by: Fred Reitberger Tested-by: build bot (Jenkins) --- util/amdfwtool/amdfwtool.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'util/amdfwtool/amdfwtool.c') diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 8c780801db..9b523fcc27 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -2159,6 +2159,7 @@ int main(int argc, char **argv) psp_directory_table *pspdir = NULL; psp_directory_table *pspdir2 = NULL; psp_directory_table *pspdir2_b = NULL; + psp_combo_directory *psp_combo_dir = NULL; int fuse_defined = 0; int targetfd; char *output = NULL, *config = NULL; @@ -2587,6 +2588,10 @@ int main(int argc, char **argv) signed_start_addr, cb_config.soc_id); + if (cb_config.use_combo) { + psp_combo_dir = new_combo_dir(&ctx); + } + if (cb_config.multi_level) { /* Do 2nd PSP directory followed by 1st */ pspdir2 = new_psp_dir(&ctx, cb_config.multi_level); @@ -2619,15 +2624,14 @@ int main(int argc, char **argv) fill_psp_directory_to_efs(amd_romsig, pspdir, &ctx, &cb_config); if (cb_config.use_combo) { - psp_combo_directory *combo_dir = new_combo_dir(&ctx); - fill_psp_directory_to_efs(amd_romsig, combo_dir, &ctx, &cb_config); + fill_psp_directory_to_efs(amd_romsig, psp_combo_dir, &ctx, &cb_config); /* 0 -Compare PSP ID, 1 -Compare chip family ID */ - combo_dir->entries[0].id_sel = 0; - combo_dir->entries[0].id = get_psp_id(cb_config.soc_id); - combo_dir->entries[0].lvl2_addr = + psp_combo_dir->entries[0].id_sel = 0; + psp_combo_dir->entries[0].id = get_psp_id(cb_config.soc_id); + psp_combo_dir->entries[0].lvl2_addr = BUFF_TO_RUN_MODE(ctx, pspdir, AMD_ADDR_REL_BIOS); - fill_dir_header(combo_dir, 1, PSP2_COOKIE, &ctx); + fill_dir_header(psp_combo_dir, 1, PSP2_COOKIE, &ctx); } if (have_bios_tables(amd_bios_table)) { -- cgit v1.2.3