diff options
author | Denis Brockus <dbrockus@google.com> | 2020-12-16 17:01:27 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-17 19:15:00 +0000 |
commit | ca428f8a39ebf54a53d33a566d72270f7dc58b3e (patch) | |
tree | d88f487c519404b001ef522677cbde01aa3641d2 /util | |
parent | 81ae77c3267fa6fed8fe392b12159d7bbebed0f2 (diff) | |
download | chrome-ec-ca428f8a39ebf54a53d33a566d72270f7dc58b3e.tar.gz |
genvif: cleanup for Supports_USB_Data
BUG=b:149852735
BRANCH=none
TEST=verify XML output
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: I982dce6ecaa8cd5db7cfb15a70c7e30813dfb190
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2596837
Tested-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/genvif.c | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/util/genvif.c b/util/genvif.c index 365308dddf..c36fcfa25b 100644 --- a/util/genvif.c +++ b/util/genvif.c @@ -702,6 +702,29 @@ static bool does_respond_to_discov_sop_dfp(void) IS_ENABLED(CONFIG_USB_PD_TBT_COMPAT_MODE))); } +static bool does_support_device_usb_data(void) +{ + return get_vif_bool(&vif.Component[component_index] + .vif_field[Device_Supports_USB_Data], + (is_usb4_supported() || + can_act_as_device())); +} + +static bool does_support_host_usb_data(void) +{ + int type_c_state_machine; + + if (!get_vif_field_tag_number( + &vif.Component[component_index] + .vif_field[Type_C_State_Machine], + &type_c_state_machine)) + return false; + + return get_vif_bool(&vif.Component[component_index] + .vif_field[Host_Supports_USB_Data], + can_act_as_host()); +} + static void init_src_pdos(void) { if (IS_ENABLED(CONFIG_USB_PD_DYNAMIC_SRC_CAP)) { @@ -3143,15 +3166,11 @@ static void init_vif_component_usb_data_ufp_fields( if (!can_act_as_device()) return; + supports_usb_data = does_support_device_usb_data(); set_vif_field_b( &vif_fields[Device_Supports_USB_Data], vif_component_name[Device_Supports_USB_Data], - true); - - if (!get_vif_field_tag_bool( - &vif_fields[Device_Supports_USB_Data], - &supports_usb_data)) - supports_usb_data = false; + supports_usb_data); if (supports_usb_data) { switch (ds) { @@ -3193,8 +3212,6 @@ static void init_vif_component_usb_data_ufp_fields( * Fields that are not currently being initialized * * vif_Component - * Host_Supports_USB_Data booleanFieldType - * Is_DFP_On_Hub booleanFieldType * Hub_Port_Number numericFieldType * Host_Truncates_DP_For_tDHPResponse booleanFieldType * Host_Gen1x1_tLinkTurnaround numericFieldType @@ -3209,11 +3226,24 @@ static void init_vif_component_usb_data_dfp_fields( */ enum usb_speed ds = USB_GEN11; bool supports_usb_data; + bool is_dfp_on_hub; - if (!get_vif_field_tag_bool( - &vif_fields[Host_Supports_USB_Data], - &supports_usb_data)) - supports_usb_data = false; + /* + * The fields in this section shall be ignored by Testers unless + * Connector_Type is set to 0 (Type-A), or + * COnnector Type is set to 3 (Micro A/B); or + * Connector_Type is set to 2 (Type-C) and Type_C_Can_Act_As_Host + * is set to YES + * + * NOTE: We currently are always a Connector_Type of 2 (Type-C) + */ + if (!can_act_as_host()) + return; + + supports_usb_data = does_support_host_usb_data(); + set_vif_field_b(&vif_fields[Host_Supports_USB_Data], + vif_component_name[Host_Supports_USB_Data], + supports_usb_data); if (supports_usb_data) { switch (ds) { @@ -3244,6 +3274,15 @@ static void init_vif_component_usb_data_dfp_fields( break; } + if (!get_vif_field_tag_bool( + &vif_fields[Type_C_Port_On_Hub], + &is_dfp_on_hub)) + is_dfp_on_hub = false; + + set_vif_field_b(&vif_fields[Is_DFP_On_Hub], + vif_component_name[Is_DFP_On_Hub], + is_dfp_on_hub); + set_vif_field_b(&vif_fields[Host_Contains_Captive_Retimer], vif_component_name[Host_Contains_Captive_Retimer], false); |