1
2
3
4
5
6
7
8
9
10
11#include <linux/sched.h>
12#include <linux/mm.h>
13#include <linux/highmem.h>
14#include <linux/module.h>
15#include <asm/pgalloc.h>
16
17
18
19
20
21
22void flush_dcache_page(struct page *page)
23{
24 unsigned long dampr2;
25 void *vaddr;
26
27 dampr2 = __get_DAMPR(2);
28
29 vaddr = kmap_atomic(page, __KM_CACHE);
30
31 frv_dcache_writeback((unsigned long) vaddr, (unsigned long) vaddr + PAGE_SIZE);
32
33 kunmap_atomic(vaddr, __KM_CACHE);
34
35 if (dampr2) {
36 __set_DAMPR(2, dampr2);
37 __set_IAMPR(2, dampr2);
38 }
39
40}
41
42EXPORT_SYMBOL(flush_dcache_page);
43
44
45
46
47
48
49void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
50 unsigned long start, unsigned long len)
51{
52 unsigned long dampr2;
53 void *vaddr;
54
55 dampr2 = __get_DAMPR(2);
56
57 vaddr = kmap_atomic(page, __KM_CACHE);
58
59 start = (start & ~PAGE_MASK) | (unsigned long) vaddr;
60 frv_cache_wback_inv(start, start + len);
61
62 kunmap_atomic(vaddr, __KM_CACHE);
63
64 if (dampr2) {
65 __set_DAMPR(2, dampr2);
66 __set_IAMPR(2, dampr2);
67 }
68
69}
70
71EXPORT_SYMBOL(flush_icache_user_range);
72