summaryrefslogtreecommitdiff
path: root/common/usbc/usb_prl_sm.c
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2020-08-14 13:05:20 -0700
committerCommit Bot <commit-bot@chromium.org>2020-08-22 01:49:02 +0000
commitc2c19821c41f0e20de1cc0c3f6103d338f868198 (patch)
tree859ea9e3dc66ae683280c3b81d1b426237b8d61d /common/usbc/usb_prl_sm.c
parent213015c44bd470565091a5eb429a593e79dfc52f (diff)
downloadchrome-ec-c2c19821c41f0e20de1cc0c3f6103d338f868198.tar.gz
TCPMv2: Don't interrupt RX/TX Extended Chunked Msg sequence
Delay sending a new message during the reception or transmitting of Chunked messages. BRANCH=none BUG=b:161836223 TEST=make -j buildall manual: Transmitted an extended message and verified that the sequence was not interrupted by attempting to send a VDM message. Without patch Chunked message request that was interrupted. 20-08-14 10:46:13.473 C1: RECV 9a9f/1 [0]00008c00 20-08-14 10:46:13.494 C1: RECV 9c9f/1 [0]00009400 20-08-14 10:46:13.516 C1: RECV 9e9f/1 [0]00009c00 20-08-14 10:46:13.535 C1: RECV 909f/1 [0]0000a400 Try to send VDM. MSG_TYPE is corrupted, was 0x1f, now 0x0f 20-08-14 10:46:13.563 C1: RECV 928f/1 [0]0000ac00 20-08-14 10:46:13.591 C1: RECV 948f/1 [0]0000b400 20-08-14 10:46:13.618 C1: RECV 968f/1 [0]0000bc00 20-08-14 10:46:13.645 C1: RECV 988f/1 [0]0000c400 20-08-14 10:46:13.674 C1: RECV 9a8f/1 [0]0000cc00 With patch. Chunked message request was not interrupted. 20-08-14 10:50:56.052 C1: RECV 9a9f/1 [0]00008c00 20-08-14 10:50:56.075 C1: RECV 9c9f/1 [0]00009400 20-08-14 10:50:56.093 C1: RECV 9e9f/1 [0]00009c00 20-08-14 10:50:56.114 C1: RECV 909f/1 [0]0000a400 Try to send VDM. Message delayed 20-08-14 10:50:56.134 C1: RECV 929f/1 [0]0000ac00 20-08-14 10:50:56.155 C1: RECV 949f/1 [0]0000b400 20-08-14 10:50:56.175 C1: RECV 969f/1 [0]0000bc00 20-08-14 10:50:56.195 C1: RECV 989f/1 [0]0000c400 20-08-14 10:50:56.216 C1: RECV 9a9f/1 [0]0000cc00 20-08-14 10:50:56.242 C1: RECV 0c90/0 Try to send VDM. Signed-off-by: Sam Hurst <shurst@google.com>wq Change-Id: I5475792ee9f272fe4964e27839e55e3409a6a799 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2357414
Diffstat (limited to 'common/usbc/usb_prl_sm.c')
-rw-r--r--common/usbc/usb_prl_sm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c
index 788b5eeef0..658c4647a1 100644
--- a/common/usbc/usb_prl_sm.c
+++ b/common/usbc/usb_prl_sm.c
@@ -520,6 +520,18 @@ static void prl_init(int port)
set_state_prl_hr(port, PRL_HR_WAIT_FOR_REQUEST);
}
+bool prl_is_busy(int port)
+{
+#ifdef CONFIG_USB_PD_EXTENDED_MESSAGES
+ return rch_get_state(port) !=
+ RCH_WAIT_FOR_MESSAGE_FROM_PROTOCOL_LAYER ||
+ tch_get_state(port) !=
+ TCH_WAIT_FOR_MESSAGE_REQUEST_FROM_PE;
+#else
+ return false;
+#endif /* CONFIG_USB_PD_EXTENDED_MESSAGES */
+}
+
void prl_set_debug_level(enum debug_level debug_level)
{
#ifndef CONFIG_USB_PD_DEBUG_LEVEL