aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ia64/page.h
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 /include/asm-ia64/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-ia64/page.h')
-rw-r--r--include/asm-ia64/page.h207
1 files changed, 207 insertions, 0 deletions
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
new file mode 100644
index 000000000000..24aab801a8ca
--- /dev/null
+++ b/include/asm-ia64/page.h
@@ -0,0 +1,207 @@
1#ifndef _ASM_IA64_PAGE_H
2#define _ASM_IA64_PAGE_H
3/*
4 * Pagetable related stuff.
5 *
6 * Copyright (C) 1998, 1999, 2002 Hewlett-Packard Co
7 * David Mosberger-Tang <davidm@hpl.hp.com>
8 */
9
10#include <linux/config.h>
11
12#include <asm/intrinsics.h>
13#include <asm/types.h>
14
15/*
16 * PAGE_SHIFT determines the actual kernel page size.
17 */
18#if defined(CONFIG_IA64_PAGE_SIZE_4KB)
19# define PAGE_SHIFT 12
20#elif defined(CONFIG_IA64_PAGE_SIZE_8KB)
21# define PAGE_SHIFT 13
22#elif defined(CONFIG_IA64_PAGE_SIZE_16KB)
23# define PAGE_SHIFT 14
24#elif defined(CONFIG_IA64_PAGE_SIZE_64KB)
25# define PAGE_SHIFT 16
26#else
27# error Unsupported page size!
28#endif
29
30#define PAGE_SIZE (__IA64_UL_CONST(1) << PAGE_SHIFT)
31#define PAGE_MASK (~(PAGE_SIZE - 1))
32#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
33
34#define PERCPU_PAGE_SHIFT 16 /* log2() of max. size of per-CPU area */
35#define PERCPU_PAGE_SIZE (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)
36
37#define RGN_MAP_LIMIT ((1UL << (4*PAGE_SHIFT - 12)) - PAGE_SIZE) /* per region addr limit */
38
39#ifdef CONFIG_HUGETLB_PAGE
40# define REGION_HPAGE (4UL) /* note: this is hardcoded in reload_context()!*/
41# define REGION_SHIFT 61
42# define HPAGE_REGION_BASE (REGION_HPAGE << REGION_SHIFT)
43# define HPAGE_SHIFT hpage_shift
44# define HPAGE_SHIFT_DEFAULT 28 /* check ia64 SDM for architecture supported size */
45# define HPAGE_SIZE (__IA64_UL_CONST(1) << HPAGE_SHIFT)
46# define HPAGE_MASK (~(HPAGE_SIZE - 1))
47
48# define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
49# define ARCH_HAS_HUGEPAGE_ONLY_RANGE
50#endif /* CONFIG_HUGETLB_PAGE */
51
52#ifdef __ASSEMBLY__
53# define __pa(x) ((x) - PAGE_OFFSET)
54# define __va(x) ((x) + PAGE_OFFSET)
55#else /* !__ASSEMBLY */
56# ifdef __KERNEL__
57# define STRICT_MM_TYPECHECKS
58
59extern void clear_page (void *page);
60extern void copy_page (void *to, void *from);
61
62/*
63 * clear_user_page() and copy_user_page() can't be inline functions because
64 * flush_dcache_page() can't be defined until later...
65 */
66#define clear_user_page(addr, vaddr, page) \
67do { \
68 clear_page(addr); \
69 flush_dcache_page(page); \
70} while (0)
71
72#define copy_user_page(to, from, vaddr, page) \
73do { \
74 copy_page((to), (from)); \
75 flush_dcache_page(page); \
76} while (0)
77
78
79#define alloc_zeroed_user_highpage(vma, vaddr) \
80({ \
81 struct page *page = alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr); \
82 if (page) \
83 flush_dcache_page(page); \
84 page; \
85})
86
87#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
88
89#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
90
91#ifdef CONFIG_VIRTUAL_MEM_MAP
92extern int ia64_pfn_valid (unsigned long pfn);
93#else
94# define ia64_pfn_valid(pfn) 1
95#endif
96
97#ifndef CONFIG_DISCONTIGMEM
98# define pfn_valid(pfn) (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
99# define page_to_pfn(page) ((unsigned long) (page - mem_map))
100# define pfn_to_page(pfn) (mem_map + (pfn))
101#else
102extern struct page *vmem_map;
103extern unsigned long max_low_pfn;
104# define pfn_valid(pfn) (((pfn) < max_low_pfn) && ia64_pfn_valid(pfn))
105# define page_to_pfn(page) ((unsigned long) (page - vmem_map))
106# define pfn_to_page(pfn) (vmem_map + (pfn))
107#endif
108
109#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
110#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
111
112typedef union ia64_va {
113 struct {
114 unsigned long off : 61; /* intra-region offset */
115 unsigned long reg : 3; /* region number */
116 } f;
117 unsigned long l;
118 void *p;
119} ia64_va;
120
121/*
122 * Note: These macros depend on the fact that PAGE_OFFSET has all
123 * region bits set to 1 and all other bits set to zero. They are
124 * expressed in this way to ensure they result in a single "dep"
125 * instruction.
126 */
127#define __pa(x) ({ia64_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
128#define __va(x) ({ia64_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
129
130#define REGION_NUMBER(x) ({ia64_va _v; _v.l = (long) (x); _v.f.reg;})
131#define REGION_OFFSET(x) ({ia64_va _v; _v.l = (long) (x); _v.f.off;})
132
133#define REGION_SIZE REGION_NUMBER(1)
134#define REGION_KERNEL 7
135
136#ifdef CONFIG_HUGETLB_PAGE
137# define htlbpage_to_page(x) (((unsigned long) REGION_NUMBER(x) << 61) \
138 | (REGION_OFFSET(x) >> (HPAGE_SHIFT-PAGE_SHIFT)))
139# define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
140# define is_hugepage_only_range(mm, addr, len) \
141 (REGION_NUMBER(addr) == REGION_HPAGE && \
142 REGION_NUMBER((addr)+(len)) == REGION_HPAGE)
143extern unsigned int hpage_shift;
144#endif
145
146static __inline__ int
147get_order (unsigned long size)
148{
149 long double d = size - 1;
150 long order;
151
152 order = ia64_getf_exp(d);
153 order = order - PAGE_SHIFT - 0xffff + 1;
154 if (order < 0)
155 order = 0;
156 return order;
157}
158
159# endif /* __KERNEL__ */
160#endif /* !__ASSEMBLY__ */
161
162#ifdef STRICT_MM_TYPECHECKS
163 /*
164 * These are used to make use of C type-checking..
165 */
166 typedef struct { unsigned long pte; } pte_t;
167 typedef struct { unsigned long pmd; } pmd_t;
168 typedef struct { unsigned long pgd; } pgd_t;
169 typedef struct { unsigned long pgprot; } pgprot_t;
170
171# define pte_val(x) ((x).pte)
172# define pmd_val(x) ((x).pmd)
173# define pgd_val(x) ((x).pgd)
174# define pgprot_val(x) ((x).pgprot)
175
176# define __pte(x) ((pte_t) { (x) } )
177# define __pgprot(x) ((pgprot_t) { (x) } )
178
179#else /* !STRICT_MM_TYPECHECKS */
180 /*
181 * .. while these make it easier on the compiler
182 */
183# ifndef __ASSEMBLY__
184 typedef unsigned long pte_t;
185 typedef unsigned long pmd_t;
186 typedef unsigned long pgd_t;
187 typedef unsigned long pgprot_t;
188# endif
189
190# define pte_val(x) (x)
191# define pmd_val(x) (x)
192# define pgd_val(x) (x)
193# define pgprot_val(x) (x)
194
195# define __pte(x) (x)
196# define __pgd(x) (x)
197# define __pgprot(x) (x)
198#endif /* !STRICT_MM_TYPECHECKS */
199
200#define PAGE_OFFSET __IA64_UL_CONST(0xe000000000000000)
201
202#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
203 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC | \
204 (((current->personality & READ_IMPLIES_EXEC) != 0) \
205 ? VM_EXEC : 0))
206
207#endif /* _ASM_IA64_PAGE_H */