soc/amd/cezanne: Init eSPI early if required

If the NO_EARLY_BOOTBLOCK_POSTCODES config option is enabled, configure
eSPI as early as possible in the x86 boot sequence.

We found that there are situations that can cause the system to hang if
there are any port80h postcodes sent out before eSPI is initialized.

BUG=b:191370340
TEST=Build & Boot with and without NO_EARLY_BOOTBLOCK_POSTCODES enabled.

Signed-off-by: Martin Roth <martinroth@chromium.org>
Change-Id: I0badb1c529e96ee4f81134287db53ce32473de6e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55732
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Martin Roth 2021-06-21 09:22:13 -06:00 committed by Martin Roth
parent 7c21c20821
commit 6662fe60e1
3 changed files with 15 additions and 1 deletions

View File

@ -92,6 +92,12 @@ asmlinkage void bootblock_c_entry(uint64_t base_timestamp)
set_caching(); set_caching();
write_resume_eip(); write_resume_eip();
enable_pci_mmconf(); enable_pci_mmconf();
/*
* If NO_EARLY_BOOTBLOCK_POSTCODES is selected, we need to initialize port80h
* routing as early as possible
*/
if (CONFIG(NO_EARLY_BOOTBLOCK_POSTCODES))
configure_port80_routing_early();
/* /*
* base_timestamp is raw tsc value. We need to divide by tsc_freq_mhz * base_timestamp is raw tsc value. We need to divide by tsc_freq_mhz

View File

@ -32,6 +32,13 @@ static void reset_i2c_peripherals(void)
sb_reset_i2c_peripherals(&reset_info); sb_reset_i2c_peripherals(&reset_info);
} }
/* Initialize port80h routing early if needed */
void configure_port80_routing_early(void)
{
if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI))
espi_setup();
}
/* Before console init */ /* Before console init */
void fch_pre_init(void) void fch_pre_init(void)
{ {
@ -69,6 +76,6 @@ void fch_early_init(void)
if (CONFIG(DISABLE_SPI_FLASH_ROM_SHARING)) if (CONFIG(DISABLE_SPI_FLASH_ROM_SHARING))
lpc_disable_spi_rom_sharing(); lpc_disable_spi_rom_sharing();
if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI)) if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI) && !CONFIG(NO_EARLY_BOOTBLOCK_POSTCODES))
espi_setup(); espi_setup();
} }

View File

@ -105,6 +105,7 @@
#define I2C_PAD_CTRL_SPARE0 BIT(17) #define I2C_PAD_CTRL_SPARE0 BIT(17)
#define I2C_PAD_CTRL_SPARE1 BIT(18) #define I2C_PAD_CTRL_SPARE1 BIT(18)
void configure_port80_routing_early(void);
void fch_pre_init(void); void fch_pre_init(void);
void fch_early_init(void); void fch_early_init(void);
void fch_init(void *chip_info); void fch_init(void *chip_info);