summaryrefslogtreecommitdiff
path: root/src/soc/amd
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd')
-rw-r--r--src/soc/amd/common/psp_verstage/Kconfig8
-rw-r--r--src/soc/amd/common/psp_verstage/psp_verstage.c16
2 files changed, 18 insertions, 6 deletions
diff --git a/src/soc/amd/common/psp_verstage/Kconfig b/src/soc/amd/common/psp_verstage/Kconfig
index 45a5d22423..13dd71659c 100644
--- a/src/soc/amd/common/psp_verstage/Kconfig
+++ b/src/soc/amd/common/psp_verstage/Kconfig
@@ -21,3 +21,11 @@ config PSP_INIT_TPM_ON_S0I3_RESUME
If the TPM is reset while in S0i3, it must be reinitialized
during s0i3 resume. This must be performed in PSP verstage since
coreboot is otherwise not involved with s0i3 resume.
+
+config PSP_SUPPORTS_EFS2_RELATIVE_ADDR
+ bool
+ default n
+ help
+ On SoCs where PSP uses A/B recovery layout, PSP support relative addressing
+ from the start of the SPI ROM. Enable this config on SoCs where PSP supports
+ relative addressing so that PSP verstage can pass the offset.
diff --git a/src/soc/amd/common/psp_verstage/psp_verstage.c b/src/soc/amd/common/psp_verstage/psp_verstage.c
index 33733848ef..b928a27e27 100644
--- a/src/soc/amd/common/psp_verstage/psp_verstage.c
+++ b/src/soc/amd/common/psp_verstage/psp_verstage.c
@@ -104,19 +104,23 @@ static uint32_t update_boot_region(struct vb2_context *ctx)
bios_dir_addr = get_bios_dir_addr(ef_table);
psp_dir_in_spi = (uint32_t *)((psp_dir_addr & SPI_ADDR_MASK) +
(uint32_t)boot_dev_base);
- bios_dir_in_spi = (uint32_t *)((bios_dir_addr & SPI_ADDR_MASK) +
- (uint32_t)boot_dev_base);
if (*psp_dir_in_spi != PSP_COOKIE) {
printk(BIOS_ERR, "PSP Directory address is not correct.\n");
return POSTCODE_PSP_COOKIE_MISMATCH_ERROR;
}
- if (*bios_dir_in_spi != BHD_COOKIE) {
- printk(BIOS_ERR, "BIOS Directory address is not correct.\n");
- return POSTCODE_BHD_COOKIE_MISMATCH_ERROR;
+
+ if (bios_dir_addr) {
+ bios_dir_in_spi = (uint32_t *)((bios_dir_addr & SPI_ADDR_MASK) +
+ (uint32_t)boot_dev_base);
+ if (*bios_dir_in_spi != BHD_COOKIE) {
+ printk(BIOS_ERR, "BIOS Directory address is not correct.\n");
+ return POSTCODE_BHD_COOKIE_MISMATCH_ERROR;
+ }
}
/* EFS2 uses relative address and PSP isn't happy with that */
- if (ef_table->efs_gen.gen == EFS_SECOND_GEN) {
+ if (ef_table->efs_gen.gen == EFS_SECOND_GEN &&
+ !CONFIG(PSP_SUPPORTS_EFS2_RELATIVE_ADDR)) {
psp_dir_addr = FLASH_BASE_ADDR + (psp_dir_addr & SPI_ADDR_MASK);
bios_dir_addr = FLASH_BASE_ADDR + (bios_dir_addr & SPI_ADDR_MASK);
}