summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorNamyoon Woo <namyoon@chromium.org>2019-12-06 15:59:15 -0800
committerCommit Bot <commit-bot@chromium.org>2020-02-22 01:46:38 +0000
commit9d9c4ca2342d09ccf241173d36d3cf2b16ed3c41 (patch)
treea8c0914043964dd7e51ce86546e4366d1944074c /board
parentc5322ba116003017deab926f5d1e9bdd16f649b8 (diff)
downloadchrome-ec-9d9c4ca2342d09ccf241173d36d3cf2b16ed3c41.tar.gz
cr50: add TPM vendor-specific commands to support EC-EFS2
Based on the design in go/ec-efs2, this patch adds two TPM vendor-specific commands: - VENDOR_CC_GET_BOOT_MODE - VENDOR_CC_RESET_EC BUG=b:141578322 BRANCH=cr50 TEST=tested with EC-EFS supporting EC/AP firmware. With CR50 dev image, tested with gsctool on Octopus and Helios by sending each of new vendor commands. Checked flash_ec working on Scarlet in bitbang mode. Change-Id: Ia8f38a7b9cc45b172a1a1ef7e216034e520b79c7 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1956409 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/cr50/ec_efs.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/board/cr50/ec_efs.c b/board/cr50/ec_efs.c
index 677fb7d7f9..d7919e105c 100644
--- a/board/cr50/ec_efs.c
+++ b/board/cr50/ec_efs.c
@@ -9,6 +9,7 @@
#include "ec_comm.h"
#include "crc8.h"
#include "ec_commands.h"
+#include "extension.h"
#include "hooks.h"
#include "registers.h"
#include "system.h"
@@ -115,6 +116,48 @@ static void ec_efs_init_(void)
}
DECLARE_HOOK(HOOK_INIT, ec_efs_init_, HOOK_PRIO_DEFAULT);
+/**
+ * TPM vendor command handler to respond with EC Boot Mode.
+ *
+ * @return VENDOR_RC_SUCCESS
+ *
+ */
+static enum vendor_cmd_rc vc_get_boot_mode_(struct vendor_cmd_params *p)
+{
+ uint8_t *buffer;
+
+ if (!board_has_ec_cr50_comm_support())
+ return VENDOR_RC_NO_SUCH_SUBCOMMAND;
+
+ buffer = (uint8_t *)p->buffer;
+ buffer[0] = (uint8_t)ec_efs_ctx.boot_mode;
+
+ p->out_size = 1;
+
+ return VENDOR_RC_SUCCESS;
+}
+DECLARE_VENDOR_COMMAND_P(VENDOR_CC_GET_BOOT_MODE, vc_get_boot_mode_);
+
+/**
+ * TPM vendor command handler to reset EC.
+ *
+ * @return VEDOR_RC_SUCCESS
+ */
+static enum vendor_cmd_rc vc_reset_ec_(struct vendor_cmd_params *p)
+{
+ if (!board_has_ec_cr50_comm_support())
+ return VENDOR_RC_NO_SUCH_SUBCOMMAND;
+
+ /*
+ * Let's reset EC a little later so that CR50 can send a TPM command
+ * to AP.
+ */
+ board_reboot_ec_deferred(50 * MSEC);
+
+ return VENDOR_RC_SUCCESS;
+}
+DECLARE_VENDOR_COMMAND_P(VENDOR_CC_RESET_EC, vc_reset_ec_);
+
void ec_efs_reset(void)
{
set_boot_mode_(EC_EFS_BOOT_MODE_NORMAL);