summaryrefslogtreecommitdiff
path: root/board/cr50
diff options
context:
space:
mode:
Diffstat (limited to 'board/cr50')
-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);