TianoCore EDK2 master
|
#include <IndustryStandard/Tpm20.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/IoLib.h>
#include <Library/TimerLib.h>
#include <Library/DebugLib.h>
#include <Library/Tpm2DeviceLib.h>
#include <Library/PcdLib.h>
#include <IndustryStandard/TpmPtp.h>
#include <IndustryStandard/TpmTis.h>
#include "Tpm2DeviceLibDTpm.h"
Go to the source code of this file.
Macros | |
#define | PTP_TIMEOUT_MAX (90000 * 1000) |
#define | TPMCMDBUFLENGTH 0x500 |
#define | RETRY_CNT_MAX 3 |
Functions | |
BOOLEAN | Tpm2IsPtpPresence (IN VOID *Reg) |
EFI_STATUS | PtpCrbWaitRegisterBits (IN UINT32 *Register, IN UINT32 BitSet, IN UINT32 BitClear, IN UINT32 TimeOut) |
EFI_STATUS | PtpCrbRequestUseTpm (IN PTP_CRB_REGISTERS_PTR CrbReg) |
EFI_STATUS | PtpCrbTpmCommand (IN PTP_CRB_REGISTERS_PTR CrbReg, IN UINT8 *BufferIn, IN UINT32 SizeIn, IN OUT UINT8 *BufferOut, IN OUT UINT32 *SizeOut) |
EFI_STATUS | Tpm2TisTpmCommand (IN TIS_PC_REGISTERS_PTR TisReg, IN UINT8 *BufferIn, IN UINT32 SizeIn, IN OUT UINT8 *BufferOut, IN OUT UINT32 *SizeOut) |
EFI_STATUS | TisPcRequestUseTpm (IN TIS_PC_REGISTERS_PTR TisReg) |
TPM2_PTP_INTERFACE_TYPE | Tpm2GetPtpInterface (IN VOID *Register) |
UINT8 | Tpm2GetIdleByPass (IN VOID *Register) |
VOID | DumpPtpInfo (IN VOID *Register) |
EFI_STATUS EFIAPI | DTpm2SubmitCommand (IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock) |
EFI_STATUS EFIAPI | DTpm2RequestUseTpm (VOID) |
PTP (Platform TPM Profile) CRB (Command Response Buffer) interface used by dTPM2.0 library.
Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
Copyright (c), Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Tpm2Ptp.c.
EFI_STATUS EFIAPI DTpm2RequestUseTpm | ( | VOID | ) |
EFI_STATUS EFIAPI DTpm2SubmitCommand | ( | IN UINT32 | InputParameterBlockSize, |
IN UINT8 * | InputParameterBlock, | ||
IN OUT UINT32 * | OutputParameterBlockSize, | ||
IN UINT8 * | OutputParameterBlock | ||
) |
This service enables the sending of commands to the TPM2.
[in] | InputParameterBlockSize | Size of the TPM2 input parameter block. |
[in] | InputParameterBlock | Pointer to the TPM2 input parameter block. |
[in,out] | OutputParameterBlockSize | Size of the TPM2 output parameter block. |
[in] | OutputParameterBlock | Pointer to the TPM2 output parameter block. |
EFI_SUCCESS | The command byte stream was successfully sent to the device and a response was successfully received. |
EFI_DEVICE_ERROR | The command was not successfully sent to the device or a response was not successfully received from the device. |
EFI_BUFFER_TOO_SMALL | The output parameter block is too small. |
VOID DumpPtpInfo | ( | IN VOID * | Register | ) |
EFI_STATUS PtpCrbRequestUseTpm | ( | IN PTP_CRB_REGISTERS_PTR | CrbReg | ) |
EFI_STATUS PtpCrbTpmCommand | ( | IN PTP_CRB_REGISTERS_PTR | CrbReg, |
IN UINT8 * | BufferIn, | ||
IN UINT32 | SizeIn, | ||
IN OUT UINT8 * | BufferOut, | ||
IN OUT UINT32 * | SizeOut | ||
) |
Send a command to TPM for execution and return response data.
[in] | CrbReg | TPM register space base address. |
[in] | BufferIn | Buffer for command data. |
[in] | SizeIn | Size of command data. |
[in,out] | BufferOut | Buffer for response data. |
[in,out] | SizeOut | Size of response data. |
EFI_SUCCESS | Operation completed successfully. |
EFI_BUFFER_TOO_SMALL | Response data buffer is too small. |
EFI_DEVICE_ERROR | Unexpected device behavior. |
EFI_UNSUPPORTED | Unsupported TPM version |
EFI_STATUS PtpCrbWaitRegisterBits | ( | IN UINT32 * | Register, |
IN UINT32 | BitSet, | ||
IN UINT32 | BitClear, | ||
IN UINT32 | TimeOut | ||
) |
Check whether the value of a TPM chip register satisfies the input BIT setting.
[in] | Register | Address port of register to be checked. |
[in] | BitSet | Check these data bits are set. |
[in] | BitClear | Check these data bits are clear. |
[in] | TimeOut | The max wait time (unit MicroSecond) when checking register. |
EFI_SUCCESS | The register satisfies the check bit. |
EFI_TIMEOUT | The register can't run into the expected status in time. |
EFI_STATUS TisPcRequestUseTpm | ( | IN TIS_PC_REGISTERS_PTR | TisReg | ) |
Get the control of TPM chip by sending requestUse command TIS_PC_ACC_RQUUSE to ACCESS Register in the time of default TIS_TIMEOUT_A.
[in] | TisReg | Pointer to TIS register. |
EFI_SUCCESS | Get the control of TPM chip. |
EFI_INVALID_PARAMETER | TisReg is NULL. |
EFI_NOT_FOUND | TPM chip doesn't exit. |
EFI_TIMEOUT | Can't get the TPM control in time. |
UINT8 Tpm2GetIdleByPass | ( | IN VOID * | Register | ) |
TPM2_PTP_INTERFACE_TYPE Tpm2GetPtpInterface | ( | IN VOID * | Register | ) |
BOOLEAN Tpm2IsPtpPresence | ( | IN VOID * | Reg | ) |
EFI_STATUS Tpm2TisTpmCommand | ( | IN TIS_PC_REGISTERS_PTR | TisReg, |
IN UINT8 * | BufferIn, | ||
IN UINT32 | SizeIn, | ||
IN OUT UINT8 * | BufferOut, | ||
IN OUT UINT32 * | SizeOut | ||
) |
Send a command to TPM for execution and return response data.
[in] | TisReg | TPM register space base address. |
[in] | BufferIn | Buffer for command data. |
[in] | SizeIn | Size of command data. |
[in,out] | BufferOut | Buffer for response data. |
[in,out] | SizeOut | Size of response data. |
EFI_SUCCESS | Operation completed successfully. |
EFI_BUFFER_TOO_SMALL | Response data buffer is too small. |
EFI_DEVICE_ERROR | Unexpected device behavior. |
EFI_UNSUPPORTED | Unsupported TPM version |