2 * arch/xtensa/mm/misc.S
4 * Miscellaneous assembly functions.
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
10 * Copyright (C) 2001 - 2005 Tensilica Inc.
12 * Chris Zankel <chris@zankel.net>
15 /* Note: we might want to implement some of the loops as zero-overhead-loops,
16 * where applicable and if supported by the processor.
19 #include <linux/linkage.h>
21 #include <asm/pgtable.h>
23 #include <xtensa/cacheasm.h>
24 #include <xtensa/cacheattrasm.h>
26 /* clear_page (page) */
30 addi a4, a2, PAGE_SIZE
47 * copy_page (void *to, void *from)
53 addi a4, a2, PAGE_SIZE
79 * void __flush_invalidate_cache_all(void)
82 ENTRY(__flush_invalidate_cache_all)
84 dcache_writeback_inv_all a2, a3
85 icache_invalidate_all a2, a3
89 * void __invalidate_icache_all(void)
92 ENTRY(__invalidate_icache_all)
94 icache_invalidate_all a2, a3
98 * void __flush_invalidate_dcache_all(void)
101 ENTRY(__flush_invalidate_dcache_all)
103 dcache_writeback_inv_all a2, a3
108 * void __flush_invalidate_cache_range(ulong start, ulong size)
111 ENTRY(__flush_invalidate_cache_range)
115 dcache_writeback_inv_region a4, a5, a6
116 icache_invalidate_region a2, a3, a4
120 * void __invalidate_icache_page(ulong start)
123 ENTRY(__invalidate_icache_page)
126 icache_invalidate_region a2, a3, a4
130 * void __invalidate_dcache_page(ulong start)
133 ENTRY(__invalidate_dcache_page)
136 dcache_invalidate_region a2, a3, a4
140 * void __invalidate_icache_range(ulong start, ulong size)
143 ENTRY(__invalidate_icache_range)
145 icache_invalidate_region a2, a3, a4
149 * void __invalidate_dcache_range(ulong start, ulong size)
152 ENTRY(__invalidate_dcache_range)
154 dcache_invalidate_region a2, a3, a4
158 * void __flush_dcache_page(ulong start)
161 ENTRY(__flush_dcache_page)
164 dcache_writeback_region a2, a3, a4
168 * void __flush_invalidate_dcache_page(ulong start)
171 ENTRY(__flush_invalidate_dcache_page)
174 dcache_writeback_inv_region a2, a3, a4
178 * void __flush_invalidate_dcache_range(ulong start, ulong size)
181 ENTRY(__flush_invalidate_dcache_range)
183 dcache_writeback_inv_region a2, a3, a4
187 * void __invalidate_dcache_all(void)
190 ENTRY(__invalidate_dcache_all)
192 dcache_invalidate_all a2, a3
196 * void __flush_invalidate_dcache_page_phys(ulong start)
199 ENTRY(__flush_invalidate_dcache_page_phys)
202 movi a3, XCHAL_DCACHE_SIZE
203 movi a4, PAGE_MASK | 1
206 1: addi a3, a3, -XCHAL_DCACHE_LINESIZE
219 ENTRY(check_dcache_low0)
222 movi a3, XCHAL_DCACHE_SIZE / 4
223 movi a4, PAGE_MASK | 1
226 1: addi a3, a3, -XCHAL_DCACHE_LINESIZE
237 ENTRY(check_dcache_high0)
240 movi a5, XCHAL_DCACHE_SIZE / 4
241 movi a3, XCHAL_DCACHE_SIZE / 2
242 movi a4, PAGE_MASK | 1
245 1: addi a3, a3, -XCHAL_DCACHE_LINESIZE
246 addi a5, a5, -XCHAL_DCACHE_LINESIZE
257 ENTRY(check_dcache_low1)
260 movi a5, XCHAL_DCACHE_SIZE / 4
261 movi a3, XCHAL_DCACHE_SIZE * 3 / 4
262 movi a4, PAGE_MASK | 1
265 1: addi a3, a3, -XCHAL_DCACHE_LINESIZE
266 addi a5, a5, -XCHAL_DCACHE_LINESIZE
277 ENTRY(check_dcache_high1)
280 movi a5, XCHAL_DCACHE_SIZE / 4
281 movi a3, XCHAL_DCACHE_SIZE
282 movi a4, PAGE_MASK | 1
285 1: addi a3, a3, -XCHAL_DCACHE_LINESIZE
286 addi a5, a5, -XCHAL_DCACHE_LINESIZE
299 * void __invalidate_icache_page_phys(ulong start)
302 ENTRY(__invalidate_icache_page_phys)
305 movi a3, XCHAL_ICACHE_SIZE
306 movi a4, PAGE_MASK | 1
309 1: addi a3, a3, -XCHAL_ICACHE_LINESIZE
325 movi a3, XCHAL_DCACHE_WAYS - 1
332 diwbi a5, XCHAL_DCACHE_LINESIZE
333 diwbi a5, XCHAL_DCACHE_LINESIZE * 2
334 diwbi a5, XCHAL_DCACHE_LINESIZE * 3
336 addi a5, a5, XCHAL_DCACHE_LINESIZE * 4
340 addi a2, a2, XCHAL_DCACHE_SIZE / XCHAL_DCACHE_WAYS
345 ENTRY(__invalidate_icache_page_index)
348 movi a3, XCHAL_ICACHE_WAYS - 1
355 iii a5, XCHAL_ICACHE_LINESIZE
356 iii a5, XCHAL_ICACHE_LINESIZE * 2
357 iii a5, XCHAL_ICACHE_LINESIZE * 3
359 addi a5, a5, XCHAL_ICACHE_LINESIZE * 4
363 addi a2, a2, XCHAL_ICACHE_SIZE / XCHAL_ICACHE_WAYS