summaryrefslogtreecommitdiff
path: root/board/cr50/tpm2
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2016-11-22 16:16:08 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-11-28 20:53:48 -0800
commit5d80e5a86535243e98c209d7e4cd56a50d1ad38f (patch)
treef86e4459ff331f8417b9a8e47c3f8892d4996770 /board/cr50/tpm2
parent6ac553462e790be98de7b521b5d30281cfc04684 (diff)
downloadchrome-ec-5d80e5a86535243e98c209d7e4cd56a50d1ad38f.tar.gz
tpm2: add extension command for immediate reset
Cr50 updates in development environment should allow resetting the device immediately after update (without the need for SYS_RST_L to be toggled). This patch adds a vendor command to do just that. BRANCH=none BUG=chrome-os-partner:60013. chrome-os-partner:60321 TEST=none yet, with the rest of the patches applied the target gets rebooted immediately after a cr50 code update. Also, observed that flashing the console does not quite work, opend crosbug.com/p/60321 to address this. Change-Id: Ia6f99ad6d22004347ad02aac2cbf4dd6c5594928 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/414442 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'board/cr50/tpm2')
-rw-r--r--board/cr50/tpm2/post_reset.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/board/cr50/tpm2/post_reset.c b/board/cr50/tpm2/post_reset.c
index 549eaec4f8..cfb3608462 100644
--- a/board/cr50/tpm2/post_reset.c
+++ b/board/cr50/tpm2/post_reset.c
@@ -6,7 +6,11 @@
#include "config.h"
#include "board.h"
+#include "console.h"
#include "extension.h"
+#include "system.h"
+
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
void post_reset_command_handler(void *body,
size_t cmd_size,
@@ -18,3 +22,17 @@ void post_reset_command_handler(void *body,
}
DECLARE_EXTENSION_COMMAND(EXTENSION_POST_RESET, post_reset_command_handler);
+
+static enum vendor_cmd_rc immediate_reset(enum vendor_cmd_cc code,
+ void *buf,
+ size_t input_size,
+ size_t *response_size)
+{
+ CPRINTS("%s: rebooting on host's request", __func__);
+ cflush(); /* Let the console drain. */
+ system_reset(SYSTEM_RESET_HARD); /* This will never return. */
+
+ /* Never reached. */
+ return VENDOR_RC_SUCCESS;
+}
+DECLARE_VENDOR_COMMAND(VENDOR_CC_IMMEDIATE_RESET, immediate_reset);