#define TIS_DEFAULT_TIMEOUT_C 750000 /* us */
#define TIS_DEFAULT_TIMEOUT_D 750000 /* us */
+/*
+ * Default TIS 2 timeouts given in TPM Profile (TPT) Spec
+ */
+#define TIS2_DEFAULT_TIMEOUT_A 750000 /* us */
+#define TIS2_DEFAULT_TIMEOUT_B 2000000 /* us */
+#define TIS2_DEFAULT_TIMEOUT_C 200000 /* us */
+#define TIS2_DEFAULT_TIMEOUT_D 30000 /* us */
+
enum tisTimeoutType {
TIS_TIMEOUT_TYPE_A = 0,
TIS_TIMEOUT_TYPE_B,
#define TPM_DEFAULT_DURATION_MEDIUM 20000000 /* us */
#define TPM_DEFAULT_DURATION_LONG 60000000 /* us */
+/*
+ * TPM 2 command durations; we set them to the timeout values
+ * given in TPM Profile (PTP) Specification; exceeding those
+ * timeout values indicates a faulty TPM.
+ */
+#define TPM2_DEFAULT_DURATION_SHORT 750000 /* us */
+#define TPM2_DEFAULT_DURATION_MEDIUM 2000000 /* us */
+#define TPM2_DEFAULT_DURATION_LONG 2000000 /* us */
+
#endif /* TPM_DRIVERS_H */
return 0;
}
+static void
+tpm20_set_timeouts(void)
+{
+ u32 durations[3] = {
+ TPM2_DEFAULT_DURATION_SHORT,
+ TPM2_DEFAULT_DURATION_MEDIUM,
+ TPM2_DEFAULT_DURATION_LONG,
+ };
+ u32 timeouts[4] = {
+ TIS2_DEFAULT_TIMEOUT_A,
+ TIS2_DEFAULT_TIMEOUT_B,
+ TIS2_DEFAULT_TIMEOUT_C,
+ TIS2_DEFAULT_TIMEOUT_D,
+ };
+
+ tpmhw_set_timeouts(timeouts, durations);
+}
+
static int
tpm12_extend(u32 pcrindex, const u8 *digest)
{
static int
tpm20_startup(void)
{
+ tpm20_set_timeouts();
+
int ret = tpm_build_and_send_cmd(0, TPM2_CC_Startup,
Startup_SU_CLEAR,
sizeof(Startup_SU_CLEAR),