2 * swift.S: MicroSparc-II mmu/cache operations.
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
10 #include <asm/pgtsrmmu.h>
11 #include <asm/asm-offsets.h>
16 #if 1 /* XXX screw this, I can't get the VAC flushes working
17 * XXX reliably... -DaveM
19 .globl swift_flush_cache_all, swift_flush_cache_mm
20 .globl swift_flush_cache_range, swift_flush_cache_page
21 .globl swift_flush_page_for_dma
22 .globl swift_flush_page_to_ram
24 swift_flush_cache_all:
26 swift_flush_cache_range:
27 swift_flush_cache_page:
28 swift_flush_page_for_dma:
29 swift_flush_page_to_ram:
30 sethi %hi(0x2000), %o0
31 1: subcc %o0, 0x10, %o0
33 sta %g0, [%o0] ASI_M_DATAC_TAG
35 sta %g0, [%o1] ASI_M_TXTC_TAG
40 .globl swift_flush_cache_all
41 swift_flush_cache_all:
42 WINDOW_FLUSH(%g4, %g5)
44 /* Just clear out all the tags. */
45 sethi %hi(16 * 1024), %o0
47 sta %g0, [%o0] ASI_M_TXTC_TAG
49 sta %g0, [%o0] ASI_M_DATAC_TAG
53 .globl swift_flush_cache_mm
55 ld [%o0 + AOFF_mm_context], %g2
57 be swift_flush_cache_mm_out
58 WINDOW_FLUSH(%g4, %g5)
64 mov SRMMU_CTX_REG, %g7
65 lda [%g7] ASI_M_MMUREGS, %g5
66 sta %g2, [%g7] ASI_M_MMUREGS
69 sethi %hi(0x2000), %o0
70 1: subcc %o0, 0x10, %o0
71 sta %g0, [%o0] ASI_M_FLUSH_CTX
84 1: sta %g0, [%o0 ] ASI_M_FLUSH_CTX
85 sta %g0, [%o0 + %o1] ASI_M_FLUSH_CTX
86 sta %g0, [%o0 + %o2] ASI_M_FLUSH_CTX
87 sta %g0, [%o0 + %o3] ASI_M_FLUSH_CTX
88 sta %g0, [%o0 + %o4] ASI_M_FLUSH_CTX
89 sta %g0, [%o0 + %o5] ASI_M_FLUSH_CTX
90 sta %g0, [%o0 + %g2] ASI_M_FLUSH_CTX
91 sta %g0, [%o0 + %g3] ASI_M_FLUSH_CTX
97 mov SRMMU_CTX_REG, %g7
98 sta %g5, [%g7] ASI_M_MMUREGS
102 swift_flush_cache_mm_out:
106 .globl swift_flush_cache_range
107 swift_flush_cache_range:
108 ld [%o0 + VMA_VM_MM], %o0
112 bgu swift_flush_cache_mm
117 .globl swift_flush_cache_page
118 swift_flush_cache_page:
119 ld [%o0 + VMA_VM_MM], %o0
121 ld [%o0 + AOFF_mm_context], %g2
123 be swift_flush_cache_page_out
124 WINDOW_FLUSH(%g4, %g5)
126 andn %g1, PSR_ET, %g3
130 mov SRMMU_CTX_REG, %g7
131 lda [%g7] ASI_M_MMUREGS, %g5
132 sta %g2, [%g7] ASI_M_MMUREGS
134 andn %o1, (PAGE_SIZE - 1), %o1
136 sethi %hi(0x1000), %o0
137 1: subcc %o0, 0x10, %o0
138 sta %g0, [%o1 + %o0] ASI_M_FLUSH_PAGE
150 1: sta %g0, [%o1 ] ASI_M_FLUSH_PAGE
151 sta %g0, [%o1 + %o0] ASI_M_FLUSH_PAGE
152 sta %g0, [%o1 + %o2] ASI_M_FLUSH_PAGE
153 sta %g0, [%o1 + %o3] ASI_M_FLUSH_PAGE
154 sta %g0, [%o1 + %o4] ASI_M_FLUSH_PAGE
155 sta %g0, [%o1 + %o5] ASI_M_FLUSH_PAGE
156 sta %g0, [%o1 + %g3] ASI_M_FLUSH_PAGE
157 sta %g0, [%o1 + %g4] ASI_M_FLUSH_PAGE
163 mov SRMMU_CTX_REG, %g7
164 sta %g5, [%g7] ASI_M_MMUREGS
168 swift_flush_cache_page_out:
172 /* Swift is write-thru, however it is not
173 * I/O nor TLB-walk coherent. Also it has
174 * caches which are virtually indexed and tagged.
176 .globl swift_flush_page_for_dma
177 .globl swift_flush_page_to_ram
178 swift_flush_page_for_dma:
179 swift_flush_page_to_ram:
180 andn %o0, (PAGE_SIZE - 1), %o1
182 sethi %hi(0x1000), %o0
183 1: subcc %o0, 0x10, %o0
184 sta %g0, [%o1 + %o0] ASI_M_FLUSH_PAGE
196 1: sta %g0, [%o1 ] ASI_M_FLUSH_PAGE
197 sta %g0, [%o1 + %o0] ASI_M_FLUSH_PAGE
198 sta %g0, [%o1 + %o2] ASI_M_FLUSH_PAGE
199 sta %g0, [%o1 + %o3] ASI_M_FLUSH_PAGE
200 sta %g0, [%o1 + %o4] ASI_M_FLUSH_PAGE
201 sta %g0, [%o1 + %o5] ASI_M_FLUSH_PAGE
202 sta %g0, [%o1 + %g3] ASI_M_FLUSH_PAGE
203 sta %g0, [%o1 + %g4] ASI_M_FLUSH_PAGE
212 .globl swift_flush_sig_insns
213 swift_flush_sig_insns:
218 .globl swift_flush_tlb_mm
219 .globl swift_flush_tlb_range
220 .globl swift_flush_tlb_all
221 swift_flush_tlb_range:
222 ld [%o0 + VMA_VM_MM], %o0
224 ld [%o0 + AOFF_mm_context], %g2
226 be swift_flush_tlb_all_out
229 sta %g0, [%o1] ASI_M_FLUSH_PROBE
230 swift_flush_tlb_all_out:
234 .globl swift_flush_tlb_page
235 swift_flush_tlb_page:
236 ld [%o0 + VMA_VM_MM], %o0
237 mov SRMMU_CTX_REG, %g1
238 ld [%o0 + AOFF_mm_context], %o3
239 andn %o1, (PAGE_SIZE - 1), %o1
241 be swift_flush_tlb_page_out
245 sta %g0, [%o1] ASI_M_FLUSH_PROBE
247 lda [%g1] ASI_M_MMUREGS, %g5
248 sta %o3, [%g1] ASI_M_MMUREGS
249 sta %g0, [%o1] ASI_M_FLUSH_PAGE /* rem. virt. cache. prot. */
250 sta %g0, [%o1] ASI_M_FLUSH_PROBE
251 sta %g5, [%g1] ASI_M_MMUREGS
253 swift_flush_tlb_page_out: