]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Include/Library/Tpm2DeviceLib.h
SecurityPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / SecurityPkg / Include / Library / Tpm2DeviceLib.h
CommitLineData
c1d93242
JY
1/** @file\r
2 This library abstract how to access TPM2 hardware device.\r
3\r
f15cb995 4Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved. <BR>\r
289b714b 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
c1d93242
JY
6\r
7**/\r
8\r
9#ifndef _TPM2_DEVICE_LIB_H_\r
10#define _TPM2_DEVICE_LIB_H_\r
11\r
12#include <Uefi.h>\r
13\r
f15cb995
ZC
14//\r
15// Used in PcdActiveTpmInterfaceType to identify TPM interface type\r
16//\r
17typedef enum {\r
18 Tpm2PtpInterfaceTis,\r
19 Tpm2PtpInterfaceFifo,\r
20 Tpm2PtpInterfaceCrb,\r
21 Tpm2PtpInterfaceMax,\r
22} TPM2_PTP_INTERFACE_TYPE;\r
23\r
c1d93242
JY
24/**\r
25 This service enables the sending of commands to the TPM2.\r
26\r
27 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.\r
28 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.\r
29 @param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.\r
30 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.\r
31\r
32 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.\r
33 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.\r
b3548d32 34 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.\r
c1d93242
JY
35**/\r
36EFI_STATUS\r
37EFIAPI\r
38Tpm2SubmitCommand (\r
39 IN UINT32 InputParameterBlockSize,\r
40 IN UINT8 *InputParameterBlock,\r
41 IN OUT UINT32 *OutputParameterBlockSize,\r
42 IN UINT8 *OutputParameterBlock\r
43 );\r
44\r
45/**\r
46 This service requests use TPM2.\r
47\r
48 @retval EFI_SUCCESS Get the control of TPM2 chip.\r
49 @retval EFI_NOT_FOUND TPM2 not found.\r
50 @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
51**/\r
52EFI_STATUS\r
53EFIAPI\r
54Tpm2RequestUseTpm (\r
55 VOID\r
56 );\r
57\r
58/**\r
59 This service enables the sending of commands to the TPM2.\r
60\r
61 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.\r
62 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.\r
63 @param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.\r
64 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.\r
65\r
66 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.\r
67 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.\r
b3548d32 68 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.\r
c1d93242
JY
69**/\r
70typedef\r
71EFI_STATUS\r
72(EFIAPI *TPM2_SUBMIT_COMMAND) (\r
73 IN UINT32 InputParameterBlockSize,\r
74 IN UINT8 *InputParameterBlock,\r
75 IN OUT UINT32 *OutputParameterBlockSize,\r
76 IN UINT8 *OutputParameterBlock\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
86typedef\r
87EFI_STATUS\r
88(EFIAPI *TPM2_REQUEST_USE_TPM) (\r
89 VOID\r
90 );\r
91\r
92typedef struct {\r
93 EFI_GUID ProviderGuid;\r
94 TPM2_SUBMIT_COMMAND Tpm2SubmitCommand;\r
95 TPM2_REQUEST_USE_TPM Tpm2RequestUseTpm;\r
96} TPM2_DEVICE_INTERFACE;\r
97\r
98/**\r
99 This service register TPM2 device.\r
100\r
101 @param Tpm2Device TPM2 device\r
102\r
103 @retval EFI_SUCCESS This TPM2 device is registered successfully.\r
104 @retval EFI_UNSUPPORTED System does not support register this TPM2 device.\r
105 @retval EFI_ALREADY_STARTED System already register this TPM2 device.\r
106**/\r
107EFI_STATUS\r
108EFIAPI\r
109Tpm2RegisterTpm2DeviceLib (\r
110 IN TPM2_DEVICE_INTERFACE *Tpm2Device\r
111 );\r
112\r
113#endif\r