diff options
author | Karthikeyan Ramasubramanian <kramasub@google.com> | 2022-08-08 22:20:48 -0600 |
---|---|---|
committer | Raul Rangel <rrangel@chromium.org> | 2022-10-26 15:55:53 +0000 |
commit | 45257abb790315b29144395d67349f93023a5d20 (patch) | |
tree | d95fdaed2915739a96b8336d3c7fefcbafb43753 /util/amdfwtool/amdfwread.c | |
parent | 852c5dc101797ecf0ca2d49adcfcead79a5d86e5 (diff) |
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>
Diffstat (limited to 'util/amdfwtool/amdfwread.c')
-rw-r--r-- | util/amdfwtool/amdfwread.c | 17 |
1 files 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"); |