coreboot-kgpe-d16/src/ec
Daisuke Nojiri ccfa18feff cros-ec: Avoid infinitely looping in google_chromeec_pd_get_amode
Currently, google_chromeec_pd_get_amode infinitely loops if a TCPC port
is connected to a device with alternate mode(s) and the call is made
for the mode with the index higher than 0 (e.g. Zinger).

Cros EC manages alternative modes entered in an array (amode[]). The
command is designed to accept a query for an particular index and a
particular SVID.

Zinger has a 'Google' mode. It's stored in amode[0]. When AP queries
first time for DisplayPort with index=0, EC says 'no' as expected.

AP sends the next query with index=1 but EC_CMD_PROTO_VERSION (0x00)
is sent instead because cmd_code is cleared by google_chromeec_command.
res.svid is supposed to be 0 when EC hits the last index + 1 but
res.svid is set to 2 by the EC_CMD_PROTO_VERSION handler because
EC_PROTO_VERSION is currently 2. So, the call succeeds and AP goes to
the next index and this repeats forever.

Any USB-C device with non-DisplayPort alternate mode can cause this
hang unless HDMI port is used.

This patch resets all the fields of chromeec_command in each iteration
in case google_chromeec_command changes them.

BUG=b:78630899
BRANCH=none
TEST=Verify Fizz boots without monitors on Zinger. Verify the svid
enumeration happens as expected.

Change-Id: I388ed4bdfac9176d8e690c429e99674ed267004f
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://review.coreboot.org/25878
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
2018-04-30 06:27:24 +00:00
..
acpi ec/acpi: add mechanisms to clear EC output queue 2017-11-07 12:26:42 +00:00
compal/ene932 device/pnp: remove struct io_info 2017-06-13 15:21:58 +02:00
google/chromeec cros-ec: Avoid infinitely looping in google_chromeec_pd_get_amode 2018-04-30 06:27:24 +00:00
hp/kbc1126 ec/hp/kbc1126: change the default offset of the blobs 2017-12-25 14:44:23 +00:00
kontron/it8516e device/pnp: remove struct io_info 2017-06-13 15:21:58 +02:00
lenovo ec/h8: Store PWRS and notify CPU on AC power plug/unplug events 2018-01-17 17:08:22 +00:00
purism/librem ec/purism: Fix CPU Turbo value (PPCM) set by the EC 2018-03-26 10:25:58 +00:00
quanta ec/quanta/it8518: add missing HID to SIO device 2017-09-19 14:11:26 +00:00
roda/it8518 device/pnp: remove struct io_info 2017-06-13 15:21:58 +02:00
smsc/mec1308 ec/mec1308: Fix fan control ACPI 2017-07-08 19:06:00 +00:00
ec.h mainboards,ec: provide common declaration for mainboard_ec_init() 2016-09-26 23:53:12 +02:00