aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv/mm/cache-page.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/frv/mm/cache-page.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
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() */