2 * SPDX-License-Identifier: BSD-4-Clause
4 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5 * Copyright (C) 1995, 1996 TooLs GmbH.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by TooLs GmbH.
19 * 4. The name of TooLs GmbH may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * $NetBSD: vmparam.h,v 1.11 2000/02/11 19:25:16 thorpej Exp $
37 #ifndef _MACHINE_VMPARAM_H_
38 #define _MACHINE_VMPARAM_H_
41 #include <machine/md_var.h>
44 #define USRSTACK SHAREDPAGE
47 #define MAXTSIZ (1*1024*1024*1024) /* max text size */
51 #define DFLDSIZ (128*1024*1024) /* default data size */
56 #define MAXDSIZ (32UL*1024*1024*1024) /* max data size */
58 #define MAXDSIZ (1*1024*1024*1024) /* max data size */
63 #define DFLSSIZ (8*1024*1024) /* default stack size */
68 #define MAXSSIZ (512*1024*1024) /* max stack size */
70 #define MAXSSIZ (64*1024*1024) /* max stack size */
75 #define VM_MAXUSER_ADDRESS32 ((vm_offset_t)0xfffff000)
77 #define VM_MAXUSER_ADDRESS32 ((vm_offset_t)0x7ffff000)
81 * Would like to have MAX addresses = 0, but this doesn't (currently) work
85 #define VM_MIN_ADDRESS (0x0000000000000000UL)
86 #define VM_MAXUSER_ADDRESS (0x3ffffffffffff000UL)
87 #define VM_MAX_ADDRESS (0xffffffffffffffffUL)
89 #define VM_MIN_ADDRESS ((vm_offset_t)0)
90 #define VM_MAXUSER_ADDRESS VM_MAXUSER_ADDRESS32
91 #define VM_MAX_ADDRESS ((vm_offset_t)0xffffffff)
93 #define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE)
96 #define VM_MIN_ADDRESS 0
98 #define VM_MAXUSER_ADDRESS 0x3ffffffffffff000
100 #define VM_MAXUSER_ADDRESS 0x7ffff000
105 #define FREEBSD32_SHAREDPAGE (VM_MAXUSER_ADDRESS32 - PAGE_SIZE)
106 #define FREEBSD32_USRSTACK FREEBSD32_SHAREDPAGE
109 #define VM_MIN_KERNEL_ADDRESS 0xe000000000000000UL
110 #define VM_MAX_KERNEL_ADDRESS 0xe0000007ffffffffUL
111 #define VM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS
115 #define KERNBASE 0x00100100UL /* start of kernel virtual */
117 #ifndef __powerpc64__
118 #define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)KERNEL_SR << ADDR_SR_SHFT)
119 #define VM_MAX_SAFE_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH -1)
120 #define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 3*SEGMENT_LENGTH - 1)
124 * Use the direct-mapped BAT registers for UMA small allocs. This
125 * takes pressure off the small amount of available KVA.
127 #define UMA_MD_SMALL_ALLOC
133 #define KERNBASE 0xe000000000000100UL /* start of kernel virtual */
135 #define KERNBASE 0xe000000000000100 /* start of kernel virtual */
138 #define KERNBASE 0xc0000000 /* start of kernel virtual */
140 #define VM_MIN_KERNEL_ADDRESS KERNBASE
141 #define VM_MAX_KERNEL_ADDRESS 0xffffefff
142 #define VM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS
145 #endif /* AIM/E500 */
148 struct pmap_physseg {
149 struct pv_entry *pvent;
154 #define VM_PHYSSEG_MAX 16 /* 1? */
157 * The physical address space is densely populated on 32-bit systems,
158 * but may not be on 64-bit ones.
161 #define VM_PHYSSEG_SPARSE
163 #define VM_PHYSSEG_DENSE
167 * Create two free page pools: VM_FREEPOOL_DEFAULT is the default pool
168 * from which physical pages are allocated and VM_FREEPOOL_DIRECT is
169 * the pool from which physical pages for small UMA objects are
172 #define VM_NFREEPOOL 2
173 #define VM_FREEPOOL_DEFAULT 0
174 #define VM_FREEPOOL_DIRECT 1
177 * Create one free page list.
179 #define VM_NFREELIST 1
180 #define VM_FREELIST_DEFAULT 0
183 * The largest allocation size is 4MB.
185 #define VM_NFREEORDER 11
188 * Disable superpage reservations.
190 #ifndef VM_NRESERVLEVEL
191 #define VM_NRESERVLEVEL 0
194 #ifndef VM_INITIAL_PAGEIN
195 #define VM_INITIAL_PAGEIN 16
199 #define SGROWSIZ (128UL*1024) /* amount to grow stack */
203 * How many physical pages per kmem arena virtual page.
205 #ifndef VM_KMEM_SIZE_SCALE
206 #define VM_KMEM_SIZE_SCALE (3)
210 * Optional floor (in bytes) on the size of the kmem arena.
212 #ifndef VM_KMEM_SIZE_MIN
213 #define VM_KMEM_SIZE_MIN (12 * 1024 * 1024)
217 * Optional ceiling (in bytes) on the size of the kmem arena: 40% of the
220 #ifndef VM_KMEM_SIZE_MAX
221 #define VM_KMEM_SIZE_MAX ((VM_MAX_SAFE_KERNEL_ADDRESS - \
222 VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
225 #define ZERO_REGION_SIZE (64 * 1024) /* 64KB */
228 * On 32-bit OEA, the only purpose for which sf_buf is used is to implement
229 * an opaque pointer required by the machine-independent parts of the kernel.
230 * That pointer references the vm_page that is "mapped" by the sf_buf. The
231 * actual mapping is provided by the direct virtual-to-physical mapping.
233 * On OEA64 and Book-E, we need to do something a little more complicated. Use
234 * the runtime-detected hw_direct_map to pick between the two cases. Our
235 * friends in vm_machdep.c will do the same to ensure nothing gets confused.
241 * We (usually) have a direct map of all physical memory, so provide
242 * a macro to use to get the kernel VA address for a given PA. Check the
243 * value of PMAP_HAS_PMAP before using.
247 #define DMAP_BASE_ADDRESS 0xc000000000000000UL
248 #define DMAP_MAX_ADDRESS 0xcfffffffffffffffUL
250 #define DMAP_BASE_ADDRESS 0x00000000UL
251 #define DMAP_MAX_ADDRESS 0xbfffffffUL
255 #define PMAP_HAS_DMAP (hw_direct_map)
256 #define PHYS_TO_DMAP(x) ({ \
257 KASSERT(hw_direct_map, ("Direct map not provided by PMAP")); \
258 (x) | DMAP_BASE_ADDRESS; })
259 #define DMAP_TO_PHYS(x) ({ \
260 KASSERT(hw_direct_map, ("Direct map not provided by PMAP")); \
261 (x) &~ DMAP_BASE_ADDRESS; })
263 #endif /* _MACHINE_VMPARAM_H_ */