summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2022-01-22 13:44:15 -0700
committerCommit Bot <commit-bot@chromium.org>2022-02-09 01:23:46 +0000
commita6d42dced51b81293ed28085e1b618ca7b736999 (patch)
tree6ee0e19b3a2a3d932446808d1c2661b05658211f
parent4797911678800b2192b2ce73415f1b477cc1d8ad (diff)
downloadchrome-ec-a6d42dced51b81293ed28085e1b618ca7b736999.tar.gz
Volteer: Add TBT UFP board policy
Add policy tracking to the volteer baseboard for whether TBT UFP mode entry has been enabled. BRANCH=None BUG=b:213024508 TEST=on volteer, confirm we NAK UFP mode entry until explicitly allowed by the AP, and then NAK again when disallowed Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: If3df72f090d35152cf4d44b121919eadad7fe603 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3411535 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--baseboard/volteer/usb_pd_policy.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/baseboard/volteer/usb_pd_policy.c b/baseboard/volteer/usb_pd_policy.c
index f939998b3d..c806548052 100644
--- a/baseboard/volteer/usb_pd_policy.c
+++ b/baseboard/volteer/usb_pd_policy.c
@@ -160,6 +160,23 @@ static int svdm_tbt_compat_response_modes(int port, uint32_t *payload)
}
}
+/* Track whether we've been enabled to ACK TBT EnterModes requests */
+static bool tbt_ufp_ack_allowed[CONFIG_USB_PD_PORT_MAX_COUNT];
+
+__override enum ec_status board_set_tbt_ufp_reply(int port,
+ enum typec_tbt_ufp_reply reply)
+{
+ /* Note: Host command has already bounds-checked port */
+ if (reply == TYPEC_TBT_UFP_REPLY_ACK)
+ tbt_ufp_ack_allowed[port] = true;
+ else if (reply == TYPEC_TBT_UFP_REPLY_NAK)
+ tbt_ufp_ack_allowed[port] = false;
+ else
+ return EC_RES_INVALID_PARAM;
+
+ return EC_RES_SUCCESS;
+}
+
static int svdm_tbt_compat_response_enter_mode(
int port, uint32_t *payload)
{
@@ -169,6 +186,10 @@ static int svdm_tbt_compat_response_enter_mode(
if (chipset_in_or_transitioning_to_state(CHIPSET_STATE_ANY_OFF))
return 0; /* NAK */
+ /* Do not enter mode while policy disallows it */
+ if (!tbt_ufp_ack_allowed[port])
+ return 0; /* NAK */
+
if ((PD_VDO_VID(payload[0]) != USB_VID_INTEL) ||
(PD_VDO_OPOS(payload[0]) != OPOS_TBT))
return 0; /* NAK */