firmware: Remove deprecated SW_WP_ENABLED flag

This was deprecated months ago in crossystem, and isn't set by
depthcharge or coreboot.  Remove the flag from vboot as well, keeping
only a reminder in vboot_struct.h so we don't reuse the VbSharedData
bit.

BUG=chromium:742685
BRANCH=none
TEST=make runtests

Change-Id: Ifa928e8ec4d999c524c6f4168695859261f384c9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/947256
Reviewed-by: Julius Werner <jwerner@chromium.org>
(cherry picked from commit 7bb45097af1e8b5f2bcf8e7a8bc6557c6505693b)
Reviewed-on: https://chromium-review.googlesource.com/949621
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Trybot-Ready: Furquan Shaikh <furquan@chromium.org>
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 97b5cca..1e6fada 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -158,12 +158,6 @@
 	 * software sync.
 	 */
 	VB2_CONTEXT_EC_EFS = (1 << 17),
-
-	/*
-	 * Software write protect for the RO firmware was enabled at boot.
-	 * Caller may set this flag when initializing the context.
-	 */
-	VB2_CONTEXT_SW_WP_ENABLED = (1 << 18),
 };
 
 /*
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index 9f2901a..5135173 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -235,11 +235,6 @@
 /* EC on this platform is slow to update. */
 #define VB_INIT_FLAG_EC_SLOW_UPDATE      0x00000400
 /*
- * Software write protect was enabled at boot time. This is separate from the
- * HW write protect. Both must be set for flash write protection to work.
- */
-#define VB_INIT_FLAG_SW_WP_ENABLED       0x00000800
-/*
  * This platform does not have a physical recovery switch which, when present,
  * can (and should) be used for additional physical presence checks.
  */
diff --git a/firmware/include/vboot_struct.h b/firmware/include/vboot_struct.h
index 3f0d888..6036dc8 100644
--- a/firmware/include/vboot_struct.h
+++ b/firmware/include/vboot_struct.h
@@ -229,8 +229,11 @@
 #define VBSD_EC_SOFTWARE_SYNC            0x00000800
 /* VbInit() was told that the EC firmware is slow to update */
 #define VBSD_EC_SLOW_UPDATE              0x00001000
-/* Firmware software write protect was enabled at boot time */
-#define VBSD_BOOT_FIRMWARE_SW_WP_ENABLED 0x00002000
+/*
+ * Deprecated; was firmware software write protect was enabled at boot time.
+ * Crossystem support removed https://chromium-review.googlesource.com/575389.
+ */
+#define VBSD_DEPRECATED_BOOT_FIRMWARE_SW_WP_ENABLED 0x00002000
 /* VbInit() was told that the recovery button is a virtual one */
 #define VBSD_BOOT_REC_SWITCH_VIRTUAL     0x00004000
 /* Firmware used vboot2 for firmware selection */
diff --git a/firmware/lib/ec_sync.c b/firmware/lib/ec_sync.c
index afa6f1e..c19e5d2 100644
--- a/firmware/lib/ec_sync.c
+++ b/firmware/lib/ec_sync.c
@@ -375,7 +375,6 @@
 	 * separately.
 	 */
 	if (vb2_nv_get(ctx, VB2_NV_TRY_RO_SYNC) &&
-	    !(ctx->flags & VB2_CONTEXT_SW_WP_ENABLED) &&
 	    check_ec_hash(ctx, 0, VB_SELECT_FIRMWARE_READONLY)) {
 		return VBERROR_EC_REBOOT_TO_RO_REQUIRED;
 	}
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index d4475fb..f550989 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -259,8 +259,6 @@
 		ctx.flags |= VB2_CONTEXT_EC_SYNC_SLOW;
 	if (shared->flags & VBSD_EC_EFS)
 		ctx.flags |= VB2_CONTEXT_EC_EFS;
-	if (shared->flags & VBSD_BOOT_FIRMWARE_SW_WP_ENABLED)
-		ctx.flags |= VB2_CONTEXT_SW_WP_ENABLED;
 
 	ctx.workbuf_size = VB2_KERNEL_WORKBUF_RECOMMENDED_SIZE +
 			VB2_WORKBUF_ALIGN;
diff --git a/tests/ec_sync_tests.c b/tests/ec_sync_tests.c
index 9becb7c..eceae78 100644
--- a/tests/ec_sync_tests.c
+++ b/tests/ec_sync_tests.c
@@ -295,18 +295,6 @@
 	TEST_EQ(ec_ro_updated, 1, "  ec ro updated");
 
 	ResetMocks();
-	ctx.flags |= VB2_CONTEXT_SW_WP_ENABLED;
-	vb2_nv_set(&ctx, VB2_NV_TRY_RO_SYNC, 1);
-	mock_ec_rw_hash[0]++;
-	mock_ec_ro_hash[0]++;
-	test_ssync(0, 0, "WP enabled");
-	TEST_EQ(ec_rw_protected, 1, "  ec rw protected");
-	TEST_EQ(ec_run_image, 1, "  ec run image");
-	TEST_EQ(ec_rw_updated, 1, "  ec rw updated");
-	TEST_EQ(ec_ro_protected, 1, "  ec ro protected");
-	TEST_EQ(ec_ro_updated, 0, "  ec ro updated");
-
-	ResetMocks();
 	vb2_nv_set(&ctx, VB2_NV_TRY_RO_SYNC, 1);
 	mock_ec_ro_hash[0]++;
 	test_ssync(0, 0, "rw update not needed");