xref: /f-stack/freebsd/vm/vm_param.h (revision 22ce4aff)
1a9643ea8Slogwang /*-
2*22ce4affSfengbojiang  * SPDX-License-Identifier: (BSD-3-Clause AND MIT-CMU)
3*22ce4affSfengbojiang  *
4a9643ea8Slogwang  * Copyright (c) 1991, 1993
5a9643ea8Slogwang  *	The Regents of the University of California.  All rights reserved.
6a9643ea8Slogwang  *
7a9643ea8Slogwang  * This code is derived from software contributed to Berkeley by
8a9643ea8Slogwang  * The Mach Operating System project at Carnegie-Mellon University.
9a9643ea8Slogwang  *
10a9643ea8Slogwang  * Redistribution and use in source and binary forms, with or without
11a9643ea8Slogwang  * modification, are permitted provided that the following conditions
12a9643ea8Slogwang  * are met:
13a9643ea8Slogwang  * 1. Redistributions of source code must retain the above copyright
14a9643ea8Slogwang  *    notice, this list of conditions and the following disclaimer.
15a9643ea8Slogwang  * 2. Redistributions in binary form must reproduce the above copyright
16a9643ea8Slogwang  *    notice, this list of conditions and the following disclaimer in the
17a9643ea8Slogwang  *    documentation and/or other materials provided with the distribution.
18*22ce4affSfengbojiang  * 3. Neither the name of the University nor the names of its contributors
19a9643ea8Slogwang  *    may be used to endorse or promote products derived from this software
20a9643ea8Slogwang  *    without specific prior written permission.
21a9643ea8Slogwang  *
22a9643ea8Slogwang  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23a9643ea8Slogwang  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24a9643ea8Slogwang  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25a9643ea8Slogwang  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26a9643ea8Slogwang  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27a9643ea8Slogwang  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28a9643ea8Slogwang  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29a9643ea8Slogwang  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30a9643ea8Slogwang  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31a9643ea8Slogwang  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32a9643ea8Slogwang  * SUCH DAMAGE.
33a9643ea8Slogwang  *
34a9643ea8Slogwang  *	from: @(#)vm_param.h	8.1 (Berkeley) 6/11/93
35a9643ea8Slogwang  *
36a9643ea8Slogwang  *
37a9643ea8Slogwang  * Copyright (c) 1987, 1990 Carnegie-Mellon University.
38a9643ea8Slogwang  * All rights reserved.
39a9643ea8Slogwang  *
40a9643ea8Slogwang  * Authors: Avadis Tevanian, Jr., Michael Wayne Young
41a9643ea8Slogwang  *
42a9643ea8Slogwang  * Permission to use, copy, modify and distribute this software and
43a9643ea8Slogwang  * its documentation is hereby granted, provided that both the copyright
44a9643ea8Slogwang  * notice and this permission notice appear in all copies of the
45a9643ea8Slogwang  * software, derivative works or modified versions, and any portions
46a9643ea8Slogwang  * thereof, and that both notices appear in supporting documentation.
47a9643ea8Slogwang  *
48a9643ea8Slogwang  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
49a9643ea8Slogwang  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
50a9643ea8Slogwang  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
51a9643ea8Slogwang  *
52a9643ea8Slogwang  * Carnegie Mellon requests users of this software to return to
53a9643ea8Slogwang  *
54a9643ea8Slogwang  *  Software Distribution Coordinator  or  [email protected]
55a9643ea8Slogwang  *  School of Computer Science
56a9643ea8Slogwang  *  Carnegie Mellon University
57a9643ea8Slogwang  *  Pittsburgh PA 15213-3890
58a9643ea8Slogwang  *
59a9643ea8Slogwang  * any improvements or extensions that they make and grant Carnegie the
60a9643ea8Slogwang  * rights to redistribute these changes.
61a9643ea8Slogwang  *
62a9643ea8Slogwang  * $FreeBSD$
63a9643ea8Slogwang  */
64a9643ea8Slogwang 
65a9643ea8Slogwang /*
66a9643ea8Slogwang  *	Machine independent virtual memory parameters.
67a9643ea8Slogwang  */
68a9643ea8Slogwang 
69a9643ea8Slogwang #ifndef	_VM_PARAM_
70a9643ea8Slogwang #define	_VM_PARAM_
71a9643ea8Slogwang 
72a9643ea8Slogwang #include <machine/vmparam.h>
73a9643ea8Slogwang 
74a9643ea8Slogwang /*
75a9643ea8Slogwang  * CTL_VM identifiers
76a9643ea8Slogwang  */
77a9643ea8Slogwang #define	VM_TOTAL		1	/* struct vmtotal */
78a9643ea8Slogwang #define	VM_METER                VM_TOTAL/* deprecated, use VM_TOTAL */
79a9643ea8Slogwang #define	VM_LOADAVG	 	2	/* struct loadavg */
80a9643ea8Slogwang #define VM_V_FREE_MIN		3	/* vm_cnt.v_free_min */
81a9643ea8Slogwang #define VM_V_FREE_TARGET	4	/* vm_cnt.v_free_target */
82a9643ea8Slogwang #define VM_V_FREE_RESERVED	5	/* vm_cnt.v_free_reserved */
83a9643ea8Slogwang #define VM_V_INACTIVE_TARGET	6	/* vm_cnt.v_inactive_target */
84a9643ea8Slogwang #define	VM_OBSOLETE_7		7	/* unused, formerly v_cache_min */
85a9643ea8Slogwang #define	VM_OBSOLETE_8		8	/* unused, formerly v_cache_max */
86a9643ea8Slogwang #define VM_V_PAGEOUT_FREE_MIN	9	/* vm_cnt.v_pageout_free_min */
87a9643ea8Slogwang #define	VM_OBSOLETE_10		10	/* pageout algorithm */
88a9643ea8Slogwang #define VM_SWAPPING_ENABLED	11	/* swapping enabled */
89*22ce4affSfengbojiang #define VM_OVERCOMMIT		12	/* vm.overcommit */
90*22ce4affSfengbojiang #define	VM_MAXID		13	/* number of valid vm ids */
91a9643ea8Slogwang 
92a9643ea8Slogwang /*
93a9643ea8Slogwang  * Structure for swap device statistics
94a9643ea8Slogwang  */
95*22ce4affSfengbojiang #define XSWDEV_VERSION	2
96a9643ea8Slogwang struct xswdev {
97a9643ea8Slogwang 	u_int	xsw_version;
98a9643ea8Slogwang 	dev_t	xsw_dev;
99a9643ea8Slogwang 	int	xsw_flags;
100a9643ea8Slogwang 	int	xsw_nblks;
101a9643ea8Slogwang 	int     xsw_used;
102a9643ea8Slogwang };
103a9643ea8Slogwang 
104a9643ea8Slogwang /*
105a9643ea8Slogwang  *	Return values from the VM routines.
106a9643ea8Slogwang  */
107a9643ea8Slogwang #define	KERN_SUCCESS		0
108a9643ea8Slogwang #define	KERN_INVALID_ADDRESS	1
109a9643ea8Slogwang #define	KERN_PROTECTION_FAILURE	2
110a9643ea8Slogwang #define	KERN_NO_SPACE		3
111a9643ea8Slogwang #define	KERN_INVALID_ARGUMENT	4
112a9643ea8Slogwang #define	KERN_FAILURE		5
113a9643ea8Slogwang #define	KERN_RESOURCE_SHORTAGE	6
114a9643ea8Slogwang #define	KERN_NOT_RECEIVER	7
115a9643ea8Slogwang #define	KERN_NO_ACCESS		8
116*22ce4affSfengbojiang #define	KERN_OUT_OF_BOUNDS	9
117*22ce4affSfengbojiang #define	KERN_RESTART		10
118a9643ea8Slogwang 
119a9643ea8Slogwang #ifndef PA_LOCK_COUNT
120a9643ea8Slogwang #ifdef SMP
121a9643ea8Slogwang #define	PA_LOCK_COUNT	32
122a9643ea8Slogwang #else
123a9643ea8Slogwang #define PA_LOCK_COUNT	1
124a9643ea8Slogwang #endif	/* !SMP */
125a9643ea8Slogwang #endif	/* !PA_LOCK_COUNT */
126a9643ea8Slogwang 
127*22ce4affSfengbojiang #ifndef KSTACK_MAX_PAGES
128*22ce4affSfengbojiang #define KSTACK_MAX_PAGES 32
129*22ce4affSfengbojiang #endif
130*22ce4affSfengbojiang 
131*22ce4affSfengbojiang #ifndef	PHYS_AVAIL_ENTRIES
132*22ce4affSfengbojiang #define PHYS_AVAIL_ENTRIES      (VM_PHYSSEG_MAX * 2)
133*22ce4affSfengbojiang #endif
134*22ce4affSfengbojiang #define PHYS_AVAIL_COUNT        (PHYS_AVAIL_ENTRIES + 2)
135*22ce4affSfengbojiang 
136a9643ea8Slogwang #ifndef ASSEMBLER
137a9643ea8Slogwang #ifdef _KERNEL
138a9643ea8Slogwang #define num_pages(x) \
139a9643ea8Slogwang 	((vm_offset_t)((((vm_offset_t)(x)) + PAGE_MASK) >> PAGE_SHIFT))
140a9643ea8Slogwang extern	unsigned long maxtsiz;
141a9643ea8Slogwang extern	unsigned long dfldsiz;
142a9643ea8Slogwang extern	unsigned long maxdsiz;
143a9643ea8Slogwang extern	unsigned long dflssiz;
144a9643ea8Slogwang extern	unsigned long maxssiz;
145a9643ea8Slogwang extern	unsigned long sgrowsiz;
146a9643ea8Slogwang #endif				/* _KERNEL */
147a9643ea8Slogwang #endif				/* ASSEMBLER */
148a9643ea8Slogwang #endif				/* _VM_PARAM_ */
149