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 <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66854
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Zheng Bao 2022-08-18 15:45:27 +08:00 committed by Fred Reitberger
parent 2f6b7d557d
commit b2ae6a5a3a
1 changed files with 10 additions and 6 deletions

View File

@ -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)) {