aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sparc64/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-sparc64/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-sparc64/page.h')
-rw-r--r--include/asm-sparc64/page.h172
1 files changed, 172 insertions, 0 deletions
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
new file mode 100644
index 000000000000..219ea043a14a
--- /dev/null
+++ b/include/asm-sparc64/page.h
@@ -0,0 +1,172 @@
1/* $Id: page.h,v 1.39 2002/02/09 19:49:31 davem Exp $ */
2
3#ifndef _SPARC64_PAGE_H
4#define _SPARC64_PAGE_H
5
6#include <linux/config.h>
7#include <asm/const.h>
8
9#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB)
10#define PAGE_SHIFT 13
11#elif defined(CONFIG_SPARC64_PAGE_SIZE_64KB)
12#define PAGE_SHIFT 16
13#elif defined(CONFIG_SPARC64_PAGE_SIZE_512KB)
14#define PAGE_SHIFT 19
15#elif defined(CONFIG_SPARC64_PAGE_SIZE_4MB)
16#define PAGE_SHIFT 22
17#else
18#error No page size specified in kernel configuration
19#endif
20
21#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
22#define PAGE_MASK (~(PAGE_SIZE-1))
23
24#ifdef __KERNEL__
25
26#ifndef __ASSEMBLY__
27
28extern void _clear_page(void *page);
29#define clear_page(X) _clear_page((void *)(X))
30struct page;
31extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page);
32#define copy_page(X,Y) memcpy((void *)(X), (void *)(Y), PAGE_SIZE)
33extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage);
34
35/* Unlike sparc32, sparc64's parameter passing API is more
36 * sane in that structures which as small enough are passed
37 * in registers instead of on the stack. Thus, setting
38 * STRICT_MM_TYPECHECKS does not generate worse code so
39 * let's enable it to get the type checking.
40 */
41
42#define STRICT_MM_TYPECHECKS
43
44#ifdef STRICT_MM_TYPECHECKS
45/* These are used to make use of C type-checking.. */
46typedef struct { unsigned long pte; } pte_t;
47typedef struct { unsigned long iopte; } iopte_t;
48typedef struct { unsigned int pmd; } pmd_t;
49typedef struct { unsigned int pgd; } pgd_t;
50typedef struct { unsigned long pgprot; } pgprot_t;
51
52#define pte_val(x) ((x).pte)
53#define iopte_val(x) ((x).iopte)
54#define pmd_val(x) ((x).pmd)
55#define pgd_val(x) ((x).pgd)
56#define pgprot_val(x) ((x).pgprot)
57
58#define __pte(x) ((pte_t) { (x) } )
59#define __iopte(x) ((iopte_t) { (x) } )
60#define __pmd(x) ((pmd_t) { (x) } )
61#define __pgd(x) ((pgd_t) { (x) } )
62#define __pgprot(x) ((pgprot_t) { (x) } )
63
64#else
65/* .. while these make it easier on the compiler */
66typedef unsigned long pte_t;
67typedef unsigned long iopte_t;
68typedef unsigned int pmd_t;
69typedef unsigned int pgd_t;
70typedef unsigned long pgprot_t;
71
72#define pte_val(x) (x)
73#define iopte_val(x) (x)
74#define pmd_val(x) (x)
75#define pgd_val(x) (x)
76#define pgprot_val(x) (x)
77
78#define __pte(x) (x)
79#define __iopte(x) (x)
80#define __pmd(x) (x)
81#define __pgd(x) (x)
82#define __pgprot(x) (x)
83
84#endif /* (STRICT_MM_TYPECHECKS) */
85
86#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
87#define HPAGE_SHIFT 22
88#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K)
89#define HPAGE_SHIFT 19
90#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
91#define HPAGE_SHIFT 16
92#endif
93
94#ifdef CONFIG_HUGETLB_PAGE
95#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
96#define HPAGE_MASK (~(HPAGE_SIZE - 1UL))
97#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
98#endif
99
100#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \
101 (_AC(0x0000000070000000,UL)) : (PAGE_OFFSET))
102
103#endif /* !(__ASSEMBLY__) */
104
105/* to align the pointer to the (next) page boundary */
106#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
107
108/* We used to stick this into a hard-coded global register (%g4)
109 * but that does not make sense anymore.
110 */
111#define PAGE_OFFSET _AC(0xFFFFF80000000000,UL)
112
113#ifndef __ASSEMBLY__
114
115#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
116#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
117
118/* PFNs are real physical page numbers. However, mem_map only begins to record
119 * per-page information starting at pfn_base. This is to handle systems where
120 * the first physical page in the machine is at some huge physical address,
121 * such as 4GB. This is common on a partitioned E10000, for example.
122 */
123extern struct page *pfn_to_page(unsigned long pfn);
124extern unsigned long page_to_pfn(struct page *);
125
126#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr)>>PAGE_SHIFT)
127
128#define pfn_valid(pfn) (((pfn)-(pfn_base)) < max_mapnr)
129#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
130
131#define virt_to_phys __pa
132#define phys_to_virt __va
133
134/* The following structure is used to hold the physical
135 * memory configuration of the machine. This is filled in
136 * probe_memory() and is later used by mem_init() to set up
137 * mem_map[]. We statically allocate SPARC_PHYS_BANKS of
138 * these structs, this is arbitrary. The entry after the
139 * last valid one has num_bytes==0.
140 */
141
142struct sparc_phys_banks {
143 unsigned long base_addr;
144 unsigned long num_bytes;
145};
146
147#define SPARC_PHYS_BANKS 32
148
149extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];
150
151/* Pure 2^n version of get_order */
152static __inline__ int get_order(unsigned long size)
153{
154 int order;
155
156 size = (size-1) >> (PAGE_SHIFT-1);
157 order = -1;
158 do {
159 size >>= 1;
160 order++;
161 } while (size);
162 return order;
163}
164
165#endif /* !(__ASSEMBLY__) */
166
167#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
168 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
169
170#endif /* !(__KERNEL__) */
171
172#endif /* !(_SPARC64_PAGE_H) */