summaryrefslogtreecommitdiff
path: root/util/genvif.c
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2020-11-18 09:42:54 -0700
committerCommit Bot <commit-bot@chromium.org>2020-11-19 18:34:22 +0000
commitaf96e7ad7909c10698dee7d64e69695bffa49d14 (patch)
treea189452a090a30835cde6167364eed41ab99cfcf /util/genvif.c
parent0e743f41d2bbd217dc5ac996921b063dafccb3cc (diff)
downloadchrome-ec-af96e7ad7909c10698dee7d64e69695bffa49d14.tar.gz
genvif: USB4_Router_Index
set to the index of the Component if USB4_Supported is true BUG=b:172417427 BRANCH=none TEST=verify XML output Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Id99f9bff22dae82282aed5622b6b1041e13934a3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2546987 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/genvif.c')
-rw-r--r--util/genvif.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/util/genvif.c b/util/genvif.c
index 327f92bda5..182fe09c5b 100644
--- a/util/genvif.c
+++ b/util/genvif.c
@@ -639,6 +639,19 @@ static bool can_act_as_host(void)
IS_ENABLED(CONFIG_USB_VPD)));
}
+static bool is_usb4_supported(void)
+{
+ bool usb4_supported;
+
+ if (!get_vif_field_tag_bool(
+ &vif.Component[component_index]
+ .vif_field[USB4_Supported],
+ &usb4_supported))
+ usb4_supported = IS_ENABLED(CONFIG_USB_PD_USB4);
+
+ return usb4_supported;
+}
+
static void init_src_pdos(void)
{
if (IS_ENABLED(CONFIG_USB_PD_DYNAMIC_SRC_CAP)) {
@@ -2513,9 +2526,28 @@ static void init_vif_component_fields(struct vif_field_t *vif_fields,
"2",
"Type-C®");
- set_vif_field_b(&vif_fields[USB4_Supported],
- vif_component_name[USB4_Supported],
- IS_ENABLED(CONFIG_USB_PD_USB4));
+ if (is_usb4_supported()) {
+ int router_index;
+
+ set_vif_field_b(&vif_fields[USB4_Supported],
+ vif_component_name[USB4_Supported],
+ true);
+
+ if (!get_vif_field_tag_number(
+ &vif.Product.USB4RouterList[0]
+ .vif_field[USB4_Router_ID],
+ &router_index)) {
+ router_index = 0;
+ }
+ set_vif_field_itss(&vif_fields[USB4_Router_Index],
+ vif_component_name[USB4_Router_Index],
+ router_index,
+ NULL);
+ } else {
+ set_vif_field_b(&vif_fields[USB4_Supported],
+ vif_component_name[USB4_Supported],
+ false);
+ }
set_vif_field_b(&vif_fields[USB_PD_Support],
vif_component_name[USB_PD_Support],