Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352867
b: refs/heads/master
c: 7240b98
h: refs/heads/master
i:
  352865: 2cb01ab
  352863: 2c31b4d
v: v3
  • Loading branch information
Jason Gunthorpe authored and Kent Yoder committed Feb 5, 2013
1 parent 1050e5f commit 52b0d6d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 78f09cc248731716633c0ef219613e762a9c4f2e
refs/heads/master: 7240b98320a28f1d41b9361dc1cc8244dfda0272
21 changes: 21 additions & 0 deletions trunk/drivers/char/tpm/tpm_tis.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,22 @@ static inline int is_itpm(struct pnp_dev *dev)
}
#endif

/* Before we attempt to access the TPM we must see that the valid bit is set.
* The specification says that this bit is 0 at reset and remains 0 until the
* 'TPM has gone through its self test and initialization and has established
* correct values in the other bits.' */
static int wait_startup(struct tpm_chip *chip, int l)
{
unsigned long stop = jiffies + chip->vendor.timeout_a;
do {
if (ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &
TPM_ACCESS_VALID)
return 0;
msleep(TPM_TIMEOUT);
} while (time_before(jiffies, stop));
return -1;
}

static int check_locality(struct tpm_chip *chip, int l)
{
if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &
Expand Down Expand Up @@ -541,6 +557,11 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT);

if (wait_startup(chip, 0) != 0) {
rc = -ENODEV;
goto out_err;
}

if (request_locality(chip, 0) != 0) {
rc = -ENODEV;
goto out_err;
Expand Down

0 comments on commit 52b0d6d

Please sign in to comment.