util/amdfwtool: Add argument for soft fuse override
Allow the soc build to pass a soft fuse value to the utility. This helps maintain compatibility across PSP generations. Add a generic 'other' item to the amd_fw_entry structure that may be used by non-fuse entries in the future. TEST=Verify google/grunt amdfw.rom unchanged before and after. Compare internal board using override before and after. Change-Id: I26223f0b42ad28c43d9bd87419a2a8f719ee91cb Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/33396 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
This commit is contained in:
parent
e5b05d61df
commit
ef79fccf4e
|
@ -80,6 +80,8 @@
|
||||||
#define TABLE_ALIGNMENT 0x1000U
|
#define TABLE_ALIGNMENT 0x1000U
|
||||||
#define BLOB_ALIGNMENT 0x100U
|
#define BLOB_ALIGNMENT 0x100U
|
||||||
|
|
||||||
|
#define DEFAULT_SOFT_FUSE_CHAIN "0x1"
|
||||||
|
|
||||||
#define EMBEDDED_FW_SIGNATURE 0x55aa55aa
|
#define EMBEDDED_FW_SIGNATURE 0x55aa55aa
|
||||||
#define PSP_COOKIE 0x50535024 /* 'PSP$' */
|
#define PSP_COOKIE 0x50535024 /* 'PSP$' */
|
||||||
#define PSP2_COOKIE 0x50535032 /* 'PSP2' */
|
#define PSP2_COOKIE 0x50535032 /* 'PSP2' */
|
||||||
|
@ -184,6 +186,7 @@ static void usage(void)
|
||||||
printf("-u | --trustletkey <FILE> Add trustletkey\n");
|
printf("-u | --trustletkey <FILE> Add trustletkey\n");
|
||||||
printf("-w | --smufirmware2 <FILE> Add smufirmware2\n");
|
printf("-w | --smufirmware2 <FILE> Add smufirmware2\n");
|
||||||
printf("-m | --smuscs <FILE> Add smuscs\n");
|
printf("-m | --smuscs <FILE> Add smuscs\n");
|
||||||
|
printf("-T | --soft-fuse <HEX_VAL> Override default soft fuse values\n");
|
||||||
printf("\n-o | --output <filename> output filename\n");
|
printf("\n-o | --output <filename> output filename\n");
|
||||||
printf("-f | --flashsize <HEX_VAL> ROM size in bytes\n");
|
printf("-f | --flashsize <HEX_VAL> ROM size in bytes\n");
|
||||||
printf(" size must be larger than %dKB\n",
|
printf(" size must be larger than %dKB\n",
|
||||||
|
@ -218,6 +221,7 @@ typedef struct _amd_fw_entry {
|
||||||
amd_fw_type type;
|
amd_fw_type type;
|
||||||
uint8_t subprog;
|
uint8_t subprog;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
uint64_t other;
|
||||||
} amd_fw_entry;
|
} amd_fw_entry;
|
||||||
|
|
||||||
static amd_fw_entry amd_psp_fw_table[] = {
|
static amd_fw_entry amd_psp_fw_table[] = {
|
||||||
|
@ -450,7 +454,7 @@ static void integrate_psp_firmwares(context *ctx,
|
||||||
pspdir->entries[count].subprog = fw_table[i].subprog;
|
pspdir->entries[count].subprog = fw_table[i].subprog;
|
||||||
pspdir->entries[count].rsvd = 0;
|
pspdir->entries[count].rsvd = 0;
|
||||||
pspdir->entries[count].size = 0xFFFFFFFF;
|
pspdir->entries[count].size = 0xFFFFFFFF;
|
||||||
pspdir->entries[count].addr = 1;
|
pspdir->entries[count].addr = fw_table[i].other;
|
||||||
count++;
|
count++;
|
||||||
} else if (fw_table[i].filename != NULL) {
|
} else if (fw_table[i].filename != NULL) {
|
||||||
bytes = copy_blob(BUFF_CURRENT(*ctx),
|
bytes = copy_blob(BUFF_CURRENT(*ctx),
|
||||||
|
@ -483,7 +487,7 @@ static void integrate_psp_firmwares(context *ctx,
|
||||||
fill_dir_header(pspdir, count, PSP_COOKIE);
|
fill_dir_header(pspdir, count, PSP_COOKIE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *optstring = "x:i:g:AS:p:b:s:r:k:c:n:d:t:u:w:m:o:f:l:h";
|
static const char *optstring = "x:i:g:AS:p:b:s:r:k:c:n:d:t:u:w:m:T:o:f:l:h";
|
||||||
|
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{"xhci", required_argument, 0, 'x' },
|
{"xhci", required_argument, 0, 'x' },
|
||||||
|
@ -504,6 +508,7 @@ static struct option long_options[] = {
|
||||||
{"trustletkey", required_argument, 0, 'u' },
|
{"trustletkey", required_argument, 0, 'u' },
|
||||||
{"smufirmware2", required_argument, 0, 'w' },
|
{"smufirmware2", required_argument, 0, 'w' },
|
||||||
{"smuscs", required_argument, 0, 'm' },
|
{"smuscs", required_argument, 0, 'm' },
|
||||||
|
{"soft-fuse", required_argument, 0, 'T' },
|
||||||
{"output", required_argument, 0, 'o' },
|
{"output", required_argument, 0, 'o' },
|
||||||
{"flashsize", required_argument, 0, 'f' },
|
{"flashsize", required_argument, 0, 'f' },
|
||||||
{"location", required_argument, 0, 'l' },
|
{"location", required_argument, 0, 'l' },
|
||||||
|
@ -512,6 +517,19 @@ static struct option long_options[] = {
|
||||||
{NULL, 0, 0, 0 }
|
{NULL, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void register_fw_fuse(char *str)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < sizeof(amd_psp_fw_table) / sizeof(amd_fw_entry); i++) {
|
||||||
|
if (amd_psp_fw_table[i].type != AMD_PSP_FUSE_CHAIN)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
amd_psp_fw_table[i].other = strtoull(str, NULL, 16);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void register_fw_filename(amd_fw_type type, uint8_t sub, char filename[])
|
static void register_fw_filename(amd_fw_type type, uint8_t sub, char filename[])
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -543,6 +561,7 @@ int main(int argc, char **argv)
|
||||||
embedded_firmware *amd_romsig;
|
embedded_firmware *amd_romsig;
|
||||||
psp_directory_table *pspdir;
|
psp_directory_table *pspdir;
|
||||||
int comboable = 0;
|
int comboable = 0;
|
||||||
|
int fuse_defined = 0;
|
||||||
int targetfd;
|
int targetfd;
|
||||||
char *output = NULL;
|
char *output = NULL;
|
||||||
context ctx = {
|
context ctx = {
|
||||||
|
@ -635,6 +654,11 @@ int main(int argc, char **argv)
|
||||||
register_fw_filename(AMD_FW_PSP_SMUSCS, sub, optarg);
|
register_fw_filename(AMD_FW_PSP_SMUSCS, sub, optarg);
|
||||||
sub = 0;
|
sub = 0;
|
||||||
break;
|
break;
|
||||||
|
case 'T':
|
||||||
|
register_fw_fuse(optarg);
|
||||||
|
fuse_defined = 1;
|
||||||
|
sub = 0;
|
||||||
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
output = optarg;
|
output = optarg;
|
||||||
break;
|
break;
|
||||||
|
@ -663,6 +687,9 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!fuse_defined)
|
||||||
|
register_fw_fuse(DEFAULT_SOFT_FUSE_CHAIN);
|
||||||
|
|
||||||
if (!output) {
|
if (!output) {
|
||||||
printf("Error: Output value is not specified.\n\n");
|
printf("Error: Output value is not specified.\n\n");
|
||||||
retval = 1;
|
retval = 1;
|
||||||
|
|
Loading…
Reference in New Issue