Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352852
b: refs/heads/master
c: 07b133e
h: refs/heads/master
v: v3
  • Loading branch information
Peter Huewe authored and Kent Yoder committed Feb 5, 2013
1 parent 736ab5e commit 4679cf0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 720ca4a9af1f1ce1d4d95ec4d6166ce84ede227f
refs/heads/master: 07b133e6060ba9de6cf6265fb23f0de8ec78e51c
13 changes: 6 additions & 7 deletions trunk/drivers/char/tpm/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ enum tpm_duration {
};

#define TPM_MAX_ORDINAL 243
#define TPM_MAX_PROTECTED_ORDINAL 12
#define TPM_PROTECTED_ORDINAL_MASK 0xFF
#define TSC_MAX_ORDINAL 12
#define TPM_PROTECTED_COMMAND 0x00
#define TPM_CONNECTION_COMMAND 0x40

/*
* Bug workaround - some TPM's don't flush the most
Expand Down Expand Up @@ -336,13 +337,11 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip,
{
int duration_idx = TPM_UNDEFINED;
int duration = 0;
u8 category = (ordinal >> 24) & 0xFF;

if (ordinal < TPM_MAX_ORDINAL)
if ((category == TPM_PROTECTED_COMMAND && ordinal < TPM_MAX_ORDINAL) ||
(category == TPM_CONNECTION_COMMAND && ordinal < TSC_MAX_ORDINAL))
duration_idx = tpm_ordinal_duration[ordinal];
else if ((ordinal & TPM_PROTECTED_ORDINAL_MASK) <
TPM_MAX_PROTECTED_ORDINAL)
duration_idx =
tpm_ordinal_duration[ordinal & TPM_PROTECTED_ORDINAL_MASK];

if (duration_idx != TPM_UNDEFINED)
duration = chip->vendor.duration[duration_idx];
Expand Down

0 comments on commit 4679cf0

Please sign in to comment.