1/*
2 * Copyright (c) 2014, University of Washington.
3 * All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, CAB F.78, Universitaetstr. 6, CH-8092 Zurich. 
8 * Attn: Systems Group.
9 */
10
11device vtd msbfirst ( addr base ) "VT-d" {
12	//////////////////////////// Translation Structure Formats ////////////////////////////
13
14	datatype root_entry "Root Entry" {
15	    _	64 mbz;
16	    ctp	52	"Context-table Pointer";
17	    _	11 mbz;
18	    p	1	"Present";
19	};
20
21	constants translation_type "Translation Type for requests-without-PASID" {
22	    hmd = 0b00 "Host mode with Device-TLBs disabled";
23	    hme = 0b01 "Host mode with Device-TLBs enabled";
24	    ptm = 0b10 "Pass-through mode";
25	    //0b011: reserved
26	};
27	
28	constants addr_width "Address Width" {
29	    agaw30 = 0b000 "30-bit AGAW (2-level page table)";
30	    agaw39 = 0b001 "39-bit AGAW (3-level page table)";
31	    agaw48 = 0b010 "48-bit AGAW (4-level page table)";
32	    agaw57 = 0b011 "57-bit AGAW (5-level page table)";
33	    agaw64 = 0b100 "64-bit AGAW (6-level page table)";
34	     // 0b101-0b111 are reserved
35	};
36	
37	// Context-entries have the same DID iff their SLPTPTR values are the same.
38	datatype context_entry "Context Entry" {
39	    _	    40 mbz;
40	    did	    16			     "Domain Identifier";
41	    _	    1 mbz;
42	    _	    4;
43	    aw	    3 type(addr_width)       "Address Width";
44	    slptptr 52			     "Second Level Page Translation Pointer";
45	    _	    8 mbz;
46	    t	    2 type(translation_type) "Translation Type";
47	    fpd	    1			     "Fault Processing Disable";
48	    p	    1			     "Present";
49	};
50
51	//////////////////////////// Remapping Registers ////////////////////////////
52
53	register VER addr(base, 0x000) "Version Register" {
54	    _	24 mbz;
55	    max	4  ro   "Major Version number";
56	    min	4  ro	"Minor Version number";
57	};
58
59
60	constants numdom "Number of domains supported" {
61	    nd4  = 0b000 "Hardware supports 4-bit (16 domains)";
62	    nd6  = 0b001 "Hardware supports 6-bit (64 domains)"; 
63	    nd8  = 0b010 "Hardware supports 8-bit (256 domains)";
64	    nd10 = 0b011 "Hardware supports 10-bit (1024 domains)";
65	    nd12 = 0b100 "Hardware supports 12-bit (4096 domains)";
66            nd14 = 0b101 "Hardware supports 14-bit (16384 domains)";
67	    nd16 = 0b110 "Hardware supports 16-bit (65536 domains)";
68	    // 0b111 reserved
69	};
70
71	register CAP addr(base, 0x008) "Capability Register" {
72	    _	    7  		    mbz;
73	    fl1gp   1		    ro   "First Level 1-GByte Page Support";
74	    drd	    1  	    	    ro   "Read Draining";
75	    dwd	    1  	    	    ro   "Write Draining";
76	    mamv    6  	    	    ro   "Maximum Address Mask Value";
77	    nfr	    8  	    	    ro   "Number of Fault-recording Registers";
78	    psi	    1  	    	    ro   "Page Selective Invalidation";
79	    _	    1  	    	    mbz;
80            _       2		    mbz  "Second Level Large Page Support - Reserved";
81            sllps30 1  	    	    ro   "Second Level Large Page Support - 1GB page size (30-bit offset to page frame)";
82	    sllps21 1  	    	    ro   "Second Level Large Page Support - 2MB page size (21-bit offset to page frame)";
83	    fro	    10 	    	    ro   "Fault-recording Register offset";
84	    _	    1  	            rsvd;
85	    zlr	    1		    ro   "Zero Length Read";
86	    mgaw    6  	    	    ro   "Maximum Guest Address Width";
87	    _	    3  	    	    mbz;
88            _       2		    mbz  "Supported Adjusted Guest Address Widths - reserved";
89	    sagaw48 1  	    	    ro   "Supported Adjusted Guest Address Widths - 48-bit AGAW (4-level page-table)";
90       	    sagaw39 1  	    	    ro   "Supported Adjusted Guest Address Widths - 39-bit AGAW (3-level page-table)";
91       	    _       1  	    	    mbz  "Supported Adjusted Guest Address Widths - reserved";
92	    cm	    1  	    	    ro   "Caching Mode";
93	    phmr    1  		    ro   "Protected High-Memory Region";
94	    plmr    1  	    	    ro   "Protected Low-Memory Region";
95	    rwbf    1  	    	    ro   "Required Write-Buffer Flushing";
96	    afl	    1  	    	    ro   "Advanced Fault Logging";
97	    nd	    3  ro type(numdom)    "Number of domains supported";
98	};	
99
100	register ECAP addr(base, 0x010) "Extended Capability Register" {
101	    _     24 mbz;
102	    pss   5  ro	   "PASID Size Supported";
103	    eafs  1  ro	   "Extended Accessed Flag Support";
104	    nwfs  1  ro	   "No Write Flag Support";
105	    pot   1  ro	   "PASID-Only Translations";
106	    srs   1  ro	   "Supervisor Request Support";
107	    ers   1  ro	   "Execute Request Support";
108	    prs   1  ro	   "Page Request Support";
109	    pasid 1  ro	   "Process Address Space ID Support";
110	    dis   1  ro	   "Deferred Invalidate Support";
111	    nest  1  ro	   "Nested Translation Support";
112	    mts   1  ro	   "Memory Type Support";
113	    ecs   1  ro	   "Extended Context Support";
114	    mhmv  4  ro    "Maximum Handle Mask Value";
115	    _     2  mbz;
116	    iro   10 ro	   "IOTLB Register Offset";
117	    sc    1  ro	   "Snoop Control";
118	    pt    1  ro	   "Pass Through";
119	    _     1  rsvd;
120	    eim   1  ro    "Extended Interrupt Mode";
121	    ir    1  ro    "Interrupt Remapping support";
122	    dt    1  ro    "Device-TLB support";
123	    qis   1  ro    "Queued Invalidation support";
124	    pwc   1  ro	   "Page-walk Coherency";
125	};
126
127	register GCMD addr(base, 0x018) "Global Command Register" {
128	    te	  1  wo	  "Translation Enable";
129	    srtp  1  wo	  "Set Root Table Pointer";
130	    sfl	  1  wo	  "Set Fault Log";
131	    eafl  1  wo	  "Enable Advanced Fault Logging";
132	    wbf	  1  wo	  "Write Buffer Flush";
133	    qie	  1  wo	  "Queued Invalidation Enable";
134	    ire	  1  wo   "Interrupt Remapping Enable";
135	    sirtp 1  wo	  "Set Interrupt Remap Table Pointer";
136	    cfi	  1  wo	  "Compatibility Format Interrupt";
137	    _	  23 mbz;
138	};
139
140	register GSTS addr(base, 0x01C) "Global Status Register" {
141	    tes	  1  ro	  "Translation Enable Status";
142	    rtps  1  ro	  "Root Table Pointer Status";
143	    fls	  1  ro	  "Fault Log Status";
144	    afls  1  ro	  "Advanced Fault Logging Status";
145	    wbfs  1  ro	  "Write Buffer Flash Status";
146	    qies  1  ro	  "Queued Invalidation Enable Status";
147	    ires  1  ro   "Interrupt Remapping Enable Status";
148	    irtps 1  ro	  "Interrupt Remaping Table Pointer Status";
149	    cfis  1  ro	  "Compatibility Format Interrupt Status";
150	    _	  23 mbz;
151	};
152	
153        constants rtt_ "Root Table Type" {
154	    rt  = 0x0 "Root Table"; 
155	    ert = 0x1 "Extended Root Table";
156	};
157
158	register RTADDR addr(base, 0x020) "Root Table Address Register" {
159	    rta	52 rw	"Root Table Address";
160	    rtt	1  rw	"Root Table Type";
161	    _	11 mbz;
162		
163	};
164
165        constants cirg_ "Context Invalidation Request Granularity" {
166	    rsvd_ir = 0b00 "Reserved";
167	    gir     = 0b01 "Global Invalidation request";
168	    domir   = 0b10 "Domain-selective invalidation request";
169	    devir   = 0b11 "Device-selective invalidation request";
170	};
171
172	constants caig_ "Context Actual Request Granularity" {
173	    rsvd_ip = 0b00 "Reserved";
174	    gip     = 0b01 "Global Invalidation performed";
175	    domip   = 0b10 "Domain-selective invalidation performed";
176	    devip   = 0b11 "Device-selective invalidation performed";
177	};
178
179	constants functmask "Function Mask" {
180	    nomask  = 0b00 "No bits in the SID field masked";
181	    mask2   = 0b01 "Mask bit 2 in the SID field";
182	    mask12  = 0b10 "Mask bits 2:1 in the SID field";
183	    mask012 = 0b11 "Mask bits 2:0 in the SID field";
184	};
185
186	register CCMD addr(base, 0x028) "Context Command Register" {
187	    icc	 1	 	     rw	  "Invalidate Context-Cache";
188	    cirg 2   rw type(cirg_)       "Context Invalidation Request Granularity";
189	    caig 2   ro type(caig_)       "Context Actual Invalidation Granularity";
190	    _	 25		     mbz;
191	    fm	 2   wo type(functmask)   "Function Mask";
192	    sid	 16		     wo	  "Source-ID";
193	    did  16		     rw	  "Domain-ID";
194	};
195};
196