summaryrefslogtreecommitdiff
path: root/src/security/tpm/tspi/tspi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/security/tpm/tspi/tspi.c')
-rw-r--r--src/security/tpm/tspi/tspi.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/security/tpm/tspi/tspi.c b/src/security/tpm/tspi/tspi.c
index 1a0f1d5c88..56b8fa8ede 100644
--- a/src/security/tpm/tspi/tspi.c
+++ b/src/security/tpm/tspi/tspi.c
@@ -17,6 +17,9 @@ static tpm_result_t tpm1_invoke_state_machine(void)
uint8_t deactivated;
tpm_result_t rc = TPM_SUCCESS;
+ if (tlcl_get_family() != TPM_1)
+ return rc;
+
/* Check that the TPM is enabled and activated. */
rc = tlcl1_get_flags(&disabled, &deactivated, NULL);
if (rc != TPM_SUCCESS) {
@@ -199,19 +202,19 @@ tpm_result_t tpm_clear_and_reenable(void)
return rc;
}
-#if CONFIG(TPM1)
- rc = tlcl1_set_enable();
- if (rc != TPM_SUCCESS) {
- printk(BIOS_ERR, "TPM Error (%#x): Can't set enabled state.\n", rc);
- return rc;
- }
+ if (tlcl_get_family() == TPM_1) {
+ rc = tlcl1_set_enable();
+ if (rc != TPM_SUCCESS) {
+ printk(BIOS_ERR, "TPM Error (%#x): Can't set enabled state.\n", rc);
+ return rc;
+ }
- rc = tlcl1_set_deactivated(0);
- if (rc != TPM_SUCCESS) {
- printk(BIOS_ERR, "TPM Error (%#x): Can't set deactivated state.\n", rc);
- return rc;
+ rc = tlcl1_set_deactivated(0);
+ if (rc != TPM_SUCCESS) {
+ printk(BIOS_ERR, "TPM Error (%#x): Can't set deactivated state.\n", rc);
+ return rc;
+ }
}
-#endif
return TPM_SUCCESS;
}