From 481661e313ddc2efb151cbdb77eeb5237eba5609 Mon Sep 17 00:00:00 2001 From: Zheng Bao Date: Fri, 20 Aug 2021 14:47:46 +0800 Subject: amdfwtool: Add flag for multi FW level to the struct amd_cb_config This change can make the code be more flexible. And later we will use amd_cb_config to transfer parameters. Change-Id: Ic726aa9fc5f67803210af71d3e9cf2438b7e2a9b Signed-off-by: Zheng Bao Reviewed-on: https://review.coreboot.org/c/coreboot/+/57062 Reviewed-by: Felix Held Tested-by: build bot (Jenkins) --- util/amdfwtool/amdfwtool.c | 20 ++++++++++---------- util/amdfwtool/amdfwtool.h | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 4ec9edf006..1c662bedfc 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1251,7 +1251,6 @@ int main(int argc, char **argv) uint8_t efs_spi_speed = 0xff; uint8_t efs_spi_micron_flag = 0xff; - int multi = 0; amd_cb_config cb_config; int debug = 0; int list_deps = 0; @@ -1261,6 +1260,7 @@ int main(int argc, char **argv) cb_config.use_secureos = 0; cb_config.load_mp2_fw = 0; cb_config.s0i3 = 0; + cb_config.multi_level = 0; while (1) { int optindex = 0; @@ -1287,7 +1287,7 @@ int main(int argc, char **argv) comboable = 1; break; case AMDFW_OPT_MULTILEVEL: - multi = 1; + cb_config.multi_level = 1; break; case AMDFW_OPT_UNLOCK: register_fw_token_unlock(); @@ -1560,18 +1560,18 @@ int main(int argc, char **argv) ctx.current = ALIGN(ctx.current, 0x10000U); /* TODO: is it necessary? */ - if (multi) { + if (cb_config.multi_level) { /* Do 2nd PSP directory followed by 1st */ - psp_directory_table *pspdir2 = new_psp_dir(&ctx, multi); + psp_directory_table *pspdir2 = new_psp_dir(&ctx, cb_config.multi_level); integrate_psp_firmwares(&ctx, pspdir2, 0, amd_psp_fw_table, PSPL2_COOKIE); - pspdir = new_psp_dir(&ctx, multi); + pspdir = new_psp_dir(&ctx, cb_config.multi_level); integrate_psp_firmwares(&ctx, pspdir, pspdir2, amd_psp_fw_table, PSP_COOKIE); } else { /* flat: PSP 1 cookie and no pointer to 2nd table */ - pspdir = new_psp_dir(&ctx, multi); + pspdir = new_psp_dir(&ctx, cb_config.multi_level); integrate_psp_firmwares(&ctx, pspdir, 0, amd_psp_fw_table, PSP_COOKIE); } @@ -1596,19 +1596,19 @@ int main(int argc, char **argv) if (have_bios_tables(amd_bios_table)) { bios_directory_table *biosdir; - if (multi) { + if (cb_config.multi_level) { /* Do 2nd level BIOS directory followed by 1st */ bios_directory_table *biosdir2 = - new_bios_dir(&ctx, multi); + new_bios_dir(&ctx, cb_config.multi_level); integrate_bios_firmwares(&ctx, biosdir2, 0, amd_bios_table, BDT2_COOKIE); - biosdir = new_bios_dir(&ctx, multi); + biosdir = new_bios_dir(&ctx, cb_config.multi_level); integrate_bios_firmwares(&ctx, biosdir, biosdir2, amd_bios_table, BDT1_COOKIE); } else { /* flat: BDT1 cookie and no pointer to 2nd table */ - biosdir = new_bios_dir(&ctx, multi); + biosdir = new_bios_dir(&ctx, cb_config.multi_level); integrate_bios_firmwares(&ctx, biosdir, 0, amd_bios_table, BDT1_COOKIE); } diff --git a/util/amdfwtool/amdfwtool.h b/util/amdfwtool/amdfwtool.h index 6db74f66e2..d246af7932 100644 --- a/util/amdfwtool/amdfwtool.h +++ b/util/amdfwtool/amdfwtool.h @@ -224,6 +224,7 @@ typedef struct _amd_cb_config { uint8_t unlock_secure; uint8_t use_secureos; uint8_t load_mp2_fw; + uint8_t multi_level; uint8_t s0i3; } amd_cb_config; -- cgit v1.2.3