summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-11-24 14:40:32 -0700
committerCommit Bot <commit-bot@chromium.org>2020-12-15 16:02:37 +0000
commit7365b16a1e3852040939289cfc9fa2472b160c83 (patch)
treea83e84d681f521feef1b5497a1765416cb5421ae /common
parent4c6709899bc811fa9c07f04f4bb826d7025f19c2 (diff)
downloadchrome-ec-7365b16a1e3852040939289cfc9fa2472b160c83.tar.gz
TCPMv2: Handle message discard in vcs_evaluate_swap
If the port partner sent a message while we were attempting to reply to a Vconn swap, soft reset with the incoming message's SOP. BRANCH=None BUG=b:157228506 TEST=on drawcia with Apple A2119, PE does not get stuck in vcs_evaluate_swap Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ifb40ee6bec02b88d96088d72b1a9371417b3338a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2558908 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usbc/usb_pe_drp_sm.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index 94c5d0f578..d9923eecf4 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -5926,6 +5926,25 @@ static void pe_vcs_evaluate_swap_run(int port)
*/
pe_set_ready_state(port);
}
+ return;
+ }
+
+ /*
+ * On outgoing discard, soft reset with SOP of incoming message
+ *
+ * See Table 6-65 Response to an incoming Message (except VDM) in PD 3.0
+ * Version 2.0 Specification.
+ */
+ if (PE_CHK_FLAG(port, PE_FLAGS_MSG_DISCARDED) &&
+ PE_CHK_FLAG(port, PE_FLAGS_MSG_RECEIVED)) {
+ enum tcpm_transmit_type sop =
+ PD_HEADER_GET_SOP(rx_emsg[port].header);
+
+ PE_CLR_FLAG(port, PE_FLAGS_MSG_DISCARDED);
+ PE_CLR_FLAG(port, PE_FLAGS_MSG_RECEIVED);
+
+ pe_send_soft_reset(port, sop);
+ return;
}
}