diff options
author | Zheng Bao <fishbaozi@gmail.com> | 2023-03-09 21:09:58 +0800 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-03-24 14:07:21 +0000 |
commit | 8dd34bd6745731d423319d86d410fd31c9180d77 (patch) | |
tree | fc64249c164437094fa983361e5f19199b6686c1 /util/amdfwtool/amdfwtool.c | |
parent | e3ebc4fe315979ad5df9748cac5634bf53274355 (diff) |
amdfwtool: Clean up table buffers before combo loop
Keep clean copies of PSP and BIOS table. Refresh the working tables
before they are filled with file names and other information at each
iteration.
Change-Id: Ie8339a4d66c38e02180cbf99e13914bfff66dc0f
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/73628
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Diffstat (limited to 'util/amdfwtool/amdfwtool.c')
-rw-r--r-- | util/amdfwtool/amdfwtool.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 6d483d011e..4d821bdf76 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -446,6 +446,8 @@ typedef struct _context { 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; } context; #define RUN_BASE(ctx) (0xFFFFFFFF - (ctx).rom_size + 1) @@ -515,6 +517,11 @@ static void amdfwtool_cleanup(context *ctx) /* Free the filename. */ free_psp_firmware_filenames(amd_psp_fw_table); free_bdt_firmware_filenames(amd_bios_table); + + free(ctx->amd_psp_fw_table_clean); + ctx->amd_psp_fw_table_clean = NULL; + free(ctx->amd_bios_table_clean); + ctx->amd_bios_table_clean = NULL; } void assert_fw_entry(uint32_t count, uint32_t max, context *ctx) @@ -2083,6 +2090,13 @@ int main(int argc, char **argv) } } + if (cb_config.use_combo) { + ctx.amd_psp_fw_table_clean = malloc(sizeof(amd_psp_fw_table)); + ctx.amd_bios_table_clean = malloc(sizeof(amd_bios_table)); + memcpy(ctx.amd_psp_fw_table_clean, amd_psp_fw_table, sizeof(amd_psp_fw_table)); + memcpy(ctx.amd_bios_table_clean, amd_bios_table, sizeof(amd_bios_table)); + } + open_process_config(config, &cb_config, debug); if (!fuse_defined) @@ -2271,6 +2285,11 @@ int main(int argc, char **argv) * case. */ if (cb_config.use_combo && combo_index > 0) { + /* Restore the table as clean data. */ + memcpy(amd_psp_fw_table, ctx.amd_psp_fw_table_clean, + sizeof(amd_psp_fw_table)); + memcpy(amd_bios_table, ctx.amd_bios_table_clean, + sizeof(amd_bios_table)); assert_fw_entry(combo_index, MAX_COMBO_ENTRIES, &ctx); open_process_config(combo_config[combo_index], &cb_config, debug); |