3 Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Protocol/PttPassThru.h>
11 #include <Library/PcdLib.h>
12 #include <Library/UefiBootServicesTableLib.h>
13 //#include <Library/Tpm2DeviceLib.h>
16 PTT_PASS_THRU_PROTOCOL
*mPttPassThruProtocol
;
20 The constructor function caches the pointer to PEI services.
22 The constructor function caches the pointer to PEI services.
23 It will always return EFI_SUCCESS.
25 @param FfsHeader Pointer to FFS header the loaded driver.
26 @param PeiServices Pointer to the PEI services.
28 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
34 Tpm2DeviceLibConstructor (
38 EFI_STATUS Status
= EFI_SUCCESS
;
40 Status
= gBS
->LocateProtocol (&gPttPassThruProtocolGuid
, NULL
, (VOID
**) &mPttPassThruProtocol
);
46 This service enables the sending of commands to the TPM2.
48 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
49 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
50 @param[in] OutputParameterBlockSize Size of the TPM2 output parameter block.
51 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
53 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
54 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
55 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
60 IN UINT32 InputParameterBlockSize
,
61 IN UINT8
*InputParameterBlock
,
62 IN OUT UINT32
*OutputParameterBlockSize
,
63 IN UINT8
*OutputParameterBlock
68 Status
= mPttPassThruProtocol
->Tpm2SubmitCommand (
70 InputParameterBlockSize
,
72 OutputParameterBlockSize
,
80 This service requests use TPM2.
82 @retval EFI_SUCCESS Get the control of TPM2 chip.
83 @retval EFI_NOT_FOUND TPM2 not found.
84 @retval EFI_DEVICE_ERROR Unexpected device behavior.
94 Status
= mPttPassThruProtocol
->Tpm2RequestUseTpm (mPttPassThruProtocol
);
100 This service register TPM2 device.
102 @Param Tpm2Device TPM2 device
104 @retval EFI_SUCCESS This TPM2 device is registered successfully.
105 @retval EFI_UNSUPPORTED System does not support register this TPM2 device.
106 @retval EFI_ALREADY_STARTED System already register this TPM2 device.
110 Tpm2RegisterTpm2DeviceLib (
111 IN PTT_TPM2_DEVICE_INTERFACE
*Tpm2Device
114 return EFI_UNSUPPORTED
;