amdfwtool: Move PSP FWs padding into a loop for combo
Move main body of PSP padding into a loop which can add a new combo entry. In the loop, get the FW files from each fw.cfg, create new pack of PSP, and fill the combo header. Currently Feature COMBO is still not fully functional. But the non-combo case will not be affected for sure. The real changes are 1. Add a do-while loop. 2. Remove a "TODO" comment. All other changes are re-indenting and re-filling. Change-Id: I351192a4bc5ed9ec0bfa3f2073c9633b8b44246d Signed-off-by: Zheng Bao <fishbaozi@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/58554 Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
committed by
Fred Reitberger
parent
fe2f50f496
commit
4b6aa195b4
@@ -2627,13 +2627,16 @@ int main(int argc, char **argv)
|
|||||||
if (config)
|
if (config)
|
||||||
combo_config[0] = config;
|
combo_config[0] = config;
|
||||||
|
|
||||||
/* TODO: For now the combo_index is always 0. The combo entries will be processed
|
do {
|
||||||
* in the loop which has not been added yet. */
|
/* for non-combo image, combo_config[0] == config, and
|
||||||
/* for non-combo image, combo_config[0] == config, and it already is processed.
|
* it already is processed. Actually "combo_index >
|
||||||
* Actually "combo_index > 0" is enough. Put both of them here to make sure and make
|
* 0" is enough. Put both of them here to make sure
|
||||||
* it clear this will not affect non-combo case. */
|
* and make it clear this will not affect non-combo
|
||||||
|
* case.
|
||||||
|
*/
|
||||||
if (cb_config.use_combo && combo_index > 0) {
|
if (cb_config.use_combo && combo_index > 0) {
|
||||||
open_process_config(combo_config[combo_index], &cb_config, list_deps, debug);
|
open_process_config(combo_config[combo_index], &cb_config,
|
||||||
|
list_deps, debug);
|
||||||
|
|
||||||
/* In most cases, the address modes are same. */
|
/* In most cases, the address modes are same. */
|
||||||
if (cb_config.need_ish)
|
if (cb_config.need_ish)
|
||||||
@@ -2657,9 +2660,12 @@ int main(int argc, char **argv)
|
|||||||
amd_psp_fw_table, PSPL2_COOKIE, &cb_config);
|
amd_psp_fw_table, PSPL2_COOKIE, &cb_config);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Either the platform is using only one slot or B is same as above
|
* Either the platform is using only
|
||||||
* directories for A. Skip creating pspdir2_b here to save flash space.
|
* one slot or B is same as above
|
||||||
* Related biosdir2_b will be skipped automatically.
|
* directories for A. Skip creating
|
||||||
|
* pspdir2_b here to save flash space.
|
||||||
|
* Related biosdir2_b will be skipped
|
||||||
|
* automatically.
|
||||||
*/
|
*/
|
||||||
pspdir2_b = NULL; /* More explicitly */
|
pspdir2_b = NULL; /* More explicitly */
|
||||||
}
|
}
|
||||||
@@ -2700,15 +2706,18 @@ int main(int argc, char **argv)
|
|||||||
amd_bios_table, BHDL2_COOKIE, &cb_config);
|
amd_bios_table, BHDL2_COOKIE, &cb_config);
|
||||||
if (cb_config.recovery_ab) {
|
if (cb_config.recovery_ab) {
|
||||||
if (pspdir2_b != NULL) {
|
if (pspdir2_b != NULL) {
|
||||||
biosdir2_b = new_bios_dir(&ctx, cb_config.multi_level);
|
biosdir2_b = new_bios_dir(&ctx,
|
||||||
|
cb_config.multi_level);
|
||||||
integrate_bios_firmwares(&ctx, biosdir2_b, NULL,
|
integrate_bios_firmwares(&ctx, biosdir2_b, NULL,
|
||||||
amd_bios_table, BHDL2_COOKIE, &cb_config);
|
amd_bios_table, BHDL2_COOKIE,
|
||||||
|
&cb_config);
|
||||||
}
|
}
|
||||||
add_psp_firmware_entry(&ctx, pspdir2, biosdir2,
|
add_psp_firmware_entry(&ctx, pspdir2, biosdir2,
|
||||||
AMD_FW_BIOS_TABLE, TABLE_ALIGNMENT);
|
AMD_FW_BIOS_TABLE, TABLE_ALIGNMENT);
|
||||||
if (pspdir2_b != NULL)
|
if (pspdir2_b != NULL)
|
||||||
add_psp_firmware_entry(&ctx, pspdir2_b, biosdir2_b,
|
add_psp_firmware_entry(&ctx, pspdir2_b,
|
||||||
AMD_FW_BIOS_TABLE, TABLE_ALIGNMENT);
|
biosdir2_b, AMD_FW_BIOS_TABLE,
|
||||||
|
TABLE_ALIGNMENT);
|
||||||
} else {
|
} else {
|
||||||
biosdir = new_bios_dir(&ctx, cb_config.multi_level);
|
biosdir = new_bios_dir(&ctx, cb_config.multi_level);
|
||||||
integrate_bios_firmwares(&ctx, biosdir, biosdir2,
|
integrate_bios_firmwares(&ctx, biosdir, biosdir2,
|
||||||
@@ -2721,18 +2730,23 @@ int main(int argc, char **argv)
|
|||||||
amd_bios_table, BHD_COOKIE, &cb_config);
|
amd_bios_table, BHD_COOKIE, &cb_config);
|
||||||
}
|
}
|
||||||
if (!cb_config.use_combo) {
|
if (!cb_config.use_combo) {
|
||||||
fill_bios_directory_to_efs(amd_romsig, biosdir, &ctx, &cb_config);
|
fill_bios_directory_to_efs(amd_romsig, biosdir,
|
||||||
|
&ctx, &cb_config);
|
||||||
} else {
|
} else {
|
||||||
fill_bios_directory_to_efs(amd_romsig, bhd_combo_dir, &ctx, &cb_config);
|
fill_bios_directory_to_efs(amd_romsig, bhd_combo_dir,
|
||||||
|
&ctx, &cb_config);
|
||||||
assert_fw_entry(combo_index, MAX_COMBO_ENTRIES, &ctx);
|
assert_fw_entry(combo_index, MAX_COMBO_ENTRIES, &ctx);
|
||||||
bhd_combo_dir->entries[combo_index].id_sel = 0;
|
bhd_combo_dir->entries[combo_index].id_sel = 0;
|
||||||
bhd_combo_dir->entries[combo_index].id = get_psp_id(cb_config.soc_id);
|
bhd_combo_dir->entries[combo_index].id =
|
||||||
|
get_psp_id(cb_config.soc_id);
|
||||||
bhd_combo_dir->entries[combo_index].lvl2_addr =
|
bhd_combo_dir->entries[combo_index].lvl2_addr =
|
||||||
BUFF_TO_RUN_MODE(ctx, biosdir, AMD_ADDR_REL_BIOS);
|
BUFF_TO_RUN_MODE(ctx, biosdir, AMD_ADDR_REL_BIOS);
|
||||||
|
|
||||||
fill_dir_header(bhd_combo_dir, combo_index + 1, BHD2_COOKIE, &ctx);
|
fill_dir_header(bhd_combo_dir, combo_index + 1,
|
||||||
|
BHD2_COOKIE, &ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} while (cb_config.use_combo && combo_config[++combo_index] != NULL);
|
||||||
|
|
||||||
targetfd = open(output, O_RDWR | O_CREAT | O_TRUNC, 0666);
|
targetfd = open(output, O_RDWR | O_CREAT | O_TRUNC, 0666);
|
||||||
if (targetfd >= 0) {
|
if (targetfd >= 0) {
|
||||||
|
Reference in New Issue
Block a user