From a595be3a4af116a9559a3868f81dcad55d01b8dd Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Wed, 25 Jan 2023 12:18:36 +0200 Subject: tpm: add a function that performs selftest + startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As described in [0] if a command requires use of an untested algorithm or functional module, the TPM performs the test and then completes the command actions. Since we don't check for TPM_RC_NEEDS_TEST (which is the return code of the TPM in that case) and even if we would, it would complicate our TPM code for no apparent reason, add a wrapper function that performs both the selftest and the startup sequence of the TPM. It's worth noting that this is implemented on TPMv2.0. The code for 1.2 would look similar, but I don't have a device available to test. [0] https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-1-Architecture-01.07-2014-03-13.pdf ยง12.3 Self-test modes Reviewed-by: Simon Glass Signed-off-by: Ilias Apalodimas --- include/tpm_api.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/tpm_api.h') diff --git a/include/tpm_api.h b/include/tpm_api.h index 8979d9d6df..022a8bbaec 100644 --- a/include/tpm_api.h +++ b/include/tpm_api.h @@ -331,4 +331,12 @@ static inline bool tpm_is_v2(struct udevice *dev) return IS_ENABLED(CONFIG_TPM_V2) && tpm_get_version(dev) == TPM_V2; } +/** + * tpm_auto_start() - start up the TPM and perform selftests + * + * @param dev TPM device + * Return: return code of the operation (0 = success) + */ +u32 tpm_auto_start(struct udevice *dev); + #endif /* __TPM_API_H */ -- cgit v1.2.3