Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/84233?usp=email )
Change subject: amdfwtool: Add combo new layout for new family ......................................................................
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 --- M util/amdfwtool/amdfwtool.c M util/amdfwtool/amdfwtool.h M util/amdfwtool/data_parse.c 3 files changed, 21 insertions(+), 6 deletions(-)
Approvals: Felix Held: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 1d94e06..97ca0df 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1582,6 +1582,11 @@ } }
+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 @@
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 @@ 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 @@ 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 @@ */ 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 @@ 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 7ca7d89..0e8ace6 100644 --- a/util/amdfwtool/amdfwtool.h +++ b/util/amdfwtool/amdfwtool.h @@ -426,6 +426,7 @@ 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 @@ 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 5e06d97..64ec4d7 100644 --- a/util/amdfwtool/data_parse.c +++ b/util/amdfwtool/data_parse.c @@ -723,7 +723,7 @@ 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;