aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tpm-v2.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2018-05-15 11:57:13 +0200
committerTom Rini <trini@konsulko.com>2018-05-25 20:12:57 -0400
commit2dc6d97e1edd50634fa9f3dba4746d77cb1b9328 (patch)
tree22aebd86494f681574b1495482dc67b0e79421ea /lib/tpm-v2.c
parent1922df201003b8736579aed70148a283bb62e33f (diff)
downloadu-boot-midas-2dc6d97e1edd50634fa9f3dba4746d77cb1b9328.tar.gz
u-boot-midas-2dc6d97e1edd50634fa9f3dba4746d77cb1b9328.tar.bz2
u-boot-midas-2dc6d97e1edd50634fa9f3dba4746d77cb1b9328.zip
tpm: add TPM2_SelfTest command support
Add support for the TPM2_Selftest command. Change the command file and the help accordingly. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'lib/tpm-v2.c')
-rw-r--r--lib/tpm-v2.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c
index 1a81177f75..a317e03607 100644
--- a/lib/tpm-v2.c
+++ b/lib/tpm-v2.c
@@ -30,3 +30,15 @@ u32 tpm2_startup(enum tpm2_startup_types mode)
return 0;
}
+
+u32 tpm2_self_test(enum tpm2_yes_no full_test)
+{
+ const u8 command_v2[12] = {
+ tpm_u16(TPM2_ST_NO_SESSIONS),
+ tpm_u32(11),
+ tpm_u32(TPM2_CC_SELF_TEST),
+ full_test,
+ };
+
+ return tpm_sendrecv_command(command_v2, NULL, NULL);
+}