aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390/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-s390/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-s390/page.h')
-rw-r--r--include/asm-s390/page.h208
1 files changed, 208 insertions, 0 deletions
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h
new file mode 100644
index 000000000000..614e2a93c703
--- /dev/null
+++ b/include/asm-s390/page.h
@@ -0,0 +1,208 @@
1/*
2 * include/asm-s390/page.h
3 *
4 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Hartmut Penner (hp@de.ibm.com)
7 */
8
9#ifndef _S390_PAGE_H
10#define _S390_PAGE_H
11
12#include <asm/setup.h>
13#include <asm/types.h>
14
15/* PAGE_SHIFT determines the page size */
16#define PAGE_SHIFT 12
17#define PAGE_SIZE (1UL << PAGE_SHIFT)
18#define PAGE_MASK (~(PAGE_SIZE-1))
19
20#ifdef __KERNEL__
21#ifndef __ASSEMBLY__
22
23#ifndef __s390x__
24
25static inline void clear_page(void *page)
26{
27 register_pair rp;
28
29 rp.subreg.even = (unsigned long) page;
30 rp.subreg.odd = (unsigned long) 4096;
31 asm volatile (" slr 1,1\n"
32 " mvcl %0,0"
33 : "+&a" (rp) : : "memory", "cc", "1" );
34}
35
36static inline void copy_page(void *to, void *from)
37{
38 if (MACHINE_HAS_MVPG)
39 asm volatile (" sr 0,0\n"
40 " mvpg %0,%1"
41 : : "a" ((void *)(to)), "a" ((void *)(from))
42 : "memory", "cc", "0" );
43 else
44 asm volatile (" mvc 0(256,%0),0(%1)\n"
45 " mvc 256(256,%0),256(%1)\n"
46 " mvc 512(256,%0),512(%1)\n"
47 " mvc 768(256,%0),768(%1)\n"
48 " mvc 1024(256,%0),1024(%1)\n"
49 " mvc 1280(256,%0),1280(%1)\n"
50 " mvc 1536(256,%0),1536(%1)\n"
51 " mvc 1792(256,%0),1792(%1)\n"
52 " mvc 2048(256,%0),2048(%1)\n"
53 " mvc 2304(256,%0),2304(%1)\n"
54 " mvc 2560(256,%0),2560(%1)\n"
55 " mvc 2816(256,%0),2816(%1)\n"
56 " mvc 3072(256,%0),3072(%1)\n"
57 " mvc 3328(256,%0),3328(%1)\n"
58 " mvc 3584(256,%0),3584(%1)\n"
59 " mvc 3840(256,%0),3840(%1)\n"
60 : : "a"((void *)(to)),"a"((void *)(from))
61 : "memory" );
62}
63
64#else /* __s390x__ */
65
66static inline void clear_page(void *page)
67{
68 asm volatile (" lgr 2,%0\n"
69 " lghi 3,4096\n"
70 " slgr 1,1\n"
71 " mvcl 2,0"
72 : : "a" ((void *) (page))
73 : "memory", "cc", "1", "2", "3" );
74}
75
76static inline void copy_page(void *to, void *from)
77{
78 if (MACHINE_HAS_MVPG)
79 asm volatile (" sgr 0,0\n"
80 " mvpg %0,%1"
81 : : "a" ((void *)(to)), "a" ((void *)(from))
82 : "memory", "cc", "0" );
83 else
84 asm volatile (" mvc 0(256,%0),0(%1)\n"
85 " mvc 256(256,%0),256(%1)\n"
86 " mvc 512(256,%0),512(%1)\n"
87 " mvc 768(256,%0),768(%1)\n"
88 " mvc 1024(256,%0),1024(%1)\n"
89 " mvc 1280(256,%0),1280(%1)\n"
90 " mvc 1536(256,%0),1536(%1)\n"
91 " mvc 1792(256,%0),1792(%1)\n"
92 " mvc 2048(256,%0),2048(%1)\n"
93 " mvc 2304(256,%0),2304(%1)\n"
94 " mvc 2560(256,%0),2560(%1)\n"
95 " mvc 2816(256,%0),2816(%1)\n"
96 " mvc 3072(256,%0),3072(%1)\n"
97 " mvc 3328(256,%0),3328(%1)\n"
98 " mvc 3584(256,%0),3584(%1)\n"
99 " mvc 3840(256,%0),3840(%1)\n"
100 : : "a"((void *)(to)),"a"((void *)(from))
101 : "memory" );
102}
103
104#endif /* __s390x__ */
105
106#define clear_user_page(page, vaddr, pg) clear_page(page)
107#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
108
109#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr)
110#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
111
112/* Pure 2^n version of get_order */
113extern __inline__ int get_order(unsigned long size)
114{
115 int order;
116
117 size = (size-1) >> (PAGE_SHIFT-1);
118 order = -1;
119 do {
120 size >>= 1;
121 order++;
122 } while (size);
123 return order;
124}
125
126/*
127 * These are used to make use of C type-checking..
128 */
129
130typedef struct { unsigned long pgprot; } pgprot_t;
131typedef struct { unsigned long pte; } pte_t;
132
133#define pte_val(x) ((x).pte)
134#define pgprot_val(x) ((x).pgprot)
135
136#ifndef __s390x__
137
138typedef struct { unsigned long pmd; } pmd_t;
139typedef struct {
140 unsigned long pgd0;
141 unsigned long pgd1;
142 unsigned long pgd2;
143 unsigned long pgd3;
144 } pgd_t;
145
146#define pmd_val(x) ((x).pmd)
147#define pgd_val(x) ((x).pgd0)
148
149#else /* __s390x__ */
150
151typedef struct {
152 unsigned long pmd0;
153 unsigned long pmd1;
154 } pmd_t;
155typedef struct { unsigned long pgd; } pgd_t;
156
157#define pmd_val(x) ((x).pmd0)
158#define pmd_val1(x) ((x).pmd1)
159#define pgd_val(x) ((x).pgd)
160
161#endif /* __s390x__ */
162
163#define __pte(x) ((pte_t) { (x) } )
164#define __pmd(x) ((pmd_t) { (x) } )
165#define __pgd(x) ((pgd_t) { (x) } )
166#define __pgprot(x) ((pgprot_t) { (x) } )
167
168/* default storage key used for all pages */
169extern unsigned int default_storage_key;
170
171static inline void
172page_set_storage_key(unsigned long addr, unsigned int skey)
173{
174 asm volatile ( "sske %0,%1" : : "d" (skey), "a" (addr) );
175}
176
177static inline unsigned int
178page_get_storage_key(unsigned long addr)
179{
180 unsigned int skey;
181
182 asm volatile ( "iske %0,%1" : "=d" (skey) : "a" (addr), "0" (0) );
183
184 return skey;
185}
186
187#endif /* !__ASSEMBLY__ */
188
189/* to align the pointer to the (next) page boundary */
190#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
191
192#define __PAGE_OFFSET 0x0UL
193#define PAGE_OFFSET 0x0UL
194#define __pa(x) (unsigned long)(x)
195#define __va(x) (void *)(unsigned long)(x)
196#define pfn_to_page(pfn) (mem_map + (pfn))
197#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
198#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
199
200#define pfn_valid(pfn) ((pfn) < max_mapnr)
201#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
202
203#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
204 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
205
206#endif /* __KERNEL__ */
207
208#endif /* _S390_PAGE_H */