diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/sparc/include/asm/pgtsrmmu.h | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'arch/sparc/include/asm/pgtsrmmu.h')
-rw-r--r-- | arch/sparc/include/asm/pgtsrmmu.h | 136 |
1 files changed, 128 insertions, 8 deletions
diff --git a/arch/sparc/include/asm/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h index 79da17866fa..f6ae2b2b687 100644 --- a/arch/sparc/include/asm/pgtsrmmu.h +++ b/arch/sparc/include/asm/pgtsrmmu.h | |||
@@ -139,7 +139,6 @@ | |||
139 | restore %g0, %g0, %g0; | 139 | restore %g0, %g0, %g0; |
140 | 140 | ||
141 | #ifndef __ASSEMBLY__ | 141 | #ifndef __ASSEMBLY__ |
142 | extern unsigned long last_valid_pfn; | ||
143 | 142 | ||
144 | /* This makes sense. Honest it does - Anton */ | 143 | /* This makes sense. Honest it does - Anton */ |
145 | /* XXX Yes but it's ugly as sin. FIXME. -KMW */ | 144 | /* XXX Yes but it's ugly as sin. FIXME. -KMW */ |
@@ -149,13 +148,78 @@ extern void *srmmu_nocache_pool; | |||
149 | #define __nocache_fix(VADDR) __va(__nocache_pa(VADDR)) | 148 | #define __nocache_fix(VADDR) __va(__nocache_pa(VADDR)) |
150 | 149 | ||
151 | /* Accessing the MMU control register. */ | 150 | /* Accessing the MMU control register. */ |
152 | unsigned int srmmu_get_mmureg(void); | 151 | static inline unsigned int srmmu_get_mmureg(void) |
153 | void srmmu_set_mmureg(unsigned long regval); | 152 | { |
154 | void srmmu_set_ctable_ptr(unsigned long paddr); | 153 | unsigned int retval; |
155 | void srmmu_set_context(int context); | 154 | __asm__ __volatile__("lda [%%g0] %1, %0\n\t" : |
156 | int srmmu_get_context(void); | 155 | "=r" (retval) : |
157 | unsigned int srmmu_get_fstatus(void); | 156 | "i" (ASI_M_MMUREGS)); |
158 | unsigned int srmmu_get_faddr(void); | 157 | return retval; |
158 | } | ||
159 | |||
160 | static inline void srmmu_set_mmureg(unsigned long regval) | ||
161 | { | ||
162 | __asm__ __volatile__("sta %0, [%%g0] %1\n\t" : : | ||
163 | "r" (regval), "i" (ASI_M_MMUREGS) : "memory"); | ||
164 | |||
165 | } | ||
166 | |||
167 | static inline void srmmu_set_ctable_ptr(unsigned long paddr) | ||
168 | { | ||
169 | paddr = ((paddr >> 4) & SRMMU_CTX_PMASK); | ||
170 | __asm__ __volatile__("sta %0, [%1] %2\n\t" : : | ||
171 | "r" (paddr), "r" (SRMMU_CTXTBL_PTR), | ||
172 | "i" (ASI_M_MMUREGS) : | ||
173 | "memory"); | ||
174 | } | ||
175 | |||
176 | static inline unsigned long srmmu_get_ctable_ptr(void) | ||
177 | { | ||
178 | unsigned int retval; | ||
179 | |||
180 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
181 | "=r" (retval) : | ||
182 | "r" (SRMMU_CTXTBL_PTR), | ||
183 | "i" (ASI_M_MMUREGS)); | ||
184 | return (retval & SRMMU_CTX_PMASK) << 4; | ||
185 | } | ||
186 | |||
187 | static inline void srmmu_set_context(int context) | ||
188 | { | ||
189 | __asm__ __volatile__("sta %0, [%1] %2\n\t" : : | ||
190 | "r" (context), "r" (SRMMU_CTX_REG), | ||
191 | "i" (ASI_M_MMUREGS) : "memory"); | ||
192 | } | ||
193 | |||
194 | static inline int srmmu_get_context(void) | ||
195 | { | ||
196 | register int retval; | ||
197 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
198 | "=r" (retval) : | ||
199 | "r" (SRMMU_CTX_REG), | ||
200 | "i" (ASI_M_MMUREGS)); | ||
201 | return retval; | ||
202 | } | ||
203 | |||
204 | static inline unsigned int srmmu_get_fstatus(void) | ||
205 | { | ||
206 | unsigned int retval; | ||
207 | |||
208 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
209 | "=r" (retval) : | ||
210 | "r" (SRMMU_FAULT_STATUS), "i" (ASI_M_MMUREGS)); | ||
211 | return retval; | ||
212 | } | ||
213 | |||
214 | static inline unsigned int srmmu_get_faddr(void) | ||
215 | { | ||
216 | unsigned int retval; | ||
217 | |||
218 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
219 | "=r" (retval) : | ||
220 | "r" (SRMMU_FAULT_ADDR), "i" (ASI_M_MMUREGS)); | ||
221 | return retval; | ||
222 | } | ||
159 | 223 | ||
160 | /* This is guaranteed on all SRMMU's. */ | 224 | /* This is guaranteed on all SRMMU's. */ |
161 | static inline void srmmu_flush_whole_tlb(void) | 225 | static inline void srmmu_flush_whole_tlb(void) |
@@ -166,6 +230,59 @@ static inline void srmmu_flush_whole_tlb(void) | |||
166 | 230 | ||
167 | } | 231 | } |
168 | 232 | ||
233 | /* These flush types are not available on all chips... */ | ||
234 | static inline void srmmu_flush_tlb_ctx(void) | ||
235 | { | ||
236 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : | ||
237 | "r" (0x300), /* Flush TLB ctx.. */ | ||
238 | "i" (ASI_M_FLUSH_PROBE) : "memory"); | ||
239 | |||
240 | } | ||
241 | |||
242 | static inline void srmmu_flush_tlb_region(unsigned long addr) | ||
243 | { | ||
244 | addr &= SRMMU_PGDIR_MASK; | ||
245 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : | ||
246 | "r" (addr | 0x200), /* Flush TLB region.. */ | ||
247 | "i" (ASI_M_FLUSH_PROBE) : "memory"); | ||
248 | |||
249 | } | ||
250 | |||
251 | |||
252 | static inline void srmmu_flush_tlb_segment(unsigned long addr) | ||
253 | { | ||
254 | addr &= SRMMU_REAL_PMD_MASK; | ||
255 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : | ||
256 | "r" (addr | 0x100), /* Flush TLB segment.. */ | ||
257 | "i" (ASI_M_FLUSH_PROBE) : "memory"); | ||
258 | |||
259 | } | ||
260 | |||
261 | static inline void srmmu_flush_tlb_page(unsigned long page) | ||
262 | { | ||
263 | page &= PAGE_MASK; | ||
264 | __asm__ __volatile__("sta %%g0, [%0] %1\n\t": : | ||
265 | "r" (page), /* Flush TLB page.. */ | ||
266 | "i" (ASI_M_FLUSH_PROBE) : "memory"); | ||
267 | |||
268 | } | ||
269 | |||
270 | #ifndef CONFIG_SPARC_LEON | ||
271 | static inline unsigned long srmmu_hwprobe(unsigned long vaddr) | ||
272 | { | ||
273 | unsigned long retval; | ||
274 | |||
275 | vaddr &= PAGE_MASK; | ||
276 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | ||
277 | "=r" (retval) : | ||
278 | "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE)); | ||
279 | |||
280 | return retval; | ||
281 | } | ||
282 | #else | ||
283 | #define srmmu_hwprobe(addr) srmmu_swprobe(addr, 0) | ||
284 | #endif | ||
285 | |||
169 | static inline int | 286 | static inline int |
170 | srmmu_get_pte (unsigned long addr) | 287 | srmmu_get_pte (unsigned long addr) |
171 | { | 288 | { |
@@ -177,6 +294,9 @@ srmmu_get_pte (unsigned long addr) | |||
177 | return entry; | 294 | return entry; |
178 | } | 295 | } |
179 | 296 | ||
297 | extern unsigned long (*srmmu_read_physical)(unsigned long paddr); | ||
298 | extern void (*srmmu_write_physical)(unsigned long paddr, unsigned long word); | ||
299 | |||
180 | #endif /* !(__ASSEMBLY__) */ | 300 | #endif /* !(__ASSEMBLY__) */ |
181 | 301 | ||
182 | #endif /* !(_SPARC_PGTSRMMU_H) */ | 302 | #endif /* !(_SPARC_PGTSRMMU_H) */ |