[SCSI] aic7xxx: fix MMIO for PPC 44x platforms
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-s390 / page.h
blobfe7f92b6ae6df2c415688fa52a7d4b1157ac2641
1 /*
2 * include/asm-s390/page.h
4 * S390 version
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Hartmut Penner (hp@de.ibm.com)
7 */
9 #ifndef _S390_PAGE_H
10 #define _S390_PAGE_H
12 #include <linux/const.h>
13 #include <asm/types.h>
15 /* PAGE_SHIFT determines the page size */
16 #define PAGE_SHIFT 12
17 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
18 #define PAGE_MASK (~(PAGE_SIZE-1))
19 #define PAGE_DEFAULT_ACC 0
20 #define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4)
22 #include <asm/setup.h>
23 #ifndef __ASSEMBLY__
25 static inline void clear_page(void *page)
27 register unsigned long reg1 asm ("1") = 0;
28 register void *reg2 asm ("2") = page;
29 register unsigned long reg3 asm ("3") = 4096;
30 asm volatile(
31 " mvcl 2,0"
32 : "+d" (reg2), "+d" (reg3) : "d" (reg1) : "memory", "cc");
35 static inline void copy_page(void *to, void *from)
37 if (MACHINE_HAS_MVPG) {
38 register unsigned long reg0 asm ("0") = 0;
39 asm volatile(
40 " mvpg %0,%1"
41 : : "a" (to), "a" (from), "d" (reg0)
42 : "memory", "cc");
43 } else
44 asm volatile(
45 " mvc 0(256,%0),0(%1)\n"
46 " mvc 256(256,%0),256(%1)\n"
47 " mvc 512(256,%0),512(%1)\n"
48 " mvc 768(256,%0),768(%1)\n"
49 " mvc 1024(256,%0),1024(%1)\n"
50 " mvc 1280(256,%0),1280(%1)\n"
51 " mvc 1536(256,%0),1536(%1)\n"
52 " mvc 1792(256,%0),1792(%1)\n"
53 " mvc 2048(256,%0),2048(%1)\n"
54 " mvc 2304(256,%0),2304(%1)\n"
55 " mvc 2560(256,%0),2560(%1)\n"
56 " mvc 2816(256,%0),2816(%1)\n"
57 " mvc 3072(256,%0),3072(%1)\n"
58 " mvc 3328(256,%0),3328(%1)\n"
59 " mvc 3584(256,%0),3584(%1)\n"
60 " mvc 3840(256,%0),3840(%1)\n"
61 : : "a" (to), "a" (from) : "memory");
64 #define clear_user_page(page, vaddr, pg) clear_page(page)
65 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
67 #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
68 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
69 #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
72 * These are used to make use of C type-checking..
75 typedef struct { unsigned long pgprot; } pgprot_t;
76 typedef struct { unsigned long pte; } pte_t;
77 typedef struct { unsigned long pmd; } pmd_t;
78 typedef struct { unsigned long pud; } pud_t;
79 typedef struct { unsigned long pgd; } pgd_t;
80 typedef pte_t *pgtable_t;
82 #define pgprot_val(x) ((x).pgprot)
83 #define pte_val(x) ((x).pte)
84 #define pmd_val(x) ((x).pmd)
85 #define pud_val(x) ((x).pud)
86 #define pgd_val(x) ((x).pgd)
88 #define __pte(x) ((pte_t) { (x) } )
89 #define __pmd(x) ((pmd_t) { (x) } )
90 #define __pgd(x) ((pgd_t) { (x) } )
91 #define __pgprot(x) ((pgprot_t) { (x) } )
93 /* default storage key used for all pages */
94 extern unsigned int default_storage_key;
96 static inline void
97 page_set_storage_key(unsigned long addr, unsigned int skey)
99 asm volatile("sske %0,%1" : : "d" (skey), "a" (addr));
102 static inline unsigned int
103 page_get_storage_key(unsigned long addr)
105 unsigned int skey;
107 asm volatile("iske %0,%1" : "=d" (skey) : "a" (addr), "0" (0));
108 return skey;
111 extern unsigned long max_pfn;
113 static inline int pfn_valid(unsigned long pfn)
115 unsigned long dummy;
116 int ccode;
118 if (pfn >= max_pfn)
119 return 0;
121 asm volatile(
122 " lra %0,0(%2)\n"
123 " ipm %1\n"
124 " srl %1,28\n"
125 : "=d" (dummy), "=d" (ccode)
126 : "a" (pfn << PAGE_SHIFT)
127 : "cc");
128 return !ccode;
131 #endif /* !__ASSEMBLY__ */
133 /* to align the pointer to the (next) page boundary */
134 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
136 #define __PAGE_OFFSET 0x0UL
137 #define PAGE_OFFSET 0x0UL
138 #define __pa(x) (unsigned long)(x)
139 #define __va(x) (void *)(unsigned long)(x)
140 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
141 #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
142 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
144 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
145 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
147 #include <asm-generic/memory_model.h>
148 #include <asm-generic/page.h>
150 #endif /* _S390_PAGE_H */