]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.c
0b1723e4a1c6b031d2ca294966fdec0e2104ec78
[mirror_edk2.git] / SecurityPkg / Library / Tpm2DeviceLibDTpm / Tpm2DeviceLibDTpm.c
1 /** @file
2 This library is TPM2 DTPM device lib.
3 Choosing this library means platform uses and only uses DTPM device as TPM2 engine.
4
5 Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved. <BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #include <Library/BaseLib.h>
17 #include <Library/BaseMemoryLib.h>
18 #include <Library/DebugLib.h>
19 #include <Library/Tpm2DeviceLib.h>
20
21 /**
22 This service enables the sending of commands to the TPM2.
23
24 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
25 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
26 @param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.
27 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
28
29 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
30 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
31 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
32 **/
33 EFI_STATUS
34 EFIAPI
35 DTpm2SubmitCommand (
36 IN UINT32 InputParameterBlockSize,
37 IN UINT8 *InputParameterBlock,
38 IN OUT UINT32 *OutputParameterBlockSize,
39 IN UINT8 *OutputParameterBlock
40 );
41
42 /**
43 This service requests use TPM2.
44
45 @retval EFI_SUCCESS Get the control of TPM2 chip.
46 @retval EFI_NOT_FOUND TPM2 not found.
47 @retval EFI_DEVICE_ERROR Unexpected device behavior.
48 **/
49 EFI_STATUS
50 EFIAPI
51 DTpm2RequestUseTpm (
52 VOID
53 );
54
55 /**
56 This service enables the sending of commands to the TPM2.
57
58 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
59 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
60 @param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.
61 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
62
63 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
64 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
65 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
66 **/
67 EFI_STATUS
68 EFIAPI
69 Tpm2SubmitCommand (
70 IN UINT32 InputParameterBlockSize,
71 IN UINT8 *InputParameterBlock,
72 IN OUT UINT32 *OutputParameterBlockSize,
73 IN UINT8 *OutputParameterBlock
74 )
75 {
76 return DTpm2SubmitCommand (
77 InputParameterBlockSize,
78 InputParameterBlock,
79 OutputParameterBlockSize,
80 OutputParameterBlock
81 );
82 }
83
84 /**
85 This service requests use TPM2.
86
87 @retval EFI_SUCCESS Get the control of TPM2 chip.
88 @retval EFI_NOT_FOUND TPM2 not found.
89 @retval EFI_DEVICE_ERROR Unexpected device behavior.
90 **/
91 EFI_STATUS
92 EFIAPI
93 Tpm2RequestUseTpm (
94 VOID
95 )
96 {
97 return DTpm2RequestUseTpm ();
98 }
99
100 /**
101 This service register TPM2 device.
102
103 @param Tpm2Device TPM2 device
104
105 @retval EFI_SUCCESS This TPM2 device is registered successfully.
106 @retval EFI_UNSUPPORTED System does not support register this TPM2 device.
107 @retval EFI_ALREADY_STARTED System already register this TPM2 device.
108 **/
109 EFI_STATUS
110 EFIAPI
111 Tpm2RegisterTpm2DeviceLib (
112 IN TPM2_DEVICE_INTERFACE *Tpm2Device
113 )
114 {
115 return EFI_UNSUPPORTED;
116 }