Attention is currently required from: Zheng Bao.
Hello Zheng Bao,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/81334?usp=email
to review the following change.
Change subject: amdfwtool: Move linking BHD2 to PSP2 from main to link funcion ......................................................................
amdfwtool: Move linking BHD2 to PSP2 from main to link funcion
Move the complexity from main to function, so the main flow is easy to understand.
Change-Id: Ia549a0d08c2a60b8858440543ac8d8b5259017dd Signed-off-by: Zheng Bao fishbaozi@gmail.com --- M util/amdfwtool/amdfwtool.c 1 file changed, 16 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/34/81334/1
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 64fdfd8..e1aadbe 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1208,15 +1208,22 @@ biosdir->entries[idx].address_mode = SET_ADDR_MODE_BY_TABLE(biosdir); }
-static void integrate_bios_levels(context *ctx) +static void integrate_bios_levels(context *ctx, amd_cb_config *cb_config) { - unsigned int count = ctx->biosdir->header.num_entries; + unsigned int count; uint32_t current_table_save;
- current_table_save = ctx->current_table; - ctx->current_table = (char *)ctx->biosdir - ctx->rom; - - if (ctx->biosdir2) { + if (cb_config->recovery_ab) { + add_psp_firmware_entry(ctx, ctx->pspdir2, ctx->biosdir2, + AMD_FW_BIOS_TABLE, TABLE_ALIGNMENT); + if (ctx->pspdir2_b != NULL) + add_psp_firmware_entry(ctx, ctx->pspdir2_b, + ctx->biosdir2_b, AMD_FW_BIOS_TABLE, + TABLE_ALIGNMENT); + } else if (ctx->biosdir2) { + current_table_save = ctx->current_table; + ctx->current_table = (char *)ctx->biosdir - ctx->rom; + count = ctx->biosdir->header.num_entries; assert_fw_entry(count, MAX_BIOS_ENTRIES, ctx); ctx->biosdir->entries[count].type = AMD_BIOS_L2_PTR; ctx->biosdir->entries[count].region_type = 0; @@ -1235,9 +1242,9 @@ ctx->biosdir->entries[count].reset = 0; ctx->biosdir->entries[count].ro = 0; count++; + fill_dir_header(ctx->biosdir, count, ctx); + ctx->current_table = current_table_save; } - fill_dir_header(ctx->biosdir, count, ctx); - ctx->current_table = current_table_save; } static void integrate_bios_firmwares(context *ctx, amd_bios_entry *fw_table, @@ -1761,17 +1768,11 @@ amd_bios_table, BHDL2_COOKIE, &cb_config); } - add_psp_firmware_entry(&ctx, ctx.pspdir2, ctx.biosdir2, - AMD_FW_BIOS_TABLE, TABLE_ALIGNMENT); - if (ctx.pspdir2_b != NULL) - add_psp_firmware_entry(&ctx, ctx.pspdir2_b, - ctx.biosdir2_b, AMD_FW_BIOS_TABLE, - TABLE_ALIGNMENT); } else { integrate_bios_firmwares(&ctx, amd_bios_table, BHD_COOKIE, &cb_config); - integrate_bios_levels(&ctx); } + integrate_bios_levels(&ctx, &cb_config); } else { /* flat: BHD1 cookie and no pointer to 2nd table */ integrate_bios_firmwares(&ctx,