aboutsummaryrefslogtreecommitdiff
path: root/src/ec
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2019-03-15 17:11:10 -0700
committerPatrick Georgi <pgeorgi@google.com>2019-03-18 09:14:36 +0000
commita436877573da335de776b262415b6997daadb54a (patch)
treed36a881eebaf2632dfc97f073d2539251f701d5f /src/ec
parentaf39c82a36119158ffcee955cf83d880c9560e5f (diff)
ec/google/wilco: Fix handling of commands that do not respond
If the command does not respond the driver should not wait for it to complete before returning. Tested with SMI debug enabled to ensure that the final command does not report a failure. Change-Id: I7c1bfa19a92e8332ac1aa6ff95f94ff4cbdf789d Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/31919 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/ec')
-rw-r--r--src/ec/google/wilco/mailbox.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ec/google/wilco/mailbox.c b/src/ec/google/wilco/mailbox.c
index 1c38a5b880..d47290ccaf 100644
--- a/src/ec/google/wilco/mailbox.c
+++ b/src/ec/google/wilco/mailbox.c
@@ -155,12 +155,6 @@ static int wilco_ec_transfer(struct wilco_ec_message *msg)
/* Start the command */
outb(EC_MAILBOX_START_COMMAND, CONFIG_EC_BASE_HOST_COMMAND);
- /* Wait for it to complete */
- if (wilco_ec_response_timed_out()) {
- printk(BIOS_ERR, "%s: response timed out\n", __func__);
- return -1;
- }
-
/* Some commands will put the EC into a state where it cannot respond */
if (msg->type == WILCO_EC_MSG_NO_RESPONSE) {
printk(BIOS_DEBUG, "%s: EC does not respond to this command\n",
@@ -168,6 +162,12 @@ static int wilco_ec_transfer(struct wilco_ec_message *msg)
return 0;
}
+ /* Wait for it to complete */
+ if (wilco_ec_response_timed_out()) {
+ printk(BIOS_ERR, "%s: response timed out\n", __func__);
+ return -1;
+ }
+
/* Check result */
msg->result = inb(CONFIG_EC_BASE_HOST_DATA);
if (msg->result != 0) {