2 * linux/arch/arm/mm/cache-v4wt.S
4 * Copyright (C) 1997-2002 Russell king
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * ARMv4 write through cache operations support.
12 * We assume that the write buffer is not enabled.
14 #include <linux/linkage.h>
15 #include <linux/init.h>
17 #include "proc-macros.S"
20 * The size of one data cache line.
22 #define CACHE_DLINESIZE 32
25 * The number of data cache segments.
27 #define CACHE_DSEGMENTS 8
30 * The number of lines in a cache segment.
32 #define CACHE_DENTRIES 64
35 * This is the size at which it becomes more efficient to
36 * clean the whole cache, rather than using the individual
37 * cache line maintainence instructions.
39 * *** This needs benchmarking
41 #define CACHE_DLIMIT 16384
44 * flush_user_cache_all()
46 * Invalidate all cache entries in a particular address
49 ENTRY(v4wt_flush_user_cache_all)
52 * flush_kern_cache_all()
54 * Clean and invalidate the entire cache.
56 ENTRY(v4wt_flush_kern_cache_all)
61 mcrne p15, 0, ip, c7, c5, 0 @ invalidate I cache
62 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache
66 * flush_user_cache_range(start, end, flags)
68 * Clean and invalidate a range of cache entries in the specified
71 * - start - start address (inclusive, page aligned)
72 * - end - end address (exclusive, page aligned)
73 * - flags - vma_area_struct flags describing address space
75 ENTRY(v4wt_flush_user_cache_range)
76 sub r3, r1, r0 @ calculate total size
78 bhs __flush_whole_cache
80 1: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
82 mcrne p15, 0, r0, c7, c5, 1 @ invalidate I entry
83 add r0, r0, #CACHE_DLINESIZE
89 * coherent_kern_range(start, end)
91 * Ensure coherency between the Icache and the Dcache in the
92 * region described by start. If you have non-snooping
93 * Harvard caches, you need to implement this function.
95 * - start - virtual start address
96 * - end - virtual end address
98 ENTRY(v4wt_coherent_kern_range)
102 * coherent_user_range(start, end)
104 * Ensure coherency between the Icache and the Dcache in the
105 * region described by start. If you have non-snooping
106 * Harvard caches, you need to implement this function.
108 * - start - virtual start address
109 * - end - virtual end address
111 ENTRY(v4wt_coherent_user_range)
112 bic r0, r0, #CACHE_DLINESIZE - 1
113 1: mcr p15, 0, r0, c7, c5, 1 @ invalidate I entry
114 add r0, r0, #CACHE_DLINESIZE
120 * flush_kern_dcache_page(void *page)
122 * Ensure no D cache aliasing occurs, either with itself or
125 * - addr - page aligned address
127 ENTRY(v4wt_flush_kern_dcache_page)
129 mcr p15, 0, r2, c7, c5, 0 @ invalidate I cache
134 * dma_inv_range(start, end)
136 * Invalidate (discard) the specified virtual address range.
137 * May not write back any entries. If 'start' or 'end'
138 * are not cache line aligned, those lines must be written
141 * - start - virtual start address
142 * - end - virtual end address
144 ENTRY(v4wt_dma_inv_range)
145 bic r0, r0, #CACHE_DLINESIZE - 1
146 1: mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
147 add r0, r0, #CACHE_DLINESIZE
153 * dma_clean_range(start, end)
155 * Clean the specified virtual address range.
157 * - start - virtual start address
158 * - end - virtual end address
160 ENTRY(v4wt_dma_clean_range)
164 * dma_flush_range(start, end)
166 * Clean and invalidate the specified virtual address range.
168 * - start - virtual start address
169 * - end - virtual end address
171 .globl v4wt_dma_flush_range
172 .equ v4wt_dma_flush_range, v4wt_dma_inv_range
176 .type v4wt_cache_fns, #object
177 ENTRY(v4wt_cache_fns)
178 .long v4wt_flush_kern_cache_all
179 .long v4wt_flush_user_cache_all
180 .long v4wt_flush_user_cache_range
181 .long v4wt_coherent_kern_range
182 .long v4wt_coherent_user_range
183 .long v4wt_flush_kern_dcache_page
184 .long v4wt_dma_inv_range
185 .long v4wt_dma_clean_range
186 .long v4wt_dma_flush_range
187 .size v4wt_cache_fns, . - v4wt_cache_fns