]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Library/Tpm12CommandLib/Tpm12Ownership.c
SecurityPkg Tpm2DeviceLibDTpm: Update enum type name to match the one in lib
[mirror_edk2.git] / SecurityPkg / Library / Tpm12CommandLib / Tpm12Ownership.c
CommitLineData
c1d93242 1/** @file\r
4ccef561 2 Implement TPM1.2 Ownership related command.\r
c1d93242 3\r
4ccef561 4Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved. <BR>\r
c1d93242
JY
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
83b9662f 15#include <PiPei.h>\r
c1d93242
JY
16#include <Library/BaseMemoryLib.h>\r
17#include <Library/BaseLib.h>\r
18#include <Library/Tpm12DeviceLib.h>\r
19\r
c1d93242
JY
20/**\r
21 Send ForceClear command to TPM1.2.\r
22\r
23 @retval EFI_SUCCESS Operation completed successfully.\r
24 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
25**/\r
26EFI_STATUS\r
27EFIAPI\r
28Tpm12ForceClear (\r
29 VOID\r
30 )\r
31{\r
83b9662f
MK
32 EFI_STATUS Status;\r
33 TPM_RQU_COMMAND_HDR Command;\r
34 TPM_RSP_COMMAND_HDR Response;\r
35 UINT32 Length;\r
c1d93242
JY
36\r
37 //\r
38 // send Tpm command TPM_ORD_ForceClear\r
39 //\r
83b9662f
MK
40 Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);\r
41 Command.paramSize = SwapBytes32 (sizeof (Command));\r
42 Command.ordinal = SwapBytes32 (TPM_ORD_ForceClear);\r
43 Length = sizeof (Response);\r
c1d93242 44\r
83b9662f 45 Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);\r
c1d93242
JY
46 if (EFI_ERROR (Status)) {\r
47 return Status;\r
48 }\r
83b9662f 49 switch (SwapBytes32 (Response.returnCode)) {\r
c1d93242
JY
50 case TPM_SUCCESS:\r
51 return EFI_SUCCESS;\r
52 default:\r
53 return EFI_DEVICE_ERROR;\r
54 }\r
55}