]> git.proxmox.com Git - mirror_edk2.git/blame - Vlv2TbltDevicePkg/Library/Tpm2DeviceLibSeCDxe/Tpm2DeviceLibSeC.c
ArmPkg/CompilerIntrinsicsLib: Add uread, uwrite GCC assembly sources
[mirror_edk2.git] / Vlv2TbltDevicePkg / Library / Tpm2DeviceLibSeCDxe / Tpm2DeviceLibSeC.c
CommitLineData
f4e7aa05
TH
1/*++\r
2\r
3Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved\r
4 \r
9dc8036d 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
f4e7aa05
TH
6 \r
7--*/\r
8\r
9#include <Uefi.h>\r
10#include <Protocol/PttPassThru.h>\r
11#include <Library/PcdLib.h>\r
12#include <Library/UefiBootServicesTableLib.h>\r
13//#include <Library/Tpm2DeviceLib.h>\r
14\r
15\r
16PTT_PASS_THRU_PROTOCOL *mPttPassThruProtocol;\r
17\r
18\r
19/**\r
20 The constructor function caches the pointer to PEI services.\r
21\r
22 The constructor function caches the pointer to PEI services.\r
23 It will always return EFI_SUCCESS.\r
24\r
25 @param FfsHeader Pointer to FFS header the loaded driver.\r
26 @param PeiServices Pointer to the PEI services.\r
27\r
28 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
29\r
30**/\r
31\r
32EFI_STATUS\r
33EFIAPI\r
34Tpm2DeviceLibConstructor (\r
35 VOID\r
36 )\r
37{\r
38 EFI_STATUS Status = EFI_SUCCESS;\r
39 \r
40 Status = gBS->LocateProtocol (&gPttPassThruProtocolGuid, NULL, (VOID **) &mPttPassThruProtocol);\r
41 \r
42 return Status;\r
43}\r
44\r
45/**\r
46 This service enables the sending of commands to the TPM2.\r
47\r
48 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.\r
49 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.\r
50 @param[in] OutputParameterBlockSize Size of the TPM2 output parameter block.\r
51 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.\r
52\r
53 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.\r
54 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.\r
55 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.\r
56**/\r
57EFI_STATUS\r
58EFIAPI\r
59Tpm2SubmitCommand (\r
60 IN UINT32 InputParameterBlockSize,\r
61 IN UINT8 *InputParameterBlock,\r
62 IN OUT UINT32 *OutputParameterBlockSize,\r
63 IN UINT8 *OutputParameterBlock\r
64 )\r
65{\r
66 EFI_STATUS Status;\r
67 \r
68 Status = mPttPassThruProtocol->Tpm2SubmitCommand (\r
69 mPttPassThruProtocol,\r
70 InputParameterBlockSize,\r
71 InputParameterBlock,\r
72 OutputParameterBlockSize,\r
73 OutputParameterBlock\r
74 );\r
75\r
76 return Status;\r
77}\r
78\r
79/**\r
80 This service requests use TPM2.\r
81\r
82 @retval EFI_SUCCESS Get the control of TPM2 chip.\r
83 @retval EFI_NOT_FOUND TPM2 not found.\r
84 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
85**/\r
86EFI_STATUS\r
87EFIAPI\r
88Tpm2RequestUseTpm (\r
89 VOID\r
90 )\r
91{\r
92 EFI_STATUS Status;\r
93 \r
94 Status = mPttPassThruProtocol->Tpm2RequestUseTpm (mPttPassThruProtocol);\r
95 \r
96 return Status;\r
97}\r
98\r
99/**\r
100 This service register TPM2 device.\r
101\r
102 @Param Tpm2Device TPM2 device\r
103\r
104 @retval EFI_SUCCESS This TPM2 device is registered successfully.\r
105 @retval EFI_UNSUPPORTED System does not support register this TPM2 device.\r
106 @retval EFI_ALREADY_STARTED System already register this TPM2 device.\r
107**/\r
108EFI_STATUS\r
109EFIAPI\r
110Tpm2RegisterTpm2DeviceLib (\r
111 IN PTT_TPM2_DEVICE_INTERFACE *Tpm2Device\r
112 )\r
113{\r
114 return EFI_UNSUPPORTED;\r
115}\r
116\r
117\r