diff options
author | Zheng Bao <fishbaozi@gmail.com> | 2024-03-16 17:12:30 +0800 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-03-21 20:37:10 +0000 |
commit | e80d06284f4155228f5e9e368a2b65770b1c9c21 (patch) | |
tree | a5eed671cbebffaeb446a4d031db6e9cf64cea02 /util | |
parent | a779b989a2175ee1ed3df8f4e6ee998998ea6c7e (diff) |
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.
TEST=Identical test on all AMD SOC platform
Change-Id: Ia549a0d08c2a60b8858440543ac8d8b5259017dd
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81334
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'util')
-rw-r--r-- | util/amdfwtool/amdfwtool.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 72f0c5ff34..00a366c9c3 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1210,15 +1210,22 @@ static void add_bios_apcb_bk_entry(bios_directory_table *biosdir, unsigned int i 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; @@ -1237,9 +1244,9 @@ static void integrate_bios_levels(context *ctx) 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, @@ -1763,17 +1770,11 @@ int main(int argc, char **argv) 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, |