]> git.sur5r.net Git - u-boot/blob - include/asm-sh/cache.h
Merge branch 'master' of git://www.denx.de/git/u-boot-coldfire
[u-boot] / include / asm-sh / cache.h
1 #ifndef __ASM_SH_CACHE_H
2 #define __ASM_SH_CACHE_H
3
4 #if defined(CONFIG_SH4) || defined(CONFIG_SH4A)
5
6 #define L1_CACHE_BYTES 32
7 struct __large_struct { unsigned long buf[100]; };
8 #define __m(x) (*(struct __large_struct *)(x))
9
10 void dcache_wback_range(u32 start, u32 end)
11 {
12     u32 v;
13
14     start &= ~(L1_CACHE_BYTES-1);
15     for (v = start; v < end; v+=L1_CACHE_BYTES) {
16         asm volatile("ocbwb     %0"
17                      : /* no output */
18                      : "m" (__m(v)));
19     }
20 }
21
22 void dcache_invalid_range(u32 start, u32 end)
23 {
24     u32 v;
25
26     start &= ~(L1_CACHE_BYTES-1);
27     for (v = start; v < end; v+=L1_CACHE_BYTES) {
28         asm volatile("ocbi     %0"
29                      : /* no output */
30                      : "m" (__m(v)));
31     }
32 }
33 #endif /* CONFIG_SH4 || CONFIG_SH4A */
34
35 #endif  /* __ASM_SH_CACHE_H */