]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/powerpc/include/vmparam.h
Merge clang trunk r300422 and resolve conflicts.
[FreeBSD/FreeBSD.git] / sys / powerpc / include / vmparam.h
1 /*-
2  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
3  * Copyright (C) 1995, 1996 TooLs GmbH.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *      This product includes software developed by TooLs GmbH.
17  * 4. The name of TooLs GmbH may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  *      $NetBSD: vmparam.h,v 1.11 2000/02/11 19:25:16 thorpej Exp $
32  * $FreeBSD$
33  */
34
35 #ifndef _MACHINE_VMPARAM_H_
36 #define _MACHINE_VMPARAM_H_
37
38 #define USRSTACK        SHAREDPAGE
39
40 #ifndef MAXTSIZ
41 #define MAXTSIZ         (1*1024*1024*1024)              /* max text size */
42 #endif
43
44 #ifndef DFLDSIZ
45 #define DFLDSIZ         (128*1024*1024)         /* default data size */
46 #endif
47
48 #ifndef MAXDSIZ
49 #define MAXDSIZ         (1*1024*1024*1024)      /* max data size */
50 #endif
51
52 #ifndef DFLSSIZ
53 #define DFLSSIZ         (8*1024*1024)           /* default stack size */
54 #endif
55
56 #ifndef MAXSSIZ
57 #define MAXSSIZ         (64*1024*1024)          /* max stack size */
58 #endif
59
60 #ifdef AIM
61 #define VM_MAXUSER_ADDRESS32    ((vm_offset_t)0xfffff000)
62 #else
63 #define VM_MAXUSER_ADDRESS32    ((vm_offset_t)0x7ffff000)
64 #endif
65
66 /*
67  * Would like to have MAX addresses = 0, but this doesn't (currently) work
68  */
69 #if !defined(LOCORE)
70 #ifdef __powerpc64__
71 #define VM_MIN_ADDRESS          (0x0000000000000000UL)
72 #ifdef AIM
73 #define VM_MAXUSER_ADDRESS      (0xfffffffffffff000UL)
74 #else
75 #define VM_MAXUSER_ADDRESS      (0x7ffffffffffff000UL)
76 #endif
77 #define VM_MAX_ADDRESS          (0xffffffffffffffffUL)
78 #else
79 #define VM_MIN_ADDRESS          ((vm_offset_t)0)
80 #define VM_MAXUSER_ADDRESS      VM_MAXUSER_ADDRESS32
81 #define VM_MAX_ADDRESS          ((vm_offset_t)0xffffffff)
82 #endif
83 #define SHAREDPAGE              (VM_MAXUSER_ADDRESS - PAGE_SIZE)
84 #else /* LOCORE */
85 #ifdef BOOKE
86 #define VM_MIN_ADDRESS          0
87 #ifdef __powerpc64__
88 #define VM_MAXUSER_ADDRESS      0x7ffffffffffff000
89 #else
90 #define VM_MAXUSER_ADDRESS      0x7ffff000
91 #endif
92 #endif
93 #endif /* LOCORE */
94
95 #define FREEBSD32_SHAREDPAGE    (VM_MAXUSER_ADDRESS32 - PAGE_SIZE)
96 #define FREEBSD32_USRSTACK      FREEBSD32_SHAREDPAGE
97
98 #ifdef __powerpc64__
99 #define VM_MIN_KERNEL_ADDRESS           0xc000000000000000UL
100 #define VM_MAX_KERNEL_ADDRESS           0xc0000001c7ffffffUL
101 #define VM_MAX_SAFE_KERNEL_ADDRESS      VM_MAX_KERNEL_ADDRESS
102 #endif
103
104 #ifdef AIM
105 #define KERNBASE                0x00100000UL    /* start of kernel virtual */
106
107 #ifndef __powerpc64__
108 #define VM_MIN_KERNEL_ADDRESS   ((vm_offset_t)KERNEL_SR << ADDR_SR_SHFT)
109 #define VM_MAX_SAFE_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH -1)
110 #define VM_MAX_KERNEL_ADDRESS   (VM_MIN_KERNEL_ADDRESS + 3*SEGMENT_LENGTH - 1)
111 #endif
112
113 /*
114  * Use the direct-mapped BAT registers for UMA small allocs. This
115  * takes pressure off the small amount of available KVA.
116  */
117 #define UMA_MD_SMALL_ALLOC
118
119 #else /* Book-E */
120
121 #ifdef __powerpc64__
122 #ifndef LOCORE
123 #define KERNBASE        0xc000000000000000UL    /* start of kernel virtual */
124 #else
125 #define KERNBASE        0xc000000000000000      /* start of kernel virtual */
126 #endif
127 #else
128 #define KERNBASE                0xc0000000      /* start of kernel virtual */
129
130 #define VM_MIN_KERNEL_ADDRESS   KERNBASE
131 #define VM_MAX_KERNEL_ADDRESS   0xffffefff
132 #define VM_MAX_SAFE_KERNEL_ADDRESS      VM_MAX_KERNEL_ADDRESS
133 #endif
134
135 #endif /* AIM/E500 */
136
137 #if !defined(LOCORE)
138 struct pmap_physseg {
139         struct pv_entry *pvent;
140         char *attrs;
141 };
142 #endif
143
144 #define VM_PHYSSEG_MAX          16      /* 1? */
145
146 /*
147  * The physical address space is densely populated on 32-bit systems,
148  * but may not be on 64-bit ones.
149  */
150 #ifdef __powerpc64__
151 #define VM_PHYSSEG_SPARSE
152 #else
153 #define VM_PHYSSEG_DENSE
154 #endif
155
156 /*
157  * Create two free page pools: VM_FREEPOOL_DEFAULT is the default pool
158  * from which physical pages are allocated and VM_FREEPOOL_DIRECT is
159  * the pool from which physical pages for small UMA objects are
160  * allocated.
161  */
162 #define VM_NFREEPOOL            2
163 #define VM_FREEPOOL_DEFAULT     0
164 #define VM_FREEPOOL_DIRECT      1
165
166 /*
167  * Create one free page list.
168  */
169 #define VM_NFREELIST            1
170 #define VM_FREELIST_DEFAULT     0
171
172 /*
173  * The largest allocation size is 4MB.
174  */
175 #define VM_NFREEORDER           11
176
177 /*
178  * Disable superpage reservations.
179  */
180 #ifndef VM_NRESERVLEVEL
181 #define VM_NRESERVLEVEL         0
182 #endif
183
184 #ifndef VM_INITIAL_PAGEIN
185 #define VM_INITIAL_PAGEIN       16
186 #endif
187
188 #ifndef SGROWSIZ
189 #define SGROWSIZ        (128UL*1024)            /* amount to grow stack */
190 #endif
191
192 /*
193  * How many physical pages per kmem arena virtual page.
194  */
195 #ifndef VM_KMEM_SIZE_SCALE
196 #define VM_KMEM_SIZE_SCALE      (3)
197 #endif
198
199 /*
200  * Optional floor (in bytes) on the size of the kmem arena.
201  */
202 #ifndef VM_KMEM_SIZE_MIN
203 #define VM_KMEM_SIZE_MIN        (12 * 1024 * 1024)
204 #endif
205
206 /*
207  * Optional ceiling (in bytes) on the size of the kmem arena: 40% of the
208  * usable KVA space.
209  */
210 #ifndef VM_KMEM_SIZE_MAX
211 #define VM_KMEM_SIZE_MAX        ((VM_MAX_SAFE_KERNEL_ADDRESS - \
212     VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
213 #endif
214
215 #define ZERO_REGION_SIZE        (64 * 1024)     /* 64KB */
216
217 /*
218  * On 32-bit OEA, the only purpose for which sf_buf is used is to implement
219  * an opaque pointer required by the machine-independent parts of the kernel.
220  * That pointer references the vm_page that is "mapped" by the sf_buf.  The
221  * actual mapping is provided by the direct virtual-to-physical mapping.
222  *
223  * On OEA64 and Book-E, we need to do something a little more complicated. Use
224  * the runtime-detected hw_direct_map to pick between the two cases. Our
225  * friends in vm_machdep.c will do the same to ensure nothing gets confused.
226  */
227 #define SFBUF
228 #define SFBUF_NOMD
229 #define SFBUF_OPTIONAL_DIRECT_MAP       hw_direct_map
230 #define SFBUF_PHYS_DMAP(x)              (x)
231  
232 #endif /* _MACHINE_VMPARAM_H_ */