diff options
author | Diana Z <dzigterman@chromium.org> | 2020-04-13 22:00:34 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-21 07:17:05 +0000 |
commit | bea99fdf5db6f7901bbfa7b5d467b0d13d06fc80 (patch) | |
tree | 7aae542f7f148c0556757613c8ebe7a0ff58a794 /common/usb_pd_console_cmd.c | |
parent | 82065675d1a81520fe093db90257889711780911 (diff) | |
download | chrome-ec-bea99fdf5db6f7901bbfa7b5d467b0d13d06fc80.tar.gz |
PD: Store cable identity in pd_discovery structure
Stores SOP' cable response in pd_discovery identity array.
BRANCH=None
BUG=b:152417977
TEST=on kindred with TCPMv2, ensure "pe" command shows correct
information for cable and port partner
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Ia1186e25b92d9ae4f34e8c039b2ad1d1abbff9eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2148426
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'common/usb_pd_console_cmd.c')
-rw-r--r-- | common/usb_pd_console_cmd.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/common/usb_pd_console_cmd.c b/common/usb_pd_console_cmd.c index d0ec5b3055..cbef79a1f1 100644 --- a/common/usb_pd_console_cmd.c +++ b/common/usb_pd_console_cmd.c @@ -17,32 +17,37 @@ static void dump_pe(int port) struct svdm_amode_data *modep; uint32_t mode_caps; struct pd_discovery *disc = pd_get_am_discovery(port); - const union disc_ident_ack *resp = pd_get_identity_response(port, - TCPC_TX_SOP); + const union disc_ident_ack *resp; + enum tcpm_transmit_type type; - const char * const idh_ptype_names[] = { + static const char * const idh_ptype_names[] = { "UNDEF", "Hub", "Periph", "PCable", "ACable", "AMA", "RSV6", "RSV7"}; + static const char * const tx_names[] = {"SOP", "SOP'", "SOP''"}; + + for (type = TCPC_TX_SOP; type < DISCOVERY_TYPE_COUNT; type++) { + resp = pd_get_identity_response(port, type); + if (pd_get_identity_discovery(port, type) != PD_DISC_COMPLETE) { + ccprintf("No %s identity discovered yet.\n", + tx_names[type]); + continue; + } - if (pd_get_identity_discovery(port, TCPC_TX_SOP) != PD_DISC_COMPLETE) { - ccprintf("No identity discovered yet.\n"); - return; - } - - idh_ptype = pd_get_product_type(port); - ccprintf("IDENT:\n"); - ccprintf("\t[ID Header] %08x :: %s, VID:%04x\n", - resp->raw_value[0], - idh_ptype_names[idh_ptype], - pd_get_identity_vid(port)); - - ccprintf("\t[Cert Stat] %08x\n", resp->cert.xid); - for (i = 2; i < ARRAY_SIZE(resp->raw_value); i++) { - ccprintf("\t"); - if (resp->raw_value[i]) - ccprintf("[%d] %08x ", i, resp->raw_value[i]); + idh_ptype = resp->idh.product_type; + ccprintf("IDENT %s:\n", tx_names[type]); + ccprintf("\t[ID Header] %08x :: %s, VID:%04x\n", + resp->raw_value[0], + idh_ptype_names[idh_ptype], + resp->idh.usb_vendor_id); + + ccprintf("\t[Cert Stat] %08x\n", resp->cert.xid); + for (i = 2; i < ARRAY_SIZE(resp->raw_value); i++) { + ccprintf("\t"); + if (resp->raw_value[i]) + ccprintf("[%d] %08x ", i, resp->raw_value[i]); + } + ccprintf("\n"); } - ccprintf("\n"); if (disc->svid_cnt < 1) { ccprintf("No SVIDS discovered yet.\n"); |