2 The definition for VTD register.
3 It is defined in "Intel VT for Direct IO Architecture Specification".
5 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
16 // Translation Structure Formats
18 #define VTD_ROOT_ENTRY_NUMBER 256
19 #define VTD_CONTEXT_ENTRY_NUMBER 256
25 UINT32 ContextTablePointerLo
:20;
26 UINT32 ContextTablePointerHi
:32;
38 UINT32 LowerPresent
:1;
40 UINT32 LowerContextTablePointerLo
:20;
41 UINT32 LowerContextTablePointerHi
:32;
43 UINT32 UpperPresent
:1;
44 UINT32 Reserved_65
:11;
45 UINT32 UpperContextTablePointerLo
:20;
46 UINT32 UpperContextTablePointerHi
:32;
57 UINT32 FaultProcessingDisable
:1;
58 UINT32 TranslationType
:2;
60 UINT32 SecondLevelPageTranslationPointerLo
:20;
61 UINT32 SecondLevelPageTranslationPointerHi
:32;
63 UINT32 AddressWidth
:3;
66 UINT32 DomainIdentifier
:16;
68 UINT32 Reserved_96
:32;
79 UINT32 FaultProcessingDisable
:1;
80 UINT32 TranslationType
:3;
81 UINT32 ExtendedMemoryType
:3;
82 UINT32 DeferredInvalidateEnable
:1;
83 UINT32 PageRequestEnable
:1;
84 UINT32 NestedTranslationEnable
:1;
86 UINT32 SecondLevelPageTranslationPointerLo
:20;
87 UINT32 SecondLevelPageTranslationPointerHi
:32;
89 UINT32 AddressWidth
:3;
90 UINT32 PageGlobalEnable
:1;
91 UINT32 NoExecuteEnable
:1;
92 UINT32 WriteProtectEnable
:1;
93 UINT32 CacheDisable
:1;
94 UINT32 ExtendedMemoryTypeEnable
:1;
95 UINT32 DomainIdentifier
:16;
96 UINT32 SupervisorModeExecuteProtection
:1;
97 UINT32 ExtendedAccessedFlagEnable
:1;
98 UINT32 ExecuteRequestsEnable
:1;
99 UINT32 SecondLevelExecuteEnable
:1;
100 UINT32 Reserved_92
:4;
101 UINT32 PageAttributeTable0
:3;
102 UINT32 Reserved_Pat0
:1;
103 UINT32 PageAttributeTable1
:3;
104 UINT32 Reserved_Pat1
:1;
105 UINT32 PageAttributeTable2
:3;
106 UINT32 Reserved_Pat2
:1;
107 UINT32 PageAttributeTable3
:3;
108 UINT32 Reserved_Pat3
:1;
109 UINT32 PageAttributeTable4
:3;
110 UINT32 Reserved_Pat4
:1;
111 UINT32 PageAttributeTable5
:3;
112 UINT32 Reserved_Pat5
:1;
113 UINT32 PageAttributeTable6
:3;
114 UINT32 Reserved_Pat6
:1;
115 UINT32 PageAttributeTable7
:3;
116 UINT32 Reserved_Pat7
:1;
118 UINT32 PASIDTableSize
:4;
119 UINT32 Reserved_132
:8;
120 UINT32 PASIDTablePointerLo
:20;
121 UINT32 PASIDTablePointerHi
:32;
123 UINT32 Reserved_192
:12;
124 UINT32 PASIDStateTablePointerLo
:20;
125 UINT32 PASIDStateTablePointerHi
:32;
133 } VTD_EXT_CONTEXT_ENTRY
;
139 UINT32 PageLevelCacheDisable
:1;
140 UINT32 PageLevelWriteThrough
:1;
142 UINT32 SupervisorRequestsEnable
:1;
143 UINT32 FirstLevelPageTranslationPointerLo
:20;
144 UINT32 FirstLevelPageTranslationPointerHi
:32;
151 UINT32 Reserved_0
:32;
152 UINT32 ActiveReferenceCount
:16;
153 UINT32 Reserved_48
:15;
154 UINT32 DeferredInvalidate
:1;
157 } VTD_PASID_STATE_ENTRY
;
163 UINT32 UserSupervisor
:1;
164 UINT32 PageLevelWriteThrough
:1;
165 UINT32 PageLevelCacheDisable
:1;
168 UINT32 PageSize
:1; // It is PageAttribute:1 for 4K page entry
171 UINT32 ExtendedAccessed
:1;
173 // NOTE: There is PageAttribute:1 as bit12 for 1G page entry and 2M page entry
176 UINT32 Ignored_52
:11;
177 UINT32 ExecuteDisable
:1;
180 } VTD_FIRST_LEVEL_PAGING_ENTRY
;
187 UINT32 ExtendedMemoryType
:3;
194 UINT32 Ignored_52
:10;
195 UINT32 TransientMapping
:1;
199 } VTD_SECOND_LEVEL_PAGING_ENTRY
;
202 // Register Descriptions
204 #define R_VER_REG 0x00
205 #define R_CAP_REG 0x08
206 #define B_CAP_REG_RWBF BIT4
207 #define R_ECAP_REG 0x10
208 #define R_GCMD_REG 0x18
209 #define B_GMCD_REG_WBF BIT27
210 #define B_GMCD_REG_SRTP BIT30
211 #define B_GMCD_REG_TE BIT31
212 #define R_GSTS_REG 0x1C
213 #define B_GSTS_REG_WBF BIT27
214 #define B_GSTS_REG_RTPS BIT30
215 #define B_GSTS_REG_TE BIT31
216 #define R_RTADDR_REG 0x20
217 #define R_CCMD_REG 0x28
218 #define B_CCMD_REG_CIRG_MASK (BIT62|BIT61)
219 #define V_CCMD_REG_CIRG_GLOBAL BIT61
220 #define V_CCMD_REG_CIRG_DOMAIN BIT62
221 #define V_CCMD_REG_CIRG_DEVICE (BIT62|BIT61)
222 #define B_CCMD_REG_ICC BIT63
223 #define R_FSTS_REG 0x34
224 #define R_FECTL_REG 0x38
225 #define R_FEDATA_REG 0x3C
226 #define R_FEADDR_REG 0x40
227 #define R_FEUADDR_REG 0x44
228 #define R_AFLOG_REG 0x58
230 #define R_IVA_REG 0x00 // + IRO
231 #define B_IVA_REG_AM_MASK (BIT0|BIT1|BIT2|BIT3|BIT4|BIT5)
232 #define B_IVA_REG_AM_4K 0 // 1 page
233 #define B_IVA_REG_AM_2M 9 // 2M page
234 #define B_IVA_REG_IH BIT6
235 #define R_IOTLB_REG 0x08 // + IRO
236 #define B_IOTLB_REG_IIRG_MASK (BIT61|BIT60)
237 #define V_IOTLB_REG_IIRG_GLOBAL BIT60
238 #define V_IOTLB_REG_IIRG_DOMAIN BIT61
239 #define V_IOTLB_REG_IIRG_PAGE (BIT61|BIT60)
240 #define B_IOTLB_REG_IVT BIT63
242 #define R_FRCD_REG 0x00 // + FRO
244 #define R_PMEN_ENABLE_REG 0x64
245 #define R_PMEN_LOW_BASE_REG 0x68
246 #define R_PMEN_LOW_LIMITE_REG 0x6C
247 #define R_PMEN_HIGH_BASE_REG 0x70
248 #define R_PMEN_HIGH_LIMITE_REG 0x78
252 UINT8 ND
:3; // Number of domains supported
253 UINT8 AFL
:1; // Advanced Fault Logging
254 UINT8 RWBF
:1; // Required Write-Buffer Flushing
255 UINT8 PLMR
:1; // Protected Low-Memory Region
256 UINT8 PHMR
:1; // Protected High-Memory Region
257 UINT8 CM
:1; // Caching Mode
259 UINT8 SAGAW
:5; // Supported Adjusted Guest Address Widths
262 UINT8 MGAW
:6; // Maximum Guest Address Width
263 UINT8 ZLR
:1; // Zero Length Read
266 UINT16 FRO
:10; // Fault-recording Register offset
267 UINT16 SLLPS
:4; // Second Level Large Page Support
269 UINT16 PSI
:1; // Page Selective Invalidation
271 UINT8 NFR
:8; // Number of Fault-recording Registers
273 UINT8 MAMV
:6; // Maximum Address Mask Value
274 UINT8 DWD
:1; // Write Draining
275 UINT8 DRD
:1; // Read Draining
277 UINT8 FL1GP
:1; // First Level 1-GByte Page Support
279 UINT8 PI
:1; // Posted Interrupts Support
287 UINT8 C
:1; // Page-walk Coherency
288 UINT8 QI
:1; // Queued Invalidation support
289 UINT8 DT
:1; // Device-TLB support
290 UINT8 IR
:1; // Interrupt Remapping support
291 UINT8 EIM
:1; // Extended Interrupt Mode
293 UINT8 PT
:1; // Pass Through
294 UINT8 SC
:1; // Snoop Control
296 UINT16 IRO
:10; // IOTLB Register Offset
298 UINT16 MHMV
:4; // Maximum Handle Mask Value
300 UINT8 ECS
:1; // Extended Context Support
301 UINT8 MTS
:1; // Memory Type Support
302 UINT8 NEST
:1; // Nested Translation Support
303 UINT8 DIS
:1; // Deferred Invalidate Support
304 UINT8 PASID
:1; // Process Address Space ID Support
305 UINT8 PRS
:1; // Page Request Support
306 UINT8 ERS
:1; // Execute Request Support
307 UINT8 SRS
:1; // Supervisor Request Support
310 UINT32 NWFS
:1; // No Write Flag Support
311 UINT32 EAFS
:1; // Extended Accessed Flag Support
312 UINT32 PSS
:5; // PASID Size Supported
321 UINT32 FILo
:20; // FaultInfo
322 UINT32 FIHi
:32; // FaultInfo
324 UINT32 SID
:16; // Source Identifier
326 UINT32 PRIV
:1; // Privilege Mode Requested
327 UINT32 EXE
:1; // Execute Permission Requested
328 UINT32 PP
:1; // PASID Present
330 UINT32 FR
:8; // Fault Reason
331 UINT32 PV
:20; // PASID Value
332 UINT32 AT
:2; // Address Type
333 UINT32 T
:1; // Type (0: Write, 1: Read)