Rev 863 | Rev 877 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 863 | Rev 873 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (C) 2005 Jakub Jermar |
2 | * Copyright (C) 2005 Jakub Jermar |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
13 | * documentation and/or other materials provided with the distribution. |
14 | * - The name of the author may not be used to endorse or promote products |
14 | * - The name of the author may not be used to endorse or promote products |
15 | * derived from this software without specific prior written permission. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | #ifndef __sparc64_TLB_H__ |
29 | #ifndef __sparc64_TLB_H__ |
30 | #define __sparc64_TLB_H__ |
30 | #define __sparc64_TLB_H__ |
31 | 31 | ||
32 | #include <arch/mm/tte.h> |
32 | #include <arch/mm/tte.h> |
33 | #include <arch/mm/mmu.h> |
33 | #include <arch/mm/mmu.h> |
34 | #include <arch/mm/page.h> |
34 | #include <arch/mm/page.h> |
35 | #include <arch/asm.h> |
35 | #include <arch/asm.h> |
36 | #include <arch/barrier.h> |
36 | #include <arch/barrier.h> |
37 | #include <arch/types.h> |
37 | #include <arch/types.h> |
38 | #include <typedefs.h> |
38 | #include <typedefs.h> |
39 | 39 | ||
40 | #define ITLB_ENTRY_COUNT 64 |
40 | #define ITLB_ENTRY_COUNT 64 |
41 | #define DTLB_ENTRY_COUNT 64 |
41 | #define DTLB_ENTRY_COUNT 64 |
42 | 42 | ||
43 | /** Page sizes. */ |
43 | /** Page sizes. */ |
44 | #define PAGESIZE_8K 0 |
44 | #define PAGESIZE_8K 0 |
45 | #define PAGESIZE_64K 1 |
45 | #define PAGESIZE_64K 1 |
46 | #define PAGESIZE_512K 2 |
46 | #define PAGESIZE_512K 2 |
47 | #define PAGESIZE_4M 3 |
47 | #define PAGESIZE_4M 3 |
48 | 48 | ||
- | 49 | union tlb_context_reg { |
|
- | 50 | __u64 v; |
|
- | 51 | struct { |
|
- | 52 | unsigned long : 51; |
|
- | 53 | unsigned context : 13; /**< Context/ASID. */ |
|
- | 54 | } __attribute__ ((packed)); |
|
- | 55 | }; |
|
- | 56 | typedef union tlb_context_reg tlb_context_reg_t; |
|
- | 57 | ||
49 | /** I-/D-TLB Data In/Access Register type. */ |
58 | /** I-/D-TLB Data In/Access Register type. */ |
50 | typedef tte_data_t tlb_data_t; |
59 | typedef tte_data_t tlb_data_t; |
51 | 60 | ||
52 | /** I-/D-TLB Data Access Address in Alternate Space. */ |
61 | /** I-/D-TLB Data Access Address in Alternate Space. */ |
53 | union tlb_data_access_addr { |
62 | union tlb_data_access_addr { |
54 | __u64 value; |
63 | __u64 value; |
55 | struct { |
64 | struct { |
56 | __u64 : 55; |
65 | __u64 : 55; |
57 | unsigned tlb_entry : 6; |
66 | unsigned tlb_entry : 6; |
58 | unsigned : 3; |
67 | unsigned : 3; |
59 | } __attribute__ ((packed)); |
68 | } __attribute__ ((packed)); |
60 | }; |
69 | }; |
61 | typedef union tlb_data_access_addr tlb_data_access_addr_t; |
70 | typedef union tlb_data_access_addr tlb_data_access_addr_t; |
62 | typedef union tlb_data_access_addr tlb_tag_read_addr_t; |
71 | typedef union tlb_data_access_addr tlb_tag_read_addr_t; |
63 | 72 | ||
64 | /** I-/D-TLB Tag Read Register. */ |
73 | /** I-/D-TLB Tag Read Register. */ |
65 | union tlb_tag_read_reg { |
74 | union tlb_tag_read_reg { |
66 | __u64 value; |
75 | __u64 value; |
67 | struct { |
76 | struct { |
68 | __u64 vpn : 51; /**< Virtual Address bits 63:13. */ |
77 | __u64 vpn : 51; /**< Virtual Address bits 63:13. */ |
69 | unsigned context : 13; /**< Context identifier. */ |
78 | unsigned context : 13; /**< Context identifier. */ |
70 | } __attribute__ ((packed)); |
79 | } __attribute__ ((packed)); |
71 | }; |
80 | }; |
72 | typedef union tlb_tag_read_reg tlb_tag_read_reg_t; |
81 | typedef union tlb_tag_read_reg tlb_tag_read_reg_t; |
73 | typedef union tlb_tag_read_reg tlb_tag_access_reg_t; |
82 | typedef union tlb_tag_read_reg tlb_tag_access_reg_t; |
74 | 83 | ||
75 | /** TLB Demap Operation types. */ |
84 | /** TLB Demap Operation types. */ |
76 | #define TLB_DEMAP_PAGE 0 |
85 | #define TLB_DEMAP_PAGE 0 |
77 | #define TLB_DEMAP_CONTEXT 1 |
86 | #define TLB_DEMAP_CONTEXT 1 |
78 | 87 | ||
79 | /** TLB Demap Operation Context register encodings. */ |
88 | /** TLB Demap Operation Context register encodings. */ |
80 | #define TLB_DEMAP_PRIMARY 0 |
89 | #define TLB_DEMAP_PRIMARY 0 |
81 | #define TLB_DEMAP_SECONDARY 1 |
90 | #define TLB_DEMAP_SECONDARY 1 |
82 | #define TLB_DEMAP_NUCLEUS 2 |
91 | #define TLB_DEMAP_NUCLEUS 2 |
83 | 92 | ||
84 | /** TLB Demap Operation Address. */ |
93 | /** TLB Demap Operation Address. */ |
85 | union tlb_demap_addr { |
94 | union tlb_demap_addr { |
86 | __u64 value; |
95 | __u64 value; |
87 | struct { |
96 | struct { |
88 | __u64 vpn: 51; /**< Virtual Address bits 63:13. */ |
97 | __u64 vpn: 51; /**< Virtual Address bits 63:13. */ |
89 | unsigned : 6; /**< Ignored. */ |
98 | unsigned : 6; /**< Ignored. */ |
90 | unsigned type : 1; /**< The type of demap operation. */ |
99 | unsigned type : 1; /**< The type of demap operation. */ |
91 | unsigned context : 2; /**< Context register selection. */ |
100 | unsigned context : 2; /**< Context register selection. */ |
92 | unsigned : 4; /**< Zero. */ |
101 | unsigned : 4; /**< Zero. */ |
93 | } __attribute__ ((packed)); |
102 | } __attribute__ ((packed)); |
94 | }; |
103 | }; |
95 | typedef union tlb_demap_addr tlb_demap_addr_t; |
104 | typedef union tlb_demap_addr tlb_demap_addr_t; |
96 | 105 | ||
- | 106 | /** TLB Synchronous Fault Status Register. */ |
|
- | 107 | union tlb_sfsr_reg { |
|
- | 108 | __u64 value; |
|
- | 109 | struct { |
|
- | 110 | unsigned long : 39; /**< Implementation dependent. */ |
|
- | 111 | unsigned nf : 1; /**< Nonfaulting load. */ |
|
- | 112 | unsigned asi : 8; /**< ASI. */ |
|
- | 113 | unsigned tm : 1; /**< TLB miss. */ |
|
- | 114 | unsigned : 3; |
|
- | 115 | unsigned ft : 5; /**< Fault type. */ |
|
- | 116 | unsigned e : 1; /**< Side-effect bit. */ |
|
- | 117 | unsigned ct : 2; /**< Context Register selection. */ |
|
- | 118 | unsigned pr : 1; /**< Privilege bit. */ |
|
- | 119 | unsigned w : 1; /**< Write bit. */ |
|
- | 120 | unsigned ow : 1; /**< Overwrite bit. */ |
|
- | 121 | unsigned fv : 1; /**< Fayult Valid bit. */ |
|
- | 122 | } __attribute__ ((packed)); |
|
- | 123 | }; |
|
- | 124 | typedef union tlb_sfsr_reg tlb_sfsr_reg_t; |
|
- | 125 | ||
- | 126 | /** Read MMU Primary Context Register. |
|
- | 127 | * |
|
- | 128 | * @return Current value of Primary Context Register. |
|
- | 129 | */ |
|
- | 130 | static inline __u64 mmu_primary_context_read(void) |
|
- | 131 | { |
|
- | 132 | return asi_u64_read(ASI_DMMU, VA_PRIMARY_CONTEXT_REG); |
|
- | 133 | } |
|
- | 134 | ||
- | 135 | /** Write MMU Primary Context Register. |
|
- | 136 | * |
|
- | 137 | * @param v New value of Primary Context Register. |
|
- | 138 | */ |
|
- | 139 | static inline void mmu_primary_context_write(__u64 v) |
|
- | 140 | { |
|
- | 141 | asi_u64_write(ASI_DMMU, VA_PRIMARY_CONTEXT_REG, v); |
|
- | 142 | flush(); |
|
- | 143 | } |
|
- | 144 | ||
- | 145 | /** Read MMU Secondary Context Register. |
|
- | 146 | * |
|
- | 147 | * @return Current value of Secondary Context Register. |
|
- | 148 | */ |
|
- | 149 | static inline __u64 mmu_secondary_context_read(void) |
|
- | 150 | { |
|
- | 151 | return asi_u64_read(ASI_DMMU, VA_SECONDARY_CONTEXT_REG); |
|
- | 152 | } |
|
- | 153 | ||
- | 154 | /** Write MMU Primary Context Register. |
|
- | 155 | * |
|
- | 156 | * @param v New value of Primary Context Register. |
|
- | 157 | */ |
|
- | 158 | static inline void mmu_secondary_context_write(__u64 v) |
|
- | 159 | { |
|
- | 160 | asi_u64_write(ASI_DMMU, VA_PRIMARY_CONTEXT_REG, v); |
|
- | 161 | flush(); |
|
- | 162 | } |
|
- | 163 | ||
97 | /** Read IMMU TLB Data Access Register. |
164 | /** Read IMMU TLB Data Access Register. |
98 | * |
165 | * |
99 | * @param entry TLB Entry index. |
166 | * @param entry TLB Entry index. |
100 | * |
167 | * |
101 | * @return Current value of specified IMMU TLB Data Access Register. |
168 | * @return Current value of specified IMMU TLB Data Access Register. |
102 | */ |
169 | */ |
103 | static inline __u64 itlb_data_access_read(index_t entry) |
170 | static inline __u64 itlb_data_access_read(index_t entry) |
104 | { |
171 | { |
105 | tlb_data_access_addr_t reg; |
172 | tlb_data_access_addr_t reg; |
106 | 173 | ||
107 | reg.value = 0; |
174 | reg.value = 0; |
108 | reg.tlb_entry = entry; |
175 | reg.tlb_entry = entry; |
109 | return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value); |
176 | return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value); |
110 | } |
177 | } |
111 | 178 | ||
112 | /** Write IMMU TLB Data Access Register. |
179 | /** Write IMMU TLB Data Access Register. |
113 | * |
180 | * |
114 | * @param entry TLB Entry index. |
181 | * @param entry TLB Entry index. |
115 | * @param value Value to be written. |
182 | * @param value Value to be written. |
116 | */ |
183 | */ |
117 | static inline void itlb_data_access_write(index_t entry, __u64 value) |
184 | static inline void itlb_data_access_write(index_t entry, __u64 value) |
118 | { |
185 | { |
119 | tlb_data_access_addr_t reg; |
186 | tlb_data_access_addr_t reg; |
120 | 187 | ||
121 | reg.value = 0; |
188 | reg.value = 0; |
122 | reg.tlb_entry = entry; |
189 | reg.tlb_entry = entry; |
123 | asi_u64_write(ASI_ITLB_DATA_ACCESS_REG, reg.value, value); |
190 | asi_u64_write(ASI_ITLB_DATA_ACCESS_REG, reg.value, value); |
124 | flush(); |
191 | flush(); |
125 | } |
192 | } |
126 | 193 | ||
127 | /** Read DMMU TLB Data Access Register. |
194 | /** Read DMMU TLB Data Access Register. |
128 | * |
195 | * |
129 | * @param entry TLB Entry index. |
196 | * @param entry TLB Entry index. |
130 | * |
197 | * |
131 | * @return Current value of specified DMMU TLB Data Access Register. |
198 | * @return Current value of specified DMMU TLB Data Access Register. |
132 | */ |
199 | */ |
133 | static inline __u64 dtlb_data_access_read(index_t entry) |
200 | static inline __u64 dtlb_data_access_read(index_t entry) |
134 | { |
201 | { |
135 | tlb_data_access_addr_t reg; |
202 | tlb_data_access_addr_t reg; |
136 | 203 | ||
137 | reg.value = 0; |
204 | reg.value = 0; |
138 | reg.tlb_entry = entry; |
205 | reg.tlb_entry = entry; |
139 | return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value); |
206 | return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value); |
140 | } |
207 | } |
141 | 208 | ||
142 | /** Write DMMU TLB Data Access Register. |
209 | /** Write DMMU TLB Data Access Register. |
143 | * |
210 | * |
144 | * @param entry TLB Entry index. |
211 | * @param entry TLB Entry index. |
145 | * @param value Value to be written. |
212 | * @param value Value to be written. |
146 | */ |
213 | */ |
147 | static inline void dtlb_data_access_write(index_t entry, __u64 value) |
214 | static inline void dtlb_data_access_write(index_t entry, __u64 value) |
148 | { |
215 | { |
149 | tlb_data_access_addr_t reg; |
216 | tlb_data_access_addr_t reg; |
150 | 217 | ||
151 | reg.value = 0; |
218 | reg.value = 0; |
152 | reg.tlb_entry = entry; |
219 | reg.tlb_entry = entry; |
153 | asi_u64_write(ASI_DTLB_DATA_ACCESS_REG, reg.value, value); |
220 | asi_u64_write(ASI_DTLB_DATA_ACCESS_REG, reg.value, value); |
154 | flush(); |
221 | flush(); |
155 | } |
222 | } |
156 | 223 | ||
157 | /** Read IMMU TLB Tag Read Register. |
224 | /** Read IMMU TLB Tag Read Register. |
158 | * |
225 | * |
159 | * @param entry TLB Entry index. |
226 | * @param entry TLB Entry index. |
160 | * |
227 | * |
161 | * @return Current value of specified IMMU TLB Tag Read Register. |
228 | * @return Current value of specified IMMU TLB Tag Read Register. |
162 | */ |
229 | */ |
163 | static inline __u64 itlb_tag_read_read(index_t entry) |
230 | static inline __u64 itlb_tag_read_read(index_t entry) |
164 | { |
231 | { |
165 | tlb_tag_read_addr_t tag; |
232 | tlb_tag_read_addr_t tag; |
166 | 233 | ||
167 | tag.value = 0; |
234 | tag.value = 0; |
168 | tag.tlb_entry = entry; |
235 | tag.tlb_entry = entry; |
169 | return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value); |
236 | return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value); |
170 | } |
237 | } |
171 | 238 | ||
172 | /** Read DMMU TLB Tag Read Register. |
239 | /** Read DMMU TLB Tag Read Register. |
173 | * |
240 | * |
174 | * @param entry TLB Entry index. |
241 | * @param entry TLB Entry index. |
175 | * |
242 | * |
176 | * @return Current value of specified DMMU TLB Tag Read Register. |
243 | * @return Current value of specified DMMU TLB Tag Read Register. |
177 | */ |
244 | */ |
178 | static inline __u64 dtlb_tag_read_read(index_t entry) |
245 | static inline __u64 dtlb_tag_read_read(index_t entry) |
179 | { |
246 | { |
180 | tlb_tag_read_addr_t tag; |
247 | tlb_tag_read_addr_t tag; |
181 | 248 | ||
182 | tag.value = 0; |
249 | tag.value = 0; |
183 | tag.tlb_entry = entry; |
250 | tag.tlb_entry = entry; |
184 | return asi_u64_read(ASI_DTLB_TAG_READ_REG, tag.value); |
251 | return asi_u64_read(ASI_DTLB_TAG_READ_REG, tag.value); |
185 | } |
252 | } |
186 | 253 | ||
187 | /** Write IMMU TLB Tag Access Register. |
254 | /** Write IMMU TLB Tag Access Register. |
188 | * |
255 | * |
189 | * @param v Value to be written. |
256 | * @param v Value to be written. |
190 | */ |
257 | */ |
191 | static inline void itlb_tag_access_write(__u64 v) |
258 | static inline void itlb_tag_access_write(__u64 v) |
192 | { |
259 | { |
193 | asi_u64_write(ASI_IMMU, VA_IMMU_TAG_ACCESS, v); |
260 | asi_u64_write(ASI_IMMU, VA_IMMU_TAG_ACCESS, v); |
194 | flush(); |
261 | flush(); |
195 | } |
262 | } |
196 | 263 | ||
197 | /** Write DMMU TLB Tag Access Register. |
264 | /** Write DMMU TLB Tag Access Register. |
198 | * |
265 | * |
199 | * @param v Value to be written. |
266 | * @param v Value to be written. |
200 | */ |
267 | */ |
201 | static inline void dtlb_tag_access_write(__u64 v) |
268 | static inline void dtlb_tag_access_write(__u64 v) |
202 | { |
269 | { |
203 | asi_u64_write(ASI_DMMU, VA_DMMU_TAG_ACCESS, v); |
270 | asi_u64_write(ASI_DMMU, VA_DMMU_TAG_ACCESS, v); |
204 | flush(); |
271 | flush(); |
205 | } |
272 | } |
206 | 273 | ||
207 | /** Write IMMU TLB Data in Register. |
274 | /** Write IMMU TLB Data in Register. |
208 | * |
275 | * |
209 | * @param v Value to be written. |
276 | * @param v Value to be written. |
210 | */ |
277 | */ |
211 | static inline void itlb_data_in_write(__u64 v) |
278 | static inline void itlb_data_in_write(__u64 v) |
212 | { |
279 | { |
213 | asi_u64_write(ASI_ITLB_DATA_IN_REG, 0, v); |
280 | asi_u64_write(ASI_ITLB_DATA_IN_REG, 0, v); |
214 | flush(); |
281 | flush(); |
215 | } |
282 | } |
216 | 283 | ||
217 | /** Write DMMU TLB Data in Register. |
284 | /** Write DMMU TLB Data in Register. |
218 | * |
285 | * |
219 | * @param v Value to be written. |
286 | * @param v Value to be written. |
220 | */ |
287 | */ |
221 | static inline void dtlb_data_in_write(__u64 v) |
288 | static inline void dtlb_data_in_write(__u64 v) |
222 | { |
289 | { |
223 | asi_u64_write(ASI_DTLB_DATA_IN_REG, 0, v); |
290 | asi_u64_write(ASI_DTLB_DATA_IN_REG, 0, v); |
224 | flush(); |
291 | flush(); |
225 | } |
292 | } |
- | 293 | ||
- | 294 | /** Read ITLB Synchronous Fault Status Register. |
|
- | 295 | * |
|
- | 296 | * @return Current content of I-SFSR register. |
|
- | 297 | */ |
|
- | 298 | static inline __u64 itlb_sfsr_read(void) |
|
- | 299 | { |
|
- | 300 | return asi_u64_read(ASI_IMMU, VA_IMMU_SFSR); |
|
- | 301 | } |
|
- | 302 | ||
- | 303 | /** Write ITLB Synchronous Fault Status Register. |
|
- | 304 | * |
|
- | 305 | * @param v New value of I-SFSR register. |
|
- | 306 | */ |
|
- | 307 | static inline void itlb_sfsr_write(__u64 v) |
|
- | 308 | { |
|
- | 309 | asi_u64_write(ASI_IMMU, VA_IMMU_SFSR, v); |
|
- | 310 | flush(); |
|
- | 311 | } |
|
- | 312 | ||
- | 313 | /** Read DTLB Synchronous Fault Status Register. |
|
- | 314 | * |
|
- | 315 | * @return Current content of D-SFSR register. |
|
- | 316 | */ |
|
- | 317 | static inline __u64 dtlb_sfsr_read(void) |
|
- | 318 | { |
|
- | 319 | return asi_u64_read(ASI_DMMU, VA_DMMU_SFSR); |
|
- | 320 | } |
|
- | 321 | ||
- | 322 | /** Write DTLB Synchronous Fault Status Register. |
|
- | 323 | * |
|
- | 324 | * @param v New value of D-SFSR register. |
|
- | 325 | */ |
|
- | 326 | static inline void dtlb_sfsr_write(__u64 v) |
|
- | 327 | { |
|
- | 328 | asi_u64_write(ASI_DMMU, VA_DMMU_SFSR, v); |
|
- | 329 | flush(); |
|
- | 330 | } |
|
- | 331 | ||
- | 332 | /** Read DTLB Synchronous Fault Address Register. |
|
- | 333 | * |
|
- | 334 | * @return Current content of D-SFAR register. |
|
- | 335 | */ |
|
- | 336 | static inline __u64 dtlb_sfar_read(void) |
|
- | 337 | { |
|
- | 338 | return asi_u64_read(ASI_DMMU, VA_DMMU_SFAR); |
|
- | 339 | } |
|
226 | 340 | ||
227 | /** Perform IMMU TLB Demap Operation. |
341 | /** Perform IMMU TLB Demap Operation. |
228 | * |
342 | * |
229 | * @param type Selects between context and page demap. |
343 | * @param type Selects between context and page demap. |
230 | * @param context_encoding Specifies which Context register has Context ID for demap. |
344 | * @param context_encoding Specifies which Context register has Context ID for demap. |
231 | * @param page Address which is on the page to be demapped. |
345 | * @param page Address which is on the page to be demapped. |
232 | */ |
346 | */ |
233 | static inline void itlb_demap(int type, int context_encoding, __address page) |
347 | static inline void itlb_demap(int type, int context_encoding, __address page) |
234 | { |
348 | { |
235 | tlb_demap_addr_t da; |
349 | tlb_demap_addr_t da; |
236 | page_address_t pg; |
350 | page_address_t pg; |
237 | 351 | ||
238 | da.value = 0; |
352 | da.value = 0; |
239 | pg.address = page; |
353 | pg.address = page; |
240 | 354 | ||
241 | da.type = type; |
355 | da.type = type; |
242 | da.context = context_encoding; |
356 | da.context = context_encoding; |
243 | da.vpn = pg.vpn; |
357 | da.vpn = pg.vpn; |
244 | 358 | ||
245 | asi_u64_write(ASI_IMMU_DEMAP, da.value, 0); |
359 | asi_u64_write(ASI_IMMU_DEMAP, da.value, 0); |
246 | flush(); |
360 | flush(); |
247 | } |
361 | } |
248 | 362 | ||
249 | /** Perform DMMU TLB Demap Operation. |
363 | /** Perform DMMU TLB Demap Operation. |
250 | * |
364 | * |
251 | * @param type Selects between context and page demap. |
365 | * @param type Selects between context and page demap. |
252 | * @param context_encoding Specifies which Context register has Context ID for demap. |
366 | * @param context_encoding Specifies which Context register has Context ID for demap. |
253 | * @param page Address which is on the page to be demapped. |
367 | * @param page Address which is on the page to be demapped. |
254 | */ |
368 | */ |
255 | static inline void dtlb_demap(int type, int context_encoding, __address page) |
369 | static inline void dtlb_demap(int type, int context_encoding, __address page) |
256 | { |
370 | { |
257 | tlb_demap_addr_t da; |
371 | tlb_demap_addr_t da; |
258 | page_address_t pg; |
372 | page_address_t pg; |
259 | 373 | ||
260 | da.value = 0; |
374 | da.value = 0; |
261 | pg.address = page; |
375 | pg.address = page; |
262 | 376 | ||
263 | da.type = type; |
377 | da.type = type; |
264 | da.context = context_encoding; |
378 | da.context = context_encoding; |
265 | da.vpn = pg.vpn; |
379 | da.vpn = pg.vpn; |
266 | 380 | ||
267 | asi_u64_write(ASI_DMMU_DEMAP, da.value, 0); |
381 | asi_u64_write(ASI_DMMU_DEMAP, da.value, 0); |
268 | flush(); |
382 | flush(); |
269 | } |
383 | } |
270 | 384 | ||
271 | extern void fast_instruction_access_mmu_miss(void); |
385 | extern void fast_instruction_access_mmu_miss(void); |
272 | extern void fast_data_access_mmu_miss(void); |
386 | extern void fast_data_access_mmu_miss(void); |
273 | extern void fast_data_access_protection(void); |
387 | extern void fast_data_access_protection(void); |
274 | 388 | ||
275 | #endif |
389 | #endif |
276 | 390 |