summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbe Levkoy <alevkoy@chromium.org>2020-05-14 11:23:02 -0600
committerCommit Bot <commit-bot@chromium.org>2020-05-15 02:59:41 +0000
commitbca6d843094cbc8bc49aea01c87b8338b529fd7b (patch)
treeb1c01ecf43775e661c307c9cec1c77dfe2f281e5
parent33e65969b7022236489b1a660468ef0191124df1 (diff)
downloadchrome-ec-bca6d843094cbc8bc49aea01c87b8338b529fd7b.tar.gz
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 <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2202517 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--common/usbc/usb_pe_drp_sm.c14
1 files changed, 14 insertions, 0 deletions
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