diff options
author | Diana Z <dzigterman@chromium.org> | 2020-06-11 13:37:36 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-25 23:57:54 +0000 |
commit | 2f651922b48ed2ed4a592ca2f61b82d7df7f0006 (patch) | |
tree | fff962a20c981472661782e3cbf48ec2f84698f1 /test | |
parent | 07fc2cff6d8575ca89e563fca741a0ea454fff9d (diff) | |
download | chrome-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 'test')
-rw-r--r-- | test/usb_prl_old.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/usb_prl_old.c b/test/usb_prl_old.c index 4c027098ea..f11db7fb5c 100644 --- a/test/usb_prl_old.c +++ b/test/usb_prl_old.c @@ -107,6 +107,7 @@ static struct pd_prl { int mock_pe_got_hard_reset; int mock_pe_message_received; int mock_got_soft_reset; + int mock_message_discard; } pd_port[CONFIG_USB_PD_PORT_MAX_COUNT]; static void init_port(int port, int rev) @@ -744,6 +745,11 @@ void pe_report_error(int port, enum pe_error e, enum tcpm_transmit_type type) pd_port[port].sop = type; } +void pe_report_discard(int port) +{ + pd_port[port].mock_message_discard = 1; +} + void pe_got_hard_reset(int port) { pd_port[port].mock_pe_got_hard_reset = 1; @@ -1353,6 +1359,7 @@ void before_test(void) pd_port[PORT0].mock_pe_message_sent = 0; pd_port[PORT0].mock_pe_error = -1; + pd_port[PORT0].mock_message_discard = 0; pd_port[PORT0].mock_pe_hard_reset_sent = 0; pd_port[PORT0].mock_pe_got_hard_reset = 0; pd_port[PORT0].mock_pe_message_received = 0; |