From 45257abb790315b29144395d67349f93023a5d20 Mon Sep 17 00:00:00 2001 From: Karthikeyan Ramasubramanian Date: Mon, 8 Aug 2022 22:20:48 -0600 Subject: [PATCH] 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 Change-Id: I0d88669bace45f3332c5e56527516b2f38295a48 Reviewed-on: https://review.coreboot.org/c/coreboot/+/66573 Reviewed-by: Robert Zieba Reviewed-by: Raul Rangel Tested-by: build bot (Jenkins) --- util/amdfwtool/amdfwread.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/util/amdfwtool/amdfwread.c b/util/amdfwtool/amdfwread.c index ccb81b3513..1701e207eb 100644 --- a/util/amdfwtool/amdfwread.c +++ b/util/amdfwtool/amdfwread.c @@ -162,10 +162,7 @@ static int read_soft_fuse(FILE *fw, const embedded_firmware *fw_header) enum { AMDFW_OPT_HELP = 'h', - - /* When bit 31 is set, options are a bitfield of info to print from the - firmware image. */ - AMDFW_OPT_SOFT_FUSE = 0xF0000001, + AMDFW_OPT_SOFT_FUSE = 1UL << 0, /* Print Softfuse */ }; static char const optstring[] = {AMDFW_OPT_HELP}; @@ -202,12 +199,18 @@ int main(int argc, char **argv) break; } - if (opt == AMDFW_OPT_HELP) { + switch (opt) { + case AMDFW_OPT_HELP: print_usage(); return 0; - } - selected_functions |= opt; + case AMDFW_OPT_SOFT_FUSE: + selected_functions |= opt; + break; + + default: + break; + } } FILE *fw = fopen(fw_file, "rb");