Fred Reitberger has submitted this change. ( https://review.coreboot.org/c/coreboot/+/73180 )
Change subject: amdfwtool: Clean up the logic sequence of pointer growing ......................................................................
amdfwtool: Clean up the logic sequence of pointer growing
When the EFS data is being packed, the pointer should be at EFS header. After that, it should be at body location.
TEST=binary identical test on amd/birman amd/chausie amd/majolica amd/gardenia pcengines/apu2 amd/mandolin
Change-Id: Ia81e2bdf9feb02971723f39e7f223b5055807cd8 Signed-off-by: Zheng Bao fishbaozi@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/73180 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Fred Reitberger reitbergerfred@gmail.com --- M util/amdfwtool/amdfwtool.c 1 file changed, 27 insertions(+), 12 deletions(-)
Approvals: build bot (Jenkins): Verified Fred Reitberger: Looks good to me, approved
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index cd29223..b946a1b 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -2496,18 +2496,8 @@ } memset(ctx.rom, 0xFF, ctx.rom_size);
- if (efs_location) { - if (efs_location != body_location) { - romsig_offset = efs_location; - set_current_pointer(&ctx, body_location); - } else { - romsig_offset = efs_location; - set_current_pointer(&ctx, romsig_offset + sizeof(embedded_firmware)); - } - } else { - romsig_offset = AMD_ROMSIG_OFFSET; - set_current_pointer(&ctx, romsig_offset + sizeof(embedded_firmware)); - } + romsig_offset = efs_location ? efs_location : AMD_ROMSIG_OFFSET; + set_current_pointer(&ctx, romsig_offset);
amd_romsig = BUFF_OFFSET(ctx, romsig_offset); amd_romsig->signature = EMBEDDED_FW_SIGNATURE; @@ -2539,6 +2529,11 @@ else printf("\n");
+ if (efs_location != body_location) + set_current_pointer(&ctx, body_location); + else + set_current_pointer(&ctx, romsig_offset + sizeof(embedded_firmware)); + integrate_firmwares(&ctx, amd_romsig, amd_fw_table);
adjust_current_pointer(&ctx, 0, 0x10000U); /* TODO: is it necessary? */