TianoCore EDK2 master
Loading...
Searching...
No Matches
TpmCommLib.h
Go to the documentation of this file.
1
10#ifndef _TPM_COMM_LIB_H_
11#define _TPM_COMM_LIB_H_
12
14
15typedef EFI_HANDLE TIS_TPM_HANDLE;
16
20#define TPM_BASE_ADDRESS 0xfed40000
21
22//
23// Set structure alignment to 1-byte
24//
25#pragma pack (1)
26
27//
28// Register set map as specified in TIS specification Chapter 10
29//
30typedef struct {
34 UINT8 Access; // 0
35 UINT8 Reserved1[7]; // 1
39 UINT32 IntEnable; // 8
43 UINT8 IntVector; // 0ch
44 UINT8 Reserved2[3]; // 0dh
48 UINT32 IntSts; // 10h
52 UINT32 IntfCapability; // 14h
56 UINT8 Status; // 18h
60 UINT16 BurstCount; // 19h
61 UINT8 Reserved3[9];
65 UINT32 DataFifo; // 24
66 UINT8 Reserved4[0xed8]; // 28h
70 UINT16 Vid; // 0f00h
74 UINT16 Did; // 0f02h
78 UINT8 Rid; // 0f04h
82 UINT8 TcgDefined[0x7b]; // 0f05h
86 UINT32 LegacyAddress1; // 0f80h
90 UINT32 LegacyAddress1Ex; // 0f84h
94 UINT32 LegacyAddress2; // 0f88h
98 UINT32 LegacyAddress2Ex; // 0f8ch
102 UINT8 VendorDefined[0x70]; // 0f90h
104
105//
106// Restore original structure alignment
107//
108#pragma pack ()
109
110//
111// Define pointer types used to access TIS registers on PC
112//
114
115//
116// TCG Platform Type based on TCG ACPI Specification Version 1.00
117//
118#define TCG_PLATFORM_TYPE_CLIENT 0
119#define TCG_PLATFORM_TYPE_SERVER 1
120
121//
122// Define bits of ACCESS and STATUS registers
123//
124
128#define TIS_PC_VALID BIT7
132#define TIS_PC_ACC_ACTIVE BIT5
137#define TIS_PC_ACC_SEIZED BIT4
143#define TIS_PC_ACC_SEIZE BIT3
147#define TIS_PC_ACC_PENDIND BIT2
151#define TIS_PC_ACC_RQUUSE BIT1
155#define TIS_PC_ACC_ESTABLISH BIT0
156
161#define TIS_PC_STS_READY BIT6
165#define TIS_PC_STS_GO BIT5
169#define TIS_PC_STS_DATA BIT4
173#define TIS_PC_STS_EXPECT BIT3
177#define TIS_PC_STS_RETRY BIT1
178
179//
180// Default TimeOut value
181//
182#define TIS_TIMEOUT_A 750 * 1000 // 750ms
183#define TIS_TIMEOUT_B 2000 * 1000 // 2s
184#define TIS_TIMEOUT_C 750 * 1000 // 750ms
185#define TIS_TIMEOUT_D 750 * 1000 // 750ms
186
187//
188// Max TPM command/response length
189//
190#define TPMCMDBUFLENGTH 1024
191
204EFIAPI
206 IN UINT8 *Register,
207 IN UINT8 BitSet,
208 IN UINT8 BitClear,
209 IN UINT32 TimeOut
210 );
211
224EFIAPI
227 OUT UINT16 *BurstCount
228 );
229
241EFIAPI
244 );
245
258EFIAPI
261 );
262
274EFIAPI
276 IN CONST UINT8 *Data,
277 IN UINTN DataLen,
278 OUT TPM_DIGEST *Digest
279 );
280
281#endif
UINT64 UINTN
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_STATUS EFIAPI Register(IN EFI_PEI_RSC_HANDLER_CALLBACK Callback)
EFI_STATUS EFIAPI TisPcWaitRegisterBits(IN UINT8 *Register, IN UINT8 BitSet, IN UINT8 BitClear, IN UINT32 TimeOut)
Definition: Tpm2Tis.c:60
EFI_STATUS EFIAPI TpmCommHashAll(IN CONST UINT8 *Data, IN UINTN DataLen, OUT TPM_DIGEST *Digest)
Definition: TpmComm.c:23
EFI_STATUS EFIAPI TisPcPrepareCommand(IN TIS_PC_REGISTERS_PTR TisReg)
Definition: Tpm2Tis.c:138
EFI_STATUS EFIAPI TisPcRequestUseTpm(IN TIS_PC_REGISTERS_PTR TisReg)
Definition: Tpm2Tis.c:170
EFI_STATUS EFIAPI TisPcReadBurstCount(IN TIS_PC_REGISTERS_PTR TisReg, OUT UINT16 *BurstCount)
Definition: Tpm2Tis.c:94
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33