From bca6d843094cbc8bc49aea01c87b8338b529fd7b Mon Sep 17 00:00:00 2001 From: Abe Levkoy Date: Thu, 14 May 2020 11:23:02 -0600 Subject: TCPMv2: Handle Not Supported response to VDMs A partner may respond to a Discover SVIDs or Discover Modes REQ with Not Supported instead of NAK, and the meaning is the same. Handle this case in PE_INIT_VDM_{SVIDs,Modes}_Request. BUG=b:156535637 TEST=Attach port partner that ACKs Discover Identity but responds to Discover SVIDs with Not Supported; observe graceful exit of discovery. BRANCH=none Change-Id: I0fe912f831de3280189bfc4e829dc9c0698548e2 Signed-off-by: Abe Levkoy Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2202517 Tested-by: Denis Brockus Reviewed-by: Denis Brockus --- common/usbc/usb_pe_drp_sm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index 5a3fa20d43..1bc1eeeb60 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -4585,6 +4585,13 @@ static void pe_init_vdm_svids_request_run(int port) "0x%04x", port, rx_emsg[port].header, payload[0]); } + } else if (sop == pe[port].tx_type && ext == 0 && cnt == 0 && + type == PD_CTRL_NOT_SUPPORTED) { + /* + * A NAK would be more expected here, but Not Supported is still + * allowed with the same meaning. + */ + pd_set_svids_discovery(port, sop, PD_DISC_FAIL); } else { /* * Unexpected Message Received. Src.Ready or Snk.Ready can @@ -4710,6 +4717,13 @@ static void pe_init_vdm_modes_request_run(int port) port, rx_emsg[port].header, payload[0]); } + } else if (sop == pe[port].tx_type && ext == 0 && cnt == 0 && + type == PD_CTRL_NOT_SUPPORTED) { + /* + * A NAK would be more expected here, but Not Supported is still + * allowed with the same meaning. + */ + pd_set_svids_discovery(port, sop, PD_DISC_FAIL); } else { /* * Unexpected Message Received. Src.Ready or Snk.Ready can -- cgit v1.2.1