Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/84440?usp=email )
Change subject: amdfwtool: Reorder the PSP L2 and BIOS L2 for A/B recovery ......................................................................
amdfwtool: Reorder the PSP L2 and BIOS L2 for A/B recovery
For A/B recovery, it is better, even though it is not mandatory, to put BIOS level 2 table next to its PSP level2. So the relative addresses of BIOS table are the same. So all the data in B could be a copy of A.
Identical binary test on all non A/B recovery platform. Booting test on Majolica with A/B recovery enabled.
Change-Id: Ia25277d307329a2fa66d38d1a7fc21b18246cfe6 Signed-off-by: Zheng Bao fishbaozi@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/84440 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Maximilian Brune maximilian.brune@9elements.com --- M util/amdfwtool/amdfwtool.c 1 file changed, 10 insertions(+), 10 deletions(-)
Approvals: Maximilian Brune: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 42d13d8..0de0475 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1770,11 +1770,17 @@ /* Do 2nd PSP directory followed by 1st */ integrate_psp_firmwares(&ctx, amd_psp_fw_table, PSPL2_COOKIE, &cb_config); + 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, amd_psp_fw_table, PSPL2_COOKIE, &cb_config); + integrate_bios_firmwares(&ctx, + amd_bios_table, BHDL2_COOKIE, &cb_config); } else { /* * Either the platform is using only @@ -1790,6 +1796,8 @@ 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, @@ -1805,21 +1813,13 @@ add_combo_entry(ctx.psp_combo_dir, ctx.pspdir, combo_index, &ctx, &cb_config); }
- if (have_bios_tables(amd_bios_table)) { + if (have_bios_tables(amd_bios_table) && !cb_config.recovery_ab) { if (cb_config.multi_level) { /* Do 2nd level BIOS directory followed by 1st */ integrate_bios_firmwares(&ctx, amd_bios_table, BHDL2_COOKIE, &cb_config); - if (cb_config.recovery_ab) { - if (ctx.pspdir2_b != NULL) { - integrate_bios_firmwares(&ctx, - amd_bios_table, BHDL2_COOKIE, - &cb_config); - } - } else { - integrate_bios_firmwares(&ctx, + integrate_bios_firmwares(&ctx, amd_bios_table, BHD_COOKIE, &cb_config); - } integrate_bios_levels(&ctx, &cb_config); } else { /* flat: BHD1 cookie and no pointer to 2nd table */