aboutsummaryrefslogtreecommitdiff
path: root/util/amdfwtool/amdfwtool.h
diff options
context:
space:
mode:
authorZheng Bao <fishbaozi@gmail.com>2023-10-11 16:08:44 +0800
committerFelix Held <felix-coreboot@felixheld.de>2024-03-06 11:05:07 +0000
commite35c502a57aca65d1cb417dd1c999f69d16c1a7b (patch)
tree58e93f86a8865c605bbe75399a74eca3416d6462 /util/amdfwtool/amdfwtool.h
parentfc3fcf2103fcdd3897a26ec19c029b516267b511 (diff)
amdfwtool: Move code related to getting options to a new file
Cleanup the messy code. The code left in main is all about filling tables. To help to do this, 1. Some local variables are put into global struct. 2. Add some functions. Set some functions to global. TEST=Identical test on all AMD platforms Change-Id: Ia25c3fd5de7ae48054359f0f6551d91d7a4f6828 Signed-off-by: Zheng Bao <fishbaozi@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/78311 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'util/amdfwtool/amdfwtool.h')
-rw-r--r--util/amdfwtool/amdfwtool.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/util/amdfwtool/amdfwtool.h b/util/amdfwtool/amdfwtool.h
index 91f1473189..fdcd6a84b1 100644
--- a/util/amdfwtool/amdfwtool.h
+++ b/util/amdfwtool/amdfwtool.h
@@ -427,14 +427,39 @@ typedef struct _amd_cb_config {
bool use_combo;
bool have_apcb_bk;
enum platform soc_id;
+
+ uint8_t efs_spi_readmode, efs_spi_speed, efs_spi_micron_flag;
+ uint32_t body_location, efs_location;
+ uint64_t signed_start_addr;
+ char *manifest_file;
+ const char *signed_output_file;
+ char *output, *config;
+ char *combo_config[MAX_COMBO_ENTRIES];
+ int debug;
} amd_cb_config;
-void register_fw_fuse(char *str);
+typedef struct _context {
+ char *rom; /* target buffer, size of flash device */
+ uint32_t rom_size; /* size of flash device */
+ uint32_t address_mode; /* 0:abs address; 1:relative to flash; 2: relative to table */
+ uint32_t current; /* pointer within flash & proxy buffer */
+ uint32_t current_pointer_saved;
+ uint32_t current_table;
+ void *amd_psp_fw_table_clean;
+ void *amd_bios_table_clean;
+ struct _combo_apcb {
+ char *filename;
+ uint8_t ins;
+ uint8_t sub;
+ } combo_apcb[MAX_COMBO_ENTRIES], combo_apcb_bk[MAX_COMBO_ENTRIES];
+} context;
+
uint8_t process_config(FILE *config, amd_cb_config *cb_config);
void process_signed_psp_firmwares(const char *signed_rom,
amd_fw_entry *fw_table,
uint64_t signed_start_addr,
enum platform soc_id);
+int find_bios_entry(amd_bios_type type);
#define EFS_FILE_SUFFIX ".efs"
#define TMP_FILE_SUFFIX ".tmp"
@@ -450,4 +475,7 @@ ssize_t copy_blob(void *dest, const char *src_file, size_t room);
#define LINE_EOF (1)
#define LINE_TOO_LONG (2)
+int amdfwtool_getopt(int argc, char *argv[], amd_cb_config *cb_config, context *ctx);
+void register_apcb_combo(amd_cb_config *cb_config, int combo_index, context *ctx);
+
#endif /* _AMD_FW_TOOL_H_ */