2 This library is TPM2 DTPM instance.
3 It can be registered to Tpm2 Device router, to be active TPM2 engine,
4 based on platform setting.
6 Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved. <BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Library/BaseLib.h>
12 #include <Library/BaseMemoryLib.h>
13 #include <Library/DebugLib.h>
14 #include <Library/Tpm2DeviceLib.h>
15 #include <Library/PcdLib.h>
17 #include <Guid/TpmInstance.h>
19 #include "Tpm2DeviceLibDTpm.h"
22 Dump PTP register information.
24 @param[in] Register Pointer to PTP register.
32 This service enables the sending of commands to the TPM2.
34 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
35 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
36 @param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.
37 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
39 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
40 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
41 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
46 IN UINT32 InputParameterBlockSize
,
47 IN UINT8
*InputParameterBlock
,
48 IN OUT UINT32
*OutputParameterBlockSize
,
49 IN UINT8
*OutputParameterBlock
53 This service requests use TPM2.
55 @retval EFI_SUCCESS Get the control of TPM2 chip.
56 @retval EFI_NOT_FOUND TPM2 not found.
57 @retval EFI_DEVICE_ERROR Unexpected device behavior.
65 TPM2_DEVICE_INTERFACE mDTpm2InternalTpm2Device
= {
66 TPM_DEVICE_INTERFACE_TPM20_DTPM
,
72 The function register DTPM2.0 instance and caches current active TPM interface type.
74 @retval EFI_SUCCESS DTPM2.0 instance is registered, or system does not support register DTPM2.0 instance
78 Tpm2InstanceLibDTpmConstructor (
84 Status
= Tpm2RegisterTpm2DeviceLib (&mDTpm2InternalTpm2Device
);
85 if ((Status
== EFI_SUCCESS
) || (Status
== EFI_UNSUPPORTED
)) {
87 // Unsupported means platform policy does not need this instance enabled.
89 if (Status
== EFI_SUCCESS
) {
90 Status
= InternalTpm2DeviceLibDTpmCommonConstructor ();
91 DumpPtpInfo ((VOID
*)(UINTN
)PcdGet64 (PcdTpmBaseAddress
));