diff options
author | Patryk Duda <pdk@semihalf.com> | 2020-06-05 16:28:10 +0200 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-10 16:11:50 +0000 |
commit | 98a9dd65547d2ef636b58bd48bd316a3a72edd7e (patch) | |
tree | 040ef337919da0bcfb7e2684cc5528e23b31b840 | |
parent | 68840c4e35af5b4f1e62c92b4f603b91b3422e48 (diff) | |
download | chrome-ec-98a9dd65547d2ef636b58bd48bd316a3a72edd7e.tar.gz |
usb_pd_protocol: Invalidate last message id in SRC_SWAP_STANDBY state
In SRC_SWAP_STANDBY state when PD_CTRL_PS_RDY message is received,
message id counter is cleared, but last message id remain the same.
Situation where last message before power swap had message id
equal to 0, and first message after power swap had message id
equal to 0, was reported as message duplication and as result
hard reset was triggered.
From ServoV4 perspective:
C1 RECV 0e6a/0 <-- Received PR_SWAP with msg_id 7
C1 CTRL[3]>1 <-- Accept it
C1 st27 SRC_SWAP_SNK_DISABLE
C1 st28 SRC_SWAP_SRC_DISABLE
C1 st29 SRC_SWAP_STANDBY
C1 CTRL[6]>1 <-- Send PS_RDY
C1 RECV 0166/0 <-- Received PS_RDY with msg_id 0
due to msg_id overflow
C1 st5 SNK_DISCOVERY
C1 Repeat msg_id 0 <-- DUT sent capabilities with
msg_id 0
C1 HARD RST RX <-- DUT sent hard reset due to
timeout
BUG=none
BRANCH=none
TEST=Flash nocturne with EC compiled with TCPMv2/PD3.0 support.
Flash ServoV4 with this fix.
Run firmware_PDConnect, test should pass.
During test check if ServoV4 is not receiving hard reset requests.
TEST=Flash nocturne with EC compiled with TCPMv2/PD3.0 support.
Flash ServoV4 with this fix.
Run 'fakedisconnect 100 10000' in ServoV4 console.
Run 'pd 0 swap power' in DUT console.
During power swap no hard reset states should be entered.
Change-Id: I902d153a4f427c6a7239f8ff8b70efc9418da31a
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2231365
Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit 9f95ab8d1655d141dcceec18d6730c9d6451e4a9)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2238287
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 8d58861fa8..973a8240dc 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -1832,6 +1832,7 @@ static void handle_ctrl_request(int port, uint16_t head, } else if (pd[port].task_state == PD_STATE_SRC_SWAP_STANDBY) { /* reset message ID and swap roles */ pd[port].msg_id = 0; + invalidate_last_message_id(port); pd_set_power_role(port, PD_ROLE_SINK); pd_update_roles(port); /* |