2 Implement TPM2 Test related command.
4 Copyright (c) 2013, Intel Corporation. All rights reserved. <BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include <IndustryStandard/UefiTcgPlatform.h>
10 #include <Library/Tpm2CommandLib.h>
11 #include <Library/Tpm2DeviceLib.h>
12 #include <Library/BaseMemoryLib.h>
13 #include <Library/BaseLib.h>
14 #include <Library/DebugLib.h>
19 TPM2_COMMAND_HEADER Header
;
21 } TPM2_SELF_TEST_COMMAND
;
24 TPM2_RESPONSE_HEADER Header
;
25 } TPM2_SELF_TEST_RESPONSE
;
30 This command causes the TPM to perform a test of its capabilities.
31 If the fullTest is YES, the TPM will test all functions.
32 If fullTest = NO, the TPM will only test those functions that have not previously been tested.
34 @param[in] FullTest YES if full test to be performed
35 NO if only test of untested functions required
37 @retval EFI_SUCCESS Operation completed successfully.
38 @retval EFI_DEVICE_ERROR Unexpected device behavior.
43 IN TPMI_YES_NO FullTest
47 TPM2_SELF_TEST_COMMAND Cmd
;
48 TPM2_SELF_TEST_RESPONSE Res
;
51 Cmd
.Header
.tag
= SwapBytes16(TPM_ST_NO_SESSIONS
);
52 Cmd
.Header
.paramSize
= SwapBytes32(sizeof(Cmd
));
53 Cmd
.Header
.commandCode
= SwapBytes32(TPM_CC_SelfTest
);
54 Cmd
.FullTest
= FullTest
;
56 ResultBufSize
= sizeof(Res
);
57 Status
= Tpm2SubmitCommand (sizeof(Cmd
), (UINT8
*)&Cmd
, &ResultBufSize
, (UINT8
*)&Res
);