This source file includes following definitions.
- sh3__flush_wback_region
- sh3__flush_purge_region
- sh3_cache_init
1
2
3
4
5
6
7
8
9 #include <linux/init.h>
10 #include <linux/mman.h>
11 #include <linux/mm.h>
12 #include <linux/threads.h>
13 #include <asm/addrspace.h>
14 #include <asm/page.h>
15 #include <asm/pgtable.h>
16 #include <asm/processor.h>
17 #include <asm/cache.h>
18 #include <asm/io.h>
19 #include <linux/uaccess.h>
20 #include <asm/pgalloc.h>
21 #include <asm/mmu_context.h>
22 #include <asm/cacheflush.h>
23
24
25
26
27
28
29
30
31
32
33
34 static void sh3__flush_wback_region(void *start, int size)
35 {
36 unsigned long v, j;
37 unsigned long begin, end;
38 unsigned long flags;
39
40 begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
41 end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
42 & ~(L1_CACHE_BYTES-1);
43
44 for (v = begin; v < end; v+=L1_CACHE_BYTES) {
45 unsigned long addrstart = CACHE_OC_ADDRESS_ARRAY;
46 for (j = 0; j < current_cpu_data.dcache.ways; j++) {
47 unsigned long data, addr, p;
48
49 p = __pa(v);
50 addr = addrstart | (v & current_cpu_data.dcache.entry_mask);
51 local_irq_save(flags);
52 data = __raw_readl(addr);
53
54 if ((data & CACHE_PHYSADDR_MASK) ==
55 (p & CACHE_PHYSADDR_MASK)) {
56 data &= ~SH_CACHE_UPDATED;
57 __raw_writel(data, addr);
58 local_irq_restore(flags);
59 break;
60 }
61 local_irq_restore(flags);
62 addrstart += current_cpu_data.dcache.way_incr;
63 }
64 }
65 }
66
67
68
69
70
71
72
73 static void sh3__flush_purge_region(void *start, int size)
74 {
75 unsigned long v;
76 unsigned long begin, end;
77
78 begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
79 end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
80 & ~(L1_CACHE_BYTES-1);
81
82 for (v = begin; v < end; v+=L1_CACHE_BYTES) {
83 unsigned long data, addr;
84
85 data = (v & 0xfffffc00);
86 addr = CACHE_OC_ADDRESS_ARRAY |
87 (v & current_cpu_data.dcache.entry_mask) | SH_CACHE_ASSOC;
88 __raw_writel(data, addr);
89 }
90 }
91
92 void __init sh3_cache_init(void)
93 {
94 __flush_wback_region = sh3__flush_wback_region;
95 __flush_purge_region = sh3__flush_purge_region;
96
97
98
99
100
101
102
103 __flush_invalidate_region = sh3__flush_purge_region;
104 }