summaryrefslogtreecommitdiff
path: root/util/genvif.c
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2020-11-30 15:30:37 -0700
committerCommit Bot <commit-bot@chromium.org>2020-12-02 13:35:35 +0000
commit00932fb7457c2e2a136f8de9281ae419b071ec13 (patch)
treed9dc83f7bb805de30e3c68cd65e5ea7018c3346e /util/genvif.c
parentd29bdc99139095127efa9a45c12164bb8e0e07e5 (diff)
downloadchrome-ec-00932fb7457c2e2a136f8de9281ae419b071ec13.tar.gz
genvif: add more Component SOP_Discovery fields
BUG=b:172293518 BRANCH=none TEST=verify XML output Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I6deeecc36505eb4f7261d04eae2c9ff419fa0296 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2567171 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'util/genvif.c')
-rw-r--r--util/genvif.c55
1 files changed, 50 insertions, 5 deletions
diff --git a/util/genvif.c b/util/genvif.c
index 41121044a4..7f21551a4f 100644
--- a/util/genvif.c
+++ b/util/genvif.c
@@ -31,6 +31,7 @@
#define DEFAULT_MISSING_TID 0xFFFF
#define DEFAULT_MISSING_PID 0xFFFF
+#define DEFAULT_MISSING_BCD_DEV 0x0000
const uint32_t *src_pdo;
uint32_t src_pdo_cnt;
@@ -3454,14 +3455,9 @@ static void init_vif_component_pd_dual_role_fields(
* Fields that are not currently being initialized
*
* vif_Component
- * Data_Capable_As_USB_Host_SOP booleanFieldType
- * Data_Capable_As_USB_Device_SOP booleanFieldType
* Product_Type_UFP_SOP numericFieldType
* Product_Type_DFP_SOP numericFieldType
- * DFP_VDO_Port_Number numericFieldType
* Modal_Operation_Supported_SOP booleanFieldType
- * USB_VID_SOP numericFieldType
- * bcdDevice_SOP numericFieldType
* Num_SVIDs_Min_SOP numericFieldType
* Num_SVIDs_Max_SOP numericFieldType
* SVID_Fixed_SOP booleanFieldType
@@ -3471,11 +3467,48 @@ static void init_vif_component_sop_discovery_fields(
{
char hex_str[10];
+ /*
+ * The fields in this section shall be ignored by Testers unless at
+ * least one of Responds_To_Discov_SOP_UFP and
+ * Responds_To_Discov_SOP_DFP is set to YES.
+ */
+ if (!does_respond_to_discov_sop_ufp() &&
+ !does_respond_to_discov_sop_dfp())
+ return;
+
set_vif_field(&vif_fields[XID_SOP],
vif_component_name[XID_SOP],
"0",
NULL);
+ set_vif_field_b(&vif_fields[Data_Capable_As_USB_Host_SOP],
+ vif_component_name[Data_Capable_As_USB_Host_SOP],
+ can_act_as_host());
+
+ set_vif_field_b(&vif_fields[Data_Capable_As_USB_Device_SOP],
+ vif_component_name[Data_Capable_As_USB_Device_SOP],
+ can_act_as_device());
+
+ if (does_respond_to_discov_sop_dfp() &&
+ is_usb4_supported()) {
+#if defined(CONFIG_USB_PD_PORT_LABEL)
+ set_vif_field_stis(&vif_fields[DFP_VDO_Port_Number],
+ vif_component_name[DFP_VDO_Port_Number],
+ NULL,
+ CONFIG_USB_PD_PORT_LABEL);
+#else
+ set_vif_field_stis(&vif_fields[DFP_VDO_Port_Number],
+ vif_component_name[DFP_VDO_Port_Number],
+ NULL,
+ component_index);
+#endif
+ }
+
+ sprintf(hex_str, "%04X", USB_VID_GOOGLE);
+ set_vif_field_itss(&vif_fields[USB_VID_SOP],
+ vif_product_name[USB_VID_SOP],
+ USB_VID_GOOGLE, hex_str);
+
#if defined(CONFIG_USB_PID)
sprintf(hex_str, "%04X", CONFIG_USB_PID);
set_vif_field_itss(&vif_fields[PID_SOP],
@@ -3487,6 +3520,18 @@ static void init_vif_component_sop_discovery_fields(
vif_component_name[PID_SOP],
DEFAULT_MISSING_PID, hex_str);
#endif
+
+ #if defined(CONFIG_USB_BCD_DEV)
+ sprintf(hex_str, "%04X", CONFIG_USB_BCD_DEV);
+ set_vif_field_itss(&vif_fields[bcdDevice_SOP],
+ vif_component_name[bcdDevice_SOP],
+ CONFIG_USB_BCD_DEV, hex_str);
+ #else
+ sprintf(hex_str, "%04X", DEFAULT_MISSING_BCD_DEV);
+ set_vif_field_itss(&vif_fields[bcdDevice_SOP],
+ vif_component_name[bcdDevice_SOP],
+ DEFAULT_MISSING_BCD_DEV, hex_str);
+ #endif
}
/*********************************************************************