3 Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Protocol/PttPassThru.h>
17 #include <Library/PcdLib.h>
18 #include <Library/UefiBootServicesTableLib.h>
19 //#include <Library/Tpm2DeviceLib.h>
22 PTT_PASS_THRU_PROTOCOL
*mPttPassThruProtocol
;
26 The constructor function caches the pointer to PEI services.
28 The constructor function caches the pointer to PEI services.
29 It will always return EFI_SUCCESS.
31 @param FfsHeader Pointer to FFS header the loaded driver.
32 @param PeiServices Pointer to the PEI services.
34 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
40 Tpm2DeviceLibConstructor (
44 EFI_STATUS Status
= EFI_SUCCESS
;
46 Status
= gBS
->LocateProtocol (&gPttPassThruProtocolGuid
, NULL
, (VOID
**) &mPttPassThruProtocol
);
52 This service enables the sending of commands to the TPM2.
54 @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
55 @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
56 @param[in] OutputParameterBlockSize Size of the TPM2 output parameter block.
57 @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
59 @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
60 @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
61 @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
66 IN UINT32 InputParameterBlockSize
,
67 IN UINT8
*InputParameterBlock
,
68 IN OUT UINT32
*OutputParameterBlockSize
,
69 IN UINT8
*OutputParameterBlock
74 Status
= mPttPassThruProtocol
->Tpm2SubmitCommand (
76 InputParameterBlockSize
,
78 OutputParameterBlockSize
,
86 This service requests use TPM2.
88 @retval EFI_SUCCESS Get the control of TPM2 chip.
89 @retval EFI_NOT_FOUND TPM2 not found.
90 @retval EFI_DEVICE_ERROR Unexpected device behavior.
100 Status
= mPttPassThruProtocol
->Tpm2RequestUseTpm (mPttPassThruProtocol
);
106 This service register TPM2 device.
108 @Param Tpm2Device TPM2 device
110 @retval EFI_SUCCESS This TPM2 device is registered successfully.
111 @retval EFI_UNSUPPORTED System does not support register this TPM2 device.
112 @retval EFI_ALREADY_STARTED System already register this TPM2 device.
116 Tpm2RegisterTpm2DeviceLib (
117 IN PTT_TPM2_DEVICE_INTERFACE
*Tpm2Device
120 return EFI_UNSUPPORTED
;