summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Semenzato <semenzato@google.com>2011-03-16 10:56:48 -0700
committerLuigi Semenzato <semenzato@google.com>2011-03-16 10:56:48 -0700
commit54992f9d3379c4b048d8da6171f0e578b2db4fac (patch)
tree19505fd099cc54a3ca89c56d4b2c91dd2ceddf77
parent4c6e6dac28edfdfc724074b929ec95c6e3104d91 (diff)
downloadvboot-54992f9d3379c4b048d8da6171f0e578b2db4fac.tar.gz
Added TPM_SaveState command.
Change-Id: If7b6ef3cba733b74ba13db0871e6ac554d0d84ef BUG=chromium-os:433 TEST=none Review URL: http://codereview.chromium.org/6696043
-rw-r--r--firmware/include/tlcl.h5
-rw-r--r--firmware/lib/tpm_lite/tlcl.c5
-rw-r--r--utility/tlcl_generator.c8
-rw-r--r--utility/tpmc.c1
4 files changed, 19 insertions, 0 deletions
diff --git a/firmware/include/tlcl.h b/firmware/include/tlcl.h
index 8e2af2c6..10d08024 100644
--- a/firmware/include/tlcl.h
+++ b/firmware/include/tlcl.h
@@ -35,6 +35,11 @@ void TlclSetLogLevel(int level);
*/
uint32_t TlclStartup(void);
+/* Save the TPM state. Normally done by the kernel before a suspend, included
+ * here for tests. The TPM error code is returned (0 for success).
+ */
+uint32_t TlclSaveState(void);
+
/* Resumes by sending a TPM_Startup(ST_STATE). The TPM error code is returned
* (0 for success).
*/
diff --git a/firmware/lib/tpm_lite/tlcl.c b/firmware/lib/tpm_lite/tlcl.c
index a3af5b5a..6252700d 100644
--- a/firmware/lib/tpm_lite/tlcl.c
+++ b/firmware/lib/tpm_lite/tlcl.c
@@ -100,6 +100,11 @@ uint32_t TlclStartup(void) {
return Send(tpm_startup_cmd.buffer);
}
+uint32_t TlclSaveState(void) {
+ VBDEBUG(("TPM: SaveState\n"));
+ return Send(tpm_savestate_cmd.buffer);
+}
+
uint32_t TlclResume(void) {
VBDEBUG(("TPM: Resume\n"));
return Send(tpm_resume_cmd.buffer);
diff --git a/utility/tlcl_generator.c b/utility/tlcl_generator.c
index efb0f341..86b7e4ed 100644
--- a/utility/tlcl_generator.c
+++ b/utility/tlcl_generator.c
@@ -222,6 +222,13 @@ Command* BuildStartupCommand(void) {
return cmd;
}
+Command* BuildSaveStateCommand(void) {
+ int size = kTpmRequestHeaderLength;
+ Command* cmd = newCommand(TPM_ORD_SaveState, size);
+ cmd->name = "tpm_savestate_cmd";
+ return cmd;
+}
+
Command* BuildResumeCommand(void) {
int size = kTpmRequestHeaderLength + sizeof(TPM_STARTUP_TYPE);
Command* cmd = newCommand(TPM_ORD_Startup, size);
@@ -452,6 +459,7 @@ Command* (*builders[])(void) = {
BuildPPLockCommand,
BuildFinalizePPCommand,
BuildStartupCommand,
+ BuildSaveStateCommand,
BuildResumeCommand,
BuildSelftestfullCommand,
BuildContinueSelfTestCommand,
diff --git a/utility/tpmc.c b/utility/tpmc.c
index 494a1ee4..fba3ff52 100644
--- a/utility/tpmc.c
+++ b/utility/tpmc.c
@@ -290,6 +290,7 @@ command_record command_table[] = {
{ "getstclearflags", "getvf", "print all volatile (ST_CLEAR) flags",
HandlerGetSTClearFlags },
{ "resume", "res", "execute TPM_Startup(ST_STATE)", TlclResume },
+ { "savestate", "save", "execute TPM_SaveState", TlclSaveState },
};
static int n_commands = sizeof(command_table) / sizeof(command_table[0]);