Philipp Deppenwiese has uploaded a new change for review. ( https://review.coreboot.org/19535 )
Change subject: drivers/pc80/tpm: Fix missing tis_close() function and TPM deactivation. ......................................................................
drivers/pc80/tpm: Fix missing tis_close() function and TPM deactivation.
tis_close() must be called after tis_open() otherwise the locked locality isn't released and the sessions hangs.
The deactivate command of the TPM should be executed after the startup is done. So that we can be sure that the TPM exists and is functional.
Change-Id: I1a06f6a29015708e4bc1de6e6678827c28b84e98 Signed-off-by: Philipp Deppenwiese zaolin@das-labor.org --- M src/drivers/pc80/tpm/romstage.c 1 file changed, 17 insertions(+), 14 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/19535/1
diff --git a/src/drivers/pc80/tpm/romstage.c b/src/drivers/pc80/tpm/romstage.c index a257ba1..9dcbf02 100644 --- a/src/drivers/pc80/tpm/romstage.c +++ b/src/drivers/pc80/tpm/romstage.c @@ -183,19 +183,6 @@ u32 result; u8 response[TPM_LARGE_ENOUGH_COMMAND_SIZE];
- if (IS_ENABLED(CONFIG_TPM_DEACTIVATE)) { - printk(BIOS_SPEW, "TPM: Deactivate\n"); - result = TlclSendReceive(tpm_deactivate_cmd.buffer, - response, sizeof(response)); - if (result == TPM_SUCCESS) { - printk(BIOS_SPEW, "TPM: OK.\n"); - return; - } - - printk(BIOS_ERR, "TPM: Error code 0x%x.\n", result); - return; - } - /* Doing TPM startup when we're not coming in on the S3 resume path * saves us roughly 20ms in boot time only. This does not seem to * be worth an API change to vboot_reference-firmware right now, so @@ -215,7 +202,6 @@ if (tis_open()) return;
- if (s3resume) { /* S3 Resume */ printk(BIOS_SPEW, "TPM: Resume\n"); @@ -226,6 +212,7 @@ * in S3, so it's already initialized. */ printk(BIOS_DEBUG, "TPM: Already initialized.\n"); + tis_close(); return; } } else { @@ -235,7 +222,23 @@ }
if (result == TPM_SUCCESS) { + if (IS_ENABLED(CONFIG_TPM_DEACTIVATE)) { + printk(BIOS_SPEW, "TPM: Deactivate\n"); + result = TlclSendReceive(tpm_deactivate_cmd.buffer, + response, sizeof(response)); + if (result == TPM_SUCCESS) { + printk(BIOS_SPEW, "TPM: OK.\n"); + tis_close(); + return; + } + + printk(BIOS_ERR, "TPM: Error code 0x%x.\n", result); + tis_close(); + return; + } + printk(BIOS_SPEW, "TPM: OK.\n"); + tis_close(); return; }