diff options
author | Simon Glass <sjg@chromium.org> | 2018-11-23 21:29:32 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-12-05 06:01:34 -0700 |
commit | 0a60a0a65fa98f265c79f3928d8628aabcba8a92 (patch) | |
tree | 5a7c28336bc8ab523acbff7c67d56478f9aef249 /lib/tpm-common.c | |
parent | 40e9ede1dcd852a97d772b8d592e36195c5d8b80 (diff) | |
download | u-boot-0a60a0a65fa98f265c79f3928d8628aabcba8a92.tar.gz u-boot-0a60a0a65fa98f265c79f3928d8628aabcba8a92.tar.bz2 u-boot-0a60a0a65fa98f265c79f3928d8628aabcba8a92.zip |
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>
Diffstat (limited to 'lib/tpm-common.c')
-rw-r--r-- | lib/tpm-common.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/tpm-common.c b/lib/tpm-common.c index 6afe59b1fe..2bf0b41e26 100644 --- a/lib/tpm-common.c +++ b/lib/tpm-common.c @@ -12,6 +12,13 @@ #include <tpm-common.h> #include "tpm-utils.h" +enum tpm_version tpm_get_version(struct udevice *dev) +{ + struct tpm_chip_priv *priv = dev_get_uclass_priv(dev); + + return priv->version; +} + int pack_byte_string(u8 *str, size_t size, const char *format, ...) { va_list args; |