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 <furquan@google.com>
Change-Id: I1f11bb2e29ea0acd71ba6984e42573cfe914e5d7
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41256
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
This commit is contained in:
Furquan Shaikh 2020-05-09 19:31:55 -07:00
parent 32b8a51153
commit 98bc961ee3
2 changed files with 22 additions and 2 deletions

View File

@ -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__ */

View File

@ -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)