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>
This commit is contained in:
Zheng Bao 2021-11-10 12:21:46 +08:00 committed by Felix Held
parent 96a3371a72
commit 993b43f2be
2 changed files with 18 additions and 13 deletions

View File

@ -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,7 +1908,7 @@ int main(int argc, char **argv)
else
amd_romsig->psp_directory = BUFF_TO_RUN(ctx, pspdir);
#if PSP_COMBO
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 */
@ -1914,7 +1918,7 @@ int main(int argc, char **argv)
combo_dir->header.lookup = 1;
fill_dir_header(combo_dir, 1, PSP2_COOKIE, &ctx);
#endif
}
if (have_bios_tables(amd_bios_table)) {
bios_directory_table *biosdir = NULL;

View File

@ -281,6 +281,7 @@ typedef struct _amd_cb_config {
bool recovery_ab;
bool recovery_ab_single_copy;
bool need_ish;
bool use_combo;
} amd_cb_config;
void register_fw_fuse(char *str);