summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/amd/common/block/include/amdblocks/espi.h6
-rw-r--r--src/soc/amd/common/block/lpc/espi_util.c18
2 files changed, 22 insertions, 2 deletions
diff --git a/src/soc/amd/common/block/include/amdblocks/espi.h b/src/soc/amd/common/block/include/amdblocks/espi.h
index 53cc5f9f3f..69267f8cc3 100644
--- a/src/soc/amd/common/block/include/amdblocks/espi.h
+++ b/src/soc/amd/common/block/include/amdblocks/espi.h
@@ -55,4 +55,10 @@ int espi_open_mmio_window(uint32_t base, size_t size);
*/
void espi_configure_decodes(void);
+/*
+ * In cases where eSPI BAR is statically provided by SoC, use that BAR instead of reading
+ * SPIBASE. This is required for cases where verstage runs on PSP.
+ */
+void espi_update_static_bar(uintptr_t bar);
+
#endif /* __AMDBLOCKS_ESPI_H__ */
diff --git a/src/soc/amd/common/block/lpc/espi_util.c b/src/soc/amd/common/block/lpc/espi_util.c
index 2585c46138..54a017ea0c 100644
--- a/src/soc/amd/common/block/lpc/espi_util.c
+++ b/src/soc/amd/common/block/lpc/espi_util.c
@@ -11,10 +11,24 @@
#include <stdint.h>
#include <types.h>
+static uintptr_t espi_bar;
+
+void espi_update_static_bar(uintptr_t bar)
+{
+ espi_bar = bar;
+}
+
static uintptr_t espi_get_bar(void)
{
- uintptr_t espi_spi_base = lpc_get_spibase();
- return espi_spi_base + ESPI_OFFSET_FROM_BAR;
+ uintptr_t espi_spi_base;
+
+ if (espi_bar)
+ return espi_bar;
+
+ espi_spi_base = lpc_get_spibase();
+ espi_update_static_bar(espi_spi_base + ESPI_OFFSET_FROM_BAR);
+
+ return espi_bar;
}
static uint32_t espi_read32(int reg)