diff options
author | Abe Levkoy <alevkoy@chromium.org> | 2020-07-23 18:59:29 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-29 03:33:59 +0000 |
commit | 95aeff804bfa2269f7aab45df2342f242fabc51d (patch) | |
tree | 1e8a50000d325e6b7528c386bcc5a49d561baa6d /common | |
parent | 3e09f177ef5021fe36b5306122439eed42fc059a (diff) | |
download | chrome-ec-95aeff804bfa2269f7aab45df2342f242fabc51d.tar.gz |
TCPMv2: Use named constants for extended messages
These correspond to MaxExtendedMsgLen and MaxExtendedMsgChunkLen
(PD 3.0, rev 2.0, ss 6.13).
BUG=b:160374787
TEST=make buildall
BRANCH=none
Signed-off-by: Abe Levkoy <alevkoy@chromium.org>
Change-Id: I3640df18724c3c04e9f644ca59a6542563d723f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2316135
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 2 | ||||
-rw-r--r-- | common/usbc/usb_prl_sm.c | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index 4c662278c6..5a8cc632a8 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -1942,7 +1942,7 @@ static void extended_message_not_supported(int port, uint32_t *payload) !IS_ENABLED(CONFIG_USB_PD_EXTENDED_MESSAGES) && PD_EXT_HEADER_CHUNKED(ext_header) && PD_EXT_HEADER_DATA_SIZE(ext_header) > - PD_MAX_EXTENDED_MESSAGE_CHUNK_LEN) { + PD_MAX_EXTENDED_MSG_CHUNK_LEN) { set_state_pe(port, pe[port].power_role == PD_ROLE_SOURCE ? PE_SRC_CHUNK_RECEIVED : PE_SNK_CHUNK_RECEIVED); diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c index 179481a774..269799c5eb 100644 --- a/common/usbc/usb_prl_sm.c +++ b/common/usbc/usb_prl_sm.c @@ -1013,8 +1013,9 @@ static void prl_tx_wait_for_phy_response_run(const int port) #ifdef CONFIG_USB_PD_EXTENDED_MESSAGES pd3_retry_check = (pdmsg[port].ext && - PD_EXT_HEADER_DATA_SIZE(GET_EXT_HEADER( - pdmsg[port].tx_chk_buf[0]) > 26)); + PD_EXT_HEADER_DATA_SIZE(GET_EXT_HEADER( + pdmsg[port].tx_chk_buf[0]) > + PD_MAX_EXTENDED_MSG_CHUNK_LEN)); #else pd3_retry_check = 0; #endif /* CONFIG_USB_PD_EXTENDED_MESSAGES */ @@ -1441,8 +1442,8 @@ static void rch_processing_extended_message_run(const int port) else if (chunk_num == pdmsg[port].chunk_number_expected) { byte_num = data_size - pdmsg[port].num_bytes_received; - if (byte_num > 25) - byte_num = 26; + if (byte_num >= PD_MAX_EXTENDED_MSG_CHUNK_LEN) + byte_num = PD_MAX_EXTENDED_MSG_CHUNK_LEN; /* Make sure extended message buffer does not overflow */ if (pdmsg[port].num_bytes_received + @@ -1750,8 +1751,8 @@ static void tch_construct_chunked_message_entry(const int port) data = ((uint8_t *)pdmsg[port].tx_chk_buf + 2); num = tx_emsg[port].len - pdmsg[port].send_offset; - if (num > 26) - num = 26; + if (num > PD_MAX_EXTENDED_MSG_CHUNK_LEN) + num = PD_MAX_EXTENDED_MSG_CHUNK_LEN; /* Set the chunks extended header */ *ext_hdr = PD_EXT_HEADER(pdmsg[port].chunk_number_to_send, |