]>
Commit | Line | Data |
---|---|---|
c1d93242 | 1 | /** @file\r |
4ccef561 | 2 | Implement TPM1.2 Ownership related command.\r |
c1d93242 | 3 | \r |
b3548d32 | 4 | Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved. <BR>\r |
c1d93242 JY |
5 | This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT 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 | |
26 | EFI_STATUS\r | |
27 | EFIAPI\r | |
28 | Tpm12ForceClear (\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 | |
b3548d32 | 55 | }\r |