Attention is currently required from: Zheng Bao.
Hello Zheng Bao,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/78274?usp=email
to review the following change.
Change subject: amdfwtool: Set the table size as the sum of entries and header ......................................................................
amdfwtool: Set the table size as the sum of entries and header
The Table size doesn't include the FWs themselves.
Change-Id: Id4fbc6d57d7ea070a9478649a96af92be9441289 Signed-off-by: Zheng Bao fishbaozi@gmail.com --- M util/amdfwtool/amdfwtool.c 1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/74/78274/1
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 6822b2a..92d0f80 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -651,7 +651,8 @@ break; case PSP_COOKIE: case PSPL2_COOKIE: - table_size = ctx->current - ctx->current_table; + table_size = ALIGN_UP(sizeof(dir->header) + count * sizeof(psp_directory_entry), + TABLE_ALIGNMENT); if ((table_size % TABLE_ALIGNMENT) != 0) { fprintf(stderr, "The PSP table size should be 4K aligned\n"); amdfwtool_cleanup(ctx); @@ -670,7 +671,8 @@ break; case BHD_COOKIE: case BHDL2_COOKIE: - table_size = ctx->current - ctx->current_table; + table_size = ALIGN_UP(sizeof(dir->header) + count * sizeof(bios_directory_entry), + TABLE_ALIGNMENT); if ((table_size % TABLE_ALIGNMENT) != 0) { fprintf(stderr, "The BIOS table size should be 4K aligned\n"); amdfwtool_cleanup(ctx);