blob: 787cc6bf281094e50464945b4b892b462703d406 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glassf255d312015-08-22 18:31:31 -06002/*
3 * Copyright (c) 2015 Google, Inc
Simon Glassf255d312015-08-22 18:31:31 -06004 */
5
6#ifndef __tpm_internal_h
7#define __tpm_internal_h
8
9enum {
10 TPM_MAX_ORDINAL = 243,
11 TPM_MAX_PROTECTED_ORDINAL = 12,
12 TPM_PROTECTED_ORDINAL_MASK = 0xff,
13 TPM_CMD_COUNT_BYTE = 2,
14 TPM_CMD_ORDINAL_BYTE = 6,
15};
16
17/*
18 * Array with one entry per ordinal defining the maximum amount
19 * of time the chip could take to return the result. The ordinal
20 * designation of short, medium or long is defined in a table in
21 * TCG Specification TPM Main Part 2 TPM Structures Section 17. The
22 * values of the SHORT, MEDIUM, and LONG durations are retrieved
23 * from the chip during initialization with a call to tpm_get_timeouts.
24 */
25static const u8 tpm_protected_ordinal_duration[TPM_MAX_PROTECTED_ORDINAL] = {
26 TPM_UNDEFINED, /* 0 */
27 TPM_UNDEFINED,
28 TPM_UNDEFINED,
29 TPM_UNDEFINED,
30 TPM_UNDEFINED,
31 TPM_UNDEFINED, /* 5 */
32 TPM_UNDEFINED,
33 TPM_UNDEFINED,
34 TPM_UNDEFINED,
35 TPM_UNDEFINED,
36 TPM_SHORT, /* 10 */
37 TPM_SHORT,
38};
39
40static const u8 tpm_ordinal_duration[TPM_MAX_ORDINAL] = {
41 TPM_UNDEFINED, /* 0 */
42 TPM_UNDEFINED,
43 TPM_UNDEFINED,
44 TPM_UNDEFINED,
45 TPM_UNDEFINED,
46 TPM_UNDEFINED, /* 5 */
47 TPM_UNDEFINED,
48 TPM_UNDEFINED,
49 TPM_UNDEFINED,
50 TPM_UNDEFINED,
51 TPM_SHORT, /* 10 */
52 TPM_SHORT,
53 TPM_MEDIUM,
54 TPM_LONG,
55 TPM_LONG,
56 TPM_MEDIUM, /* 15 */
57 TPM_SHORT,
58 TPM_SHORT,
59 TPM_MEDIUM,
60 TPM_LONG,
61 TPM_SHORT, /* 20 */
62 TPM_SHORT,
63 TPM_MEDIUM,
64 TPM_MEDIUM,
65 TPM_MEDIUM,
66 TPM_SHORT, /* 25 */
67 TPM_SHORT,
68 TPM_MEDIUM,
69 TPM_SHORT,
70 TPM_SHORT,
71 TPM_MEDIUM, /* 30 */
72 TPM_LONG,
73 TPM_MEDIUM,
74 TPM_SHORT,
75 TPM_SHORT,
76 TPM_SHORT, /* 35 */
77 TPM_MEDIUM,
78 TPM_MEDIUM,
79 TPM_UNDEFINED,
80 TPM_UNDEFINED,
81 TPM_MEDIUM, /* 40 */
82 TPM_LONG,
83 TPM_MEDIUM,
84 TPM_SHORT,
85 TPM_SHORT,
86 TPM_SHORT, /* 45 */
87 TPM_SHORT,
88 TPM_SHORT,
89 TPM_SHORT,
90 TPM_LONG,
91 TPM_MEDIUM, /* 50 */
92 TPM_MEDIUM,
93 TPM_UNDEFINED,
94 TPM_UNDEFINED,
95 TPM_UNDEFINED,
96 TPM_UNDEFINED, /* 55 */
97 TPM_UNDEFINED,
98 TPM_UNDEFINED,
99 TPM_UNDEFINED,
100 TPM_UNDEFINED,
101 TPM_MEDIUM, /* 60 */
102 TPM_MEDIUM,
103 TPM_MEDIUM,
104 TPM_SHORT,
105 TPM_SHORT,
106 TPM_MEDIUM, /* 65 */
107 TPM_UNDEFINED,
108 TPM_UNDEFINED,
109 TPM_UNDEFINED,
110 TPM_UNDEFINED,
111 TPM_SHORT, /* 70 */
112 TPM_SHORT,
113 TPM_UNDEFINED,
114 TPM_UNDEFINED,
115 TPM_UNDEFINED,
116 TPM_UNDEFINED, /* 75 */
117 TPM_UNDEFINED,
118 TPM_UNDEFINED,
119 TPM_UNDEFINED,
120 TPM_UNDEFINED,
121 TPM_LONG, /* 80 */
122 TPM_UNDEFINED,
123 TPM_MEDIUM,
124 TPM_LONG,
125 TPM_SHORT,
126 TPM_UNDEFINED, /* 85 */
127 TPM_UNDEFINED,
128 TPM_UNDEFINED,
129 TPM_UNDEFINED,
130 TPM_UNDEFINED,
131 TPM_SHORT, /* 90 */
132 TPM_SHORT,
133 TPM_SHORT,
134 TPM_SHORT,
135 TPM_SHORT,
136 TPM_UNDEFINED, /* 95 */
137 TPM_UNDEFINED,
138 TPM_UNDEFINED,
139 TPM_UNDEFINED,
140 TPM_UNDEFINED,
141 TPM_MEDIUM, /* 100 */
142 TPM_SHORT,
143 TPM_SHORT,
144 TPM_UNDEFINED,
145 TPM_UNDEFINED,
146 TPM_UNDEFINED, /* 105 */
147 TPM_UNDEFINED,
148 TPM_UNDEFINED,
149 TPM_UNDEFINED,
150 TPM_UNDEFINED,
151 TPM_SHORT, /* 110 */
152 TPM_SHORT,
153 TPM_SHORT,
154 TPM_SHORT,
155 TPM_SHORT,
156 TPM_SHORT, /* 115 */
157 TPM_SHORT,
158 TPM_SHORT,
159 TPM_UNDEFINED,
160 TPM_UNDEFINED,
161 TPM_LONG, /* 120 */
162 TPM_LONG,
163 TPM_MEDIUM,
164 TPM_UNDEFINED,
165 TPM_SHORT,
166 TPM_SHORT, /* 125 */
167 TPM_SHORT,
168 TPM_LONG,
169 TPM_SHORT,
170 TPM_SHORT,
171 TPM_SHORT, /* 130 */
172 TPM_MEDIUM,
173 TPM_UNDEFINED,
174 TPM_SHORT,
175 TPM_MEDIUM,
176 TPM_UNDEFINED, /* 135 */
177 TPM_UNDEFINED,
178 TPM_UNDEFINED,
179 TPM_UNDEFINED,
180 TPM_UNDEFINED,
181 TPM_SHORT, /* 140 */
182 TPM_SHORT,
183 TPM_UNDEFINED,
184 TPM_UNDEFINED,
185 TPM_UNDEFINED,
186 TPM_UNDEFINED, /* 145 */
187 TPM_UNDEFINED,
188 TPM_UNDEFINED,
189 TPM_UNDEFINED,
190 TPM_UNDEFINED,
191 TPM_SHORT, /* 150 */
192 TPM_MEDIUM,
193 TPM_MEDIUM,
194 TPM_SHORT,
195 TPM_SHORT,
196 TPM_UNDEFINED, /* 155 */
197 TPM_UNDEFINED,
198 TPM_UNDEFINED,
199 TPM_UNDEFINED,
200 TPM_UNDEFINED,
201 TPM_SHORT, /* 160 */
202 TPM_SHORT,
203 TPM_SHORT,
204 TPM_SHORT,
205 TPM_UNDEFINED,
206 TPM_UNDEFINED, /* 165 */
207 TPM_UNDEFINED,
208 TPM_UNDEFINED,
209 TPM_UNDEFINED,
210 TPM_UNDEFINED,
211 TPM_LONG, /* 170 */
212 TPM_UNDEFINED,
213 TPM_UNDEFINED,
214 TPM_UNDEFINED,
215 TPM_UNDEFINED,
216 TPM_UNDEFINED, /* 175 */
217 TPM_UNDEFINED,
218 TPM_UNDEFINED,
219 TPM_UNDEFINED,
220 TPM_UNDEFINED,
221 TPM_MEDIUM, /* 180 */
222 TPM_SHORT,
223 TPM_MEDIUM,
224 TPM_MEDIUM,
225 TPM_MEDIUM,
226 TPM_MEDIUM, /* 185 */
227 TPM_SHORT,
228 TPM_UNDEFINED,
229 TPM_UNDEFINED,
230 TPM_UNDEFINED,
231 TPM_UNDEFINED, /* 190 */
232 TPM_UNDEFINED,
233 TPM_UNDEFINED,
234 TPM_UNDEFINED,
235 TPM_UNDEFINED,
236 TPM_UNDEFINED, /* 195 */
237 TPM_UNDEFINED,
238 TPM_UNDEFINED,
239 TPM_UNDEFINED,
240 TPM_UNDEFINED,
241 TPM_SHORT, /* 200 */
242 TPM_UNDEFINED,
243 TPM_UNDEFINED,
244 TPM_UNDEFINED,
245 TPM_SHORT,
246 TPM_SHORT, /* 205 */
247 TPM_SHORT,
248 TPM_SHORT,
249 TPM_SHORT,
250 TPM_SHORT,
251 TPM_MEDIUM, /* 210 */
252 TPM_UNDEFINED,
253 TPM_MEDIUM,
254 TPM_MEDIUM,
255 TPM_MEDIUM,
256 TPM_UNDEFINED, /* 215 */
257 TPM_MEDIUM,
258 TPM_UNDEFINED,
259 TPM_UNDEFINED,
260 TPM_SHORT,
261 TPM_SHORT, /* 220 */
262 TPM_SHORT,
263 TPM_SHORT,
264 TPM_SHORT,
265 TPM_SHORT,
266 TPM_UNDEFINED, /* 225 */
267 TPM_UNDEFINED,
268 TPM_UNDEFINED,
269 TPM_UNDEFINED,
270 TPM_UNDEFINED,
271 TPM_SHORT, /* 230 */
272 TPM_LONG,
273 TPM_MEDIUM,
274 TPM_UNDEFINED,
275 TPM_UNDEFINED,
276 TPM_UNDEFINED, /* 235 */
277 TPM_UNDEFINED,
278 TPM_UNDEFINED,
279 TPM_UNDEFINED,
280 TPM_UNDEFINED,
281 TPM_SHORT, /* 240 */
282 TPM_UNDEFINED,
283 TPM_MEDIUM,
284};
285
286#endif