From daf32b75c6f1a3dca782998ea405429a97a7936c Mon Sep 17 00:00:00 2001 From: Zheng Bao Date: Sat, 21 Sep 2024 11:22:11 +0800 Subject: [PATCH] amdfwtool: Merge all the steps for A/B recovery into one branch Clean up the code to make it more logical. This is for later changes to reorder the PSP Level 1, Level 2, ISH and BIOS tables. TEST=Identical test on all AMD platform Change-Id: I5f7213fd42c7f0ff5ecd9e504a6654cdfb1e3513 Signed-off-by: Zheng Bao Reviewed-on: https://review.coreboot.org/c/coreboot/+/84531 Reviewed-by: Maximilian Brune Tested-by: build bot (Jenkins) --- util/amdfwtool/amdfwtool.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 0de0475b9a..89aff6aaa7 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1770,34 +1770,21 @@ int main(int argc, char **argv) /* Do 2nd PSP directory followed by 1st */ integrate_psp_firmwares(&ctx, amd_psp_fw_table, PSPL2_COOKIE, &cb_config); - if (cb_config.recovery_ab) + if (cb_config.recovery_ab) { integrate_bios_firmwares(&ctx, amd_bios_table, BHDL2_COOKIE, &cb_config); - - if (cb_config.recovery_ab && !cb_config.recovery_ab_single_copy) { - /* Create a copy of PSP Directory 2 in the backup slot B. - Related biosdir2_b copy will be created later. */ - integrate_psp_firmwares(&ctx, + if (!cb_config.recovery_ab_single_copy) { + integrate_psp_firmwares(&ctx, amd_psp_fw_table, PSPL2_COOKIE, &cb_config); - integrate_bios_firmwares(&ctx, + integrate_bios_firmwares(&ctx, amd_bios_table, BHDL2_COOKIE, &cb_config); - } else { - /* - * Either the platform is using only - * one slot or B is same as above - * directories for A. Skip creating - * pspdir2_b here to save flash space. - * Related biosdir2_b will be skipped - * automatically. - */ - ctx.pspdir2_b = NULL; /* More explicitly */ + } + integrate_bios_levels(&ctx, &cb_config); } if (!cb_config.combo_new_rab || combo_index == 0) integrate_psp_firmwares(&ctx, amd_psp_fw_table, PSP_COOKIE, &cb_config); integrate_psp_levels(&ctx, &cb_config); - if (cb_config.recovery_ab) - integrate_bios_levels(&ctx, &cb_config); } else { /* flat: PSP 1 cookie and no pointer to 2nd table */ integrate_psp_firmwares(&ctx,