diff options
author | Furquan Shaikh <furquan@chromium.org> | 2016-09-30 12:53:19 -0700 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2016-10-02 19:07:29 +0200 |
commit | cc3365a0398d02dc2e88c3caf969c0b874d6a3dc (patch) | |
tree | 62fff8aa6413fa8c36cd331449bd590df38603ab /src | |
parent | 5db043f0d6ddcae38b8addde1c8b3466265fa823 (diff) | |
download | coreboot-cc3365a0398d02dc2e88c3caf969c0b874d6a3dc.tar.xz |
TPM2: Fill in empty tlcl_resume function in TPM2 tlcl
On resume, TPM2_Starup(STATE) command needs to be sent to the TPM. This
ensures that TPM restores the state saved at last Shutdown(STATE).
Since tlcl_resume and tlcl_startup both use the same sequence for
sending startup command with different arguments, add a common function
that can be used by both.
BUG=chrome-os-partner:58043
BRANCH=None
TEST=Verified that on resume coreboot no longer complains about index
read for 0x1007. Return value is 0 as expected.
Change-Id: Ib8640acc9cc9cdb3ba5d40e0ccee5ca7d67fa645
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://review.coreboot.org/16832
Tested-by: build bot (Jenkins)
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/tpm2_tlcl.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/lib/tpm2_tlcl.c b/src/lib/tpm2_tlcl.c index b6017a2a98..ecf0db6058 100644 --- a/src/lib/tpm2_tlcl.c +++ b/src/lib/tpm2_tlcl.c @@ -54,10 +54,27 @@ uint32_t tlcl_get_permanent_flags(TPM_PERMANENT_FLAGS *pflags) return TPM_SUCCESS; } -uint32_t tlcl_resume(void) +static uint32_t tlcl_send_startup(TPM_SU type) { - printk(BIOS_INFO, "%s:%s:%d\n", __FILE__, __func__, __LINE__); + struct tpm2_startup startup; + struct tpm2_response *response; + + startup.startup_type = type; + response = tpm_process_command(TPM2_Startup, &startup); + + if (response && response->hdr.tpm_code && + (response->hdr.tpm_code != TPM_RC_INITIALIZE)) { + printk(BIOS_INFO, "%s: Startup return code is %x\n", + __func__, response->hdr.tpm_code); + return TPM_E_IOERROR; + } return TPM_SUCCESS; + +} + +uint32_t tlcl_resume(void) +{ + return tlcl_send_startup(TPM_SU_STATE); } uint32_t tlcl_assert_physical_presence(void) @@ -245,18 +262,7 @@ uint32_t tlcl_lock_nv_write(uint32_t index) uint32_t tlcl_startup(void) { - struct tpm2_startup startup; - struct tpm2_response *response; - - startup.startup_type = TPM_SU_CLEAR; - response = tpm_process_command(TPM2_Startup, &startup); - if (response && response->hdr.tpm_code && - (response->hdr.tpm_code != TPM_RC_INITIALIZE)) { - printk(BIOS_INFO, "startup return code is %x\n", - response->hdr.tpm_code); - return TPM_E_IOERROR; - } - return TPM_SUCCESS; + return tlcl_send_startup(TPM_SU_CLEAR); } uint32_t tlcl_write(uint32_t index, const void *data, uint32_t length) |