SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c File Reference


Data Structures

struct  TIS_PC_REGISTERS

Defines

#define TIS_PC_VALID   BIT7
#define TIS_PC_ACC_ACTIVE   BIT5
#define TIS_PC_ACC_SEIZED   BIT4
#define TIS_PC_ACC_SEIZE   BIT3
#define TIS_PC_ACC_PENDIND   BIT2
#define TIS_PC_ACC_RQUUSE   BIT1
#define TIS_PC_ACC_ESTABLISH   BIT0
#define TIS_PC_STS_READY   BIT6
#define TIS_PC_STS_GO   BIT5
#define TIS_PC_STS_DATA   BIT4
#define TIS_PC_STS_EXPECT   BIT3
#define TIS_PC_STS_RETRY   BIT1
#define TIS_TIMEOUT_A   (750 * 1000)
#define TIS_TIMEOUT_B   (2000 * 1000)
#define TIS_TIMEOUT_C   (750 * 1000)
#define TIS_TIMEOUT_D   (750 * 1000)
#define TPMCMDBUFLENGTH   1024

Typedefs

typedef TIS_PC_REGISTERSTIS_PC_REGISTERS_PTR

Functions

BOOLEAN Tpm12TisPcPresenceCheck (IN TIS_PC_REGISTERS_PTR TisReg)
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 EFIAPI Tpm12RequestUseTpm (VOID)

Detailed Description

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

Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Define Documentation

#define TIS_PC_ACC_ACTIVE   BIT5

Indicate that this locality is active.

#define TIS_PC_ACC_ESTABLISH   BIT0

A value of 1 indicates that a T/OS has not been established on the platform

#define TIS_PC_ACC_PENDIND   BIT2

When this bit is 1, another locality is requesting usage of the TPM.

#define TIS_PC_ACC_RQUUSE   BIT1

Set to 1 to indicate that this locality is requesting to use TPM.

#define TIS_PC_ACC_SEIZE   BIT3

Set to 1 to indicate that TPM MUST reset the TIS_PC_ACC_ACTIVE bit and remove ownership for localities less than the locality that is writing this bit.

#define TIS_PC_ACC_SEIZED   BIT4

Set to 1 to indicate that this locality had the TPM taken away while this locality had the TIS_PC_ACC_ACTIVE bit set.

#define TIS_PC_STS_DATA   BIT4

This bit indicates that the TPM has data available as a response.

#define TIS_PC_STS_EXPECT   BIT3

The TPM sets this bit to a value of 1 when it expects another byte of data for a command.

#define TIS_PC_STS_GO   BIT5

Write a 1 to this bit to cause the TPM to execute that command.

#define TIS_PC_STS_READY   BIT6

When this bit is 1, TPM is in the Ready state, indicating it is ready to receive a new command.

#define TIS_PC_STS_RETRY   BIT1

Writes a 1 to this bit to force the TPM to re-send the response.

#define TIS_PC_VALID   BIT7

This bit is a 1 to indicate that the other bits in this register are valid.

#define TIS_TIMEOUT_A   (750 * 1000)

#define TIS_TIMEOUT_B   (2000 * 1000)

#define TIS_TIMEOUT_C   (750 * 1000)

#define TIS_TIMEOUT_D   (750 * 1000)

#define TPMCMDBUFLENGTH   1024


Typedef Documentation


Function Documentation

EFI_STATUS EFIAPI Tpm12RequestUseTpm ( VOID   ) 

This service requests use TPM12.

Return values:
EFI_SUCCESS Get the control of TPM12 chip.
EFI_NOT_FOUND TPM12 not found.
EFI_DEVICE_ERROR Unexpected device behavior.

References Tpm12TisPcRequestUseTpm(), and UINTN().

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] InputParameterBlockSize Size of the TPM12 input parameter block.
[in] InputParameterBlock Pointer to the TPM12 input parameter block.
[in,out] OutputParameterBlockSize Size of the TPM12 output parameter block.
[in] OutputParameterBlock Pointer to the TPM12 output parameter block.
Return values:
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.

References Tpm12TisTpmCommand(), and UINTN().

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] TisReg Pointer to TIS register.
Return values:
EFI_SUCCESS TPM chip enters into ready state.
EFI_INVALID_PARAMETER TisReg is NULL.
EFI_TIMEOUT TPM chip can't be set to ready state in time.

References EFI_STATUS(), TIS_PC_STS_READY, TIS_TIMEOUT_B, Tpm12TisPcWaitRegisterBits(), and UINTN().

Referenced by Tpm12TisTpmCommand().

BOOLEAN Tpm12TisPcPresenceCheck ( IN TIS_PC_REGISTERS_PTR  TisReg  ) 

Check whether TPM chip exist.

Parameters:
[in] TisReg Pointer to TIS register.
Return values:
TRUE TPM chip exists.
FALSE TPM chip is not found.

References BOOLEAN(), and UINTN().

Referenced by Tpm12TisPcRequestUseTpm().

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

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

Parameters:
[in] TisReg Pointer to TIS register.
[out] BurstCount Pointer to a buffer to store the got BurstConut.
Return values:
EFI_SUCCESS Get BurstCount.
EFI_INVALID_PARAMETER TisReg is NULL or BurstCount is NULL.
EFI_TIMEOUT BurstCount can't be got in time.

References TIS_TIMEOUT_D, and UINTN().

Referenced by Tpm12TisTpmCommand().

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] TisReg Pointer to TIS register.
Return values:
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.

References EFI_STATUS(), TIS_PC_ACC_ACTIVE, TIS_PC_ACC_RQUUSE, TIS_PC_VALID, TIS_TIMEOUT_A, Tpm12TisPcPresenceCheck(), Tpm12TisPcWaitRegisterBits(), and UINTN().

Referenced by Tpm12RequestUseTpm().

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] 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.
Return values:
EFI_SUCCESS The register satisfies the check bit.
EFI_TIMEOUT The register can't run into the expected status in time.

References UINTN().

Referenced by Tpm12TisPcPrepareCommand(), Tpm12TisPcRequestUseTpm(), and 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] 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.
Return values:
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

References EFI_STATUS(), TIS_PC_STS_DATA, TIS_PC_STS_EXPECT, TIS_PC_STS_GO, TIS_PC_STS_READY, TIS_PC_VALID, TIS_TIMEOUT_B, TIS_TIMEOUT_C, Tpm12TisPcPrepareCommand(), Tpm12TisPcReadBurstCount(), Tpm12TisPcWaitRegisterBits(), and UINTN().

Referenced by Tpm12SubmitCommand().


Generated on Thu Sep 24 23:44:24 2015 for SecurityPkg[ALL] by  doxygen 1.5.7.1