amdfwtool: Only update count in header in only one function

Other function calls don't have to worry about the fletcher error.

TEST=Binary identical test on all AMD SOC platform

Change-Id: I7c9d653100b476b52d6d1d80c41d0c3d765f7be3
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81372
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
Zheng Bao 2024-03-21 11:33:52 +08:00 committed by Felix Held
parent dc68ada3a0
commit e8f9d18e88

View File

@ -877,7 +877,7 @@ static void integrate_psp_ab(context *ctx, psp_directory_table *pspdir,
} }
count++; count++;
pspdir->header.num_entries = count; fill_dir_header(pspdir, count, ctx);
ctx->current_table = current_table_save; ctx->current_table = current_table_save;
} }
@ -903,7 +903,6 @@ static void integrate_psp_levels(context *ctx,
if (pspdir2_b != NULL) if (pspdir2_b != NULL)
ctx->ish_b_dir = new_ish_dir(ctx); ctx->ish_b_dir = new_ish_dir(ctx);
} }
pspdir->header.num_entries = count;
integrate_psp_ab(ctx, pspdir, pspdir2, ctx->ish_a_dir, integrate_psp_ab(ctx, pspdir, pspdir2, ctx->ish_a_dir,
AMD_FW_RECOVERYAB_A, cb_config->soc_id); AMD_FW_RECOVERYAB_A, cb_config->soc_id);
if (pspdir2_b != NULL) if (pspdir2_b != NULL)
@ -915,7 +914,6 @@ static void integrate_psp_levels(context *ctx,
use_only_a ? AMD_FW_RECOVERYAB_A : AMD_FW_RECOVERYAB_B, use_only_a ? AMD_FW_RECOVERYAB_A : AMD_FW_RECOVERYAB_B,
cb_config->soc_id); cb_config->soc_id);
count = pspdir->header.num_entries;
} else if (pspdir2 != NULL) { } else if (pspdir2 != NULL) {
assert_fw_entry(count, MAX_PSP_ENTRIES, ctx); assert_fw_entry(count, MAX_PSP_ENTRIES, ctx);
pspdir->entries[count].type = AMD_FW_L2_PTR; pspdir->entries[count].type = AMD_FW_L2_PTR;
@ -930,8 +928,8 @@ static void integrate_psp_levels(context *ctx,
pspdir->entries[count].address_mode = pspdir->entries[count].address_mode =
SET_ADDR_MODE(pspdir, AMD_ADDR_REL_BIOS); SET_ADDR_MODE(pspdir, AMD_ADDR_REL_BIOS);
count++; count++;
fill_dir_header(pspdir, count, ctx);
} }
fill_dir_header(pspdir, count, ctx);
ctx->current_table = current_table_save; ctx->current_table = current_table_save;
} }