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

Go to the source code of this file.

Macros

#define TIS_TIMEOUT_MAX   (90000 * 1000)
 
#define TPMCMDBUFLENGTH   0x500
 

Functions

BOOLEAN TisPcPresenceCheck (IN TIS_PC_REGISTERS_PTR TisReg)
 
EFI_STATUS TisPcWaitRegisterBits (IN UINT8 *Register, IN UINT8 BitSet, IN UINT8 BitClear, IN UINT32 TimeOut)
 
EFI_STATUS TisPcReadBurstCount (IN TIS_PC_REGISTERS_PTR TisReg, OUT UINT16 *BurstCount)
 
EFI_STATUS TisPcPrepareCommand (IN TIS_PC_REGISTERS_PTR TisReg)
 
EFI_STATUS TisPcRequestUseTpm (IN TIS_PC_REGISTERS_PTR TisReg)
 
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 EFIAPI DTpm2TisSubmitCommand (IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock)
 
EFI_STATUS EFIAPI DTpm2TisRequestUseTpm (VOID)
 

Detailed Description

TIS (TPM Interface Specification) functions used by dTPM2.0 library.

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 Tpm2Tis.c.

Macro Definition Documentation

◆ TIS_TIMEOUT_MAX

#define TIS_TIMEOUT_MAX   (90000 * 1000)

Definition at line 22 of file Tpm2Tis.c.

◆ TPMCMDBUFLENGTH

#define TPMCMDBUFLENGTH   0x500

Definition at line 27 of file Tpm2Tis.c.

Function Documentation

◆ DTpm2TisRequestUseTpm()

EFI_STATUS EFIAPI DTpm2TisRequestUseTpm ( VOID  )

This service requests use TPM2.

Return values
EFI_SUCCESSGet the control of TPM2 chip.
EFI_NOT_FOUNDTPM2 not found.
EFI_DEVICE_ERRORUnexpected device behavior.

Definition at line 449 of file Tpm2Tis.c.

◆ DTpm2TisSubmitCommand()

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

This service enables the sending of commands to the TPM2.

Parameters
[in]InputParameterBlockSizeSize of the TPM2 input parameter block.
[in]InputParameterBlockPointer to the TPM2 input parameter block.
[in,out]OutputParameterBlockSizeSize of the TPM2 output parameter block.
[in]OutputParameterBlockPointer to the TPM2 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 424 of file Tpm2Tis.c.

◆ TisPcPrepareCommand()

EFI_STATUS TisPcPrepareCommand ( 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 138 of file Tpm2Tis.c.

◆ TisPcPresenceCheck()

BOOLEAN TisPcPresenceCheck ( 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 38 of file Tpm2Tis.c.

◆ TisPcReadBurstCount()

EFI_STATUS TisPcReadBurstCount ( 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 94 of file Tpm2Tis.c.

◆ TisPcRequestUseTpm()

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.

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 170 of file Tpm2Tis.c.

◆ TisPcWaitRegisterBits()

EFI_STATUS TisPcWaitRegisterBits ( 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 60 of file Tpm2Tis.c.

◆ Tpm2TisTpmCommand()

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.

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 210 of file Tpm2Tis.c.