History

tpm: fix (ACPI S3) suspend regression

This patch fixes an (ACPI S3) suspend regression introduced in commit 68d6e6713fcb ("tpm: Introduce function to poll for result of self test") and occurring with an Infineon TPM and tpm_tis and tpm_infineon drivers active. The suspend problem occurred if the TPM was disabled and/or deactivated and therefore the TPM_PCRRead checking the result of the (asynchronous) self test returned an error code which then caused the tpm_tis driver to become inactive and this then seemed to have negatively influenced the suspend support by the tpm_infineon driver... Besides that the tpm_tis drive may stay active even if the TPM is disabled and/or deactivated.

Stefan Berger committed 14 years ago

Commit be405411 parent 93c3d652 files · +12 −0Browse files

Unified · Split

2 files
  1. drivers/char/tpm/tpm.c +9 −0
  2. drivers/char/tpm/tpm.h +3 −0
drivers/char/tpm/tpm.c+9−0
@@ -846,6 +846,15 @@ int tpm_do_selftest(struct tpm_chip *chip) · 845 unmodified lines
846846
847847 do {
848848 rc = __tpm_pcr_read(chip, 0, digest);
849+ if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
850+ dev_info(chip->dev,
851+ "TPM is disabled/deactivated (0x%X)\n", rc);
852+ /* TPM is disabled and/or deactivated; driver can
853+ * proceed and TPM does handle commands for
854+ * suspend/resume correctly
855+ */
856+ return 0;
857+ }
849858 if (rc != TPM_WARN_DOING_SELFTEST)
850859 return rc;
851860 msleep(delay_msec);
drivers/char/tpm/tpm.h+3−0
@@ -39,6 +39,9 @@ enum tpm_addr { · 38 unmodified lines
3939 };
4040
4141 #define TPM_WARN_DOING_SELFTEST 0x802
42+#define TPM_ERR_DEACTIVATED 0x6
43+#define TPM_ERR_DISABLED 0x7
44+
4245 #define TPM_HEADER_SIZE 10
4346 extern ssize_t tpm_show_pubek(struct device *, struct device_attribute *attr,
4447 char *);