From: Gang W. <gan...@in...> - 2011-11-27 04:46:17
|
changeset be2ed927cfbb in /var/www/tboot.hg details: tboot.hg?cmd=changeset;node=be2ed927cfbb description: TPM: add waiting on expect==0 before issue tpmGo This is bug fix to keep complying with TCG PC Client TIS Spec which indicates that TPM will ignores the state when Expect (E) is 1 when tpmGO (TG) is 1. Affected platform as a consequence to the wrong sequence during command transmission, the TPM correctly ignores the write to tpmGo as it is not yet in the state that all bytes have been received and waits forever for the tpmGo after the TPM has received all bytes. Signed-off-by: Sevaiyan Balaguru <sev...@in...> Signed-off-by: Gang Wei <gan...@in...> diffstat: tboot/common/tpm.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diffs (38 lines): diff -r 62875758c839 -r be2ed927cfbb tboot/common/tpm.c --- a/tboot/common/tpm.c Sun Nov 27 12:19:31 2011 +0800 +++ b/tboot/common/tpm.c Sun Nov 27 12:21:32 2011 +0800 @@ -386,6 +386,24 @@ (tpm_reg_data_fifo_t *)&in[offset]); } while ( offset < in_size ); + i = 0; + do { + read_tpm_reg(locality,TPM_REG_STS, ®_sts); +#ifdef TPM_TRACE + printk("Wait on Expect = 0, Status register %02x\n", reg_sts._raw[0]); +#endif + if ( reg_sts.sts_valid == 1 && reg_sts.expect == 0 ) + break; + else + cpu_relax(); + i++; + } while ( i <= TPM_DATA_AVAIL_TIME_OUT ); + if ( i > TPM_DATA_AVAIL_TIME_OUT ) { + printk("TPM: wait for expect becoming 0 timeout\n"); + ret = TPM_FAIL; + goto RelinquishControl; + } + /* command has been written to the TPM, it is time to execute it. */ memset(®_sts, 0, sizeof(reg_sts)); reg_sts.tpm_go = 1; @@ -395,6 +413,9 @@ i = 0; do { read_tpm_reg(locality,TPM_REG_STS, ®_sts); +#ifdef TPM_TRACE + printk("Waiting for DA Flag, Status register %02x\n", reg_sts._raw[0]); +#endif if ( reg_sts.sts_valid == 1 && reg_sts.data_avail == 1 ) break; else |