From 2d17ea4d501c8e0f68813cda80dd6412b10ca0d8 Mon Sep 17 00:00:00 2001 From: Karthikeyan Ramasubramanian Date: Tue, 5 Oct 2021 13:57:30 -0600 Subject: soc/amd/common/block/espi_util: Refactor eSPI Setup eSPI is setup in two different locations in bootblock depending on early port80 routing configuration. Also eSPI is setup in PSP, if verified boot starts before bootblock. Consolidate all the scenarios by initializating eSPI very early in fch_pre_init if verified boot starts after bootblock and eSPI is enabled. BUG=None TEST=Build and boot to OS in Guybrush. Perform S5->S0, G3->S0, warm reset and suspend/resume cycles for 50 iterations each. Signed-off-by: Karthikeyan Ramasubramanian Change-Id: Icfeba17dae0a964c9ca73686e29c18d965589934 Reviewed-on: https://review.coreboot.org/c/coreboot/+/58114 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held Reviewed-by: Raul Rangel --- src/soc/amd/common/block/include/amdblocks/espi.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/soc/amd/common/block') diff --git a/src/soc/amd/common/block/include/amdblocks/espi.h b/src/soc/amd/common/block/include/amdblocks/espi.h index 9a563f9e36..7e49ea0f2e 100644 --- a/src/soc/amd/common/block/include/amdblocks/espi.h +++ b/src/soc/amd/common/block/include/amdblocks/espi.h @@ -131,4 +131,15 @@ int espi_setup(void); /* Run mainboard configuration needed to set up eSPI */ void mb_set_up_early_espi(void); +/* Setup eSPI with any mainboard specific initialization. */ +static inline void configure_espi(void) +{ + /* If eSPI is setup in PSP Verstage, continue with that. Else setup eSPI to perform + port80h routing as early as possible. */ + if (!CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK) && CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI)) { + mb_set_up_early_espi(); + espi_setup(); + } +} + #endif /* AMD_BLOCK_ESPI_H */ -- cgit v1.2.3