tpm_tis: Only probe iTPMs
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Fri, 20 Jan 2012 17:58:49 +0000 (12:58 -0500)
committerRajiv Andrade <srajiv@linux.vnet.ibm.com>
Tue, 14 Feb 2012 18:43:08 +0000 (16:43 -0200)
Detect iTPMs through the vendor ID on the hardware interface and only
probe the device if the manufacturer is found to be Intel. This
obsoletes a previously added delay necessary for some TPMs but not iTPMs.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
drivers/char/tpm/tpm.h
drivers/char/tpm/tpm_tis.c

index 01054713828128ea59fa1c06b2adf035b8b3f281..b1c5280ac15946fa453dcba5ac2566416985195d 100644 (file)
@@ -99,6 +99,8 @@ struct tpm_vendor_specific {
        wait_queue_head_t int_queue;
 };
 
+#define TPM_VID_INTEL    0x8086
+
 struct tpm_chip {
        struct device *dev;     /* Device stuff */
 
index a1748621111be511a8694a4d91ab74094f45c631..47ba9c213cc10a5108df2a08bf1ea54bf48f2ac1 100644 (file)
@@ -368,6 +368,11 @@ static int probe_itpm(struct tpm_chip *chip)
        };
        size_t len = sizeof(cmd_getticks);
        int rem_itpm = itpm;
+       u16 vendor = ioread16(chip->vendor.iobase + TPM_DID_VID(0));
+
+       /* probe only iTPMS */
+       if (vendor != TPM_VID_INTEL)
+               return 0;
 
        itpm = 0;
 
@@ -390,9 +395,6 @@ static int probe_itpm(struct tpm_chip *chip)
 out:
        itpm = rem_itpm;
        tpm_tis_ready(chip);
-       /* some TPMs need a break here otherwise they will not work
-        * correctly on the immediately subsequent command */
-       msleep(chip->vendor.timeout_b);
        release_locality(chip, chip->vendor.locality, 0);
 
        return rc;