summaryrefslogtreecommitdiff
path: root/util/amdfwtool/amdfwtool.c
diff options
context:
space:
mode:
authorZheng Bao <fishbaozi@gmail.com>2023-02-21 10:52:47 +0800
committerFred Reitberger <reitbergerfred@gmail.com>2023-03-01 13:01:34 +0000
commit6095cd1501143025c51a6505fd37c4e2614f0347 (patch)
treeaaaa2c69b1fc1af79dd6b18bc347c3335b207709 /util/amdfwtool/amdfwtool.c
parent0a466040e0dc3351ac819ba00146f284e5f70f05 (diff)
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>
Diffstat (limited to 'util/amdfwtool/amdfwtool.c')
-rw-r--r--util/amdfwtool/amdfwtool.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c
index cd2922359d..b946a1bf54 100644
--- a/util/amdfwtool/amdfwtool.c
+++ b/util/amdfwtool/amdfwtool.c
@@ -2496,18 +2496,8 @@ int main(int argc, char **argv)
}
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 @@ int main(int argc, char **argv)
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? */