diff options
author | Diana Z <dzigterman@chromium.org> | 2022-10-20 11:47:18 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-10-28 23:17:34 +0000 |
commit | 1e0abfa71e84e6f870d986088e7ce4fb7ead8395 (patch) | |
tree | 0b47213c24e8629c190f72fb770cfd0637e101a6 /util | |
parent | df6a10d22b520a3c89e29e533f147d513df1611c (diff) | |
download | chrome-ec-1e0abfa71e84e6f870d986088e7ce4fb7ead8395.tar.gz |
TCPMv2: Add host command to send VDM REQ messages
Add an option for the AP to send us VDM REQ messages to pass on to the
port partner or cable. This is the first of a series of commits, and
later ones will add the transmission of replies to the AP as well as the
underlying EC actions that still need to take place (ex. storing active
modes and such).
LOW_COVERAGE_REASON=Zoss incorrectly marks variable declarations as
uncovered
BRANCH=None
BUG=b:208884535
TEST=./twister -T ./zephyr/test, load on Skyrim and verify messages are
sent as directed to partner and cable with TotalPhase
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I205eaa73e7b4b7aa64c1168ef1d8505f1781a1cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3969859
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/ectool.cc | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/util/ectool.cc b/util/ectool.cc index 61c0e85301..0b3ee18791 100644 --- a/util/ectool.cc +++ b/util/ectool.cc @@ -10149,7 +10149,10 @@ int cmd_typec_control(int argc, char *argv[]) " <mux_mode> is one of: dp, dock, usb, tbt,\n" " usb4, none, safe\n" " 5: Enable bist share mode\n" - " args: <0: DISABLE, 1: ENABLE>\n", + " args: <0: DISABLE, 1: ENABLE>\n" + " 6: Send VDM REQ\n" + " args: <tx_type vdm_hdr [vdo...]>\n" + " <tx_type> is 0 - SOP, 1 - SOP', 2 - SOP''\n", argv[0]); return -1; } @@ -10253,6 +10256,35 @@ int cmd_typec_control(int argc, char *argv[]) } p.bist_share_mode = conversion_result; break; + case TYPEC_CONTROL_COMMAND_SEND_VDM_REQ: + if (argc < 5) { + fprintf(stderr, "Missing VDM header and type\n"); + return -1; + } + if (argc > 4 + VDO_MAX_SIZE) { + fprintf(stderr, "Too many VDOs\n"); + return -1; + } + + conversion_result = strtol(argv[3], &endptr, 0); + if ((endptr && *endptr) || conversion_result > UINT8_MAX || + conversion_result < 0) { + fprintf(stderr, "Bad SOP* type\n"); + return -1; + } + p.vdm_req_params.partner_type = conversion_result; + + int vdm_index; + for (vdm_index = 0; vdm_index < argc - 4; vdm_index++) { + uint32_t vdm_entry = + strtoul(argv[vdm_index + 4], &endptr, 0); + if (endptr && *endptr) { + fprintf(stderr, "Bad VDO\n"); + return -1; + } + p.vdm_req_params.vdm_data[vdm_index] = vdm_entry; + } + p.vdm_req_params.vdm_data_objects = vdm_index; } rv = ec_command(EC_CMD_TYPEC_CONTROL, 0, &p, sizeof(p), ec_inbuf, |