aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/cacheflush.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include/asm/cacheflush.h')
-rw-r--r--arch/powerpc/include/asm/cacheflush.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h
index 69b6c3d78d6c..217f183aa8c4 100644
--- a/arch/powerpc/include/asm/cacheflush.h
+++ b/arch/powerpc/include/asm/cacheflush.h
@@ -67,11 +67,13 @@ static inline void __flush_dcache_icache_phys(unsigned long physaddr)
67 */ 67 */
68static inline void flush_dcache_range(unsigned long start, unsigned long stop) 68static inline void flush_dcache_range(unsigned long start, unsigned long stop)
69{ 69{
70 void *addr = (void *)(start & ~(L1_CACHE_BYTES - 1)); 70 unsigned long shift = l1_cache_shift();
71 unsigned long size = stop - (unsigned long)addr + (L1_CACHE_BYTES - 1); 71 unsigned long bytes = l1_cache_bytes();
72 void *addr = (void *)(start & ~(bytes - 1));
73 unsigned long size = stop - (unsigned long)addr + (bytes - 1);
72 unsigned long i; 74 unsigned long i;
73 75
74 for (i = 0; i < size >> L1_CACHE_SHIFT; i++, addr += L1_CACHE_BYTES) 76 for (i = 0; i < size >> shift; i++, addr += bytes)
75 dcbf(addr); 77 dcbf(addr);
76 mb(); /* sync */ 78 mb(); /* sync */
77} 79}
@@ -83,11 +85,13 @@ static inline void flush_dcache_range(unsigned long start, unsigned long stop)
83 */ 85 */
84static inline void clean_dcache_range(unsigned long start, unsigned long stop) 86static inline void clean_dcache_range(unsigned long start, unsigned long stop)
85{ 87{
86 void *addr = (void *)(start & ~(L1_CACHE_BYTES - 1)); 88 unsigned long shift = l1_cache_shift();
87 unsigned long size = stop - (unsigned long)addr + (L1_CACHE_BYTES - 1); 89 unsigned long bytes = l1_cache_bytes();
90 void *addr = (void *)(start & ~(bytes - 1));
91 unsigned long size = stop - (unsigned long)addr + (bytes - 1);
88 unsigned long i; 92 unsigned long i;
89 93
90 for (i = 0; i < size >> L1_CACHE_SHIFT; i++, addr += L1_CACHE_BYTES) 94 for (i = 0; i < size >> shift; i++, addr += bytes)
91 dcbst(addr); 95 dcbst(addr);
92 mb(); /* sync */ 96 mb(); /* sync */
93} 97}
@@ -100,11 +104,13 @@ static inline void clean_dcache_range(unsigned long start, unsigned long stop)
100static inline void invalidate_dcache_range(unsigned long start, 104static inline void invalidate_dcache_range(unsigned long start,
101 unsigned long stop) 105 unsigned long stop)
102{ 106{
103 void *addr = (void *)(start & ~(L1_CACHE_BYTES - 1)); 107 unsigned long shift = l1_cache_shift();
104 unsigned long size = stop - (unsigned long)addr + (L1_CACHE_BYTES - 1); 108 unsigned long bytes = l1_cache_bytes();
109 void *addr = (void *)(start & ~(bytes - 1));
110 unsigned long size = stop - (unsigned long)addr + (bytes - 1);
105 unsigned long i; 111 unsigned long i;
106 112
107 for (i = 0; i < size >> L1_CACHE_SHIFT; i++, addr += L1_CACHE_BYTES) 113 for (i = 0; i < size >> shift; i++, addr += bytes)
108 dcbi(addr); 114 dcbi(addr);
109 mb(); /* sync */ 115 mb(); /* sync */
110} 116}