diff options
-rw-r--r-- | drivers/char/tpm/tpm.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 9e3c529cac80..0a08af031a57 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -40,8 +40,9 @@ enum tpm_duration { | |||
40 | }; | 40 | }; |
41 | 41 | ||
42 | #define TPM_MAX_ORDINAL 243 | 42 | #define TPM_MAX_ORDINAL 243 |
43 | #define TPM_MAX_PROTECTED_ORDINAL 12 | 43 | #define TSC_MAX_ORDINAL 12 |
44 | #define TPM_PROTECTED_ORDINAL_MASK 0xFF | 44 | #define TPM_PROTECTED_COMMAND 0x00 |
45 | #define TPM_CONNECTION_COMMAND 0x40 | ||
45 | 46 | ||
46 | /* | 47 | /* |
47 | * Bug workaround - some TPM's don't flush the most | 48 | * Bug workaround - some TPM's don't flush the most |
@@ -336,13 +337,11 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, | |||
336 | { | 337 | { |
337 | int duration_idx = TPM_UNDEFINED; | 338 | int duration_idx = TPM_UNDEFINED; |
338 | int duration = 0; | 339 | int duration = 0; |
340 | u8 category = (ordinal >> 24) & 0xFF; | ||
339 | 341 | ||
340 | if (ordinal < TPM_MAX_ORDINAL) | 342 | if ((category == TPM_PROTECTED_COMMAND && ordinal < TPM_MAX_ORDINAL) || |
343 | (category == TPM_CONNECTION_COMMAND && ordinal < TSC_MAX_ORDINAL)) | ||
341 | duration_idx = tpm_ordinal_duration[ordinal]; | 344 | duration_idx = tpm_ordinal_duration[ordinal]; |
342 | else if ((ordinal & TPM_PROTECTED_ORDINAL_MASK) < | ||
343 | TPM_MAX_PROTECTED_ORDINAL) | ||
344 | duration_idx = | ||
345 | tpm_ordinal_duration[ordinal & TPM_PROTECTED_ORDINAL_MASK]; | ||
346 | 345 | ||
347 | if (duration_idx != TPM_UNDEFINED) | 346 | if (duration_idx != TPM_UNDEFINED) |
348 | duration = chip->vendor.duration[duration_idx]; | 347 | duration = chip->vendor.duration[duration_idx]; |