XenevaOS
Loading...
Searching...
No Matches
TpmPtp.h
Go to the documentation of this file.
1
16#ifndef _TPM_PTP_H_
17#define _TPM_PTP_H_
18
19//
20// PTP FIFO definition
21//
22
23//
24// Set structure alignment to 1-byte
25//
26#pragma pack (1)
27
28//
29// Register set map as specified in PTP specification Chapter 5
30//
31typedef struct {
45 UINT8 Reserved2[3]; // 0dh
49 UINT32 IntSts; // 10h
57 UINT8 Status; // 18h
66 UINT8 Reserved3[8];
71 UINT8 Reserved4[8]; // 28h
76 UINT8 Reserved5[0x4c]; // 34h
81 UINT8 Reserved6[0xe7c]; // 84h
85 UINT16 Vid; // 0f00h
89 UINT16 Did; // 0f02h
93 UINT8 Rid; // 0f04h
94 UINT8 Reserved[0xfb]; // 0f05h
96
97//
98// Restore original structure alignment
99//
100#pragma pack ()
101
102//
103// Define pointer types used to access TIS registers on PC
104//
106
107//
108// Define bits of FIFO Interface Identifier Register
109//
127
128//
129// Define bits of FIFO Interface Capability Register
130//
149
153#define INTERFACE_CAPABILITY_INTERFACE_VERSION_TIS_12 0x0
154#define INTERFACE_CAPABILITY_INTERFACE_VERSION_TIS_13 0x2
155#define INTERFACE_CAPABILITY_INTERFACE_VERSION_PTP 0x3
156
157
158//
159// Define bits of ACCESS and STATUS registers
160//
161
165#define PTP_FIFO_VALID BIT7
169#define PTP_FIFO_ACC_ACTIVE BIT5
174#define PTP_FIFO_ACC_SEIZED BIT4
180#define PTP_FIFO_ACC_SEIZE BIT3
184#define PTP_FIFO_ACC_PENDIND BIT2
188#define PTP_FIFO_ACC_RQUUSE BIT1
192#define PTP_FIFO_ACC_ESTABLISH BIT0
193
197#define PTP_FIFO_STS_VALID BIT7
202#define PTP_FIFO_STS_READY BIT6
206#define PTP_FIFO_STS_GO BIT5
210#define PTP_FIFO_STS_DATA BIT4
214#define PTP_FIFO_STS_EXPECT BIT3
218#define PTP_FIFO_STS_SELFTEST_DONE BIT2
222#define PTP_FIFO_STS_RETRY BIT1
223
229#define PTP_FIFO_STS_EX_TPM_FAMILY (BIT2 | BIT3)
230#define PTP_FIFO_STS_EX_TPM_FAMILY_OFFSET (2)
231#define PTP_FIFO_STS_EX_TPM_FAMILY_TPM12 (0)
232#define PTP_FIFO_STS_EX_TPM_FAMILY_TPM20 (BIT2)
237#define PTP_FIFO_STS_EX_CANCEL BIT0
238
239
240//
241// PTP CRB definition
242//
243
244//
245// Set structure alignment to 1-byte
246//
247#pragma pack (1)
248
249//
250// Register set map as specified in PTP specification Chapter 5
251//
327
328//
329// Define pointer types used to access CRB registers on PTP
330//
332
333//
334// Define bits of CRB Interface Identifier Register
335//
354
358#define PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_FIFO 0x0
359#define PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_CRB 0x1
360#define PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_TIS 0xF
361
365#define PTP_INTERFACE_IDENTIFIER_INTERFACE_VERSION_FIFO 0x0
366#define PTP_INTERFACE_IDENTIFIER_INTERFACE_VERSION_CRB 0x1
367
371#define PTP_INTERFACE_IDENTIFIER_INTERFACE_SELECTOR_FIFO 0x0
372#define PTP_INTERFACE_IDENTIFIER_INTERFACE_SELECTOR_CRB 0x1
373
374//
375// Define bits of Locality State Register
376//
377
381#define PTP_CRB_LOCALITY_STATE_TPM_REG_VALID_STATUS BIT7
382
390#define PTP_CRB_LOCALITY_STATE_ACTIVE_LOCALITY_MASK (BIT2 | BIT3 | BIT4)
391#define PTP_CRB_LOCALITY_STATE_ACTIVE_LOCALITY_0 (0)
392#define PTP_CRB_LOCALITY_STATE_ACTIVE_LOCALITY_1 (BIT2)
393#define PTP_CRB_LOCALITY_STATE_ACTIVE_LOCALITY_2 (BIT3)
394#define PTP_CRB_LOCALITY_STATE_ACTIVE_LOCALITY_3 (BIT2 | BIT3)
395#define PTP_CRB_LOCALITY_STATE_ACTIVE_LOCALITY_4 (BIT4)
396
401#define PTP_CRB_LOCALITY_STATE_LOCALITY_ASSIGNED BIT1
402
407#define PTP_CRB_LOCALITY_STATE_TPM_ESTABLISHED BIT0
408
409//
410// Define bits of Locality Control Register
411//
412
416#define PTP_CRB_LOCALITY_CONTROL_RESET_ESTABLISHMENT_BIT BIT3
417
421#define PTP_CRB_LOCALITY_CONTROL_SEIZE BIT2
422
426#define PTP_CRB_LOCALITY_CONTROL_RELINQUISH BIT1
427
431#define PTP_CRB_LOCALITY_CONTROL_REQUEST_ACCESS BIT0
432
433//
434// Define bits of Locality Status Register
435//
436
441#define PTP_CRB_LOCALITY_STATUS_BEEN_SEIZED BIT1
442
447#define PTP_CRB_LOCALITY_STATUS_GRANTED BIT0
448
449//
450// Define bits of CRB Control Area Request Register
451//
452
459#define PTP_CRB_CONTROL_AREA_REQUEST_GO_IDLE BIT1
460
467#define PTP_CRB_CONTROL_AREA_REQUEST_COMMAND_READY BIT0
468
469//
470// Define bits of CRB Control Area Status Register
471//
472
479#define PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE BIT1
480
486#define PTP_CRB_CONTROL_AREA_STATUS_TPM_STATUS BIT0
487
488//
489// Define bits of CRB Control Cancel Register
490//
491
497#define PTP_CRB_CONTROL_CANCEL BIT0
498
499//
500// Define bits of CRB Control Start Register
501//
502
508#define PTP_CRB_CONTROL_START BIT0
509
510//
511// Restore original structure alignment
512//
513#pragma pack ()
514
515//
516// Default TimeOut value
517//
518#define PTP_TIMEOUT_A (750 * 1000) // 750ms
519#define PTP_TIMEOUT_B (2000 * 1000) // 2s
520#define PTP_TIMEOUT_C (200 * 1000) // 200ms
521#define PTP_TIMEOUT_D (30 * 1000) // 30ms
522
523#endif
unsigned int UINT32
Definition ProcessorBind.h:102
PACKED struct @21::@35 Bits
UINT8 Reserved
Definition Acpi30.h:40
uint32_t Reserved1
Definition pe.h:18
PTP_FIFO_REGISTERS * PTP_FIFO_REGISTERS_PTR
Definition TpmPtp.h:105
PTP_CRB_REGISTERS * PTP_CRB_REGISTERS_PTR
Definition TpmPtp.h:331
unsigned short UINT16
Definition actypes.h:237
unsigned char UINT8
Definition actypes.h:236
COMPILER_DEPENDENT_UINT64 UINT64
Definition actypes.h:239
Definition TpmPtp.h:252
UINT32 CrbControlStart
Definition TpmPtp.h:298
UINT32 CrbControlCommandAddressLow
Definition TpmPtp.h:311
UINT64 CrbControlResponseAddrss
Definition TpmPtp.h:320
UINT32 CrbControlStatus
Definition TpmPtp.h:290
UINT64 CrbControlExtension
Definition TpmPtp.h:282
UINT32 CrbControlRequest
Definition TpmPtp.h:286
UINT16 Did
Definition TpmPtp.h:278
UINT32 CrbControlCommandAddressHigh
Definition TpmPtp.h:312
UINT16 Vid
Definition TpmPtp.h:274
UINT32 LocalityStatus
Definition TpmPtp.h:265
UINT32 InterfaceId
Definition TpmPtp.h:270
UINT32 CrbControlCommandSize
Definition TpmPtp.h:307
UINT32 CrbInterruptStatus
Definition TpmPtp.h:303
UINT32 CrbControlCancel
Definition TpmPtp.h:294
UINT32 LocalityState
Definition TpmPtp.h:256
UINT32 CrbInterruptEnable
Definition TpmPtp.h:302
UINT32 CrbControlResponseSize
Definition TpmPtp.h:316
UINT32 LocalityControl
Definition TpmPtp.h:261
Definition TpmPtp.h:31
UINT8 IntVector
Definition TpmPtp.h:44
UINT8 StatusEx
Definition TpmPtp.h:65
UINT32 InterfaceCapability
Definition TpmPtp.h:53
UINT8 Rid
Definition TpmPtp.h:93
UINT8 Access
Definition TpmPtp.h:35
UINT16 Vid
Definition TpmPtp.h:85
UINT16 BurstCount
Definition TpmPtp.h:61
UINT32 XDataFifo
Definition TpmPtp.h:80
UINT32 IntEnable
Definition TpmPtp.h:40
UINT16 Did
Definition TpmPtp.h:89
UINT8 Status
Definition TpmPtp.h:57
UINT32 IntSts
Definition TpmPtp.h:49
UINT32 InterfaceId
Definition TpmPtp.h:75
UINT32 DataFifo
Definition TpmPtp.h:70
Definition TpmPtp.h:336
UINT32 Reserved1
Definition TpmPtp.h:342
UINT32 InterfaceVersion
Definition TpmPtp.h:339
UINT32 Uint32
Definition TpmPtp.h:352
UINT32 Reserved2
Definition TpmPtp.h:349
UINT32 CapCRBIdleBypass
Definition TpmPtp.h:341
UINT32 CapIFRes
Definition TpmPtp.h:346
UINT32 InterfaceSelector
Definition TpmPtp.h:347
UINT32 InterfaceType
Definition TpmPtp.h:338
UINT32 CapDataXferSizeSupport
Definition TpmPtp.h:343
UINT32 Rid
Definition TpmPtp.h:350
UINT32 CapLocality
Definition TpmPtp.h:340
UINT32 CapCRB
Definition TpmPtp.h:345
UINT32 CapFIFO
Definition TpmPtp.h:344
UINT32 IntfSelLock
Definition TpmPtp.h:348
Definition TpmPtp.h:131
UINT32 InterruptLevelHigh
Definition TpmPtp.h:136
UINT32 StsValidIntSupport
Definition TpmPtp.h:134
UINT32 LocalityChangeIntSupport
Definition TpmPtp.h:135
UINT32 Reserved2
Definition TpmPtp.h:145
UINT32 BurstCountStatic
Definition TpmPtp.h:141
UINT32 DataTransferSizeSupport
Definition TpmPtp.h:142
UINT32 CommandReadyIntSupport
Definition TpmPtp.h:140
UINT32 Reserved
Definition TpmPtp.h:143
UINT32 InterruptEdgeRising
Definition TpmPtp.h:138
UINT32 Uint32
Definition TpmPtp.h:147
UINT32 InterfaceVersion
Definition TpmPtp.h:144
UINT32 InterruptEdgeFalling
Definition TpmPtp.h:139
UINT32 InterruptLevelLow
Definition TpmPtp.h:137
UINT32 DataAvailIntSupport
Definition TpmPtp.h:133
Definition TpmPtp.h:110
UINT32 CapIFRes
Definition TpmPtp.h:119
UINT32 CapCRB
Definition TpmPtp.h:118
UINT32 Uint32
Definition TpmPtp.h:125
UINT32 Reserved1
Definition TpmPtp.h:115
UINT32 Reserved3
Definition TpmPtp.h:123
UINT32 CapFIFO
Definition TpmPtp.h:117
UINT32 InterfaceType
Definition TpmPtp.h:112
UINT32 CapDataXferSizeSupport
Definition TpmPtp.h:116
UINT32 InterfaceSelector
Definition TpmPtp.h:120
UINT32 Reserved2
Definition TpmPtp.h:122
UINT32 CapLocality
Definition TpmPtp.h:114
UINT32 IntfSelLock
Definition TpmPtp.h:121
UINT32 InterfaceVersion
Definition TpmPtp.h:113