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