Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/78281?usp=email )
Change subject: amdfwtool: Use macro to get the table relative address ......................................................................
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 fishbaozi@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/78281 Reviewed-by: Felix Held felix-coreboot@felixheld.de Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M util/amdfwtool/amdfwtool.c 1 file changed, 5 insertions(+), 5 deletions(-)
Approvals: Felix Held: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index ebadb91..1dac476 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -846,7 +846,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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++) {