1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

tpm: Remove use of build-time TPM versions

There is only one place in the code which assumes at build-time that we
are using either a v1 or a v2 TPM. Fix this up and add a new function to
return the version of a TPM.

Supported TPM versions (v1 and v2) can be enabled independently and it is
possible to use both versions at once. This is useful for sandbox when
running tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2018-11-23 21:29:32 -07:00
parent 40e9ede1dc
commit 0a60a0a65f
3 changed files with 29 additions and 11 deletions

View File

@@ -79,19 +79,19 @@ u32 tpm_clear_and_reenable(struct udevice *dev)
return ret;
}
#if IS_ENABLED(CONFIG_TPM_V1)
ret = tpm_physical_enable(dev);
if (ret != TPM_SUCCESS) {
log_err("TPM: Can't set enabled state\n");
return ret;
}
if (tpm_get_version(dev) == TPM_V1) {
ret = tpm_physical_enable(dev);
if (ret != TPM_SUCCESS) {
log_err("TPM: Can't set enabled state\n");
return ret;
}
ret = tpm_physical_set_deactivated(dev, 0);
if (ret != TPM_SUCCESS) {
log_err("TPM: Can't set deactivated state\n");
return ret;
ret = tpm_physical_set_deactivated(dev, 0);
if (ret != TPM_SUCCESS) {
log_err("TPM: Can't set deactivated state\n");
return ret;
}
}
#endif
return TPM_SUCCESS;
}