TianoCore EDK2 master
Loading...
Searching...
No Matches
Tpm12Tis.c File Reference

Go to the source code of this file.

Macros

#define TPMCMDBUFLENGTH   1024
 

Enumerations

enum  PTP_INTERFACE_TYPE { PtpInterfaceTis , PtpInterfaceFifo , PtpInterfaceCrb , PtpInterfaceMax }
 

Functions

BOOLEAN Tpm12TisPcPresenceCheck (IN TIS_PC_REGISTERS_PTR TisReg)
 
PTP_INTERFACE_TYPE Tpm12GetPtpInterface (IN VOID *Register)
 
EFI_STATUS Tpm12TisPcWaitRegisterBits (IN UINT8 *Register, IN UINT8 BitSet, IN UINT8 BitClear, IN UINT32 TimeOut)
 
EFI_STATUS Tpm12TisPcReadBurstCount (IN TIS_PC_REGISTERS_PTR TisReg, OUT UINT16 *BurstCount)
 
EFI_STATUS Tpm12TisPcPrepareCommand (IN TIS_PC_REGISTERS_PTR TisReg)
 
EFI_STATUS Tpm12TisPcRequestUseTpm (IN TIS_PC_REGISTERS_PTR TisReg)
 
EFI_STATUS Tpm12TisTpmCommand (IN TIS_PC_REGISTERS_PTR TisReg, IN UINT8 *BufferIn, IN UINT32 SizeIn, IN OUT UINT8 *BufferOut, IN OUT UINT32 *SizeOut)
 
EFI_STATUS EFIAPI Tpm12SubmitCommand (IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock)
 
EFI_STATUS Tpm12PtpCrbWaitRegisterBits (IN UINT32 *Register, IN UINT32 BitSet, IN UINT32 BitClear, IN UINT32 TimeOut)
 
EFI_STATUS Tpm12PtpCrbRequestUseTpm (IN PTP_CRB_REGISTERS_PTR CrbReg)
 
EFI_STATUS EFIAPI Tpm12RequestUseTpm (VOID)
 

Detailed Description

TIS (TPM Interface Specification) functions used by TPM1.2.

Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Tpm12Tis.c.

Macro Definition Documentation

◆ TPMCMDBUFLENGTH

#define TPMCMDBUFLENGTH   1024

Definition at line 33 of file Tpm12Tis.c.

Enumeration Type Documentation

◆ PTP_INTERFACE_TYPE

enum PTP_INTERFACE_TYPE

Definition at line 23 of file Tpm12Tis.c.

Function Documentation

◆ Tpm12GetPtpInterface()

PTP_INTERFACE_TYPE Tpm12GetPtpInterface ( IN VOID *  Register)

Return PTP interface type.

Parameters
[in]RegisterPointer to PTP register.
Returns
PTP interface type.

Definition at line 62 of file Tpm12Tis.c.

◆ Tpm12PtpCrbRequestUseTpm()

EFI_STATUS Tpm12PtpCrbRequestUseTpm ( IN PTP_CRB_REGISTERS_PTR  CrbReg)

Get the control of TPM chip.

Parameters
[in]CrbRegPointer to CRB register.
Return values
EFI_SUCCESSGet the control of TPM chip.
EFI_INVALID_PARAMETERCrbReg is NULL.
EFI_NOT_FOUNDTPM chip doesn't exit.
EFI_TIMEOUTCan't get the TPM control in time.

Definition at line 530 of file Tpm12Tis.c.

◆ Tpm12PtpCrbWaitRegisterBits()

EFI_STATUS Tpm12PtpCrbWaitRegisterBits ( 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.

Parameters
[in]RegisterAddress port of register to be checked.
[in]BitSetCheck these data bits are set.
[in]BitClearCheck these data bits are clear.
[in]TimeOutThe max wait time (unit MicroSecond) when checking register.
Return values
EFI_SUCCESSThe register satisfies the check bit.
EFI_TIMEOUTThe register can't run into the expected status in time.

Definition at line 497 of file Tpm12Tis.c.

◆ Tpm12RequestUseTpm()

EFI_STATUS EFIAPI Tpm12RequestUseTpm ( VOID  )

This service requests use TPM12.

Return values
EFI_SUCCESSGet the control of TPM12 chip.
EFI_NOT_FOUNDTPM12 not found.
EFI_DEVICE_ERRORUnexpected device behavior.

Definition at line 555 of file Tpm12Tis.c.

◆ Tpm12SubmitCommand()

EFI_STATUS EFIAPI Tpm12SubmitCommand ( IN UINT32  InputParameterBlockSize,
IN UINT8 *  InputParameterBlock,
IN OUT UINT32 *  OutputParameterBlockSize,
IN UINT8 *  OutputParameterBlock 
)

This service enables the sending of commands to the TPM12.

Parameters
[in]InputParameterBlockSizeSize of the TPM12 input parameter block.
[in]InputParameterBlockPointer to the TPM12 input parameter block.
[in,out]OutputParameterBlockSizeSize of the TPM12 output parameter block.
[in]OutputParameterBlockPointer to the TPM12 output parameter block.
Return values
EFI_SUCCESSThe command byte stream was successfully sent to the device and a response was successfully received.
EFI_DEVICE_ERRORThe command was not successfully sent to the device or a response was not successfully received from the device.
EFI_BUFFER_TOO_SMALLThe output parameter block is too small.

Definition at line 453 of file Tpm12Tis.c.

◆ Tpm12TisPcPrepareCommand()

EFI_STATUS Tpm12TisPcPrepareCommand ( IN TIS_PC_REGISTERS_PTR  TisReg)

Set TPM chip to ready state by sending ready command TIS_PC_STS_READY to Status Register in time.

Parameters
[in]TisRegPointer to TIS register.
Return values
EFI_SUCCESSTPM chip enters into ready state.
EFI_INVALID_PARAMETERTisReg is NULL.
EFI_TIMEOUTTPM chip can't be set to ready state in time.

Definition at line 191 of file Tpm12Tis.c.

◆ Tpm12TisPcPresenceCheck()

BOOLEAN Tpm12TisPcPresenceCheck ( IN TIS_PC_REGISTERS_PTR  TisReg)

Check whether TPM chip exist.

Parameters
[in]TisRegPointer to TIS register.
Return values
TRUETPM chip exists.
FALSETPM chip is not found.

Definition at line 44 of file Tpm12Tis.c.

◆ Tpm12TisPcReadBurstCount()

EFI_STATUS Tpm12TisPcReadBurstCount ( IN TIS_PC_REGISTERS_PTR  TisReg,
OUT UINT16 *  BurstCount 
)

Get BurstCount by reading the burstCount field of a TIS register in the time of default TIS_TIMEOUT_D.

Parameters
[in]TisRegPointer to TIS register.
[out]BurstCountPointer to a buffer to store the got BurstCount.
Return values
EFI_SUCCESSGet BurstCount.
EFI_INVALID_PARAMETERTisReg is NULL or BurstCount is NULL.
EFI_TIMEOUTBurstCount can't be got in time.

Definition at line 147 of file Tpm12Tis.c.

◆ Tpm12TisPcRequestUseTpm()

EFI_STATUS Tpm12TisPcRequestUseTpm ( 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.

Parameters
[in]TisRegPointer to TIS register.
Return values
EFI_SUCCESSGet the control of TPM chip.
EFI_INVALID_PARAMETERTisReg is NULL.
EFI_NOT_FOUNDTPM chip doesn't exit.
EFI_TIMEOUTCan't get the TPM control in time.

Definition at line 223 of file Tpm12Tis.c.

◆ Tpm12TisPcWaitRegisterBits()

EFI_STATUS Tpm12TisPcWaitRegisterBits ( IN UINT8 *  Register,
IN UINT8  BitSet,
IN UINT8  BitClear,
IN UINT32  TimeOut 
)

Check whether the value of a TPM chip register satisfies the input BIT setting.

Parameters
[in]RegisterAddress port of register to be checked.
[in]BitSetCheck these data bits are set.
[in]BitClearCheck these data bits are clear.
[in]TimeOutThe max wait time (unit MicroSecond) when checking register.
Return values
EFI_SUCCESSThe register satisfies the check bit.
EFI_TIMEOUTThe register can't run into the expected status in time.

Definition at line 113 of file Tpm12Tis.c.

◆ Tpm12TisTpmCommand()

EFI_STATUS Tpm12TisTpmCommand ( 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.

Parameters
[in]TisRegTPM register space base address.
[in]BufferInBuffer for command data.
[in]SizeInSize of command data.
[in,out]BufferOutBuffer for response data.
[in,out]SizeOutSize of response data.
Return values
EFI_SUCCESSOperation completed successfully.
EFI_BUFFER_TOO_SMALLResponse data buffer is too small.
EFI_DEVICE_ERRORUnexpected device behavior.
EFI_UNSUPPORTEDUnsupported TPM version

Definition at line 263 of file Tpm12Tis.c.