From 073da0cbae869389a2fd07a18feaea0c6c7d42e1 Mon Sep 17 00:00:00 2001 From: Sridhar Siricilla Date: Fri, 4 Mar 2022 09:24:48 +0530 Subject: [PATCH] soc/intel/common: Retry MEI CSE DISABLE command As per ME BWG, the patch retries MEI CSE DISABLE command if CSE doesn't respond or sends the garbled response. It retries the command additionally 2 more times. TEST=build and boot the Brya board Signed-off-by: Sridhar Siricilla Change-Id: Id38a172d670a0cd44643744f27b85ca7e368ccdb Reviewed-on: https://review.coreboot.org/c/coreboot/+/62560 Tested-by: build bot (Jenkins) Reviewed-by: Tim Wawrzynczak --- src/soc/intel/common/block/cse/cse_eop.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/soc/intel/common/block/cse/cse_eop.c b/src/soc/intel/common/block/cse/cse_eop.c index c6b527778f..a8c8bbdfcf 100644 --- a/src/soc/intel/common/block/cse/cse_eop.c +++ b/src/soc/intel/common/block/cse/cse_eop.c @@ -34,7 +34,7 @@ static enum cse_cmd_result decode_heci_send_receive_error(enum cse_tx_rx_status } } -static bool cse_disable_mei_bus(void) +static enum cse_cmd_result cse_disable_mei_bus(void) { struct bus_disable_message { uint8_t command; @@ -49,18 +49,22 @@ static bool cse_disable_mei_bus(void) } __packed reply = {}; size_t reply_sz = sizeof(reply); + enum cse_tx_rx_status ret; - if (heci_send_receive(&msg, sizeof(msg), &reply, &reply_sz, HECI_MEI_ADDR)) { + printk(BIOS_DEBUG, "HECI, Sending MEI BIOS DISABLE command\n"); + ret = heci_send_receive(&msg, sizeof(msg), &reply, &reply_sz, HECI_MEI_ADDR); + + if (ret) { printk(BIOS_ERR, "HECI: Failed to Disable MEI bus\n"); - return false; + return decode_heci_send_receive_error(ret); } if (reply.status) { printk(BIOS_ERR, "HECI: MEI_Bus_Disable Failed (status: %d)\n", reply.status); - return false; + return CSE_CMD_RESULT_ERROR; } - return true; + return CSE_CMD_RESULT_SUCCESS; } static enum cse_cmd_result cse_send_eop(void) @@ -158,7 +162,7 @@ static enum cse_cmd_result cse_send_cmd_retries(enum cse_cmd_result (*cse_send_c */ static void cse_handle_eop_error(void) { - if (!cse_disable_mei_bus()) + if (cse_send_cmd_retries(cse_disable_mei_bus)) die("Failed to disable MEI bus while recovering from EOP error\n" "Preventing system from booting into an insecure state.\n");