amdfwtool: Change the variable name to body_location

The dir_location and efs_location have the same meaning. Now the dir
means body.

Change-Id: I02d4dc848f189449b6f0a1eea5cd6b8020a7d101
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/71649
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
This commit is contained in:
Zheng Bao 2023-01-02 10:55:56 +08:00 committed by Martin L Roth
parent 3d426f38c5
commit 99945dcb8c
1 changed files with 13 additions and 12 deletions

View File

@ -2115,7 +2115,7 @@ int main(int argc, char **argv)
context ctx = { 0 }; context ctx = { 0 };
/* Values cleared after each firmware or parameter, regardless if N/A */ /* Values cleared after each firmware or parameter, regardless if N/A */
uint8_t sub = 0, instance = 0; uint8_t sub = 0, instance = 0;
uint32_t dir_location = 0; uint32_t body_location = 0;
uint32_t efs_location = 0; uint32_t efs_location = 0;
bool any_location = 0; bool any_location = 0;
uint32_t romsig_offset; uint32_t romsig_offset;
@ -2310,7 +2310,8 @@ int main(int argc, char **argv)
" incorrectly (%s)\n\n", optarg); " incorrectly (%s)\n\n", optarg);
retval = 1; retval = 1;
} }
dir_location = efs_location; if (body_location == 0)
body_location = efs_location;
break; break;
case AMDFW_OPT_ANYWHERE: case AMDFW_OPT_ANYWHERE:
any_location = 1; any_location = 1;
@ -2348,7 +2349,7 @@ int main(int argc, char **argv)
list_deps = 1; list_deps = 1;
break; break;
case AMDFW_OPT_BODY_LOCATION: case AMDFW_OPT_BODY_LOCATION:
dir_location = (uint32_t)strtoul(optarg, &tmp, 16); body_location = (uint32_t)strtoul(optarg, &tmp, 16);
if (*tmp != '\0') { if (*tmp != '\0') {
fprintf(stderr, "Error: Body Location specified" fprintf(stderr, "Error: Body Location specified"
" incorrectly (%s)\n\n", optarg); " incorrectly (%s)\n\n", optarg);
@ -2429,7 +2430,7 @@ int main(int argc, char **argv)
return 1; return 1;
} }
if (!efs_location && dir_location) { if (!efs_location && body_location) {
fprintf(stderr, "Error AMDFW body location specified without EFS location.\n"); fprintf(stderr, "Error AMDFW body location specified without EFS location.\n");
return 1; return 1;
} }
@ -2440,20 +2441,20 @@ int main(int argc, char **argv)
* currently. This condition is to ensure that it is not accidentally split. Revisit * currently. This condition is to ensure that it is not accidentally split. Revisit
* this condition if such a need arises in the future. * this condition if such a need arises in the future.
*/ */
if (!any_location && dir_location != efs_location) { if (!any_location && body_location != efs_location) {
fprintf(stderr, "Error: EFS cannot be separate from AMDFW Body.\n"); fprintf(stderr, "Error: EFS cannot be separate from AMDFW Body.\n");
return 1; return 1;
} }
if (dir_location != efs_location && if (body_location != efs_location &&
dir_location < ALIGN(efs_location + sizeof(embedded_firmware), BLOB_ALIGNMENT)) { body_location < ALIGN(efs_location + sizeof(embedded_firmware), BLOB_ALIGNMENT)) {
fprintf(stderr, "Error: Insufficient space between EFS and Blobs.\n"); fprintf(stderr, "Error: Insufficient space between EFS and Blobs.\n");
fprintf(stderr, " Require safe spacing of 256 bytes\n"); fprintf(stderr, " Require safe spacing of 256 bytes\n");
return 1; return 1;
} }
if (any_location) { if (any_location) {
if ((dir_location & 0x3f) || (efs_location & 0x3f)) { if ((body_location & 0x3f) || (efs_location & 0x3f)) {
fprintf(stderr, "Error: Invalid Directory/EFS location.\n"); fprintf(stderr, "Error: Invalid Directory/EFS location.\n");
fprintf(stderr, " Valid locations are 64-byte aligned\n"); fprintf(stderr, " Valid locations are 64-byte aligned\n");
return 1; return 1;
@ -2483,9 +2484,9 @@ int main(int argc, char **argv)
memset(ctx.rom, 0xFF, ctx.rom_size); memset(ctx.rom, 0xFF, ctx.rom_size);
if (efs_location) { if (efs_location) {
if (efs_location != dir_location) { if (efs_location != body_location) {
romsig_offset = efs_location - rom_base_address; romsig_offset = efs_location - rom_base_address;
ctx.current = dir_location - rom_base_address; ctx.current = body_location - rom_base_address;
} else { } else {
romsig_offset = efs_location - rom_base_address; romsig_offset = efs_location - rom_base_address;
ctx.current = romsig_offset + sizeof(embedded_firmware); ctx.current = romsig_offset + sizeof(embedded_firmware);
@ -2641,7 +2642,7 @@ int main(int argc, char **argv)
targetfd = open(output, O_RDWR | O_CREAT | O_TRUNC, 0666); targetfd = open(output, O_RDWR | O_CREAT | O_TRUNC, 0666);
if (targetfd >= 0) { if (targetfd >= 0) {
ssize_t bytes; ssize_t bytes;
uint32_t offset = dir_location ? dir_location - rom_base_address : AMD_ROMSIG_OFFSET; uint32_t offset = body_location ? body_location - rom_base_address : AMD_ROMSIG_OFFSET;
bytes = write(targetfd, BUFF_OFFSET(ctx, offset), ctx.current - offset); bytes = write(targetfd, BUFF_OFFSET(ctx, offset), ctx.current - offset);
if (bytes != ctx.current - offset) { if (bytes != ctx.current - offset) {
@ -2654,7 +2655,7 @@ int main(int argc, char **argv)
retval = 1; retval = 1;
} }
if (efs_location != dir_location) { if (efs_location != body_location) {
ssize_t bytes; ssize_t bytes;
bytes = write_efs(output, amd_romsig); bytes = write_efs(output, amd_romsig);