Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/83812?usp=email )
Change subject: util/amdfwtool: add support to specify RPMC NVRAM region ......................................................................
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 --- M util/amdfwtool/amdfwtool.c M util/amdfwtool/opts.c 2 files changed, 18 insertions(+), 1 deletion(-)
Approvals: Martin Roth: Looks good to me, approved Karthik Ramasubramanian: Looks good to me, approved Matt DeVillier: Looks good to me, but someone else must approve build bot (Jenkins): Verified Marshall Dawson: Looks good to me, approved
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 1dac476..1fe9923 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1011,7 +1011,8 @@ 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 511ffd0..62bbc97 100644 --- a/util/amdfwtool/opts.c +++ b/util/amdfwtool/opts.c @@ -68,6 +68,8 @@ 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 @@ {"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 @@ 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 @@ 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;