Attention is currently required from: Zheng Bao.
Hello Zheng Bao,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/75682?usp=email
to review the following change.
Change subject: WIP:amdfwtool: Add psp header backup copy ......................................................................
WIP:amdfwtool: Add psp header backup copy
For PHX.
Change-Id: Ia5a745c86595554c83cd13a35c312c17987b716b Signed-off-by: Zheng Bao fishbaozi@gmail.com --- M util/amdfwtool/amdfwtool.c M util/amdfwtool/amdfwtool.h 2 files changed, 24 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/82/75682/1
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 1b2b005..3dc113d 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -740,6 +740,19 @@ } }
+static void fill_psp_directory_backup_to_efs(embedded_firmware *amd_romsig, void *pspdir, + context *ctx, amd_cb_config *cb_config) +{ + switch (cb_config->soc_id) { + case PLATFORM_PHOENIX: + case PLATFORM_GLINDA: + amd_romsig->psp_directory_backup = + BUFF_TO_RUN_MODE(*ctx, pspdir, AMD_ADDR_REL_BIOS); + break; + default: + break; + } +} static ssize_t copy_blob(void *dest, const char *src_file, size_t room) { int fd; @@ -1897,6 +1910,7 @@ char *tmp; embedded_firmware *amd_romsig; psp_directory_table *pspdir = NULL; + psp_directory_table *pspdir_bak = NULL; psp_directory_table *pspdir2 = NULL; psp_directory_table *pspdir2_b = NULL; psp_combo_directory *psp_combo_dir = NULL, *bhd_combo_dir = NULL; @@ -2394,8 +2408,13 @@ pspdir2_b = NULL; /* More explicitly */ } pspdir = new_psp_dir(&ctx, cb_config.multi_level); + if (1) + pspdir_bak = new_psp_dir(&ctx, cb_config.multi_level); integrate_psp_firmwares(&ctx, pspdir, pspdir2, pspdir2_b, amd_psp_fw_table, PSP_COOKIE, &cb_config); + if (pspdir_bak) + memcpy(pspdir_bak, pspdir, + 0x10 * pspdir->header.num_entries + 0x10); } else { /* flat: PSP 1 cookie and no pointer to 2nd table */ pspdir = new_psp_dir(&ctx, cb_config.multi_level); @@ -2405,8 +2424,12 @@
if (!cb_config.use_combo) { fill_psp_directory_to_efs(amd_romsig, pspdir, &ctx, &cb_config); + if (pspdir_bak != NULL) + fill_psp_directory_backup_to_efs(amd_romsig, pspdir_bak, + &ctx, &cb_config); } else { fill_psp_directory_to_efs(amd_romsig, psp_combo_dir, &ctx, &cb_config); + /* TODO: Doc doesn't say how backup copy PSP dir is saved for combo */ /* 0 -Compare PSP ID, 1 -Compare chip family ID */ assert_fw_entry(combo_index, MAX_COMBO_ENTRIES, &ctx); psp_combo_dir->entries[combo_index].id_sel = 0; diff --git a/util/amdfwtool/amdfwtool.h b/util/amdfwtool/amdfwtool.h index 11b7996..a1fb6cd 100644 --- a/util/amdfwtool/amdfwtool.h +++ b/util/amdfwtool/amdfwtool.h @@ -160,7 +160,7 @@ uint32_t bios2_entry; struct second_gen_efs efs_gen; uint32_t bios3_entry; - uint32_t reserved_2Ch; + uint32_t psp_directory_backup; uint32_t promontory_fw_ptr; uint32_t lp_promontory_fw_ptr; uint32_t reserved_38h;