diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-v850/page.h |
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 'include/asm-v850/page.h')
-rw-r--r-- | include/asm-v850/page.h | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/include/asm-v850/page.h b/include/asm-v850/page.h new file mode 100644 index 000000000000..06085b0c043e --- /dev/null +++ b/include/asm-v850/page.h | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | * include/asm-v850/page.h -- VM ops | ||
3 | * | ||
4 | * Copyright (C) 2001,02,03 NEC Electronics Corporation | ||
5 | * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org> | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General | ||
8 | * Public License. See the file COPYING in the main directory of this | ||
9 | * archive for more details. | ||
10 | * | ||
11 | * Written by Miles Bader <miles@gnu.org> | ||
12 | */ | ||
13 | |||
14 | #ifndef __V850_PAGE_H__ | ||
15 | #define __V850_PAGE_H__ | ||
16 | |||
17 | #include <asm/machdep.h> | ||
18 | |||
19 | |||
20 | #define PAGE_SHIFT 12 | ||
21 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | ||
22 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
23 | |||
24 | |||
25 | /* | ||
26 | * PAGE_OFFSET -- the first address of the first page of memory. For archs with | ||
27 | * no MMU this corresponds to the first free page in physical memory (aligned | ||
28 | * on a page boundary). | ||
29 | */ | ||
30 | #ifndef PAGE_OFFSET | ||
31 | #define PAGE_OFFSET 0x0000000 | ||
32 | #endif | ||
33 | |||
34 | |||
35 | #ifdef __KERNEL__ | ||
36 | #ifndef __ASSEMBLY__ | ||
37 | |||
38 | #define STRICT_MM_TYPECHECKS | ||
39 | |||
40 | #define clear_page(page) memset ((void *)(page), 0, PAGE_SIZE) | ||
41 | #define copy_page(to, from) memcpy ((void *)(to), (void *)from, PAGE_SIZE) | ||
42 | |||
43 | #define clear_user_page(addr, vaddr, page) \ | ||
44 | do { clear_page(addr); \ | ||
45 | flush_dcache_page(page); \ | ||
46 | } while (0) | ||
47 | #define copy_user_page(to, from, vaddr, page) \ | ||
48 | do { copy_page(to, from); \ | ||
49 | flush_dcache_page(page); \ | ||
50 | } while (0) | ||
51 | |||
52 | #ifdef STRICT_MM_TYPECHECKS | ||
53 | /* | ||
54 | * These are used to make use of C type-checking.. | ||
55 | */ | ||
56 | |||
57 | typedef struct { unsigned long pte; } pte_t; | ||
58 | typedef struct { unsigned long pmd; } pmd_t; | ||
59 | typedef struct { unsigned long pgd; } pgd_t; | ||
60 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
61 | |||
62 | #define pte_val(x) ((x).pte) | ||
63 | #define pmd_val(x) ((x).pmd) | ||
64 | #define pgd_val(x) ((x).pgd) | ||
65 | #define pgprot_val(x) ((x).pgprot) | ||
66 | |||
67 | #define __pte(x) ((pte_t) { (x) } ) | ||
68 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
69 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
70 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
71 | |||
72 | #else /* !STRICT_MM_TYPECHECKS */ | ||
73 | /* | ||
74 | * .. while these make it easier on the compiler | ||
75 | */ | ||
76 | |||
77 | typedef unsigned long pte_t; | ||
78 | typedef unsigned long pmd_t; | ||
79 | typedef unsigned long pgd_t; | ||
80 | typedef unsigned long pgprot_t; | ||
81 | |||
82 | #define pte_val(x) (x) | ||
83 | #define pmd_val(x) (x) | ||
84 | #define pgd_val(x) (x) | ||
85 | #define pgprot_val(x) (x) | ||
86 | |||
87 | #define __pte(x) (x) | ||
88 | #define __pmd(x) (x) | ||
89 | #define __pgd(x) (x) | ||
90 | #define __pgprot(x) (x) | ||
91 | |||
92 | #endif /* STRICT_MM_TYPECHECKS */ | ||
93 | |||
94 | #endif /* !__ASSEMBLY__ */ | ||
95 | |||
96 | |||
97 | /* to align the pointer to the (next) page boundary */ | ||
98 | #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) | ||
99 | |||
100 | |||
101 | #ifndef __ASSEMBLY__ | ||
102 | |||
103 | /* Pure 2^n version of get_order */ | ||
104 | extern __inline__ int get_order (unsigned long size) | ||
105 | { | ||
106 | int order; | ||
107 | |||
108 | size = (size-1) >> (PAGE_SHIFT-1); | ||
109 | order = -1; | ||
110 | do { | ||
111 | size >>= 1; | ||
112 | order++; | ||
113 | } while (size); | ||
114 | return order; | ||
115 | } | ||
116 | |||
117 | #endif /* !__ASSEMBLY__ */ | ||
118 | |||
119 | |||
120 | /* No current v850 processor has virtual memory. */ | ||
121 | #define __virt_to_phys(addr) (addr) | ||
122 | #define __phys_to_virt(addr) (addr) | ||
123 | |||
124 | #define virt_to_pfn(kaddr) (__virt_to_phys (kaddr) >> PAGE_SHIFT) | ||
125 | #define pfn_to_virt(pfn) __phys_to_virt ((pfn) << PAGE_SHIFT) | ||
126 | |||
127 | #define MAP_NR(kaddr) \ | ||
128 | (((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT) | ||
129 | #define virt_to_page(kaddr) (mem_map + MAP_NR (kaddr)) | ||
130 | #define page_to_virt(page) \ | ||
131 | ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) | ||
132 | |||
133 | #define pfn_to_page(pfn) virt_to_page (pfn_to_virt (pfn)) | ||
134 | #define page_to_pfn(page) virt_to_pfn (page_to_virt (page)) | ||
135 | |||
136 | #define virt_addr_valid(kaddr) \ | ||
137 | (((void *)(kaddr) >= (void *)PAGE_OFFSET) && MAP_NR (kaddr) < max_mapnr) | ||
138 | |||
139 | |||
140 | #define __pa(x) __virt_to_phys ((unsigned long)(x)) | ||
141 | #define __va(x) ((void *)__phys_to_virt ((unsigned long)(x))) | ||
142 | |||
143 | |||
144 | #endif /* KERNEL */ | ||
145 | |||
146 | #endif /* __V850_PAGE_H__ */ | ||