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/+/57063
to review the following change.
Change subject: amdfwtool: Detect the flag multilevel to decide the actual value ......................................................................
amdfwtool: Detect the flag multilevel to decide the actual value
To save the space for FW, some of the FWs are going to be define as LVL2 entries. To be compatible to "flattened" layout, we still drop the LVL2 entry to level1 if there is only one level.
Change-Id: Ibe8cdd5c14225899352b02bb19aae6059d56d428 Signed-off-by: Zheng Bao fishbaozi@gmail.com --- M util/amdfwtool/amdfwtool.c 1 file changed, 16 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/63/57063/1
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 1c662be..8f9acf1 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -585,7 +585,8 @@ psp_directory_table *pspdir, psp_directory_table *pspdir2, amd_fw_entry *fw_table, - uint32_t cookie) + uint32_t cookie, + amd_cb_config *cb_config) { ssize_t bytes; unsigned int i, count; @@ -598,7 +599,9 @@ * 1st-level cookie may indicate level 1 or flattened. If the caller * passes a pointer to a 2nd-level table, then assume not flat. */ - if (cookie == PSPL2_COOKIE) + if (cb_config->multi_level == 0) + level = PSP_LVL1; + else if (cookie == PSPL2_COOKIE) level = PSP_LVL2; else if (pspdir2) level = PSP_LVL1; @@ -763,7 +766,8 @@ bios_directory_table *biosdir, bios_directory_table *biosdir2, amd_bios_entry *fw_table, - uint32_t cookie) + uint32_t cookie, + amd_cb_config *cb_config) { ssize_t bytes; unsigned int i, count; @@ -779,7 +783,9 @@ * 1st-level cookie may indicate level 1 or flattened. If the caller * passes a pointer to a 2nd-level table, then assume not flat. */ - if (cookie == BDT2_COOKIE) + if (cb_config->multi_level == 0) + level = BDT_LVL1; + else if (cookie == BDT2_COOKIE) level = BDT_LVL2; else if (biosdir2) level = BDT_LVL1; @@ -1564,16 +1570,16 @@ /* Do 2nd PSP directory followed by 1st */ psp_directory_table *pspdir2 = new_psp_dir(&ctx, cb_config.multi_level); integrate_psp_firmwares(&ctx, pspdir2, 0, - amd_psp_fw_table, PSPL2_COOKIE); + amd_psp_fw_table, PSPL2_COOKIE, &cb_config);
pspdir = new_psp_dir(&ctx, cb_config.multi_level); integrate_psp_firmwares(&ctx, pspdir, pspdir2, - amd_psp_fw_table, PSP_COOKIE); + amd_psp_fw_table, PSP_COOKIE, &cb_config); } else { /* flat: PSP 1 cookie and no pointer to 2nd table */ pspdir = new_psp_dir(&ctx, cb_config.multi_level); integrate_psp_firmwares(&ctx, pspdir, 0, - amd_psp_fw_table, PSP_COOKIE); + amd_psp_fw_table, PSP_COOKIE, &cb_config); }
if (comboable) @@ -1601,16 +1607,16 @@ bios_directory_table *biosdir2 = new_bios_dir(&ctx, cb_config.multi_level); integrate_bios_firmwares(&ctx, biosdir2, 0, - amd_bios_table, BDT2_COOKIE); + amd_bios_table, BDT2_COOKIE, &cb_config);
biosdir = new_bios_dir(&ctx, cb_config.multi_level); integrate_bios_firmwares(&ctx, biosdir, biosdir2, - amd_bios_table, BDT1_COOKIE); + amd_bios_table, BDT1_COOKIE, &cb_config); } else { /* flat: BDT1 cookie and no pointer to 2nd table */ biosdir = new_bios_dir(&ctx, cb_config.multi_level); integrate_bios_firmwares(&ctx, biosdir, 0, - amd_bios_table, BDT1_COOKIE); + amd_bios_table, BDT1_COOKIE, &cb_config); } switch (soc_id) { case PLATFORM_RENOIR: