diff options
author | Sam Hurst <shurst@google.com> | 2019-11-21 13:06:00 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-12-09 19:01:11 +0000 |
commit | 37e7cd81880bc4ee25e5bcd085a3c217ad7b6eae (patch) | |
tree | 3d71cca4fa2701dcc15d3340f36dc17b9a02a0ce /common | |
parent | 939160b5b82424e57457a3d07dccfe7127681787 (diff) | |
download | chrome-ec-37e7cd81880bc4ee25e5bcd085a3c217ad7b6eae.tar.gz |
TCPMv2: Handle unexpected msgs received during Port Discovery
During a port discovery, unexpected messages such as SRC_CAPs
and Not_Supported are handled by the Src.Attached or Snk.Attached
state and the port discovery process is terminated.
BUG=chromium:1027252
BRANCH=none
TEST=make -j buildall
Manual Test:
Used an Anker charger to verify that Not Supported
messages are handle correctly during a Port Discovery.
Total Phase output:
Source:DFP, Source_Cap
Sink:UFP, GoodCRC
Sink:UFP, Request
Source:DFP, GoodCRC
Source:DFP, Accept
Sink:UFP, GoodCRC
Source:DFP, PS_RDY
Sink:UFP, GoodCRC
Sink:UFP, VDM:DiscIdentity
Source:DFP, GoodCRC
Source:DFP, Not_Supported
Sink:UFP, GoodCRC
Change-Id: I48db149c0c59affe6aad49b8b1bcfb6dc3656142
Signed-off-by: Sam Hurst <shurst@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1928793
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index 447b5ca583..5c11f6c4d9 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -3693,11 +3693,17 @@ static void pe_vdm_request_run(int port) PE_FLAGS_VDM_REQUEST_BUSY); } } else { + /* Unexpected Message Received. */ + /* - * Unexpected Message Received. - * Return to Src.Ready or Snk.Ready to - * handle it. + * Reset PE_FLAGS_MSG_RECEIVED so Src.Ready or Snk.Ready + * can handle it. */ + PE_SET_FLAG(port, PE_FLAGS_MSG_RECEIVED); + + /* Port Disc. was interrupted. So don't try again. */ + PE_SET_FLAG(port, PE_FLAGS_DISCOVER_PORT_IDENTITY_DONE); + if (pe[port].power_role == PD_ROLE_SOURCE) set_state_pe(port, PE_SRC_READY); else |