]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.c
SecurityPkg: Add TPM PTP support in TPM2 device lib.
[mirror_edk2.git] / SecurityPkg / Library / Tpm2DeviceLibDTpm / Tpm2DeviceLibDTpm.c
CommitLineData
c1d93242
JY
1/** @file\r
2 Ihis library is TPM2 DTPM device lib.\r
3 Choosing this library means platform uses and only uses DTPM device as TPM2 engine.\r
4\r
5Copyright (c) 2013, Intel Corporation. All rights reserved. <BR>\r
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 <Library/BaseLib.h>\r
17#include <Library/BaseMemoryLib.h>\r
18#include <Library/DebugLib.h>\r
19#include <Library/Tpm2DeviceLib.h>\r
20\r
21/**\r
22 This service enables the sending of commands to the TPM2.\r
23\r
24 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.\r
25 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.\r
26 @param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.\r
27 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.\r
28\r
29 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.\r
30 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.\r
31 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. \r
32**/\r
33EFI_STATUS\r
34EFIAPI\r
35DTpm2SubmitCommand (\r
36 IN UINT32 InputParameterBlockSize,\r
37 IN UINT8 *InputParameterBlock,\r
38 IN OUT UINT32 *OutputParameterBlockSize,\r
39 IN UINT8 *OutputParameterBlock\r
40 );\r
41\r
42/**\r
43 This service requests use TPM2.\r
44\r
45 @retval EFI_SUCCESS Get the control of TPM2 chip.\r
46 @retval EFI_NOT_FOUND TPM2 not found.\r
47 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
48**/\r
49EFI_STATUS\r
50EFIAPI\r
51DTpm2RequestUseTpm (\r
52 VOID\r
53 );\r
54\r
55/**\r
56 This service enables the sending of commands to the TPM2.\r
57\r
58 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.\r
59 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.\r
60 @param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.\r
61 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.\r
62\r
63 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.\r
64 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.\r
65 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. \r
66**/\r
67EFI_STATUS\r
68EFIAPI\r
69Tpm2SubmitCommand (\r
70 IN UINT32 InputParameterBlockSize,\r
71 IN UINT8 *InputParameterBlock,\r
72 IN OUT UINT32 *OutputParameterBlockSize,\r
73 IN UINT8 *OutputParameterBlock\r
74 )\r
75{\r
76 return DTpm2SubmitCommand (\r
77 InputParameterBlockSize,\r
78 InputParameterBlock,\r
79 OutputParameterBlockSize,\r
80 OutputParameterBlock\r
81 );\r
82}\r
83\r
84/**\r
85 This service requests use TPM2.\r
86\r
87 @retval EFI_SUCCESS Get the control of TPM2 chip.\r
88 @retval EFI_NOT_FOUND TPM2 not found.\r
89 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
90**/\r
91EFI_STATUS\r
92EFIAPI\r
93Tpm2RequestUseTpm (\r
94 VOID\r
95 )\r
96{\r
97 return DTpm2RequestUseTpm ();\r
98}\r
99\r
100/**\r
101 This service register TPM2 device.\r
102\r
103 @param Tpm2Device TPM2 device\r
104\r
105 @retval EFI_SUCCESS This TPM2 device is registered successfully.\r
106 @retval EFI_UNSUPPORTED System does not support register this TPM2 device.\r
107 @retval EFI_ALREADY_STARTED System already register this TPM2 device.\r
108**/\r
109EFI_STATUS\r
110EFIAPI\r
111Tpm2RegisterTpm2DeviceLib (\r
112 IN TPM2_DEVICE_INTERFACE *Tpm2Device\r
113 )\r
114{\r
115 return EFI_UNSUPPORTED;\r
116}\r