soc/intel: Treat time-out as failure in HECI

If HECI gets times out when waiting for read slots, there's no need to
read back reply message to decide if the HECI recieve successed or not.
Otherwise, system will stuck after global reset required.

BUG=b:707290799
TEST=Boot up meowth board without battery, and confirm hard reset got
trigged after heci time out.

Change-Id: I7c1655284d7027294d8ff5d6a5dbbebe4cbd0c47
Signed-off-by: Lijian Zhao <lijian.zhao@intel.com>
Reviewed-on: https://review.coreboot.org/22910
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Lijian Zhao
2017-12-15 19:10:18 -08:00
committed by Martin Roth
parent ceac787a4f
commit c50296d997
2 changed files with 10 additions and 5 deletions

View File

@@ -25,6 +25,7 @@
/* Reset Request */ /* Reset Request */
#define MKHI_GLOBAL_RESET 0x0b #define MKHI_GLOBAL_RESET 0x0b
#define MKHI_STATUS_SUCCESS 0
#define GR_ORIGIN_BIOS_MEM_INIT 0x01 #define GR_ORIGIN_BIOS_MEM_INIT 0x01
#define GR_ORIGIN_BIOS_POST 0x02 #define GR_ORIGIN_BIOS_POST 0x02
@@ -67,13 +68,13 @@ static int send_heci_reset_message(void)
reply_size = sizeof(reply); reply_size = sizeof(reply);
memset(&reply, 0, reply_size); memset(&reply, 0, reply_size);
heci_receive(&reply, &reply_size); if (!heci_receive(&reply, &reply_size))
/* get reply result from HECI MSG */ return -1;
if (reply.result != 0) { if (reply.result != MKHI_STATUS_SUCCESS) {
printk(BIOS_DEBUG, "%s: Exit with Failure\n", __func__); printk(BIOS_DEBUG, "Returned Mkhi Status is not success!\n");
return -1; return -1;
} }
printk(BIOS_DEBUG, "%s: Exit with Success\n", __func__); printk(BIOS_DEBUG, "Heci recieve success!\n");
return 0; return 0;
} }

View File

@@ -438,6 +438,10 @@ int heci_receive(void *buff, size_t *maxlen)
*/ */
do { do {
received = recv_one_message(&hdr, p, left); received = recv_one_message(&hdr, p, left);
if (!received) {
printk(BIOS_ERR, "HECI: Failed to recieve!\n");
return 0;
}
left -= received; left -= received;
p += received; p += received;
/* If we read out everything ping to send more */ /* If we read out everything ping to send more */