2 This library is TPM2 DTPM device lib.
3 Choosing this library means platform uses and only uses DTPM device as TPM2 engine.
5 Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved. <BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/BaseLib.h>
11 #include <Library/BaseMemoryLib.h>
12 #include <Library/DebugLib.h>
13 #include <Library/Tpm2DeviceLib.h>
14 #include <Library/PcdLib.h>
16 #include "Tpm2DeviceLibDTpm.h"
19 This service enables the sending of commands to the TPM2.
21 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
22 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
23 @param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.
24 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
26 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
27 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
28 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
33 IN UINT32 InputParameterBlockSize
,
34 IN UINT8
*InputParameterBlock
,
35 IN OUT UINT32
*OutputParameterBlockSize
,
36 IN UINT8
*OutputParameterBlock
40 This service requests use TPM2.
42 @retval EFI_SUCCESS Get the control of TPM2 chip.
43 @retval EFI_NOT_FOUND TPM2 not found.
44 @retval EFI_DEVICE_ERROR Unexpected device behavior.
53 This service enables the sending of commands to the TPM2.
55 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
56 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
57 @param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.
58 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
60 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
61 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
62 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
67 IN UINT32 InputParameterBlockSize
,
68 IN UINT8
*InputParameterBlock
,
69 IN OUT UINT32
*OutputParameterBlockSize
,
70 IN UINT8
*OutputParameterBlock
73 return DTpm2SubmitCommand (
74 InputParameterBlockSize
,
76 OutputParameterBlockSize
,
82 This service requests use TPM2.
84 @retval EFI_SUCCESS Get the control of TPM2 chip.
85 @retval EFI_NOT_FOUND TPM2 not found.
86 @retval EFI_DEVICE_ERROR Unexpected device behavior.
94 return DTpm2RequestUseTpm ();
98 This service register TPM2 device.
100 @param Tpm2Device TPM2 device
102 @retval EFI_SUCCESS This TPM2 device is registered successfully.
103 @retval EFI_UNSUPPORTED System does not support register this TPM2 device.
104 @retval EFI_ALREADY_STARTED System already register this TPM2 device.
108 Tpm2RegisterTpm2DeviceLib (
109 IN TPM2_DEVICE_INTERFACE
*Tpm2Device
112 return EFI_UNSUPPORTED
;
116 The function caches current active TPM interface type.
118 @retval EFI_SUCCESS DTPM2.0 instance is registered, or system does not support register DTPM2.0 instance
122 Tpm2DeviceLibConstructor (
126 return InternalTpm2DeviceLibDTpmCommonConstructor ();