From 687ec6bd7203ad3f1fcf3c03c49d8255ac77d16e Mon Sep 17 00:00:00 2001 From: Felix Held Date: Tue, 13 Dec 2022 18:05:00 +0100 Subject: [PATCH] soc/amd/common/block/espi_util: make espi_set_initial_config non-fatal Improve the espi_set_initial_config implementation so that a failure in there due to an invalid configuration won't call die() and stop booting at this point, but return an error to the caller so that the rest of the eSPI configuration will be skipped. Signed-off-by: Felix Held Change-Id: I97f730778a190c4485c4ffe93edf19bcbaa45392 Reviewed-on: https://review.coreboot.org/c/coreboot/+/70731 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Reviewed-by: Fred Reitberger --- src/soc/amd/common/block/lpc/espi_util.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/soc/amd/common/block/lpc/espi_util.c b/src/soc/amd/common/block/lpc/espi_util.c index 4b23b3f10e..0cd35e5ed8 100644 --- a/src/soc/amd/common/block/lpc/espi_util.c +++ b/src/soc/amd/common/block/lpc/espi_util.c @@ -962,7 +962,7 @@ static enum cb_err espi_setup_flash_channel(const struct espi_config *mb_cfg, ESPI_FLASH_CH_EN); } -static void espi_set_initial_config(const struct espi_config *mb_cfg) +static enum cb_err espi_set_initial_config(const struct espi_config *mb_cfg) { uint32_t espi_initial_mode = ESPI_OP_FREQ_16_MHZ | ESPI_IO_MODE_SINGLE; @@ -974,10 +974,12 @@ static void espi_set_initial_config(const struct espi_config *mb_cfg) espi_initial_mode |= ESPI_ALERT_MODE; break; default: - die("Unknown espi alert config: %u!\n", mb_cfg->alert_pin); + printk(BIOS_ERR, "Unknown espi alert config: %u!\n", mb_cfg->alert_pin); + return CB_ERR; } espi_write32(ESPI_SLAVE0_CONFIG, espi_initial_mode); + return CB_SUCCESS; } static void espi_setup_subtractive_decode(const struct espi_config *mb_cfg) @@ -1013,7 +1015,8 @@ enum cb_err espi_setup(void) * Set correct initial configuration to talk to the slave: * Set clock frequency to 16.7MHz and single IO mode. */ - espi_set_initial_config(cfg); + if (espi_set_initial_config(cfg) != CB_SUCCESS) + return CB_ERR; /* * Boot sequence: Step 2 @@ -1024,7 +1027,9 @@ enum cb_err espi_setup(void) printk(BIOS_ERR, "In-band reset failed!\n"); return CB_ERR; } - espi_set_initial_config(cfg); + + if (espi_set_initial_config(cfg) != CB_SUCCESS) + return CB_ERR; /* * Boot sequence: Step 3