vmparam.h revision 285634
1238104Sdes/*	$OpenBSD: vmparam.h,v 1.2 1998/09/15 10:50:12 pefo Exp $	*/
2238104Sdes/*	$NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $	*/
3238104Sdes
4238104Sdes/*
5238104Sdes * Copyright (c) 1988 University of Utah.
6238104Sdes * Copyright (c) 1992, 1993
7238104Sdes *	The Regents of the University of California.  All rights reserved.
8238104Sdes *
9238104Sdes * This code is derived from software contributed to Berkeley by
10238104Sdes * the Systems Programming Group of the University of Utah Computer
11238104Sdes * Science Department and Ralph Campbell.
12238104Sdes *
13238104Sdes * Redistribution and use in source and binary forms, with or without
14238104Sdes * modification, are permitted provided that the following conditions
15238104Sdes * are met:
16238104Sdes * 1. Redistributions of source code must retain the above copyright
17238104Sdes *    notice, this list of conditions and the following disclaimer.
18238104Sdes * 2. Redistributions in binary form must reproduce the above copyright
19238104Sdes *    notice, this list of conditions and the following disclaimer in the
20238104Sdes *    documentation and/or other materials provided with the distribution.
21238104Sdes * 4. Neither the name of the University nor the names of its contributors
22238104Sdes *    may be used to endorse or promote products derived from this software
23238104Sdes *    without specific prior written permission.
24238104Sdes *
25238104Sdes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26238104Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27238104Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28238104Sdes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29238104Sdes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30238104Sdes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31238104Sdes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32238104Sdes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33238104Sdes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34238104Sdes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35238104Sdes * SUCH DAMAGE.
36238104Sdes *
37238104Sdes *	from: Utah Hdr: vmparam.h 1.16 91/01/18
38238104Sdes *	@(#)vmparam.h	8.2 (Berkeley) 4/22/94
39238104Sdes *	JNPR: vmparam.h,v 1.3.2.1 2007/09/10 06:01:28 girish
40238104Sdes * $FreeBSD: stable/10/sys/mips/include/vmparam.h 285634 2015-07-16 14:41:58Z kib $
41238104Sdes */
42238104Sdes
43238104Sdes#ifndef _MACHINE_VMPARAM_H_
44238104Sdes#define	_MACHINE_VMPARAM_H_
45238104Sdes
46238104Sdes/*
47238104Sdes * Machine dependent constants mips processors.
48238104Sdes */
49238104Sdes
50238104Sdes/*
51238104Sdes * Virtual memory related constants, all in bytes
52238104Sdes */
53238104Sdes#ifndef MAXTSIZ
54238104Sdes#define	MAXTSIZ		(128UL*1024*1024)	/* max text size */
55238104Sdes#endif
56238104Sdes#ifndef DFLDSIZ
57238104Sdes#define	DFLDSIZ		(128UL*1024*1024)	/* initial data size limit */
58238104Sdes#endif
59238104Sdes#ifndef MAXDSIZ
60238104Sdes#define	MAXDSIZ		(1*1024UL*1024*1024)	/* max data size */
61238104Sdes#endif
62238104Sdes#ifndef DFLSSIZ
63238104Sdes#define	DFLSSIZ		(8UL*1024*1024)		/* initial stack size limit */
64238104Sdes#endif
65238104Sdes#ifndef MAXSSIZ
66238104Sdes#define	MAXSSIZ		(64UL*1024*1024)	/* max stack size */
67238104Sdes#endif
68238104Sdes#ifndef SGROWSIZ
69238104Sdes#define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */
70238104Sdes#endif
71238104Sdes
72238104Sdes/*
73238104Sdes * Mach derived constants
74238104Sdes */
75238104Sdes
76238104Sdes/* user/kernel map constants */
77238104Sdes#define	VM_MIN_ADDRESS		((vm_offset_t)0x00000000)
78238104Sdes#define	VM_MAX_ADDRESS		((vm_offset_t)(intptr_t)(int32_t)0xffffffff)
79238104Sdes
80238104Sdes#define	VM_MINUSER_ADDRESS	((vm_offset_t)0x00000000)
81238104Sdes
82238104Sdes#ifdef __mips_n64
83238104Sdes#define	VM_MAXUSER_ADDRESS	(VM_MINUSER_ADDRESS + (NPDEPG * NBSEG))
84238104Sdes#define	VM_MIN_KERNEL_ADDRESS	((vm_offset_t)0xc000000000000000)
85238104Sdes#define	VM_MAX_KERNEL_ADDRESS	(VM_MIN_KERNEL_ADDRESS + (NPDEPG * NBSEG))
86238104Sdes#else
87238104Sdes#define	VM_MAXUSER_ADDRESS	((vm_offset_t)0x80000000)
88238104Sdes#define	VM_MIN_KERNEL_ADDRESS	((vm_offset_t)0xC0000000)
89238104Sdes#define	VM_MAX_KERNEL_ADDRESS	((vm_offset_t)0xFFFFC000)
90238104Sdes#endif
91238104Sdes
92238104Sdes#define	KERNBASE		((vm_offset_t)(intptr_t)(int32_t)0x80000000)
93238104Sdes/*
94238104Sdes * USRSTACK needs to start a little below 0x8000000 because the R8000
95238104Sdes * and some QED CPUs perform some virtual address checks before the
96238104Sdes * offset is calculated.
97238104Sdes */
98238104Sdes#define	USRSTACK		(VM_MAXUSER_ADDRESS - PAGE_SIZE)
99238104Sdes#ifdef __mips_n64
100238104Sdes#define	FREEBSD32_USRSTACK	(((vm_offset_t)0x80000000) - PAGE_SIZE)
101238104Sdes#endif
102238104Sdes
103238104Sdes/*
104238104Sdes * Disable superpage reservations. (not sure if this is right
105238104Sdes * I copied it from ARM)
106238104Sdes */
107238104Sdes#ifndef	VM_NRESERVLEVEL
108238104Sdes#define	VM_NRESERVLEVEL		0
109238104Sdes#endif
110238104Sdes
111238104Sdes/*
112238104Sdes * How many physical pages per kmem arena virtual page.
113238104Sdes */
114238104Sdes#ifndef VM_KMEM_SIZE_SCALE
115238104Sdes#define	VM_KMEM_SIZE_SCALE	(3)
116238104Sdes#endif
117238104Sdes
118238104Sdes/*
119238104Sdes * Optional floor (in bytes) on the size of the kmem arena.
120238104Sdes */
121238104Sdes#ifndef VM_KMEM_SIZE_MIN
122238104Sdes#define	VM_KMEM_SIZE_MIN	(12 * 1024 * 1024)
123238104Sdes#endif
124238104Sdes
125238104Sdes/*
126238104Sdes * Optional ceiling (in bytes) on the size of the kmem arena: 40% of the
127238104Sdes * kernel map.
128238104Sdes */
129238104Sdes#ifndef VM_KMEM_SIZE_MAX
130238104Sdes#define	VM_KMEM_SIZE_MAX	((VM_MAX_KERNEL_ADDRESS - \
131238104Sdes    VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
132238104Sdes#endif
133238104Sdes
134238104Sdes/* initial pagein size of beginning of executable file */
135238104Sdes#ifndef VM_INITIAL_PAGEIN
136238104Sdes#define	VM_INITIAL_PAGEIN	16
137238104Sdes#endif
138238104Sdes
139238104Sdes#define	UMA_MD_SMALL_ALLOC
140238104Sdes
141238104Sdes/*
142238104Sdes * max number of non-contig chunks of physical RAM you can have
143238104Sdes */
144238104Sdes#define	VM_PHYSSEG_MAX		32
145238104Sdes
146238104Sdes/*
147238104Sdes * The physical address space is sparsely populated.
148238104Sdes */
149238104Sdes#define	VM_PHYSSEG_SPARSE
150238104Sdes
151238104Sdes/*
152238104Sdes * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool
153238104Sdes * from which physical pages are allocated and VM_FREEPOOL_DIRECT is
154238104Sdes * the pool from which physical pages for small UMA objects are
155238104Sdes * allocated.
156238104Sdes */
157238104Sdes#define	VM_NFREEPOOL		3
158238104Sdes#define	VM_FREEPOOL_CACHE	2
159238104Sdes#define	VM_FREEPOOL_DEFAULT	0
160238104Sdes#define	VM_FREEPOOL_DIRECT	1
161238104Sdes
162238104Sdes/*
163238104Sdes * Create up to two free lists on !__mips_n64: VM_FREELIST_DEFAULT is for
164238104Sdes * physical pages that are above the largest physical address that is
165238104Sdes * accessible through the direct map (KSEG0) and VM_FREELIST_LOWMEM is for
166238104Sdes * physical pages that are below that address.  VM_LOWMEM_BOUNDARY is the
167238104Sdes * physical address for the end of the direct map (KSEG0).
168238104Sdes */
169246827Sdes#ifdef __mips_n64
170238104Sdes#define	VM_NFREELIST		1
171238104Sdes#define	VM_FREELIST_DEFAULT	0
172238104Sdes#define	VM_FREELIST_DIRECT	VM_FREELIST_DEFAULT
173238104Sdes#else
174238104Sdes#define	VM_NFREELIST		2
175246827Sdes#define	VM_FREELIST_DEFAULT	0
176238104Sdes#define	VM_FREELIST_LOWMEM	1
177238104Sdes#define	VM_FREELIST_DIRECT	VM_FREELIST_LOWMEM
178238104Sdes#define	VM_LOWMEM_BOUNDARY	((vm_paddr_t)0x20000000)
179238104Sdes#endif
180238104Sdes
181238104Sdes/*
182238104Sdes * The largest allocation size is 1MB.
183238104Sdes */
184238104Sdes#define	VM_NFREEORDER		9
185238104Sdes
186238104Sdes#define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */
187238104Sdes
188238104Sdes#endif /* !_MACHINE_VMPARAM_H_ */
189238104Sdes