1178172Simp/*	$OpenBSD: vmparam.h,v 1.2 1998/09/15 10:50:12 pefo Exp $	*/
2178172Simp/*	$NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $	*/
3178172Simp
4178172Simp/*
5178172Simp * Copyright (c) 1988 University of Utah.
6178172Simp * Copyright (c) 1992, 1993
7178172Simp *	The Regents of the University of California.  All rights reserved.
8178172Simp *
9178172Simp * This code is derived from software contributed to Berkeley by
10178172Simp * the Systems Programming Group of the University of Utah Computer
11178172Simp * Science Department and Ralph Campbell.
12178172Simp *
13178172Simp * Redistribution and use in source and binary forms, with or without
14178172Simp * modification, are permitted provided that the following conditions
15178172Simp * are met:
16178172Simp * 1. Redistributions of source code must retain the above copyright
17178172Simp *    notice, this list of conditions and the following disclaimer.
18178172Simp * 2. Redistributions in binary form must reproduce the above copyright
19178172Simp *    notice, this list of conditions and the following disclaimer in the
20178172Simp *    documentation and/or other materials provided with the distribution.
21178172Simp * 4. Neither the name of the University nor the names of its contributors
22178172Simp *    may be used to endorse or promote products derived from this software
23178172Simp *    without specific prior written permission.
24178172Simp *
25178172Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28178172Simp * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35178172Simp * SUCH DAMAGE.
36178172Simp *
37178172Simp *	from: Utah Hdr: vmparam.h 1.16 91/01/18
38178172Simp *	@(#)vmparam.h	8.2 (Berkeley) 4/22/94
39178172Simp *	JNPR: vmparam.h,v 1.3.2.1 2007/09/10 06:01:28 girish
40178172Simp * $FreeBSD$
41178172Simp */
42178172Simp
43178172Simp#ifndef _MACHINE_VMPARAM_H_
44178172Simp#define	_MACHINE_VMPARAM_H_
45178172Simp
46178172Simp/*
47178172Simp * Machine dependent constants mips processors.
48178172Simp */
49178172Simp
50178172Simp/*
51178172Simp * Virtual memory related constants, all in bytes
52178172Simp */
53178172Simp#ifndef MAXTSIZ
54178172Simp#define	MAXTSIZ		(128UL*1024*1024)	/* max text size */
55178172Simp#endif
56178172Simp#ifndef DFLDSIZ
57178172Simp#define	DFLDSIZ		(128UL*1024*1024)	/* initial data size limit */
58178172Simp#endif
59178172Simp#ifndef MAXDSIZ
60178172Simp#define	MAXDSIZ		(1*1024UL*1024*1024)	/* max data size */
61178172Simp#endif
62178172Simp#ifndef DFLSSIZ
63178172Simp#define	DFLSSIZ		(8UL*1024*1024)		/* initial stack size limit */
64178172Simp#endif
65178172Simp#ifndef MAXSSIZ
66178172Simp#define	MAXSSIZ		(64UL*1024*1024)	/* max stack size */
67178172Simp#endif
68178172Simp#ifndef SGROWSIZ
69178172Simp#define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */
70178172Simp#endif
71178172Simp
72178172Simp/*
73178172Simp * Mach derived constants
74178172Simp */
75178172Simp
76178172Simp/* user/kernel map constants */
77178172Simp#define	VM_MIN_ADDRESS		((vm_offset_t)0x00000000)
78206746Sjmallett#define	VM_MAX_ADDRESS		((vm_offset_t)(intptr_t)(int32_t)0xffffffff)
79206746Sjmallett
80206746Sjmallett#define	VM_MINUSER_ADDRESS	((vm_offset_t)0x00000000)
81178172Simp
82211453Sjchandra#ifdef __mips_n64
83210627Sjchandra#define	VM_MAXUSER_ADDRESS	(VM_MINUSER_ADDRESS + (NPDEPG * NBSEG))
84209500Sjchandra#define	VM_MIN_KERNEL_ADDRESS	((vm_offset_t)0xc000000000000000)
85210627Sjchandra#define	VM_MAX_KERNEL_ADDRESS	(VM_MIN_KERNEL_ADDRESS + (NPDEPG * NBSEG))
86209500Sjchandra#else
87209500Sjchandra#define	VM_MAXUSER_ADDRESS	((vm_offset_t)0x80000000)
88209500Sjchandra#define	VM_MIN_KERNEL_ADDRESS	((vm_offset_t)0xC0000000)
89209500Sjchandra#define	VM_MAX_KERNEL_ADDRESS	((vm_offset_t)0xFFFFC000)
90209500Sjchandra#endif
91210627Sjchandra
92206746Sjmallett#define	KERNBASE		((vm_offset_t)(intptr_t)(int32_t)0x80000000)
93178172Simp/*
94210627Sjchandra * USRSTACK needs to start a little below 0x8000000 because the R8000
95210627Sjchandra * and some QED CPUs perform some virtual address checks before the
96210627Sjchandra * offset is calculated.
97210627Sjchandra */
98210627Sjchandra#define	USRSTACK		(VM_MAXUSER_ADDRESS - PAGE_SIZE)
99232449Sjmallett#ifdef __mips_n64
100232449Sjmallett#define	FREEBSD32_USRSTACK	(((vm_offset_t)0x80000000) - PAGE_SIZE)
101232449Sjmallett#endif
102232449Sjmallett
103210627Sjchandra/*
104178172Simp * Disable superpage reservations. (not sure if this is right
105178172Simp * I copied it from ARM)
106178172Simp */
107178172Simp#ifndef	VM_NRESERVLEVEL
108178172Simp#define	VM_NRESERVLEVEL		0
109178172Simp#endif
110178172Simp
111178172Simp/* virtual sizes (bytes) for various kernel submaps */
112178172Simp#ifndef VM_KMEM_SIZE
113178172Simp#define	VM_KMEM_SIZE		(12 * 1024 * 1024)
114178172Simp#endif
115178172Simp
116178172Simp/*
117178172Simp * How many physical pages per KVA page allocated.
118178172Simp * min(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), VM_KMEM_SIZE_MAX)
119178172Simp * is the total KVA space allocated for kmem_map.
120178172Simp */
121178172Simp#ifndef VM_KMEM_SIZE_SCALE
122178172Simp#define	VM_KMEM_SIZE_SCALE	(3)
123178172Simp#endif
124178172Simp
125178172Simp/*
126245337Salc * Ceiling on the amount of kmem_map KVA space: 40% of the entire KVA space.
127178172Simp */
128178172Simp#ifndef VM_KMEM_SIZE_MAX
129245337Salc#define	VM_KMEM_SIZE_MAX	((VM_MAX_KERNEL_ADDRESS - \
130245337Salc    VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
131178172Simp#endif
132178172Simp
133178172Simp/* initial pagein size of beginning of executable file */
134178172Simp#ifndef VM_INITIAL_PAGEIN
135178172Simp#define	VM_INITIAL_PAGEIN	16
136178172Simp#endif
137178172Simp
138216315Sjchandra#define	UMA_MD_SMALL_ALLOC
139216315Sjchandra
140178172Simp/*
141178172Simp * max number of non-contig chunks of physical RAM you can have
142178172Simp */
143178172Simp#define	VM_PHYSSEG_MAX		32
144178172Simp
145178172Simp/*
146207139Sjmallett * The physical address space is sparsely populated.
147178172Simp */
148207139Sjmallett#define	VM_PHYSSEG_SPARSE
149178172Simp
150178172Simp/*
151178172Simp * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool
152178172Simp * from which physical pages are allocated and VM_FREEPOOL_DIRECT is
153178172Simp * the pool from which physical pages for small UMA objects are
154178172Simp * allocated.
155178172Simp */
156178172Simp#define	VM_NFREEPOOL		3
157178172Simp#define	VM_FREEPOOL_CACHE	2
158178172Simp#define	VM_FREEPOOL_DEFAULT	0
159178172Simp#define	VM_FREEPOOL_DIRECT	1
160178172Simp
161178172Simp/*
162210327Sjchandra * we support 2 free lists:
163178172Simp *
164210327Sjchandra *	- DEFAULT for direct mapped (KSEG0) pages.
165210327Sjchandra *	  Note: This usage of DEFAULT may be misleading because we use
166210327Sjchandra *	  DEFAULT for allocating direct mapped pages. The normal page
167210327Sjchandra *	  allocations use HIGHMEM if available, and then DEFAULT.
168210327Sjchandra *	- HIGHMEM for other pages
169178172Simp */
170211453Sjchandra#ifdef __mips_n64
171178172Simp#define	VM_NFREELIST		1
172178172Simp#define	VM_FREELIST_DEFAULT	0
173210460Simp#define	VM_FREELIST_DIRECT	VM_FREELIST_DEFAULT
174210327Sjchandra#else
175210327Sjchandra#define	VM_NFREELIST		2
176210327Sjchandra#define	VM_FREELIST_DEFAULT	1
177210327Sjchandra#define	VM_FREELIST_HIGHMEM	0
178210327Sjchandra#define	VM_FREELIST_DIRECT	VM_FREELIST_DEFAULT
179210327Sjchandra#define	VM_HIGHMEM_ADDRESS	((vm_paddr_t)0x20000000)
180210327Sjchandra#endif
181178172Simp
182178172Simp/*
183178172Simp * The largest allocation size is 1MB.
184178172Simp */
185178172Simp#define	VM_NFREEORDER		9
186178172Simp
187221855Smdf#define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */
188221855Smdf
189178172Simp#endif /* !_MACHINE_VMPARAM_H_ */
190