From 98bc961ee365f9d71ee3844e522b659519a8f8a2 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Sat, 9 May 2020 19:31:55 -0700 Subject: soc/amd/common/block/lpc: Provide an option to use static eSPI BAR This change provides a helper function espi_update_static_bar() that informs the eSPI common driver about the static BAR to use for eSPI controller instead of reading the SPIBASE. This is required to support the case of verstage running on PSP. BUG=b:153675913 Signed-off-by: Furquan Shaikh Change-Id: I1f11bb2e29ea0acd71ba6984e42573cfe914e5d7 Reviewed-on: https://review.coreboot.org/c/coreboot/+/41256 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Raul Rangel --- src/soc/amd/common/block/lpc/espi_util.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/soc/amd/common/block/lpc') 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 #include +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) -- cgit v1.2.3