1From 5a510e0afd7c288e3f0fb3523ec749ba1366ad61 Mon Sep 17 00:00:00 2001
2From: Jason Andryuk <jandryuk@gmail.com>
3Date: Sun, 14 Mar 2021 12:42:10 -0400
4Subject: [PATCH 1/2] Use microseconds for timeouts and durations
5
6The timeout and duration fields should be in microseconds according to
7the spec.
8
9TPM_CAP_PROP_TIS_TIMEOUT:
10A 4 element array of UINT32 values each denoting the timeout value in
11microseconds for the following in this order:
12
13TPM_CAP_PROP_DURATION:
14A 3 element array of UINT32 values each denoting the duration value in
15microseconds of the duration of the three classes of commands:
16
17Linux will scale the timeouts up by 1000, but not the durations.  Change
18the units for both sets as appropriate.
19
20Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
21---
22 tpm/tpm_data.c | 14 +++++++-------
23 1 file changed, 7 insertions(+), 7 deletions(-)
24
25diff --git a/tpm/tpm_data.c b/tpm/tpm_data.c
26index a3a79ef..bebaf10 100644
27--- a/tpm/tpm_data.c
28+++ b/tpm/tpm_data.c
29@@ -67,13 +67,13 @@ static void init_nv_storage(void)
30 static void init_timeouts(void)
31 {
32   /* for the timeouts we use the PC platform defaults */
33-  tpmData.permanent.data.tis_timeouts[0] = 750;
34-  tpmData.permanent.data.tis_timeouts[1] = 2000;
35-  tpmData.permanent.data.tis_timeouts[2] = 750;
36-  tpmData.permanent.data.tis_timeouts[3] = 750;
37-  tpmData.permanent.data.cmd_durations[0] = 1;
38-  tpmData.permanent.data.cmd_durations[1] = 10;
39-  tpmData.permanent.data.cmd_durations[2] = 1000;
40+  tpmData.permanent.data.tis_timeouts[0] = 750000;
41+  tpmData.permanent.data.tis_timeouts[1] = 2000000;
42+  tpmData.permanent.data.tis_timeouts[2] = 750000;
43+  tpmData.permanent.data.tis_timeouts[3] = 750000;
44+  tpmData.permanent.data.cmd_durations[0] = 1000;
45+  tpmData.permanent.data.cmd_durations[1] = 10000;
46+  tpmData.permanent.data.cmd_durations[2] = 1000000;
47 }
48
49 void tpm_init_data(void)
50--
512.30.2
52
53