summaryrefslogtreecommitdiff
path: root/util/amdfwtool/amdfwtool.c
diff options
context:
space:
mode:
authorZheng Bao <fishbaozi@gmail.com>2021-11-10 12:21:46 +0800
committerFelix Held <felix-coreboot@felixheld.de>2022-04-25 14:48:16 +0000
commit993b43f2be5c46a9148599e749be345efa337d27 (patch)
treed5c094a6005c11b4d0179bbfcca6fdd7cb44146f /util/amdfwtool/amdfwtool.c
parent96a3371a721d0fe0925df2f264afbbf4bce32976 (diff)
amdfwtool: Use command line option use-combo to decide if use combo
The macro PSP_COMBO is removed and instead use the flag use_combo. As long as this flag is false, the amdfwtool behaves the same way as the macro does. Change-Id: Ief0d78ae1e94b8183d6cf3195935ff9774fee426 Signed-off-by: Zheng Bao <fishbaozi@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55455 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'util/amdfwtool/amdfwtool.c')
-rw-r--r--util/amdfwtool/amdfwtool.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c
index f09a5a8438..3273b7284e 100644
--- a/util/amdfwtool/amdfwtool.c
+++ b/util/amdfwtool/amdfwtool.c
@@ -89,7 +89,6 @@
*
* TODO: Future work may require fully implementing the PSP_COMBO feature.
*/
-#define PSP_COMBO 0
/*
* Creates the OSI Fletcher checksum. See 8473-1, Appendix C, section C.3.
@@ -155,6 +154,7 @@ static void usage(void)
printf("--combo-capable Place PSP directory pointer at Embedded\n");
printf(" Firmware\n");
printf(" offset able to support combo directory\n");
+ printf("--use-combo Use the COMBO layout\n");
printf("--multilevel Generate primary and secondary tables\n");
printf("--nvram <FILE> Add nvram binary\n");
printf("--soft-fuse Set soft fuse\n");
@@ -430,7 +430,6 @@ static void *new_ish_dir(context *ctx)
return ptr;
}
-#if PSP_COMBO
static void *new_combo_dir(context *ctx)
{
void *ptr;
@@ -441,7 +440,6 @@ static void *new_combo_dir(context *ctx)
+ MAX_COMBO_ENTRIES * sizeof(psp_combo_entry);
return ptr;
}
-#endif
static void fill_dir_header(void *directory, uint32_t count, uint32_t cookie, context *ctx)
{
@@ -1207,6 +1205,7 @@ enum {
AMDFW_OPT_COMBO,
AMDFW_OPT_RECOVERY_AB,
AMDFW_OPT_RECOVERY_AB_SINGLE_COPY,
+ AMDFW_OPT_USE_COMBO,
AMDFW_OPT_MULTILEVEL,
AMDFW_OPT_NVRAM,
@@ -1256,6 +1255,7 @@ static struct option long_options[] = {
{"combo-capable", no_argument, 0, AMDFW_OPT_COMBO },
{"recovery-ab", no_argument, 0, AMDFW_OPT_RECOVERY_AB },
{"recovery-ab-single-copy", no_argument, 0, AMDFW_OPT_RECOVERY_AB_SINGLE_COPY },
+ {"use-combo", no_argument, 0, AMDFW_OPT_USE_COMBO },
{"multilevel", no_argument, 0, AMDFW_OPT_MULTILEVEL },
{"nvram", required_argument, 0, AMDFW_OPT_NVRAM },
{"soft-fuse", required_argument, 0, AMDFW_OPT_FUSE },
@@ -1539,6 +1539,7 @@ int main(int argc, char **argv)
cb_config.recovery_ab = false;
cb_config.need_ish = false;
cb_config.recovery_ab_single_copy = false;
+ cb_config.use_combo = false;
while (1) {
int optindex = 0;
@@ -1571,6 +1572,9 @@ int main(int argc, char **argv)
cb_config.recovery_ab = true;
cb_config.recovery_ab_single_copy = true;
break;
+ case AMDFW_OPT_USE_COMBO:
+ cb_config.use_combo = true;
+ break;
case AMDFW_OPT_MULTILEVEL:
cb_config.multi_level = true;
break;
@@ -1904,17 +1908,17 @@ int main(int argc, char **argv)
else
amd_romsig->psp_directory = BUFF_TO_RUN(ctx, pspdir);
-#if PSP_COMBO
- psp_combo_directory *combo_dir = new_combo_dir(&ctx);
- amd_romsig->combo_psp_directory = BUFF_TO_RUN(ctx, combo_dir);
- /* 0 -Compare PSP ID, 1 -Compare chip family ID */
- combo_dir->entries[0].id_sel = 0;
- combo_dir->entries[0].id = get_psp_id(soc_id);
- combo_dir->entries[0].lvl2_addr = BUFF_TO_RUN(ctx, pspdir);
-
- combo_dir->header.lookup = 1;
- fill_dir_header(combo_dir, 1, PSP2_COOKIE, &ctx);
-#endif
+ if (cb_config.use_combo) {
+ psp_combo_directory *combo_dir = new_combo_dir(&ctx);
+ amd_romsig->combo_psp_directory = BUFF_TO_RUN(ctx, combo_dir);
+ /* 0 -Compare PSP ID, 1 -Compare chip family ID */
+ combo_dir->entries[0].id_sel = 0;
+ combo_dir->entries[0].id = get_psp_id(soc_id);
+ combo_dir->entries[0].lvl2_addr = BUFF_TO_RUN(ctx, pspdir);
+
+ combo_dir->header.lookup = 1;
+ fill_dir_header(combo_dir, 1, PSP2_COOKIE, &ctx);
+ }
if (have_bios_tables(amd_bios_table)) {
bios_directory_table *biosdir = NULL;