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