firmware: Remove VbLockDevice()

VbLockDevice() would be inconvenient to port to 64-byte NV storage
records because it doesn't take VbSharedData flags or a vb2_context.
So, just have depthcharge call vbnv_write() directly (as it does in
other places in fastboot.c) and get rid of this API.

BUG=chromium:789276
BRANCH=none
TEST=make runtests
CQ-DEPEND=CL:944183

Change-Id: I2aeaecf7f929cd1a1ebd1f6850d0dd96c6fabb49
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/944243
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index 994f00b..9f2901a 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -424,20 +424,6 @@
  */
 VbError_t VbUnlockDevice(void);
 
-/**
- * Fastboot API to enter normal mode.
- *
- * This routine is used by fastboot oem lock command to switch the device into
- * normal mode.
- *
- * NOTE: On successful return from this function, the caller needs to reboot the
- * device immediately for changes to take effect. This routine just stores a
- * request, which will be handled by RO firmware on next reboot.
- *
- * @return VBERROR_... error, VBERROR_SUCCESS on success.
- */
-VbError_t VbLockDevice(void);
-
 /*****************************************************************************/
 /* Debug output (from utility.h) */
 
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 02d09ad..d4475fb 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -621,18 +621,3 @@
 	VB2_DEBUG("Mode change will take effect on next reboot.\n");
 	return VBERROR_SUCCESS;
 }
-
-VbError_t VbLockDevice(void)
-{
-	VB2_DEBUG("Storing request to leave dev-mode.\n");
-
-	memset(&ctx, 0, sizeof(ctx));
-	VbExNvStorageRead(ctx.nvdata);
-	vb2_nv_init(&ctx);
-	vb2_nv_set(&ctx, VB2_NV_DISABLE_DEV_REQUEST, 1);
-	vb2_nv_commit(&ctx);
-
-	VB2_DEBUG("Mode change will take effect on next reboot.\n");
-
-	return VBERROR_SUCCESS;
-}
diff --git a/tests/vboot_api_kernel6_tests.c b/tests/vboot_api_kernel6_tests.c
index 801ff72..c44c3c1 100644
--- a/tests/vboot_api_kernel6_tests.c
+++ b/tests/vboot_api_kernel6_tests.c
@@ -43,16 +43,9 @@
 		"set dev fail");
 }
 
-static void VbLockDeviceTest(void)
-{
-	ResetMocks();
-	TEST_EQ(VbLockDevice(), 0, "lock success");
-}
-
 int main(void)
 {
 	VbUnlockDeviceTest();
-	VbLockDeviceTest();
 
 	return gTestSuccess ? 0 : 255;
 }