]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/Library/Tpm12CommandLib/Tpm12SelfTest.c
cd08d193ab876261a7401562e4025306bb42a203
[mirror_edk2.git] / SecurityPkg / Library / Tpm12CommandLib / Tpm12SelfTest.c
1 /** @file
2 Implement TPM1.2 NV Self Test related commands.
3
4 Copyright (c) 2016, Intel Corporation. All rights reserved. <BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include <PiPei.h>
16 #include <Library/Tpm12CommandLib.h>
17 #include <Library/BaseLib.h>
18 #include <Library/Tpm12DeviceLib.h>
19
20 /**
21 Send TPM_ContinueSelfTest command to TPM.
22
23 @retval EFI_SUCCESS Operation completed successfully.
24 @retval EFI_TIMEOUT The register can't run into the expected status in time.
25 @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.
26 @retval EFI_DEVICE_ERROR Unexpected device behavior.
27
28 **/
29 EFI_STATUS
30 EFIAPI
31 Tpm12ContinueSelfTest (
32 VOID
33 )
34 {
35 TPM_RQU_COMMAND_HDR Command;
36 TPM_RSP_COMMAND_HDR Response;
37 UINT32 Length;
38
39 //
40 // send Tpm command TPM_ORD_ContinueSelfTest
41 //
42 Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
43 Command.paramSize = SwapBytes32 (sizeof (Command));
44 Command.ordinal = SwapBytes32 (TPM_ORD_ContinueSelfTest);
45 return Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
46 }