1 /* $Id: swift.S,v 1.9 2002/01/08 11:11:59 davem Exp $
2 * swift.S: MicroSparc-II mmu/cache operations.
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
7 #include <linux/config.h>
11 #include <asm/pgtsrmmu.h>
12 #include <asm/asm_offsets.h>
17 #if 1 /* XXX screw this, I can't get the VAC flushes working
18 * XXX reliably... -DaveM
20 .globl swift_flush_cache_all, swift_flush_cache_mm
21 .globl swift_flush_cache_range, swift_flush_cache_page
22 .globl swift_flush_page_for_dma
23 .globl swift_flush_page_to_ram
25 swift_flush_cache_all:
27 swift_flush_cache_range:
28 swift_flush_cache_page:
29 swift_flush_page_for_dma:
30 swift_flush_page_to_ram:
31 sethi %hi(0x2000), %o0
32 1: subcc %o0, 0x10, %o0
34 sta %g0, [%o0] ASI_M_DATAC_TAG
36 sta %g0, [%o1] ASI_M_TXTC_TAG
41 .globl swift_flush_cache_all
42 swift_flush_cache_all:
43 WINDOW_FLUSH(%g4, %g5)
45 /* Just clear out all the tags. */
46 sethi %hi(16 * 1024), %o0
48 sta %g0, [%o0] ASI_M_TXTC_TAG
50 sta %g0, [%o0] ASI_M_DATAC_TAG
54 .globl swift_flush_cache_mm
56 ld [%o0 + AOFF_mm_context], %g2
58 be swift_flush_cache_mm_out
59 WINDOW_FLUSH(%g4, %g5)
65 mov SRMMU_CTX_REG, %g7
66 lda [%g7] ASI_M_MMUREGS, %g5
67 sta %g2, [%g7] ASI_M_MMUREGS
70 sethi %hi(0x2000), %o0
71 1: subcc %o0, 0x10, %o0
72 sta %g0, [%o0] ASI_M_FLUSH_CTX
85 1: sta %g0, [%o0 ] ASI_M_FLUSH_CTX
86 sta %g0, [%o0 + %o1] ASI_M_FLUSH_CTX
87 sta %g0, [%o0 + %o2] ASI_M_FLUSH_CTX
88 sta %g0, [%o0 + %o3] ASI_M_FLUSH_CTX
89 sta %g0, [%o0 + %o4] ASI_M_FLUSH_CTX
90 sta %g0, [%o0 + %o5] ASI_M_FLUSH_CTX
91 sta %g0, [%o0 + %g2] ASI_M_FLUSH_CTX
92 sta %g0, [%o0 + %g3] ASI_M_FLUSH_CTX
98 mov SRMMU_CTX_REG, %g7
99 sta %g5, [%g7] ASI_M_MMUREGS
103 swift_flush_cache_mm_out:
107 .globl swift_flush_cache_range
108 swift_flush_cache_range:
109 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */
113 bgu swift_flush_cache_mm
118 .globl swift_flush_cache_page
119 swift_flush_cache_page:
120 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */
122 ld [%o0 + AOFF_mm_context], %g2
124 be swift_flush_cache_page_out
125 WINDOW_FLUSH(%g4, %g5)
127 andn %g1, PSR_ET, %g3
131 mov SRMMU_CTX_REG, %g7
132 lda [%g7] ASI_M_MMUREGS, %g5
133 sta %g2, [%g7] ASI_M_MMUREGS
135 andn %o1, (PAGE_SIZE - 1), %o1
137 sethi %hi(0x1000), %o0
138 1: subcc %o0, 0x10, %o0
139 sta %g0, [%o1 + %o0] ASI_M_FLUSH_PAGE
151 1: sta %g0, [%o1 ] ASI_M_FLUSH_PAGE
152 sta %g0, [%o1 + %o0] ASI_M_FLUSH_PAGE
153 sta %g0, [%o1 + %o2] ASI_M_FLUSH_PAGE
154 sta %g0, [%o1 + %o3] ASI_M_FLUSH_PAGE
155 sta %g0, [%o1 + %o4] ASI_M_FLUSH_PAGE
156 sta %g0, [%o1 + %o5] ASI_M_FLUSH_PAGE
157 sta %g0, [%o1 + %g3] ASI_M_FLUSH_PAGE
158 sta %g0, [%o1 + %g4] ASI_M_FLUSH_PAGE
164 mov SRMMU_CTX_REG, %g7
165 sta %g5, [%g7] ASI_M_MMUREGS
169 swift_flush_cache_page_out:
173 /* Swift is write-thru, however it is not
174 * I/O nor TLB-walk coherent. Also it has
175 * caches which are virtually indexed and tagged.
177 .globl swift_flush_page_for_dma
178 .globl swift_flush_page_to_ram
179 swift_flush_page_for_dma:
180 swift_flush_page_to_ram:
181 andn %o0, (PAGE_SIZE - 1), %o1
183 sethi %hi(0x1000), %o0
184 1: subcc %o0, 0x10, %o0
185 sta %g0, [%o1 + %o0] ASI_M_FLUSH_PAGE
197 1: sta %g0, [%o1 ] ASI_M_FLUSH_PAGE
198 sta %g0, [%o1 + %o0] ASI_M_FLUSH_PAGE
199 sta %g0, [%o1 + %o2] ASI_M_FLUSH_PAGE
200 sta %g0, [%o1 + %o3] ASI_M_FLUSH_PAGE
201 sta %g0, [%o1 + %o4] ASI_M_FLUSH_PAGE
202 sta %g0, [%o1 + %o5] ASI_M_FLUSH_PAGE
203 sta %g0, [%o1 + %g3] ASI_M_FLUSH_PAGE
204 sta %g0, [%o1 + %g4] ASI_M_FLUSH_PAGE
213 .globl swift_flush_sig_insns
214 swift_flush_sig_insns:
219 .globl swift_flush_tlb_mm
220 .globl swift_flush_tlb_range
221 .globl swift_flush_tlb_all
222 swift_flush_tlb_range:
223 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */
225 ld [%o0 + AOFF_mm_context], %g2
227 be swift_flush_tlb_all_out
230 sta %g0, [%o1] ASI_M_FLUSH_PROBE
231 swift_flush_tlb_all_out:
235 .globl swift_flush_tlb_page
236 swift_flush_tlb_page:
237 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */
238 mov SRMMU_CTX_REG, %g1
239 ld [%o0 + AOFF_mm_context], %o3
240 andn %o1, (PAGE_SIZE - 1), %o1
242 be swift_flush_tlb_page_out
246 sta %g0, [%o1] ASI_M_FLUSH_PROBE
248 lda [%g1] ASI_M_MMUREGS, %g5
249 sta %o3, [%g1] ASI_M_MMUREGS
250 sta %g0, [%o1] ASI_M_FLUSH_PAGE /* rem. virt. cache. prot. */
251 sta %g0, [%o1] ASI_M_FLUSH_PROBE
252 sta %g5, [%g1] ASI_M_MMUREGS
254 swift_flush_tlb_page_out: