aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2011-03-30 12:13:24 -0400
committerRajiv Andrade <srajiv@linux.vnet.ibm.com>2011-07-12 17:53:07 -0400
commite934acca1ee993e1d99d7dc203569a6e5cdfb392 (patch)
treee0ac7a2305c0b2633a798721e5fe5b95c6d89d98 /drivers/char/tpm
parent979b140614a5459f340f5f8b1641ef77c863d899 (diff)
tpm: Adjust the durations if they are too small
Adjust the durations if they are found to be too small, i.e., if they are returned in milliseconds rather than microseconds as some Infineon TPMs are reported to do. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/tpm.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index aebb4b5a199c..277cf22609ca 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -583,17 +583,22 @@ duration:
583 duration_cap = &tpm_cmd.params.getcap_out.cap.duration; 583 duration_cap = &tpm_cmd.params.getcap_out.cap.duration;
584 chip->vendor.duration[TPM_SHORT] = 584 chip->vendor.duration[TPM_SHORT] =
585 usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); 585 usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short));
586 chip->vendor.duration[TPM_MEDIUM] =
587 usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_medium));
588 chip->vendor.duration[TPM_LONG] =
589 usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_long));
590
586 /* The Broadcom BCM0102 chipset in a Dell Latitude D820 gets the above 591 /* The Broadcom BCM0102 chipset in a Dell Latitude D820 gets the above
587 * value wrong and apparently reports msecs rather than usecs. So we 592 * value wrong and apparently reports msecs rather than usecs. So we
588 * fix up the resulting too-small TPM_SHORT value to make things work. 593 * fix up the resulting too-small TPM_SHORT value to make things work.
594 * We also scale the TPM_MEDIUM and -_LONG values by 1000.
589 */ 595 */
590 if (chip->vendor.duration[TPM_SHORT] < (HZ/100)) 596 if (chip->vendor.duration[TPM_SHORT] < (HZ / 100)) {
591 chip->vendor.duration[TPM_SHORT] = HZ; 597 chip->vendor.duration[TPM_SHORT] = HZ;
592 598 chip->vendor.duration[TPM_MEDIUM] *= 1000;
593 chip->vendor.duration[TPM_MEDIUM] = 599 chip->vendor.duration[TPM_LONG] *= 1000;
594 usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_medium)); 600 dev_info(chip->dev, "Adjusting TPM timeout parameters.");
595 chip->vendor.duration[TPM_LONG] = 601 }
596 usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_long));
597} 602}
598EXPORT_SYMBOL_GPL(tpm_get_timeouts); 603EXPORT_SYMBOL_GPL(tpm_get_timeouts);
599 604