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