From 757580081d99f19a3d879e94bc534028dfc37e72 Mon Sep 17 00:00:00 2001 From: Zheng Bao Date: Mon, 9 Oct 2023 18:35:27 +0800 Subject: amdfwtool: Use macro to get the table relative address TEST=Identical binary test on all AMD SOC platform Change-Id: Iece4ba65e0476543a8d472168d93801714330dde Signed-off-by: Zheng Bao Reviewed-on: https://review.coreboot.org/c/coreboot/+/78281 Reviewed-by: Felix Held Tested-by: build bot (Jenkins) --- util/amdfwtool/amdfwtool.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index ebadb9123c..1dac476a2a 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -846,7 +846,7 @@ static void integrate_psp_ab(context *ctx, psp_directory_table *pspdir, uint32_t current_table_save; current_table_save = ctx->current_table; - ctx->current_table = (char *)pspdir - ctx->rom; + ctx->current_table = BUFF_TO_RUN_MODE(*ctx, pspdir, AMD_ADDR_REL_BIOS); count = pspdir->header.num_entries; assert_fw_entry(count, MAX_PSP_ENTRIES, ctx); pspdir->entries[count].type = (uint8_t)ab; @@ -982,7 +982,7 @@ static void integrate_psp_firmwares(context *ctx, level = PSP_BOTH_AB; } current_table_save = ctx->current_table; - ctx->current_table = (char *)pspdir - ctx->rom; + ctx->current_table = BUFF_TO_RUN_MODE(*ctx, pspdir, AMD_ADDR_REL_BIOS); adjust_current_pointer(ctx, 0, TABLE_ALIGNMENT); for (i = 0, count = 0; fw_table[i].type != AMD_FW_INVALID; i++) { @@ -1092,7 +1092,7 @@ static void add_psp_firmware_entry(context *ctx, uint32_t current_table_save; current_table_save = ctx->current_table; - ctx->current_table = (char *)pspdir - ctx->rom; + ctx->current_table = BUFF_TO_RUN_MODE(*ctx, pspdir, AMD_ADDR_REL_BIOS); /* If there is an entry of "type", replace it. */ for (index = 0; index < count; index++) { @@ -1222,7 +1222,7 @@ static void integrate_bios_levels(context *ctx, amd_cb_config *cb_config) TABLE_ALIGNMENT); } else if (ctx->biosdir2) { current_table_save = ctx->current_table; - ctx->current_table = (char *)ctx->biosdir - ctx->rom; + ctx->current_table = BUFF_TO_RUN_MODE(*ctx, ctx->biosdir, AMD_ADDR_REL_BIOS); count = ctx->biosdir->header.num_entries; assert_fw_entry(count, MAX_BIOS_ENTRIES, ctx); ctx->biosdir->entries[count].type = AMD_BIOS_L2_PTR; @@ -1287,7 +1287,7 @@ static void integrate_bios_firmwares(context *ctx, level = BDT_BOTH; current_table_save = ctx->current_table; - ctx->current_table = (char *)biosdir - ctx->rom; + ctx->current_table = BUFF_TO_RUN_MODE(*ctx, biosdir, AMD_ADDR_REL_BIOS); adjust_current_pointer(ctx, 0, TABLE_ALIGNMENT); for (i = 0, count = 0; fw_table[i].type != AMD_BIOS_INVALID; i++) { -- cgit v1.2.3