diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2022-12-13 18:05:00 +0100 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2022-12-14 17:07:19 +0000 |
commit | 687ec6bd7203ad3f1fcf3c03c49d8255ac77d16e (patch) | |
tree | 7bc806ca07ca88b5a7895c9bb05494eaff75f2a5 | |
parent | 84429e092f1c80f6e05e9d15f675923eb043352e (diff) |
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 <felix-coreboot@felixheld.de>
Change-Id: I97f730778a190c4485c4ffe93edf19bcbaa45392
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70731
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
-rw-r--r-- | src/soc/amd/common/block/lpc/espi_util.c | 13 |
1 files 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 |