]>
Commit | Line | Data |
---|---|---|
83b9662f MK |
1 | /** @file\r |
2 | Implement TPM1.2 NV Self Test related commands.\r | |
3 | \r | |
8b17ad86 | 4 | Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved. <BR>\r |
fd338d8b | 5 | (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r |
289b714b | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
83b9662f MK |
7 | \r |
8 | **/\r | |
9 | \r | |
10 | #include <PiPei.h>\r | |
11 | #include <Library/Tpm12CommandLib.h>\r | |
12 | #include <Library/BaseLib.h>\r | |
8b17ad86 | 13 | #include <Library/DebugLib.h>\r |
83b9662f MK |
14 | #include <Library/Tpm12DeviceLib.h>\r |
15 | \r | |
16 | /**\r | |
17 | Send TPM_ContinueSelfTest command to TPM.\r | |
18 | \r | |
19 | @retval EFI_SUCCESS Operation completed successfully.\r | |
20 | @retval EFI_TIMEOUT The register can't run into the expected status in time.\r | |
21 | @retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.\r | |
22 | @retval EFI_DEVICE_ERROR Unexpected device behavior.\r | |
23 | \r | |
24 | **/\r | |
25 | EFI_STATUS\r | |
26 | EFIAPI\r | |
27 | Tpm12ContinueSelfTest (\r | |
28 | VOID\r | |
29 | )\r | |
30 | {\r | |
8b17ad86 | 31 | EFI_STATUS Status;\r |
83b9662f MK |
32 | TPM_RQU_COMMAND_HDR Command;\r |
33 | TPM_RSP_COMMAND_HDR Response;\r | |
34 | UINT32 Length;\r | |
35 | \r | |
36 | //\r | |
37 | // send Tpm command TPM_ORD_ContinueSelfTest\r | |
38 | //\r | |
39 | Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);\r | |
40 | Command.paramSize = SwapBytes32 (sizeof (Command));\r | |
41 | Command.ordinal = SwapBytes32 (TPM_ORD_ContinueSelfTest);\r | |
fd338d8b | 42 | Length = sizeof (Response);\r |
8b17ad86 MK |
43 | Status = Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);\r |
44 | if (EFI_ERROR (Status)) {\r | |
45 | return Status;\r | |
46 | }\r | |
47 | \r | |
48 | if (SwapBytes32 (Response.returnCode) != TPM_SUCCESS) {\r | |
49 | DEBUG ((DEBUG_ERROR, "Tpm12ContinueSelfTest: Response Code error! 0x%08x\r\n", SwapBytes32 (Response.returnCode)));\r | |
50 | return EFI_DEVICE_ERROR;\r | |
51 | }\r | |
52 | \r | |
53 | return Status;\r | |
83b9662f | 54 | }\r |