1 /* cache-page.c: whole-page cache wrangling functions for MMU linux
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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.
11 #include <linux/sched.h>
13 #include <linux/highmem.h>
14 #include <asm/pgalloc.h>
16 /*****************************************************************************/
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
21 void flush_dcache_page(struct page
*page
)
26 dampr2
= __get_DAMPR(2);
28 vaddr
= kmap_atomic(page
, __KM_CACHE
);
30 frv_dcache_writeback((unsigned long) vaddr
, (unsigned long) vaddr
+ PAGE_SIZE
);
32 kunmap_atomic(vaddr
, __KM_CACHE
);
35 __set_DAMPR(2, dampr2
);
36 __set_IAMPR(2, dampr2
);
39 } /* end flush_dcache_page() */
41 /*****************************************************************************/
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
46 void flush_icache_user_range(struct vm_area_struct
*vma
, struct page
*page
,
47 unsigned long start
, unsigned long len
)
52 dampr2
= __get_DAMPR(2);
54 vaddr
= kmap_atomic(page
, __KM_CACHE
);
56 start
= (start
& ~PAGE_MASK
) | (unsigned long) vaddr
;
57 frv_cache_wback_inv(start
, start
+ len
);
59 kunmap_atomic(vaddr
, __KM_CACHE
);
62 __set_DAMPR(2, dampr2
);
63 __set_IAMPR(2, dampr2
);
66 } /* end flush_icache_user_range() */