diff options
author | Zheng Bao <fishbaozi@gmail.com> | 2024-08-29 15:54:59 +0800 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-09-12 12:57:35 +0000 |
commit | 138dc601f764a253b669f2c055cf45a43bb231c6 (patch) | |
tree | 0e0e4e946d159f4cc7a3fe7388e9134b427312af /util | |
parent | 2e1c89fc78d26241e49ea2f2111695d7d407d9ed (diff) |
amdfwtool: Add combo new layout for new family
The new layout definition has a new way to support combo.
It packs multiple ISH entries into PSP L1 directory.
TEST=Identical test on all AMD platform
Change-Id: If573cdeaeb56e95d2fed235c9337fab82d622757
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84233
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'util')
-rw-r--r-- | util/amdfwtool/amdfwtool.c | 23 | ||||
-rw-r--r-- | util/amdfwtool/amdfwtool.h | 2 | ||||
-rw-r--r-- | util/amdfwtool/data_parse.c | 2 |
3 files changed, 21 insertions, 6 deletions
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 1d94e06fdd..97ca0dfeee 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1582,6 +1582,11 @@ static bool is_initial_alignment_required(enum platform soc_id) } } +static bool needs_new_combo_layout(enum platform soc_id) +{ + return needs_ish(soc_id); +} + int main(int argc, char **argv) { int retval = 0; @@ -1610,6 +1615,9 @@ int main(int argc, char **argv) open_process_config(cb_config.config, &cb_config); + if (cb_config.use_combo && needs_new_combo_layout(cb_config.soc_id)) + cb_config.combo_new_rab = true; + ctx.rom = malloc(ctx.rom_size); if (!ctx.rom) { fprintf(stderr, "Error: Failed to allocate memory\n"); @@ -1664,7 +1672,7 @@ int main(int argc, char **argv) cb_config.signed_start_addr, cb_config.soc_id); - if (cb_config.use_combo) { + if (cb_config.use_combo && !cb_config.combo_new_rab) { ctx.psp_combo_dir = new_combo_dir(&ctx, PSP2_COOKIE); adjust_current_pointer(&ctx, 0, 0x1000U); @@ -1681,7 +1689,10 @@ int main(int argc, char **argv) if (cb_config.use_combo && cb_config.debug) printf("Processing %dth combo entry\n", combo_index); - ctx.pspdir = NULL; + /* The pspdir level 1 is special. For new combo layout, all the combo entries + share one pspdir L1. It should not be cleared at each iteration. */ + if (!cb_config.combo_new_rab || combo_index == 0) + ctx.pspdir = NULL; ctx.pspdir2 = NULL; ctx.pspdir2_b = NULL; ctx.biosdir = NULL; @@ -1735,7 +1746,8 @@ int main(int argc, char **argv) */ ctx.pspdir2_b = NULL; /* More explicitly */ } - integrate_psp_firmwares(&ctx, + if (!cb_config.combo_new_rab || combo_index == 0) + integrate_psp_firmwares(&ctx, amd_psp_fw_table, PSP_COOKIE, &cb_config); integrate_psp_levels(&ctx, &cb_config); } else { @@ -1744,9 +1756,10 @@ int main(int argc, char **argv) amd_psp_fw_table, PSP_COOKIE, &cb_config); } - if (!cb_config.use_combo) { + if (!cb_config.use_combo || (cb_config.combo_new_rab && combo_index == 0)) { + /* For new combo layout, there is only 1 PSP level 1 directory. */ fill_psp_directory_to_efs(ctx.amd_romsig_ptr, ctx.pspdir, &ctx, &cb_config); - } else { + } else if (cb_config.use_combo && !cb_config.combo_new_rab) { fill_psp_directory_to_efs(ctx.amd_romsig_ptr, ctx.psp_combo_dir, &ctx, &cb_config); /* 0 -Compare PSP ID, 1 -Compare chip family ID */ assert_fw_entry(combo_index, MAX_COMBO_ENTRIES, &ctx); diff --git a/util/amdfwtool/amdfwtool.h b/util/amdfwtool/amdfwtool.h index 7ca7d89bc6..0e8ace6cfc 100644 --- a/util/amdfwtool/amdfwtool.h +++ b/util/amdfwtool/amdfwtool.h @@ -426,6 +426,7 @@ typedef struct _amd_cb_config { bool recovery_ab_single_copy; bool need_ish; bool use_combo; + bool combo_new_rab; /* new combo layout for recovery A/B */ bool have_apcb_bk; enum platform soc_id; @@ -466,6 +467,7 @@ void process_signed_psp_firmwares(const char *signed_rom, uint64_t signed_start_addr, enum platform soc_id); int find_bios_entry(amd_bios_type type); +bool needs_ish(enum platform platform_type); #define EFS_FILE_SUFFIX ".efs" #define TMP_FILE_SUFFIX ".tmp" diff --git a/util/amdfwtool/data_parse.c b/util/amdfwtool/data_parse.c index 5e06d974b0..64ec4d7e33 100644 --- a/util/amdfwtool/data_parse.c +++ b/util/amdfwtool/data_parse.c @@ -723,7 +723,7 @@ static uint8_t process_one_line(char *oneline, regmatch_t *match, char *dir, return 1; } -static bool needs_ish(enum platform platform_type) +bool needs_ish(enum platform platform_type) { if (platform_type == PLATFORM_MENDOCINO || platform_type == PLATFORM_PHOENIX || platform_type == PLATFORM_GLINDA) return true; |