TianoCore EDK2 master
Loading...
Searching...
No Matches
TpmPtp.h
Go to the documentation of this file.
1
10#ifndef _TPM_PTP_H_
11#define _TPM_PTP_H_
12
13//
14// PTP FIFO definition
15//
16
17//
18// Set structure alignment to 1-byte
19//
20#pragma pack (1)
21
22//
23// Register set map as specified in PTP specification Chapter 5
24//
25typedef struct {
29 UINT8 Access; // 0
30 UINT8 Reserved1[7]; // 1
34 UINT32 IntEnable; // 8
38 UINT8 IntVector; // 0ch
39 UINT8 Reserved2[3]; // 0dh
43 UINT32 IntSts; // 10h
47 UINT32 InterfaceCapability; // 14h
51 UINT8 Status; // 18h
55 UINT16 BurstCount; // 19h
59 UINT8 StatusEx; // 1Bh
60 UINT8 Reserved3[8];
64 UINT32 DataFifo; // 24h
65 UINT8 Reserved4[8]; // 28h
69 UINT32 InterfaceId; // 30h
70 UINT8 Reserved5[0x4c]; // 34h
74 UINT32 XDataFifo; // 80h
75 UINT8 Reserved6[0xe7c]; // 84h
79 UINT16 Vid; // 0f00h
83 UINT16 Did; // 0f02h
87 UINT8 Rid; // 0f04h
88 UINT8 Reserved[0xfb]; // 0f05h
90
91//
92// Restore original structure alignment
93//
94#pragma pack ()
95
96//
97// Define pointer types used to access TIS registers on PC
98//
100
101//
102// Define bits of FIFO Interface Identifier Register
103//
104typedef union {
105 struct {
106 UINT32 InterfaceType : 4;
107 UINT32 InterfaceVersion : 4;
108 UINT32 CapLocality : 1;
109 UINT32 Reserved1 : 2;
110 UINT32 CapDataXferSizeSupport : 2;
111 UINT32 CapFIFO : 1;
112 UINT32 CapCRB : 1;
113 UINT32 CapIFRes : 2;
114 UINT32 InterfaceSelector : 2;
115 UINT32 IntfSelLock : 1;
116 UINT32 Reserved2 : 4;
117 UINT32 Reserved3 : 8;
118 } Bits;
119 UINT32 Uint32;
121
122//
123// Define bits of FIFO Interface Capability Register
124//
125typedef union {
126 struct {
127 UINT32 DataAvailIntSupport : 1;
128 UINT32 StsValidIntSupport : 1;
129 UINT32 LocalityChangeIntSupport : 1;
130 UINT32 InterruptLevelHigh : 1;
131 UINT32 InterruptLevelLow : 1;
132 UINT32 InterruptEdgeRising : 1;
133 UINT32 InterruptEdgeFalling : 1;
134 UINT32 CommandReadyIntSupport : 1;
135 UINT32 BurstCountStatic : 1;
136 UINT32 DataTransferSizeSupport : 2;
137 UINT32 Reserved : 17;
138 UINT32 InterfaceVersion : 3;
139 UINT32 Reserved2 : 1;
140 } Bits;
141 UINT32 Uint32;
143
147#define INTERFACE_CAPABILITY_INTERFACE_VERSION_TIS_12 0x0
148#define INTERFACE_CAPABILITY_INTERFACE_VERSION_TIS_13 0x2
149#define INTERFACE_CAPABILITY_INTERFACE_VERSION_PTP 0x3
150
151//
152// Define bits of ACCESS and STATUS registers
153//
154
158#define PTP_FIFO_VALID BIT7
162#define PTP_FIFO_ACC_ACTIVE BIT5
167#define PTP_FIFO_ACC_SEIZED BIT4
173#define PTP_FIFO_ACC_SEIZE BIT3
177#define PTP_FIFO_ACC_PENDIND BIT2
181#define PTP_FIFO_ACC_RQUUSE BIT1
185#define PTP_FIFO_ACC_ESTABLISH BIT0
186
190#define PTP_FIFO_STS_VALID BIT7
195#define PTP_FIFO_STS_READY BIT6
199#define PTP_FIFO_STS_GO BIT5
203#define PTP_FIFO_STS_DATA BIT4
207#define PTP_FIFO_STS_EXPECT BIT3
211#define PTP_FIFO_STS_SELFTEST_DONE BIT2
215#define PTP_FIFO_STS_RETRY BIT1
216
222#define PTP_FIFO_STS_EX_TPM_FAMILY (BIT2 | BIT3)
223#define PTP_FIFO_STS_EX_TPM_FAMILY_OFFSET (2)
224#define PTP_FIFO_STS_EX_TPM_FAMILY_TPM12 (0)
225#define PTP_FIFO_STS_EX_TPM_FAMILY_TPM20 (BIT2)
230#define PTP_FIFO_STS_EX_CANCEL BIT0
231
232//
233// PTP CRB definition
234//
235
236//
237// Set structure alignment to 1-byte
238//
239#pragma pack (1)
240
241//
242// Register set map as specified in PTP specification Chapter 5
243//
244typedef struct {
248 UINT32 LocalityState; // 0
249 UINT8 Reserved1[4]; // 4
253 UINT32 LocalityControl; // 8
257 UINT32 LocalityStatus; // 0ch
258 UINT8 Reserved2[0x20]; // 10h
262 UINT32 InterfaceId; // 30h
266 UINT16 Vid; // 34h
270 UINT16 Did; // 36h
274 UINT64 CrbControlExtension; // 38h
278 UINT32 CrbControlRequest; // 40h
282 UINT32 CrbControlStatus; // 44h
286 UINT32 CrbControlCancel; // 48h
290 UINT32 CrbControlStart; // 4Ch
294 UINT32 CrbInterruptEnable; // 50h
295 UINT32 CrbInterruptStatus; // 54h
304 UINT32 CrbControlCommandAddressHigh; // 60h
313 UINT8 Reserved4[0x10]; // 70h
317 UINT8 CrbDataBuffer[0xF80]; // 80h
319
320//
321// Define pointer types used to access CRB registers on PTP
322//
324
325//
326// Define bits of CRB Interface Identifier Register
327//
328typedef union {
329 struct {
330 UINT32 InterfaceType : 4;
331 UINT32 InterfaceVersion : 4;
332 UINT32 CapLocality : 1;
333 UINT32 CapCRBIdleBypass : 1;
334 UINT32 Reserved1 : 1;
335 UINT32 CapDataXferSizeSupport : 2;
336 UINT32 CapFIFO : 1;
337 UINT32 CapCRB : 1;
338 UINT32 CapIFRes : 2;
339 UINT32 InterfaceSelector : 2;
340 UINT32 IntfSelLock : 1;
341 UINT32 Reserved2 : 4;
342 UINT32 Rid : 8;
343 } Bits;
344 UINT32 Uint32;
346
350#define PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_FIFO 0x0
351#define PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_CRB 0x1
352#define PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_TIS 0xF
353
357#define PTP_INTERFACE_IDENTIFIER_INTERFACE_VERSION_FIFO 0x0
358#define PTP_INTERFACE_IDENTIFIER_INTERFACE_VERSION_CRB 0x1
359
363#define PTP_INTERFACE_IDENTIFIER_INTERFACE_SELECTOR_FIFO 0x0
364#define PTP_INTERFACE_IDENTIFIER_INTERFACE_SELECTOR_CRB 0x1
365
366//
367// Define bits of Locality State Register
368//
369
373#define PTP_CRB_LOCALITY_STATE_TPM_REG_VALID_STATUS BIT7
374
382#define PTP_CRB_LOCALITY_STATE_ACTIVE_LOCALITY_MASK (BIT2 | BIT3 | BIT4)
383#define PTP_CRB_LOCALITY_STATE_ACTIVE_LOCALITY_0 (0)
384#define PTP_CRB_LOCALITY_STATE_ACTIVE_LOCALITY_1 (BIT2)
385#define PTP_CRB_LOCALITY_STATE_ACTIVE_LOCALITY_2 (BIT3)
386#define PTP_CRB_LOCALITY_STATE_ACTIVE_LOCALITY_3 (BIT2 | BIT3)
387#define PTP_CRB_LOCALITY_STATE_ACTIVE_LOCALITY_4 (BIT4)
388
393#define PTP_CRB_LOCALITY_STATE_LOCALITY_ASSIGNED BIT1
394
399#define PTP_CRB_LOCALITY_STATE_TPM_ESTABLISHED BIT0
400
401//
402// Define bits of Locality Control Register
403//
404
408#define PTP_CRB_LOCALITY_CONTROL_RESET_ESTABLISHMENT_BIT BIT3
409
413#define PTP_CRB_LOCALITY_CONTROL_SEIZE BIT2
414
418#define PTP_CRB_LOCALITY_CONTROL_RELINQUISH BIT1
419
423#define PTP_CRB_LOCALITY_CONTROL_REQUEST_ACCESS BIT0
424
425//
426// Define bits of Locality Status Register
427//
428
433#define PTP_CRB_LOCALITY_STATUS_BEEN_SEIZED BIT1
434
439#define PTP_CRB_LOCALITY_STATUS_GRANTED BIT0
440
441//
442// Define bits of CRB Control Area Request Register
443//
444
451#define PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE BIT1
452
459#define PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY BIT0
460
461//
462// Define bits of CRB Control Area Status Register
463//
464
471#define PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE BIT1
472
478#define PTP_CRB_CONTROL_AREA_STATUS_TPM_STATUS BIT0
479
480//
481// Define bits of CRB Control Cancel Register
482//
483
489#define PTP_CRB_CONTROL_CANCEL BIT0
490
491//
492// Define bits of CRB Control Start Register
493//
494
500#define PTP_CRB_CONTROL_START BIT0
501
502//
503// Restore original structure alignment
504//
505#pragma pack ()
506
507//
508// Default TimeOut value
509//
510#define PTP_TIMEOUT_A (750 * 1000) // 750ms
511#define PTP_TIMEOUT_B (2000 * 1000) // 2s
512#define PTP_TIMEOUT_C (200 * 1000) // 200ms
513#define PTP_TIMEOUT_D (30 * 1000) // 30ms
514
515#endif
UINT32 CrbControlStart
Definition: TpmPtp.h:290
UINT32 CrbControlCommandAddressLow
Definition: TpmPtp.h:303
UINT64 CrbControlResponseAddrss
Definition: TpmPtp.h:312
UINT32 CrbControlStatus
Definition: TpmPtp.h:282
UINT64 CrbControlExtension
Definition: TpmPtp.h:274
UINT32 CrbControlRequest
Definition: TpmPtp.h:278
UINT32 LocalityStatus
Definition: TpmPtp.h:257
UINT32 InterfaceId
Definition: TpmPtp.h:262
UINT32 CrbControlCommandSize
Definition: TpmPtp.h:299
UINT32 CrbControlCancel
Definition: TpmPtp.h:286
UINT32 LocalityState
Definition: TpmPtp.h:248
UINT32 CrbInterruptEnable
Definition: TpmPtp.h:294
UINT32 CrbControlResponseSize
Definition: TpmPtp.h:308
UINT32 LocalityControl
Definition: TpmPtp.h:253
UINT8 IntVector
Definition: TpmPtp.h:38
UINT8 StatusEx
Definition: TpmPtp.h:59
UINT32 InterfaceCapability
Definition: TpmPtp.h:47
UINT16 BurstCount
Definition: TpmPtp.h:55
UINT32 XDataFifo
Definition: TpmPtp.h:74
UINT32 IntEnable
Definition: TpmPtp.h:34
UINT32 IntSts
Definition: TpmPtp.h:43
UINT32 InterfaceId
Definition: TpmPtp.h:69
UINT32 DataFifo
Definition: TpmPtp.h:64