aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/include/asm/page.h
diff options
context:
space:
mode:
authorJesper Nilsson <jesper.nilsson@axis.com>2008-10-21 11:45:58 -0400
committerJesper Nilsson <jesper.nilsson@axis.com>2008-10-29 12:29:44 -0400
commit556dcee7b829e5c350c3ffdbdb87a8b15aa3c5d3 (patch)
tree26485b0d92eedcba6c0c96d4069469041aaf7106 /arch/cris/include/asm/page.h
parent242bfafc8e42da4697c1e2dea108049d14dbac4b (diff)
[CRIS] Move header files from include to arch/cris/include.
Change all users of header files to correct path. Remove some unneeded headers for arch-v32. Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Diffstat (limited to 'arch/cris/include/asm/page.h')
-rw-r--r--arch/cris/include/asm/page.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/arch/cris/include/asm/page.h b/arch/cris/include/asm/page.h
new file mode 100644
index 000000000000..f3fdbd09c34c
--- /dev/null
+++ b/arch/cris/include/asm/page.h
@@ -0,0 +1,74 @@
1#ifndef _CRIS_PAGE_H
2#define _CRIS_PAGE_H
3
4#include <arch/page.h>
5#include <linux/const.h>
6
7/* PAGE_SHIFT determines the page size */
8#define PAGE_SHIFT 13
9#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
10#define PAGE_MASK (~(PAGE_SIZE-1))
11
12#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
13#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
14
15#define clear_user_page(page, vaddr, pg) clear_page(page)
16#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
17
18#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
19 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
20#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
21
22/*
23 * These are used to make use of C type-checking..
24 */
25#ifndef __ASSEMBLY__
26typedef struct { unsigned long pte; } pte_t;
27typedef struct { unsigned long pgd; } pgd_t;
28typedef struct { unsigned long pgprot; } pgprot_t;
29typedef struct page *pgtable_t;
30#endif
31
32#define pte_val(x) ((x).pte)
33#define pgd_val(x) ((x).pgd)
34#define pgprot_val(x) ((x).pgprot)
35
36#define __pte(x) ((pte_t) { (x) } )
37#define __pgd(x) ((pgd_t) { (x) } )
38#define __pgprot(x) ((pgprot_t) { (x) } )
39
40/* On CRIS the PFN numbers doesn't start at 0 so we have to compensate */
41/* for that before indexing into the page table starting at mem_map */
42#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
43#define pfn_valid(pfn) (((pfn) - (PAGE_OFFSET >> PAGE_SHIFT)) < max_mapnr)
44
45/* to index into the page map. our pages all start at physical addr PAGE_OFFSET so
46 * we can let the map start there. notice that we subtract PAGE_OFFSET because
47 * we start our mem_map there - in other ports they map mem_map physically and
48 * use __pa instead. in our system both the physical and virtual address of DRAM
49 * is too high to let mem_map start at 0, so we do it this way instead (similar
50 * to arm and m68k I think)
51 */
52
53#define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT))
54#define VALID_PAGE(page) (((page) - mem_map) < max_mapnr)
55#define virt_addr_valid(kaddr) pfn_valid((unsigned)(kaddr) >> PAGE_SHIFT)
56
57/* convert a page (based on mem_map and forward) to a physical address
58 * do this by figuring out the virtual address and then use __pa
59 */
60
61#define page_to_phys(page) __pa((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
62
63#ifndef __ASSEMBLY__
64
65#endif /* __ASSEMBLY__ */
66
67#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
68 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
69
70#include <asm-generic/memory_model.h>
71#include <asm-generic/page.h>
72
73#endif /* _CRIS_PAGE_H */
74