drivers/ec/vboot_aux_fw: Remove tunnel protect_status operation

TCPC FW update is performed immediately after checking the need for FW
update. Remote bus tunnel protection status is checked at both times and
is redundant. Remove the redundant protect_status operation and invoke
it directly just before applying the FW update.

BUG=b:128820536,b:119046668
BRANCH=None
TEST=Boot to ChromeOS.

Change-Id: Id3dd54ab1463a9db69cf3887a11d5f457311ff23
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1625867
Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Commit-Ready: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
diff --git a/src/drivers/ec/anx3429/anx3429.c b/src/drivers/ec/anx3429/anx3429.c
index 4017027..6387e8e 100644
--- a/src/drivers/ec/anx3429/anx3429.c
+++ b/src/drivers/ec/anx3429/anx3429.c
@@ -1211,7 +1211,6 @@
 	.fw_hash_name = "anx3429_ocm.hash",
 	.check_hash = anx3429_check_hash,
 	.update_image = anx3429_update_image,
-	.protect_status = anx3429_ec_tunnel_status,
 };
 
 Anx3429 *new_anx3429(CrosECTunnelI2c *bus, int ec_pd_id)
diff --git a/src/drivers/ec/ps8751/ps8751.c b/src/drivers/ec/ps8751/ps8751.c
index ec54f6e..86099a2 100644
--- a/src/drivers/ec/ps8751/ps8751.c
+++ b/src/drivers/ec/ps8751/ps8751.c
@@ -1339,7 +1339,6 @@
 	.fw_hash_name = "ps8751_a3.hash",
 	.check_hash = ps8751_check_hash,
 	.update_image = ps8751_update_image,
-	.protect_status = ps8751_ec_tunnel_status,
 };
 
 static const VbootAuxFwOps ps8751_fw_canary_ops = {
@@ -1347,7 +1346,6 @@
 	.fw_hash_name = "ps8751_a3_canary.hash",
 	.check_hash = ps8751_check_hash,
 	.update_image = ps8751_update_image,
-	.protect_status = ps8751_ec_tunnel_status,
 };
 
 static const VbootAuxFwOps ps8805_fw_ops = {
@@ -1355,7 +1353,6 @@
 	.fw_hash_name = "ps8805_a2.hash",
 	.check_hash = ps8751_check_hash,
 	.update_image = ps8751_update_image,
-	.protect_status = ps8751_ec_tunnel_status,
 };
 
 Ps8751 *new_ps8751(CrosECTunnelI2c *bus, int ec_pd_id)
diff --git a/src/drivers/ec/vboot_aux_fw.c b/src/drivers/ec/vboot_aux_fw.c
index d1cd02a..73cb63b 100644
--- a/src/drivers/ec/vboot_aux_fw.c
+++ b/src/drivers/ec/vboot_aux_fw.c
@@ -90,7 +90,6 @@
 	max = VB_AUX_FW_NO_DEVICE;
 	for (int i = 0; i < vboot_aux_fw_count; ++i) {
 		const VbootAuxFwOps *const aux_fw = vboot_aux_fw[i].fw_ops;
-		int protect_status;
 
 		status = check_dev_fw_hash(aux_fw, &current);
 		if (status != VBERROR_SUCCESS)
@@ -98,21 +97,6 @@
 
 		vboot_aux_fw[i].severity = current;
 		max = MAX(max, current);
-
-		if (current == VB_AUX_FW_NO_DEVICE ||
-				current == VB_AUX_FW_NO_UPDATE)
-			continue;
-
-		status = aux_fw->protect_status(aux_fw, &protect_status);
-		if (status != VBERROR_SUCCESS)
-			return status;
-
-		/*
-		 * If we have an update but the tunnel is already protected,
-		 * try to reboot earlier instead of when we apply the update.
-		 */
-		if (protect_status)
-			return VBERROR_EC_REBOOT_TO_RO_REQUIRED;
 	}
 
 	*severity = max;
diff --git a/src/drivers/ec/vboot_aux_fw.h b/src/drivers/ec/vboot_aux_fw.h
index c93eb06..dba0e11 100644
--- a/src/drivers/ec/vboot_aux_fw.h
+++ b/src/drivers/ec/vboot_aux_fw.h
@@ -32,8 +32,6 @@
 	 */
 	VbError_t (*update_image)(const VbootAuxFwOps *me,
 				  const uint8_t *image, size_t image_size);
-	VbError_t (*protect_status)(const VbootAuxFwOps *me,
-				    int *protect_status);
 	const char *fw_image_name;
 	const char *fw_hash_name;
 };
diff --git a/src/drivers/ec/wilco/pd.c b/src/drivers/ec/wilco/pd.c
index c57f05d..0d8c17d 100644
--- a/src/drivers/ec/wilco/pd.c
+++ b/src/drivers/ec/wilco/pd.c
@@ -250,14 +250,6 @@
 	return VBERROR_SUCCESS;
 }
 
-static VbError_t wilco_pd_protect_status(const VbootAuxFwOps *vbaux,
-					 int *protected)
-{
-	WilcoPd *pd = container_of(vbaux, WilcoPd, ops);
-	*protected = pd->protected;
-	return VBERROR_SUCCESS;
-}
-
 WilcoPd *new_wilco_pd(WilcoEc *ec, WilcoPdFlashInfo *info,
 		      const char *fw_image_name, const char *fw_hash_name)
 {
@@ -265,7 +257,6 @@
 
 	pd->ec = ec;
 
-	pd->ops.protect_status = &wilco_pd_protect_status;
 	pd->ops.update_image = &wilco_pd_update_image;
 	pd->ops.check_hash = &wilco_pd_check_hash;
 	pd->ops.fw_image_name = fw_image_name;
diff --git a/src/drivers/ec/wilco/pd.h b/src/drivers/ec/wilco/pd.h
index 31315a2..ea2c0f4 100644
--- a/src/drivers/ec/wilco/pd.h
+++ b/src/drivers/ec/wilco/pd.h
@@ -36,14 +36,12 @@
  * @ec: Handle for Wilco EC.
  * @ops: Handle for Verified Boot AUX firmware update callbacks.
  * @info: PD controller information &WilcoPdFlashInfo
- * @protected: Flag to indicate PD protect function has been called.
  */
 typedef struct WilcoPd
 {
 	WilcoEc *ec;
 	VbootAuxFwOps ops;
 	WilcoPdFlashInfo *info;
-	int protected;
 } WilcoPd;
 
 /**