util/amdfwtool: Add amdfwread utility

Amdfwtool creates AMD firmware images however there is currently no way
to get information from an existing image. This commit adds amdfwread to
support that functionality. At the moment only reading PSP soft fuse
flags is supported. Example usage: `amdfwread --soft-fuse bios.bin`,
example output: `Soft-fuse:0x400000030000041`.

BUG=b:202397678
TEST=Ran amdfwread and verified that it correctly reads the soft fuse
bits, verified that built AMD FW still boots on DUT

Signed-off-by: Robert Zieba <robertzieba@google.com>
Change-Id: I15fa07c9cad8e4640e9c40e5539b0dab44424850
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62795
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Rob Barnes <robbarnes@google.com>
This commit is contained in:
Robert Zieba
2022-03-14 15:59:12 -06:00
committed by Stefan Reinauer
parent 305086c0f2
commit 29bc79fddb
6 changed files with 286 additions and 38 deletions

View File

@@ -83,6 +83,13 @@ typedef enum _amd_bios_type {
AMD_BIOS_SKIP
} amd_bios_type;
typedef enum _amd_addr_mode {
AMD_ADDR_PHYSICAL = 0, /* Physical address */
AMD_ADDR_REL_BIOS, /* Relative to beginning of image */
AMD_ADDR_REL_TAB, /* Relative to table */
AMD_ADDR_REL_SLOT, /* Relative to slot */
} amd_addr_mode;
struct second_gen_efs { /* todo: expand for Server products */
int gen:1; /* Client products only use bit 0 */
int reserved:31;
@@ -293,5 +300,6 @@ uint8_t process_config(FILE *config, amd_cb_config *cb_config, uint8_t print_dep
#define LINE_EOF (1)
#define LINE_TOO_LONG (2)
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif /* _AMD_FW_TOOL_H_ */