diff options
-rw-r--r-- | firmware/include/tlcl.h | 5 | ||||
-rw-r--r-- | firmware/lib/tpm_lite/tlcl.c | 5 | ||||
-rw-r--r-- | utility/tlcl_generator.c | 8 | ||||
-rw-r--r-- | utility/tpmc.c | 1 |
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]); |