aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv/mm/cache-page.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/frv/mm/cache-page.c')
-rw-r--r--arch/frv/mm/cache-page.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/arch/frv/mm/cache-page.c b/arch/frv/mm/cache-page.c
new file mode 100644
index 000000000000..683b5e344318
--- /dev/null
+++ b/arch/frv/mm/cache-page.c
@@ -0,0 +1,66 @@
1/* cache-page.c: whole-page cache wrangling functions for MMU linux
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#include <linux/sched.h>
12#include <linux/mm.h>
13#include <linux/highmem.h>
14#include <asm/pgalloc.h>
15
16/*****************************************************************************/
17/*
18 * DCF takes a virtual address and the page may not currently have one
19 * - temporarily hijack a kmap_atomic() slot and attach the page to it
20 */
21void flush_dcache_page(struct page *page)
22{
23 unsigned long dampr2;
24 void *vaddr;
25
26 dampr2 = __get_DAMPR(2);
27
28 vaddr = kmap_atomic(page, __KM_CACHE);
29
30 frv_dcache_writeback((unsigned long) vaddr, (unsigned long) vaddr + PAGE_SIZE);
31
32 kunmap_atomic(vaddr, __KM_CACHE);
33
34 if (dampr2) {
35 __set_DAMPR(2, dampr2);
36 __set_IAMPR(2, dampr2);
37 }
38
39} /* end flush_dcache_page() */
40
41/*****************************************************************************/
42/*
43 * ICI takes a virtual address and the page may not currently have one
44 * - so we temporarily attach the page to a bit of virtual space so that is can be flushed
45 */
46void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
47 unsigned long start, unsigned long len)
48{
49 unsigned long dampr2;
50 void *vaddr;
51
52 dampr2 = __get_DAMPR(2);
53
54 vaddr = kmap_atomic(page, __KM_CACHE);
55
56 start = (start & ~PAGE_MASK) | (unsigned long) vaddr;
57 frv_cache_wback_inv(start, start + len);
58
59 kunmap_atomic(vaddr, __KM_CACHE);
60
61 if (dampr2) {
62 __set_DAMPR(2, dampr2);
63 __set_IAMPR(2, dampr2);
64 }
65
66} /* end flush_icache_user_range() */