util/amdfwtool: Add option to build verstage binary into the PSP

For AMD's Family17h processors, verstage needs to be run in the PSP,
before memory is initialized.  This adds that binary into the PSP
directory.

See the Family17h documentation in the coreboot documentation directory
for more information.

BUG=b:137338769
TEST=Build, add test binary to mandolin board, boot

Signed-off-by: Martin Roth <martin@coreboot.org>
Change-Id: I29002a1af51c59a2e6c715e15f3dc63e59cd5729
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34324
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
This commit is contained in:
Martin Roth 2019-07-13 20:13:07 -06:00 committed by Martin Roth
parent ec933135ce
commit d3ce8c8442
1 changed files with 10 additions and 2 deletions

View File

@ -203,6 +203,7 @@ static void usage(void)
printf("-K | --drv-entry-pts <FILE> Add PSP driver entry points\n"); printf("-K | --drv-entry-pts <FILE> Add PSP driver entry points\n");
printf("-L | --ikek <FILE> Add Wrapped iKEK\n"); printf("-L | --ikek <FILE> Add Wrapped iKEK\n");
printf("-Y | --s0i3drv <FILE> Add s0i3 driver\n"); printf("-Y | --s0i3drv <FILE> Add s0i3 driver\n");
printf("-Z | --verstage <FILE> Add verstage\n");
printf("\nBIOS options:\n"); printf("\nBIOS options:\n");
printf("-I | --instance <number> Sets instance field for the next BIOS firmware\n"); printf("-I | --instance <number> Sets instance field for the next BIOS firmware\n");
printf("-a | --apcb <FILE> Add AGESA PSP customization block\n"); printf("-a | --apcb <FILE> Add AGESA PSP customization block\n");
@ -290,6 +291,7 @@ typedef enum _amd_fw_type {
AMD_ABL7 = 0x37, AMD_ABL7 = 0x37,
AMD_FW_PSP_WHITELIST = 0x3a, AMD_FW_PSP_WHITELIST = 0x3a,
AMD_FW_L2_PTR = 0x40, AMD_FW_L2_PTR = 0x40,
AMD_FW_PSP_VERSTAGE = 0x52,
AMD_FW_IMC, AMD_FW_IMC,
AMD_FW_GEC, AMD_FW_GEC,
AMD_FW_XHCI, AMD_FW_XHCI,
@ -345,6 +347,7 @@ static amd_fw_entry amd_psp_fw_table[] = {
{ .type = AMD_FW_PSP_SMU_FIRMWARE, .subprog = 1, .level = PSP_BOTH }, { .type = AMD_FW_PSP_SMU_FIRMWARE, .subprog = 1, .level = PSP_BOTH },
{ .type = AMD_FW_PSP_SMU_FIRMWARE2, .subprog = 1, .level = PSP_BOTH }, { .type = AMD_FW_PSP_SMU_FIRMWARE2, .subprog = 1, .level = PSP_BOTH },
{ .type = AMD_FW_PSP_WHITELIST, .level = PSP_LVL2 }, { .type = AMD_FW_PSP_WHITELIST, .level = PSP_LVL2 },
{ .type = AMD_FW_PSP_VERSTAGE, .level = PSP_BOTH },
{ .type = AMD_FW_INVALID }, { .type = AMD_FW_INVALID },
}; };
@ -975,8 +978,8 @@ static void integrate_bios_firmwares(context *ctx,
fill_dir_header(biosdir, count, cookie); fill_dir_header(biosdir, count, cookie);
} }
// Unused values: CDEPqR
static const char *optstring = "x:i:g:AMS:p:b:s:r:k:c:n:d:t:u:w:m:T:z:J:B:K:L:Y:N:UW:I:a:Q:V:e:v:j:y:G:O:X:F:H:o:f:l:h"; static const char *optstring = "x:i:g:AMS:p:b:s:r:k:c:n:d:t:u:w:m:T:z:J:B:K:L:Y:N:UW:I:a:Q:V:e:v:j:y:G:O:X:F:H:o:f:l:hZ:";
static struct option long_options[] = { static struct option long_options[] = {
{"xhci", required_argument, 0, 'x' }, {"xhci", required_argument, 0, 'x' },
@ -1008,6 +1011,7 @@ static struct option long_options[] = {
{"secdebug", required_argument, 0, 'N' }, {"secdebug", required_argument, 0, 'N' },
{"token-unlock", no_argument, 0, 'U' }, {"token-unlock", no_argument, 0, 'U' },
{"whitelist", required_argument, 0, 'W' }, {"whitelist", required_argument, 0, 'W' },
{"verstage", required_argument, 0, 'Z' },
/* BIOS Directory Table items */ /* BIOS Directory Table items */
{"instance", required_argument, 0, 'I' }, {"instance", required_argument, 0, 'I' },
{"apcb", required_argument, 0, 'a' }, {"apcb", required_argument, 0, 'a' },
@ -1322,6 +1326,10 @@ int main(int argc, char **argv)
register_fw_filename(AMD_FW_PSP_WHITELIST, sub, optarg); register_fw_filename(AMD_FW_PSP_WHITELIST, sub, optarg);
sub = instance = 0; sub = instance = 0;
break; break;
case 'Z':
register_fw_filename(AMD_FW_PSP_VERSTAGE, sub, optarg);
sub = instance = 0;
break;
case 'o': case 'o':
output = optarg; output = optarg;
break; break;