Commit b03c4370 authored by Tomas Winkler's avatar Tomas Winkler Committed by Jarkko Sakkinen

tpm: add tpm_auto_startup() into tpm-interface.c

Add wrapper tpm_auto_startup() to tpm-interface.c
instead of open coded decision between TPM 1.x and TPM 2.x
in tpm-chip.c
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Tested-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
parent 9db7fe18
...@@ -451,14 +451,9 @@ int tpm_chip_register(struct tpm_chip *chip) ...@@ -451,14 +451,9 @@ int tpm_chip_register(struct tpm_chip *chip)
{ {
int rc; int rc;
if (chip->ops->flags & TPM_OPS_AUTO_STARTUP) { rc = tpm_auto_startup(chip);
if (chip->flags & TPM_CHIP_FLAG_TPM2) if (rc)
rc = tpm2_auto_startup(chip); return rc;
else
rc = tpm1_auto_startup(chip);
if (rc)
return rc;
}
tpm_sysfs_add_device(chip); tpm_sysfs_add_device(chip);
......
...@@ -544,6 +544,21 @@ int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen) ...@@ -544,6 +544,21 @@ int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen)
} }
EXPORT_SYMBOL_GPL(tpm_send); EXPORT_SYMBOL_GPL(tpm_send);
int tpm_auto_startup(struct tpm_chip *chip)
{
int rc;
if (!(chip->ops->flags & TPM_OPS_AUTO_STARTUP))
return 0;
if (chip->flags & TPM_CHIP_FLAG_TPM2)
rc = tpm2_auto_startup(chip);
else
rc = tpm1_auto_startup(chip);
return rc;
}
/* /*
* We are about to suspend. Save the TPM state * We are about to suspend. Save the TPM state
* so that it can be restored. * so that it can be restored.
......
...@@ -541,6 +541,7 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space, ...@@ -541,6 +541,7 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space,
size_t min_rsp_body_length, unsigned int flags, size_t min_rsp_body_length, unsigned int flags,
const char *desc); const char *desc);
int tpm_get_timeouts(struct tpm_chip *); int tpm_get_timeouts(struct tpm_chip *);
int tpm_auto_startup(struct tpm_chip *chip);
int tpm1_pm_suspend(struct tpm_chip *chip, int tpm_suspend_pcr); int tpm1_pm_suspend(struct tpm_chip *chip, int tpm_suspend_pcr);
int tpm1_auto_startup(struct tpm_chip *chip); int tpm1_auto_startup(struct tpm_chip *chip);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment