diff options
author | Denis Brockus <dbrockus@chromium.org> | 2019-08-27 07:35:18 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-09-19 17:16:21 +0000 |
commit | 4be44b7a0b036e6a27d4588f71761cd499e56e4e (patch) | |
tree | 06d99ba0035528e513f29d08889225913f4f8793 /common | |
parent | 6f5e3d2a11dcc0884581fd5f90f992b413858cec (diff) | |
download | chrome-ec-4be44b7a0b036e6a27d4588f71761cd499e56e4e.tar.gz |
pd: RCH_Processing_Extended_Message cleanup
Change first chunk processing to be handled embedded in
RCH_Wait_For_Message_From_Protocol_Layer run to get the
actual first chunk and don't rely on the chunk headers
to indicate the first chunk
BUG=none
BRANCH=none
TEST=make buildall -j
Change-Id: Iadb606dfaca7b3f4d3ff6528dcfbd3e6aad196a4
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1773118
Diffstat (limited to 'common')
-rw-r--r-- | common/usbc/usb_prl_sm.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c index 74c041d680..30401aeb27 100644 --- a/common/usbc/usb_prl_sm.c +++ b/common/usbc/usb_prl_sm.c @@ -935,6 +935,19 @@ static void rch_wait_for_message_from_protocol_layer_run(const int port) */ if ((RCH_CHK_FLAG(port, PRL_FLAGS_CHUNKING)) && chunked) { + /* + * RCH_Processing_Extended_Message first chunk + * entry processing embedded here + * + * This is the first chunk: + * Set Chunk_number_expected = 0 and + * Num_Bytes_Received = 0 + */ + pdmsg[port].chunk_number_expected = 0; + pdmsg[port].num_bytes_received = 0; + pdmsg[port].msg_type = + PD_HEADER_TYPE(emsg[port].header); + set_state_rch(port, RCH_PROCESSING_EXTENDED_MESSAGE); } @@ -986,24 +999,6 @@ static void rch_pass_up_message_entry(const int port) /* * RchProcessingExtendedMessage */ -static void rch_processing_extended_message_entry(const int port) -{ - uint32_t header = emsg[port].header; - uint16_t exhdr = GET_EXT_HEADER(pdmsg[port].chk_buf[0]); - uint8_t chunk_num = PD_EXT_HEADER_CHUNK_NUM(exhdr); - - /* - * If first chunk: - * Set Chunk_number_expected = 0 and - * Num_Bytes_Received = 0 - */ - if (chunk_num == 0) { - pdmsg[port].chunk_number_expected = 0; - pdmsg[port].num_bytes_received = 0; - pdmsg[port].msg_type = PD_HEADER_TYPE(header); - } -} - static void rch_processing_extended_message_run(const int port) { uint16_t exhdr = GET_EXT_HEADER(pdmsg[port].chk_buf[0]); @@ -1649,7 +1644,6 @@ static const struct usb_state rch_states[] = { .entry = rch_pass_up_message_entry, }, [RCH_PROCESSING_EXTENDED_MESSAGE] = { - .entry = rch_processing_extended_message_entry, .run = rch_processing_extended_message_run, }, [RCH_REQUESTING_CHUNK] = { |