summaryrefslogtreecommitdiff
path: root/common/usbc/usb_prl_sm.c
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-06-11 13:37:36 -0600
committerCommit Bot <commit-bot@chromium.org>2020-06-25 23:57:54 +0000
commit2f651922b48ed2ed4a592ca2f61b82d7df7f0006 (patch)
treefff962a20c981472661782e3cbf48ec2f84698f1 /common/usbc/usb_prl_sm.c
parent07fc2cff6d8575ca89e563fca741a0ea454fff9d (diff)
downloadchrome-ec-2f651922b48ed2ed4a592ca2f61b82d7df7f0006.tar.gz
TCPMv2: Report message discard to the PE
This commit creates a reporting function for the PRL to let the PE know when messages have been discarded. States will have to handle message discard internally since the response depends on the portion of the AMS sequence they're in. For some states which begin AMSes, a new shared parent has been added which runs the sender response timer and checks discard for the child. More states (and discard mid-AMS) are expected to be added in future CLs. The new parent state saves an average of 124 bytes of flash space. BRANCH=None BUG=b:158248741,b:157228506 TEST=on waddledoo, Dell dock no longer soft resets during power role swap Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I61b3e96e1d14634dcd5edda4e133968ace769b21 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2241577 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'common/usbc/usb_prl_sm.c')
-rw-r--r--common/usbc/usb_prl_sm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c
index 3d2e7a5bc4..659e5f2cdc 100644
--- a/common/usbc/usb_prl_sm.c
+++ b/common/usbc/usb_prl_sm.c
@@ -860,9 +860,9 @@ static void prl_tx_discard_message_entry(const int port)
* incoming SOP' or SOP''. However this would get the TCH out of sync.
*/
if (PRL_TX_CHK_FLAG(port, PRL_FLAGS_MSG_XMIT)) {
- increment_msgid_counter(port);
PRL_TX_CLR_FLAG(port, PRL_FLAGS_MSG_XMIT);
- /* TODO(b/157228506): notify pe if needed */
+ increment_msgid_counter(port);
+ pe_report_discard(port);
}
set_state_prl_tx(port, PRL_TX_PHY_LAYER_RESET);
@@ -1893,8 +1893,10 @@ static void tch_message_received_entry(const int port)
RCH_SET_FLAG(port, PRL_FLAGS_MSG_RECEIVED);
/* Clear extended message objects */
- /* TODO: Notify PE of message discard */
- TCH_CLR_FLAG(port, PRL_FLAGS_MSG_XMIT);
+ if (TCH_CHK_FLAG(port, PRL_FLAGS_MSG_XMIT)) {
+ TCH_CLR_FLAG(port, PRL_FLAGS_MSG_XMIT);
+ pe_report_discard(port);
+ }
pdmsg[port].data_objs = 0;
}