xref: /freebsd-13-stable/sys/mips/include/vmparam.h (revision 4b40a16f0d188422227478889b38cc341d50f88f)
1 /*	$OpenBSD: vmparam.h,v 1.2 1998/09/15 10:50:12 pefo Exp $	*/
2 /*	$NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $	*/
3 
4 /*
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Copyright (c) 1988 University of Utah.
8  * Copyright (c) 1992, 1993
9  *	The Regents of the University of California.  All rights reserved.
10  *
11  * This code is derived from software contributed to Berkeley by
12  * the Systems Programming Group of the University of Utah Computer
13  * Science Department and Ralph Campbell.
14  *
15  * Redistribution and use in source and binary forms, with or without
16  * modification, are permitted provided that the following conditions
17  * are met:
18  * 1. Redistributions of source code must retain the above copyright
19  *    notice, this list of conditions and the following disclaimer.
20  * 2. Redistributions in binary form must reproduce the above copyright
21  *    notice, this list of conditions and the following disclaimer in the
22  *    documentation and/or other materials provided with the distribution.
23  * 3. Neither the name of the University nor the names of its contributors
24  *    may be used to endorse or promote products derived from this software
25  *    without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37  * SUCH DAMAGE.
38  *
39  *	from: Utah Hdr: vmparam.h 1.16 91/01/18
40  *	@(#)vmparam.h	8.2 (Berkeley) 4/22/94
41  *	JNPR: vmparam.h,v 1.3.2.1 2007/09/10 06:01:28 girish
42  */
43 
44 #ifndef _MACHINE_VMPARAM_H_
45 #define	_MACHINE_VMPARAM_H_
46 
47 /*
48  * Machine dependent constants mips processors.
49  */
50 
51 /*
52  * Virtual memory related constants, all in bytes
53  */
54 #ifndef MAXTSIZ
55 #define	MAXTSIZ		(128UL*1024*1024)	/* max text size */
56 #endif
57 #ifndef DFLDSIZ
58 #define	DFLDSIZ		(128UL*1024*1024)	/* initial data size limit */
59 #endif
60 #ifndef MAXDSIZ
61 #define	MAXDSIZ		(1*1024UL*1024*1024)	/* max data size */
62 #endif
63 #ifndef DFLSSIZ
64 #define	DFLSSIZ		(8UL*1024*1024)		/* initial stack size limit */
65 #endif
66 #ifndef MAXSSIZ
67 #define	MAXSSIZ		(64UL*1024*1024)	/* max stack size */
68 #endif
69 #ifndef SGROWSIZ
70 #define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */
71 #endif
72 
73 /*
74  * Mach derived constants
75  */
76 
77 /* user/kernel map constants */
78 #define	VM_MIN_ADDRESS		((vm_offset_t)0x00000000)
79 #define	VM_MAX_ADDRESS		((vm_offset_t)(intptr_t)(int32_t)0xffffffff)
80 
81 #define	VM_MINUSER_ADDRESS	((vm_offset_t)0x00000000)
82 
83 #ifdef __mips_n64
84 #define	VM_MAXUSER_ADDRESS	(VM_MINUSER_ADDRESS + (NPDEPG * NBSEG))
85 #define	VM_MIN_KERNEL_ADDRESS	((vm_offset_t)0xc000000000000000)
86 #define	VM_MAX_KERNEL_ADDRESS	(VM_MIN_KERNEL_ADDRESS + (NPDEPG * NBSEG))
87 #else
88 #define	VM_MAXUSER_ADDRESS	((vm_offset_t)0x80000000)
89 #define	VM_MIN_KERNEL_ADDRESS	((vm_offset_t)0xC0000000)
90 #define	VM_MAX_KERNEL_ADDRESS	((vm_offset_t)0xFFFFC000)
91 #endif
92 
93 #define	KERNBASE		((vm_offset_t)(intptr_t)(int32_t)0x80000000)
94 /*
95  * USRSTACK needs to start a little below 0x8000000 because the R8000
96  * and some QED CPUs perform some virtual address checks before the
97  * offset is calculated.
98  */
99 #define	USRSTACK		(VM_MAXUSER_ADDRESS - PAGE_SIZE)
100 #ifdef __mips_n64
101 #define	FREEBSD32_USRSTACK	(((vm_offset_t)0x80000000) - PAGE_SIZE)
102 #endif
103 
104 /*
105  * Disable superpage reservations. (not sure if this is right
106  * I copied it from ARM)
107  */
108 #ifndef	VM_NRESERVLEVEL
109 #define	VM_NRESERVLEVEL		0
110 #endif
111 
112 /*
113  * How many physical pages per kmem arena virtual page.
114  */
115 #ifndef VM_KMEM_SIZE_SCALE
116 #define	VM_KMEM_SIZE_SCALE	(3)
117 #endif
118 
119 /*
120  * Optional floor (in bytes) on the size of the kmem arena.
121  */
122 #ifndef VM_KMEM_SIZE_MIN
123 #define	VM_KMEM_SIZE_MIN	(12 * 1024 * 1024)
124 #endif
125 
126 /*
127  * Optional ceiling (in bytes) on the size of the kmem arena: 40% of the
128  * kernel map.
129  */
130 #ifndef VM_KMEM_SIZE_MAX
131 #define	VM_KMEM_SIZE_MAX	((VM_MAX_KERNEL_ADDRESS - \
132     VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
133 #endif
134 
135 /* initial pagein size of beginning of executable file */
136 #ifndef VM_INITIAL_PAGEIN
137 #define	VM_INITIAL_PAGEIN	16
138 #endif
139 
140 #define	UMA_MD_SMALL_ALLOC
141 
142 /*
143  * max number of non-contig chunks of physical RAM you can have
144  */
145 #define	VM_PHYSSEG_MAX		32
146 
147 /*
148  * The physical address space is sparsely populated.
149  */
150 #define	VM_PHYSSEG_SPARSE
151 
152 /*
153  * Create two free page pools: VM_FREEPOOL_DEFAULT is the default pool
154  * from which physical pages are allocated and VM_FREEPOOL_DIRECT is
155  * the pool from which physical pages for small UMA objects are
156  * allocated.
157  */
158 #define	VM_NFREEPOOL		2
159 #define	VM_FREEPOOL_DEFAULT	0
160 #define	VM_FREEPOOL_DIRECT	1
161 
162 /*
163  * Create up to two free lists on !__mips_n64: VM_FREELIST_DEFAULT is for
164  * physical pages that are above the largest physical address that is
165  * accessible through the direct map (KSEG0) and VM_FREELIST_LOWMEM is for
166  * physical pages that are below that address.  VM_LOWMEM_BOUNDARY is the
167  * physical address for the end of the direct map (KSEG0).
168  */
169 #ifdef __mips_n64
170 #define	VM_NFREELIST		1
171 #define	VM_FREELIST_DEFAULT	0
172 #define	VM_FREELIST_DIRECT	VM_FREELIST_DEFAULT
173 #else
174 #define	VM_NFREELIST		2
175 #define	VM_FREELIST_DEFAULT	0
176 #define	VM_FREELIST_LOWMEM	1
177 #define	VM_FREELIST_DIRECT	VM_FREELIST_LOWMEM
178 #define	VM_LOWMEM_BOUNDARY	((vm_paddr_t)0x20000000)
179 #endif
180 
181 /*
182  * The largest allocation size is 1MB.
183  */
184 #define	VM_NFREEORDER		9
185 
186 #define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */
187 
188 #ifndef __mips_n64
189 #define	SFBUF
190 #define	SFBUF_MAP
191 #define	PMAP_HAS_DMAP	0
192 #else
193 #define	PMAP_HAS_DMAP	1
194 #endif
195 
196 #define	PHYS_TO_DMAP(x)	MIPS_PHYS_TO_DIRECT(x)
197 #define	DMAP_TO_PHYS(x)	MIPS_DIRECT_TO_PHYS(x)
198 
199 /*
200  * No non-transparent large page support in the pmap.
201  */
202 #define	PMAP_HAS_LARGEPAGES	0
203 
204 /*
205  * Need a page dump array for minidump.
206  */
207 #define MINIDUMP_PAGE_TRACKING	1
208 
209 #endif /* !_MACHINE_VMPARAM_H_ */
210