1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2013-2015 The FreeBSD Foundation 5 * 6 * This software was developed by Konstantin Belousov <kib@FreeBSD.org> 7 * under sponsorship from the FreeBSD Foundation. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31 #ifndef __X86_IOMMU_INTEL_REG_H 32 #define __X86_IOMMU_INTEL_REG_H 33 34 typedef struct dmar_root_entry { 35 uint64_t r1; 36 uint64_t r2; 37 } dmar_root_entry_t; 38 #define DMAR_ROOT_R1_P 1 /* Present */ 39 #define DMAR_ROOT_R1_CTP_MASK 0xfffffffffffff000 /* Mask for Context-Entry 40 Table Pointer */ 41 42 #define DMAR_CTX_CNT (IOMMU_PAGE_SIZE / sizeof(dmar_root_entry_t)) 43 44 typedef struct dmar_ctx_entry { 45 uint64_t ctx1; 46 uint64_t ctx2; 47 } dmar_ctx_entry_t; 48 #define DMAR_CTX1_P 1 /* Present */ 49 #define DMAR_CTX1_FPD 2 /* Fault Processing Disable */ 50 /* Translation Type: */ 51 #define DMAR_CTX1_T_UNTR 0 /* only Untranslated */ 52 #define DMAR_CTX1_T_TR 4 /* both Untranslated 53 and Translated */ 54 #define DMAR_CTX1_T_PASS 8 /* Pass-Through */ 55 #define DMAR_CTX1_ASR_MASK 0xfffffffffffff000 /* Mask for the Address 56 Space Root */ 57 #define DMAR_CTX2_AW_2LVL 0 /* 2-level page tables */ 58 #define DMAR_CTX2_AW_3LVL 1 /* 3-level page tables */ 59 #define DMAR_CTX2_AW_4LVL 2 /* 4-level page tables */ 60 #define DMAR_CTX2_AW_5LVL 3 /* 5-level page tables */ 61 #define DMAR_CTX2_AW_6LVL 4 /* 6-level page tables */ 62 #define DMAR_CTX2_DID_MASK 0xffff0 63 #define DMAR_CTX2_DID(x) ((x) << 8) /* Domain Identifier */ 64 #define DMAR_CTX2_GET_DID(ctx2) (((ctx2) & DMAR_CTX2_DID_MASK) >> 8) 65 66 #define DMAR_PTE_R 1 /* Read */ 67 #define DMAR_PTE_W (1 << 1) /* Write */ 68 #define DMAR_PTE_SP (1 << 7) /* Super Page */ 69 #define DMAR_PTE_SNP (1 << 11) /* Snoop Behaviour */ 70 #define DMAR_PTE_ADDR_MASK 0xffffffffff000 /* Address Mask */ 71 #define DMAR_PTE_TM (1ULL << 62) /* Transient Mapping */ 72 73 typedef struct dmar_irte { 74 uint64_t irte1; 75 uint64_t irte2; 76 } dmar_irte_t; 77 /* Source Validation Type */ 78 #define DMAR_IRTE2_SVT_NONE (0ULL << (82 - 64)) 79 #define DMAR_IRTE2_SVT_RID (1ULL << (82 - 64)) 80 #define DMAR_IRTE2_SVT_BUS (2ULL << (82 - 64)) 81 /* Source-id Qualifier */ 82 #define DMAR_IRTE2_SQ_RID (0ULL << (80 - 64)) 83 #define DMAR_IRTE2_SQ_RID_N2 (1ULL << (80 - 64)) 84 #define DMAR_IRTE2_SQ_RID_N21 (2ULL << (80 - 64)) 85 #define DMAR_IRTE2_SQ_RID_N210 (3ULL << (80 - 64)) 86 /* Source Identifier */ 87 #define DMAR_IRTE2_SID_RID(x) ((uint64_t)(x)) 88 #define DMAR_IRTE2_SID_BUS(start, end) ((((uint64_t)(start)) << 8) | (end)) 89 /* Destination Id */ 90 #define DMAR_IRTE1_DST_xAPIC(x) (((uint64_t)(x)) << 40) 91 #define DMAR_IRTE1_DST_x2APIC(x) (((uint64_t)(x)) << 32) 92 /* Vector */ 93 #define DMAR_IRTE1_V(x) (((uint64_t)x) << 16) 94 #define DMAR_IRTE1_IM_POSTED (1ULL << 15) /* Posted */ 95 /* Delivery Mode */ 96 #define DMAR_IRTE1_DLM_FM (0ULL << 5) 97 #define DMAR_IRTE1_DLM_LP (1ULL << 5) 98 #define DMAR_IRTE1_DLM_SMI (2ULL << 5) 99 #define DMAR_IRTE1_DLM_NMI (4ULL << 5) 100 #define DMAR_IRTE1_DLM_INIT (5ULL << 5) 101 #define DMAR_IRTE1_DLM_ExtINT (7ULL << 5) 102 /* Trigger Mode */ 103 #define DMAR_IRTE1_TM_EDGE (0ULL << 4) 104 #define DMAR_IRTE1_TM_LEVEL (1ULL << 4) 105 /* Redirection Hint */ 106 #define DMAR_IRTE1_RH_DIRECT (0ULL << 3) 107 #define DMAR_IRTE1_RH_SELECT (1ULL << 3) 108 /* Destination Mode */ 109 #define DMAR_IRTE1_DM_PHYSICAL (0ULL << 2) 110 #define DMAR_IRTE1_DM_LOGICAL (1ULL << 2) 111 #define DMAR_IRTE1_FPD (1ULL << 1) /* Fault Processing Disable */ 112 #define DMAR_IRTE1_P (1ULL) /* Present */ 113 114 /* Version register */ 115 #define DMAR_VER_REG 0 116 #define DMAR_MAJOR_VER(x) (((x) >> 4) & 0xf) 117 #define DMAR_MINOR_VER(x) ((x) & 0xf) 118 119 /* Capabilities register */ 120 #define DMAR_CAP_REG 0x8 121 #define DMAR_CAP_PI (1ULL << 59) /* Posted Interrupts */ 122 #define DMAR_CAP_FL1GP (1ULL << 56) /* First Level 1GByte Page */ 123 #define DMAR_CAP_DRD (1ULL << 55) /* DMA Read Draining */ 124 #define DMAR_CAP_DWD (1ULL << 54) /* DMA Write Draining */ 125 #define DMAR_CAP_MAMV(x) ((u_int)(((x) >> 48) & 0x3f)) 126 /* Maximum Address Mask */ 127 #define DMAR_CAP_NFR(x) ((u_int)(((x) >> 40) & 0xff) + 1) 128 /* Num of Fault-recording regs */ 129 #define DMAR_CAP_PSI (1ULL << 39) /* Page Selective Invalidation */ 130 #define DMAR_CAP_SPS(x) ((u_int)(((x) >> 34) & 0xf)) /* Super-Page Support */ 131 #define DMAR_CAP_SPS_2M 0x1 132 #define DMAR_CAP_SPS_1G 0x2 133 #define DMAR_CAP_SPS_512G 0x4 134 #define DMAR_CAP_SPS_1T 0x8 135 #define DMAR_CAP_FRO(x) ((u_int)(((x) >> 24) & 0x1ff)) 136 /* Fault-recording reg offset */ 137 #define DMAR_CAP_ISOCH (1 << 23) /* Isochrony */ 138 #define DMAR_CAP_ZLR (1 << 22) /* Zero-length reads */ 139 #define DMAR_CAP_MGAW(x) ((u_int)(((x) >> 16) & 0x3f)) 140 /* Max Guest Address Width */ 141 #define DMAR_CAP_SAGAW(x) ((u_int)(((x) >> 8) & 0x1f)) 142 /* Adjusted Guest Address Width */ 143 #define DMAR_CAP_SAGAW_2LVL 0x01 144 #define DMAR_CAP_SAGAW_3LVL 0x02 145 #define DMAR_CAP_SAGAW_4LVL 0x04 146 #define DMAR_CAP_SAGAW_5LVL 0x08 147 #define DMAR_CAP_SAGAW_6LVL 0x10 148 #define DMAR_CAP_CM (1 << 7) /* Caching mode */ 149 #define DMAR_CAP_PHMR (1 << 6) /* Protected High-mem Region */ 150 #define DMAR_CAP_PLMR (1 << 5) /* Protected Low-mem Region */ 151 #define DMAR_CAP_RWBF (1 << 4) /* Required Write-Buffer Flushing */ 152 #define DMAR_CAP_AFL (1 << 3) /* Advanced Fault Logging */ 153 #define DMAR_CAP_ND(x) ((u_int)((x) & 0x3)) /* Number of domains */ 154 155 /* Extended Capabilities register */ 156 #define DMAR_ECAP_REG 0x10 157 #define DMAR_ECAP_PSS(x) (((x) >> 35) & 0xf) /* PASID Size Supported */ 158 #define DMAR_ECAP_EAFS (1ULL << 34) /* Extended Accessed Flag */ 159 #define DMAR_ECAP_NWFS (1ULL << 33) /* No Write Flag */ 160 #define DMAR_ECAP_SRS (1ULL << 31) /* Supervisor Request */ 161 #define DMAR_ECAP_ERS (1ULL << 30) /* Execute Request */ 162 #define DMAR_ECAP_PRS (1ULL << 29) /* Page Request */ 163 #define DMAR_ECAP_PASID (1ULL << 28) /* Process Address Space Id */ 164 #define DMAR_ECAP_DIS (1ULL << 27) /* Deferred Invalidate */ 165 #define DMAR_ECAP_NEST (1ULL << 26) /* Nested Translation */ 166 #define DMAR_ECAP_MTS (1ULL << 25) /* Memory Type */ 167 #define DMAR_ECAP_ECS (1ULL << 24) /* Extended Context */ 168 #define DMAR_ECAP_MHMV(x) ((u_int)(((x) >> 20) & 0xf)) 169 /* Maximum Handle Mask Value */ 170 #define DMAR_ECAP_IRO(x) ((u_int)(((x) >> 8) & 0x3ff)) 171 /* IOTLB Register Offset */ 172 #define DMAR_ECAP_SC (1 << 7) /* Snoop Control */ 173 #define DMAR_ECAP_PT (1 << 6) /* Pass Through */ 174 #define DMAR_ECAP_EIM (1 << 4) /* Extended Interrupt Mode (x2APIC) */ 175 #define DMAR_ECAP_IR (1 << 3) /* Interrupt Remapping */ 176 #define DMAR_ECAP_DI (1 << 2) /* Device IOTLB */ 177 #define DMAR_ECAP_QI (1 << 1) /* Queued Invalidation */ 178 #define DMAR_ECAP_C (1 << 0) /* Coherency */ 179 180 /* Global Command register */ 181 #define DMAR_GCMD_REG 0x18 182 #define DMAR_GCMD_TE (1U << 31) /* Translation Enable */ 183 #define DMAR_GCMD_SRTP (1 << 30) /* Set Root Table Pointer */ 184 #define DMAR_GCMD_SFL (1 << 29) /* Set Fault Log */ 185 #define DMAR_GCMD_EAFL (1 << 28) /* Enable Advanced Fault Logging */ 186 #define DMAR_GCMD_WBF (1 << 27) /* Write Buffer Flush */ 187 #define DMAR_GCMD_QIE (1 << 26) /* Queued Invalidation Enable */ 188 #define DMAR_GCMD_IRE (1 << 25) /* Interrupt Remapping Enable */ 189 #define DMAR_GCMD_SIRTP (1 << 24) /* Set Interrupt Remap Table Pointer */ 190 #define DMAR_GCMD_CFI (1 << 23) /* Compatibility Format Interrupt */ 191 192 /* Global Status register */ 193 #define DMAR_GSTS_REG 0x1c 194 #define DMAR_GSTS_TES (1U << 31) /* Translation Enable Status */ 195 #define DMAR_GSTS_RTPS (1 << 30) /* Root Table Pointer Status */ 196 #define DMAR_GSTS_FLS (1 << 29) /* Fault Log Status */ 197 #define DMAR_GSTS_AFLS (1 << 28) /* Advanced Fault Logging Status */ 198 #define DMAR_GSTS_WBFS (1 << 27) /* Write Buffer Flush Status */ 199 #define DMAR_GSTS_QIES (1 << 26) /* Queued Invalidation Enable Status */ 200 #define DMAR_GSTS_IRES (1 << 25) /* Interrupt Remapping Enable Status */ 201 #define DMAR_GSTS_IRTPS (1 << 24) /* Interrupt Remapping Table 202 Pointer Status */ 203 #define DMAR_GSTS_CFIS (1 << 23) /* Compatibility Format 204 Interrupt Status */ 205 206 /* Root-Entry Table Address register */ 207 #define DMAR_RTADDR_REG 0x20 208 #define DMAR_RTADDR_RTT (1 << 11) /* Root Table Type */ 209 #define DMAR_RTADDR_RTA_MASK 0xfffffffffffff000 210 211 /* Context Command register */ 212 #define DMAR_CCMD_REG 0x28 213 #define DMAR_CCMD_ICC (1ULL << 63) /* Invalidate Context-Cache */ 214 #define DMAR_CCMD_ICC32 (1U << 31) 215 #define DMAR_CCMD_CIRG_MASK (0x3ULL << 61) /* Context Invalidation 216 Request Granularity */ 217 #define DMAR_CCMD_CIRG_GLOB (0x1ULL << 61) /* Global */ 218 #define DMAR_CCMD_CIRG_DOM (0x2ULL << 61) /* Domain */ 219 #define DMAR_CCMD_CIRG_DEV (0x3ULL << 61) /* Device */ 220 #define DMAR_CCMD_CAIG(x) (((x) >> 59) & 0x3) /* Context Actual 221 Invalidation Granularity */ 222 #define DMAR_CCMD_CAIG_GLOB 0x1 /* Global */ 223 #define DMAR_CCMD_CAIG_DOM 0x2 /* Domain */ 224 #define DMAR_CCMD_CAIG_DEV 0x3 /* Device */ 225 #define DMAR_CCMD_FM (0x3UUL << 32) /* Function Mask */ 226 #define DMAR_CCMD_SID(x) (((x) & 0xffff) << 16) /* Source-ID */ 227 #define DMAR_CCMD_DID(x) ((x) & 0xffff) /* Domain-ID */ 228 229 /* Invalidate Address register */ 230 #define DMAR_IVA_REG_OFF 0 231 #define DMAR_IVA_IH (1 << 6) /* Invalidation Hint */ 232 #define DMAR_IVA_AM(x) ((x) & 0x1f) /* Address Mask */ 233 #define DMAR_IVA_ADDR(x) ((x) & ~0xfffULL) /* Address */ 234 235 /* IOTLB Invalidate register */ 236 #define DMAR_IOTLB_REG_OFF 0x8 237 #define DMAR_IOTLB_IVT (1ULL << 63) /* Invalidate IOTLB */ 238 #define DMAR_IOTLB_IVT32 (1U << 31) 239 #define DMAR_IOTLB_IIRG_MASK (0x3ULL << 60) /* Invalidation Request 240 Granularity */ 241 #define DMAR_IOTLB_IIRG_GLB (0x1ULL << 60) /* Global */ 242 #define DMAR_IOTLB_IIRG_DOM (0x2ULL << 60) /* Domain-selective */ 243 #define DMAR_IOTLB_IIRG_PAGE (0x3ULL << 60) /* Page-selective */ 244 #define DMAR_IOTLB_IAIG_MASK (0x3ULL << 57) /* Actual Invalidation 245 Granularity */ 246 #define DMAR_IOTLB_IAIG_INVLD 0 /* Hw detected error */ 247 #define DMAR_IOTLB_IAIG_GLB (0x1ULL << 57) /* Global */ 248 #define DMAR_IOTLB_IAIG_DOM (0x2ULL << 57) /* Domain-selective */ 249 #define DMAR_IOTLB_IAIG_PAGE (0x3ULL << 57) /* Page-selective */ 250 #define DMAR_IOTLB_DR (0x1ULL << 49) /* Drain Reads */ 251 #define DMAR_IOTLB_DW (0x1ULL << 48) /* Drain Writes */ 252 #define DMAR_IOTLB_DID(x) (((uint64_t)(x) & 0xffff) << 32) /* Domain Id */ 253 254 /* Fault Status register */ 255 #define DMAR_FSTS_REG 0x34 256 #define DMAR_FSTS_FRI(x) (((x) >> 8) & 0xff) /* Fault Record Index */ 257 #define DMAR_FSTS_ITE (1 << 6) /* Invalidation Time-out */ 258 #define DMAR_FSTS_ICE (1 << 5) /* Invalidation Completion */ 259 #define DMAR_FSTS_IQE (1 << 4) /* Invalidation Queue */ 260 #define DMAR_FSTS_APF (1 << 3) /* Advanced Pending Fault */ 261 #define DMAR_FSTS_AFO (1 << 2) /* Advanced Fault Overflow */ 262 #define DMAR_FSTS_PPF (1 << 1) /* Primary Pending Fault */ 263 #define DMAR_FSTS_PFO 1 /* Fault Overflow */ 264 265 /* Fault Event Control register */ 266 #define DMAR_FECTL_REG 0x38 267 #define DMAR_FECTL_IM (1U << 31) /* Interrupt Mask */ 268 #define DMAR_FECTL_IP (1 << 30) /* Interrupt Pending */ 269 270 /* Fault Event Data register */ 271 #define DMAR_FEDATA_REG 0x3c 272 273 /* Fault Event Address register */ 274 #define DMAR_FEADDR_REG 0x40 275 276 /* Fault Event Upper Address register */ 277 #define DMAR_FEUADDR_REG 0x44 278 279 /* Advanced Fault Log register */ 280 #define DMAR_AFLOG_REG 0x58 281 282 /* Fault Recording Register, also usable for Advanced Fault Log records */ 283 #define DMAR_FRCD2_F (1ULL << 63) /* Fault */ 284 #define DMAR_FRCD2_F32 (1U << 31) 285 #define DMAR_FRCD2_T(x) ((int)((x >> 62) & 1)) /* Type */ 286 #define DMAR_FRCD2_T_W 0 /* Write request */ 287 #define DMAR_FRCD2_T_R 1 /* Read or AtomicOp */ 288 #define DMAR_FRCD2_AT(x) ((int)((x >> 60) & 0x3)) /* Address Type */ 289 #define DMAR_FRCD2_FR(x) ((int)((x >> 32) & 0xff)) /* Fault Reason */ 290 #define DMAR_FRCD2_SID(x) ((int)(x & 0xffff)) /* Source Identifier */ 291 #define DMAR_FRCS1_FI_MASK 0xffffffffff000 /* Fault Info, Address Mask */ 292 293 /* Protected Memory Enable register */ 294 #define DMAR_PMEN_REG 0x64 295 #define DMAR_PMEN_EPM (1U << 31) /* Enable Protected Memory */ 296 #define DMAR_PMEN_PRS 1 /* Protected Region Status */ 297 298 /* Protected Low-Memory Base register */ 299 #define DMAR_PLMBASE_REG 0x68 300 301 /* Protected Low-Memory Limit register */ 302 #define DMAR_PLMLIMIT_REG 0x6c 303 304 /* Protected High-Memory Base register */ 305 #define DMAR_PHMBASE_REG 0x70 306 307 /* Protected High-Memory Limit register */ 308 #define DMAR_PHMLIMIT_REG 0x78 309 310 /* Queued Invalidation Descriptors */ 311 #define DMAR_IQ_DESCR_SZ_SHIFT 4 /* Shift for descriptor count 312 to ring offset */ 313 #define DMAR_IQ_DESCR_SZ (1 << DMAR_IQ_DESCR_SZ_SHIFT) 314 /* Descriptor size */ 315 316 /* Context-cache Invalidate Descriptor */ 317 #define DMAR_IQ_DESCR_CTX_INV 0x1 318 #define DMAR_IQ_DESCR_CTX_GLOB (0x1 << 4) /* Granularity: Global */ 319 #define DMAR_IQ_DESCR_CTX_DOM (0x2 << 4) /* Granularity: Domain */ 320 #define DMAR_IQ_DESCR_CTX_DEV (0x3 << 4) /* Granularity: Device */ 321 #define DMAR_IQ_DESCR_CTX_DID(x) (((uint32_t)(x)) << 16) /* Domain Id */ 322 #define DMAR_IQ_DESCR_CTX_SRC(x) (((uint64_t)(x)) << 32) /* Source Id */ 323 #define DMAR_IQ_DESCR_CTX_FM(x) (((uint64_t)(x)) << 48) /* Function Mask */ 324 325 /* IOTLB Invalidate Descriptor */ 326 #define DMAR_IQ_DESCR_IOTLB_INV 0x2 327 #define DMAR_IQ_DESCR_IOTLB_GLOB (0x1 << 4) /* Granularity: Global */ 328 #define DMAR_IQ_DESCR_IOTLB_DOM (0x2 << 4) /* Granularity: Domain */ 329 #define DMAR_IQ_DESCR_IOTLB_PAGE (0x3 << 4) /* Granularity: Page */ 330 #define DMAR_IQ_DESCR_IOTLB_DW (1 << 6) /* Drain Writes */ 331 #define DMAR_IQ_DESCR_IOTLB_DR (1 << 7) /* Drain Reads */ 332 #define DMAR_IQ_DESCR_IOTLB_DID(x) (((uint32_t)(x)) << 16) /* Domain Id */ 333 334 /* Device-TLB Invalidate Descriptor */ 335 #define DMAR_IQ_DESCR_DTLB_INV 0x3 336 337 /* Invalidate Interrupt Entry Cache */ 338 #define DMAR_IQ_DESCR_IEC_INV 0x4 339 #define DMAR_IQ_DESCR_IEC_IDX (1 << 4) /* Index-Selective Invalidation */ 340 #define DMAR_IQ_DESCR_IEC_IIDX(x) (((uint64_t)x) << 32) /* Interrupt Index */ 341 #define DMAR_IQ_DESCR_IEC_IM(x) ((x) << 27) /* Index Mask */ 342 343 /* Invalidation Wait Descriptor */ 344 #define DMAR_IQ_DESCR_WAIT_ID 0x5 345 #define DMAR_IQ_DESCR_WAIT_IF (1 << 4) /* Interrupt Flag */ 346 #define DMAR_IQ_DESCR_WAIT_SW (1 << 5) /* Status Write */ 347 #define DMAR_IQ_DESCR_WAIT_FN (1 << 6) /* Fence */ 348 #define DMAR_IQ_DESCR_WAIT_SD(x) (((uint64_t)(x)) << 32) /* Status Data */ 349 350 /* Extended IOTLB Invalidate Descriptor */ 351 #define DMAR_IQ_DESCR_EIOTLB_INV 0x6 352 353 /* PASID-Cache Invalidate Descriptor */ 354 #define DMAR_IQ_DESCR_PASIDC_INV 0x7 355 356 /* Extended Device-TLB Invalidate Descriptor */ 357 #define DMAR_IQ_DESCR_EDTLB_INV 0x8 358 359 /* Invalidation Queue Head register */ 360 #define DMAR_IQH_REG 0x80 361 #define DMAR_IQH_MASK 0x7fff0 /* Next cmd index mask */ 362 363 /* Invalidation Queue Tail register */ 364 #define DMAR_IQT_REG 0x88 365 #define DMAR_IQT_MASK 0x7fff0 366 367 /* Invalidation Queue Address register */ 368 #define DMAR_IQA_REG 0x90 369 #define DMAR_IQA_IQA_MASK 0xfffffffffffff000 /* Invalidation Queue 370 Base Address mask */ 371 #define DMAR_IQA_QS_MASK 0x7 /* Queue Size in pages */ 372 #define DMAR_IQA_QS_MAX 0x7 /* Max Queue size */ 373 #define DMAR_IQA_QS_DEF 3 374 375 /* Invalidation Completion Status register */ 376 #define DMAR_ICS_REG 0x9c 377 #define DMAR_ICS_IWC 1 /* Invalidation Wait 378 Descriptor Complete */ 379 380 /* Invalidation Event Control register */ 381 #define DMAR_IECTL_REG 0xa0 382 #define DMAR_IECTL_IM (1U << 31) /* Interrupt Mask */ 383 #define DMAR_IECTL_IP (1 << 30) /* Interrupt Pending */ 384 385 /* Invalidation Event Data register */ 386 #define DMAR_IEDATA_REG 0xa4 387 388 /* Invalidation Event Address register */ 389 #define DMAR_IEADDR_REG 0xa8 390 391 /* Invalidation Event Upper Address register */ 392 #define DMAR_IEUADDR_REG 0xac 393 394 /* Interrupt Remapping Table Address register */ 395 #define DMAR_IRTA_REG 0xb8 396 #define DMAR_IRTA_EIME (1 << 11) /* Extended Interrupt Mode 397 Enable */ 398 #define DMAR_IRTA_S_MASK 0xf /* Size Mask */ 399 400 #endif 401