summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2024-08-07 16:18:03 +0200
committerFelix Held <felix-coreboot@felixheld.de>2024-08-08 17:41:09 +0000
commitf9af26618973c3d8b938ad65f555ddcd31efeb45 (patch)
treeb51411ae8109d0009b81fecb6cde220defca196b
parent1ce1b58b0153c1fc6f8cdc10b33fc0e906a42ea3 (diff)
util/amdfwtool: add support to specify RPMC NVRAM region
Add support to specify the base and size of the replay-protected monotonic counter (RPMC) non-volatile storage area in the SPI flash. A later patch will use this to tell amdfwtool about the location and size of the corresponding FMAP section. This code is ported from github.com/teslamotors/coreboot/tree/tesla-4.12-amd Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: Idafa7d9bf64125bcabd9b47e77147bcffee739e2 Reviewed-on: https://review.coreboot.org/c/coreboot/+/83812 Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com> Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com> Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
-rw-r--r--util/amdfwtool/amdfwtool.c3
-rw-r--r--util/amdfwtool/opts.c16
2 files changed, 18 insertions, 1 deletions
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c
index 1dac476a2a..1fe9923696 100644
--- a/util/amdfwtool/amdfwtool.c
+++ b/util/amdfwtool/amdfwtool.c
@@ -1011,7 +1011,8 @@ static void integrate_psp_firmwares(context *ctx,
pspdir->entries[count].addr = fw_table[i].other;
pspdir->entries[count].address_mode = 0;
count++;
- } else if (fw_table[i].type == AMD_FW_PSP_NVRAM) {
+ } else if (fw_table[i].type == AMD_FW_PSP_NVRAM ||
+ fw_table[i].type == AMD_RPMC_NVRAM) {
if (fw_table[i].filename == NULL) {
if (fw_table[i].size == 0)
continue;
diff --git a/util/amdfwtool/opts.c b/util/amdfwtool/opts.c
index 511ffd02db..62bbc97ae5 100644
--- a/util/amdfwtool/opts.c
+++ b/util/amdfwtool/opts.c
@@ -68,6 +68,8 @@ enum {
LONGOPT_BIOS_SIG = 259,
LONGOPT_NVRAM_BASE = 260,
LONGOPT_NVRAM_SIZE = 261,
+ LONGOPT_RPMC_NVRAM_BASE = 262,
+ LONGOPT_RPMC_NVRAM_SIZE = 263,
};
static const char optstring[] = {AMDFW_OPT_CONFIG, ':',
@@ -87,6 +89,8 @@ static struct option long_options[] = {
{"nvram", required_argument, 0, AMDFW_OPT_NVRAM },
{"nvram-base", required_argument, 0, LONGOPT_NVRAM_BASE },
{"nvram-size", required_argument, 0, LONGOPT_NVRAM_SIZE },
+ {"rpmc-nvram-base", required_argument, 0, LONGOPT_RPMC_NVRAM_BASE },
+ {"rpmc-nvram-size", required_argument, 0, LONGOPT_RPMC_NVRAM_SIZE },
{"soft-fuse", required_argument, 0, AMDFW_OPT_FUSE },
{"token-unlock", no_argument, 0, AMDFW_OPT_UNLOCK },
{"whitelist", required_argument, 0, AMDFW_OPT_WHITELIST },
@@ -150,6 +154,8 @@ static void usage(void)
printf("--token-unlock Set token unlock\n");
printf("--nvram-base <HEX_VAL> Base address of nvram\n");
printf("--nvram-size <HEX_VAL> Size of nvram\n");
+ printf("--rpmc-nvram-base <HEX_VAL> Base address of RPMC nvram\n");
+ printf("--rpmc-nvram-size <HEX_VAL> Size of RPMC nvram\n");
printf("--whitelist Set if there is a whitelist\n");
printf("--use-pspsecureos Set if psp secure OS is needed\n");
printf("--load-mp2-fw Set if load MP2 firmware\n");
@@ -577,6 +583,16 @@ int amdfwtool_getopt(int argc, char *argv[], amd_cb_config *cb_config, context *
register_amd_psp_fw_addr(AMD_FW_PSP_NVRAM, sub, 0, optarg);
sub = instance = 0;
break;
+ case LONGOPT_RPMC_NVRAM_BASE:
+ /* PSP RPMC NV base */
+ register_amd_psp_fw_addr(AMD_RPMC_NVRAM, sub, optarg, 0);
+ sub = instance = 0;
+ break;
+ case LONGOPT_RPMC_NVRAM_SIZE:
+ /* PSP RPMC NV size */
+ register_amd_psp_fw_addr(AMD_RPMC_NVRAM, sub, 0, optarg);
+ sub = instance = 0;
+ break;
case AMDFW_OPT_CONFIG:
cb_config->config = optarg;
break;