From: Stefan Berger stefanb@linux.vnet.ibm.com
Remove the scaler that scaled the timeouts and durations by a factor of 10. Remove that to use the default values that are being used until the TPM specific ones are read from the TPM itself.
Get these TPM specific values earlier from the device.
Signed-off-by: Stefan Berger stefanb@linux.vnet.ibm.com --- src/hw/tpm_drivers.h | 23 ++++++++++++++--------- src/tcgbios.c | 8 ++++---- 2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/src/hw/tpm_drivers.h b/src/hw/tpm_drivers.h index 6357d02..497037e 100644 --- a/src/hw/tpm_drivers.h +++ b/src/hw/tpm_drivers.h @@ -66,12 +66,13 @@ extern struct tpm_driver tpm_drivers[]; #define TIS_ACCESS_REQUEST_USE (1 << 1) /* 0x02 */ #define TIS_ACCESS_TPM_ESTABLISHMENT (1 << 0) /* 0x01 */
-#define SCALER 10 - -#define TIS_DEFAULT_TIMEOUT_A (750 * SCALER) -#define TIS_DEFAULT_TIMEOUT_B (2000 * SCALER) -#define TIS_DEFAULT_TIMEOUT_C (750 * SCALER) -#define TIS_DEFAULT_TIMEOUT_D (750 * SCALER) +/* + * Default TIS timeouts used before getting them from the TPM itself + */ +#define TIS_DEFAULT_TIMEOUT_A 750 /* ms */ +#define TIS_DEFAULT_TIMEOUT_B 2000 /* ms */ +#define TIS_DEFAULT_TIMEOUT_C 750 /* ms */ +#define TIS_DEFAULT_TIMEOUT_D 750 /* ms */
enum tisTimeoutType { TIS_TIMEOUT_TYPE_A = 0, @@ -80,8 +81,12 @@ enum tisTimeoutType { TIS_TIMEOUT_TYPE_D, };
-#define TPM_DEFAULT_DURATION_SHORT (2000 * SCALER) -#define TPM_DEFAULT_DURATION_MEDIUM (20000 * SCALER) -#define TPM_DEFAULT_DURATION_LONG (60000 * SCALER) +/* + * Default command durations used before getting them from the + * TPM itself + */ +#define TPM_DEFAULT_DURATION_SHORT 2000 /* ms */ +#define TPM_DEFAULT_DURATION_MEDIUM 20000 /* ms */ +#define TPM_DEFAULT_DURATION_LONG 60000 /* ms */
#endif /* TPM_DRIVERS_H */ diff --git a/src/tcgbios.c b/src/tcgbios.c index cb741f0..a5b84b9 100644 --- a/src/tcgbios.c +++ b/src/tcgbios.c @@ -488,6 +488,10 @@ tpm_startup(void) if (rc || returnCode) goto err_exit;
+ rc = determine_timeouts(); + if (rc) + goto err_exit; + rc = build_and_send_cmd(0, TPM_ORD_SelfTestFull, NULL, 0, NULL, 0, &returnCode, TPM_DURATION_TYPE_LONG);
@@ -506,10 +510,6 @@ tpm_startup(void) if (rc || (returnCode != 0 && returnCode != TPM_BAD_LOCALITY)) goto err_exit;
- rc = determine_timeouts(); - if (rc) - goto err_exit; - rc = tpm_smbios_measure(); if (rc) goto err_exit;