util/amdfwtool/amdfwread: Fix AMDFW_OPT* bit mask

Optional arguments that involve printing information from the firmware
image is mapped to bit fields with bit 31 set. But instead of just
setting bit 31, bits 27 - 31 are set. Fix AMDFW_OPT* bit mask.

BUG=None
TEST=Build and use amdfwread to read the Soft-fuse bits from Guybrush
BIOS image. Observed no changes before and after the changes.

Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Change-Id: I0d88669bace45f3332c5e56527516b2f38295a48
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66573
Reviewed-by: Robert Zieba <robertzieba@google.com>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Karthikeyan Ramasubramanian 2022-08-08 22:20:48 -06:00 committed by Raul Rangel
parent 852c5dc101
commit 45257abb79
1 changed files with 10 additions and 7 deletions

View File

@ -162,10 +162,7 @@ static int read_soft_fuse(FILE *fw, const embedded_firmware *fw_header)
enum { enum {
AMDFW_OPT_HELP = 'h', AMDFW_OPT_HELP = 'h',
AMDFW_OPT_SOFT_FUSE = 1UL << 0, /* Print Softfuse */
/* When bit 31 is set, options are a bitfield of info to print from the
firmware image. */
AMDFW_OPT_SOFT_FUSE = 0xF0000001,
}; };
static char const optstring[] = {AMDFW_OPT_HELP}; static char const optstring[] = {AMDFW_OPT_HELP};
@ -202,12 +199,18 @@ int main(int argc, char **argv)
break; break;
} }
if (opt == AMDFW_OPT_HELP) { switch (opt) {
case AMDFW_OPT_HELP:
print_usage(); print_usage();
return 0; return 0;
}
selected_functions |= opt; case AMDFW_OPT_SOFT_FUSE:
selected_functions |= opt;
break;
default:
break;
}
} }
FILE *fw = fopen(fw_file, "rb"); FILE *fw = fopen(fw_file, "rb");