| /* SPDX-License-Identifier: GPL-2.0+ */ |
| /* |
| * Copyright (c) 2015 Google, Inc |
| */ |
| |
| #ifndef __tpm_internal_h |
| #define __tpm_internal_h |
| |
| enum { |
| TPM_MAX_ORDINAL = 243, |
| TPM_MAX_PROTECTED_ORDINAL = 12, |
| TPM_PROTECTED_ORDINAL_MASK = 0xff, |
| TPM_CMD_COUNT_BYTE = 2, |
| TPM_CMD_ORDINAL_BYTE = 6, |
| }; |
| |
| /* |
| * Array with one entry per ordinal defining the maximum amount |
| * of time the chip could take to return the result. The ordinal |
| * designation of short, medium or long is defined in a table in |
| * TCG Specification TPM Main Part 2 TPM Structures Section 17. The |
| * values of the SHORT, MEDIUM, and LONG durations are retrieved |
| * from the chip during initialization with a call to tpm_get_timeouts. |
| */ |
| static const u8 tpm_protected_ordinal_duration[TPM_MAX_PROTECTED_ORDINAL] = { |
| TPM_UNDEFINED, /* 0 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, /* 5 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, /* 10 */ |
| TPM_SHORT, |
| }; |
| |
| static const u8 tpm_ordinal_duration[TPM_MAX_ORDINAL] = { |
| TPM_UNDEFINED, /* 0 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, /* 5 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, /* 10 */ |
| TPM_SHORT, |
| TPM_MEDIUM, |
| TPM_LONG, |
| TPM_LONG, |
| TPM_MEDIUM, /* 15 */ |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_MEDIUM, |
| TPM_LONG, |
| TPM_SHORT, /* 20 */ |
| TPM_SHORT, |
| TPM_MEDIUM, |
| TPM_MEDIUM, |
| TPM_MEDIUM, |
| TPM_SHORT, /* 25 */ |
| TPM_SHORT, |
| TPM_MEDIUM, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_MEDIUM, /* 30 */ |
| TPM_LONG, |
| TPM_MEDIUM, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, /* 35 */ |
| TPM_MEDIUM, |
| TPM_MEDIUM, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_MEDIUM, /* 40 */ |
| TPM_LONG, |
| TPM_MEDIUM, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, /* 45 */ |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_LONG, |
| TPM_MEDIUM, /* 50 */ |
| TPM_MEDIUM, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, /* 55 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_MEDIUM, /* 60 */ |
| TPM_MEDIUM, |
| TPM_MEDIUM, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_MEDIUM, /* 65 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, /* 70 */ |
| TPM_SHORT, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, /* 75 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_LONG, /* 80 */ |
| TPM_UNDEFINED, |
| TPM_MEDIUM, |
| TPM_LONG, |
| TPM_SHORT, |
| TPM_UNDEFINED, /* 85 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, /* 90 */ |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_UNDEFINED, /* 95 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_MEDIUM, /* 100 */ |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, /* 105 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, /* 110 */ |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, /* 115 */ |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_LONG, /* 120 */ |
| TPM_LONG, |
| TPM_MEDIUM, |
| TPM_UNDEFINED, |
| TPM_SHORT, |
| TPM_SHORT, /* 125 */ |
| TPM_SHORT, |
| TPM_LONG, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, /* 130 */ |
| TPM_MEDIUM, |
| TPM_UNDEFINED, |
| TPM_SHORT, |
| TPM_MEDIUM, |
| TPM_UNDEFINED, /* 135 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, /* 140 */ |
| TPM_SHORT, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, /* 145 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, /* 150 */ |
| TPM_MEDIUM, |
| TPM_MEDIUM, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_UNDEFINED, /* 155 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, /* 160 */ |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, /* 165 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_LONG, /* 170 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, /* 175 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_MEDIUM, /* 180 */ |
| TPM_SHORT, |
| TPM_MEDIUM, |
| TPM_MEDIUM, |
| TPM_MEDIUM, |
| TPM_MEDIUM, /* 185 */ |
| TPM_SHORT, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, /* 190 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, /* 195 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, /* 200 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, |
| TPM_SHORT, /* 205 */ |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_MEDIUM, /* 210 */ |
| TPM_UNDEFINED, |
| TPM_MEDIUM, |
| TPM_MEDIUM, |
| TPM_MEDIUM, |
| TPM_UNDEFINED, /* 215 */ |
| TPM_MEDIUM, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, |
| TPM_SHORT, /* 220 */ |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_SHORT, |
| TPM_UNDEFINED, /* 225 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, /* 230 */ |
| TPM_LONG, |
| TPM_MEDIUM, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, /* 235 */ |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_UNDEFINED, |
| TPM_SHORT, /* 240 */ |
| TPM_UNDEFINED, |
| TPM_MEDIUM, |
| }; |
| |
| #endif |