tpm_tis: Some smaller fixes
cover tpm_tis: Some smaller fixes
The following two patches fix small issues with the TPM TIS driver.
Regards,
Stefan
PATCH 1/2 Only probe iTPMs
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.
--- drivers/char/tpm/tpm.h | 2 ++ drivers/char/tpm/tpm_tis.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm.h +2 -0
@@ -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 */
drivers/char/tpm/tpm_tis.c +5 -3
@@ -368,6 +368,11 @@ static int probe_itpm(struct tpm_chip *c };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 *c 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;
Rajiv Andrade
AppliedRe: [PATCH 1/2] Only probe iTPMs
Quoted 6 lines · Stefan Berger
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 <[email protected]>
Applied to github.com:srajiv/tpm.git next
Thanks,
Rajiv
PATCH 2/2 tpm_tis: Clean up after module_param cleanup
In reply to Stefan BergerCommit 90ab5ee94171b3e28de6bb42ee30b527014e0be7 changed the itpm module parameter from int to bool. Some other changes need to be done to clean up after this change.
--- drivers/char/tpm/tpm_tis.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/char/tpm/tpm_tis.c +5 -4
@@ -367,7 +367,7 @@ static int probe_itpm(struct tpm_chip *c 0x00, 0x00, 0x00, 0xf1 };size_t len =sizeof (cmd_getticks); -int rem_itpm = itpm; +bool rem_itpm = itpm;u16 vendor =ioread16 (chip->vendor.iobase +TPM_DID_VID (0 ));/* probe only iTPMS */
@@ -510,7 +510,7 @@ static int tpm_tis_init(struct device *d resource_size_t len, unsigned int irq) {u32 vendor, intfcaps, intmask; -int rc, i, irq_s, irq_e; +int rc, i, irq_s, irq_e, probe;struct tpm_chip *chip;if (!(chip =tpm_register_hardware (dev, &tpm_tis)))
@@ -540,11 +540,12 @@ static int tpm_tis_init(struct device *d vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));if (!itpm) { - itpm =probe_itpm (chip); -if (itpm <0 ) { + probe =probe_itpm (chip); +if (probe <0 ) { rc = -ENODEV ; goto out_err; } + itpm = (probe ==0 ) ?0 :1 ; }if (itpm)
Rajiv Andrade
AppliedRe: [PATCH 2/2] tpm_tis: Clean up after module_param cleanup
Quoted 8 lines · Stefan Berger
Commit
90ab5ee94171b3e28de6bb42ee30b527014e0be7changed the itpm module parameter from int to bool. Some other changes need to be done to clean up after this change.Signed-off-by Stefan Berger <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Cc Rusty Russell <[email protected]>
Applied to github.com:srajiv/tpm.git next
Thanks,
Rajiv