1139825Simp/*-
21541Srgrimes * Copyright (c) 1991, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes *
51541Srgrimes * This code is derived from software contributed to Berkeley by
61541Srgrimes * The Mach Operating System project at Carnegie-Mellon University.
71541Srgrimes *
81541Srgrimes * Redistribution and use in source and binary forms, with or without
91541Srgrimes * modification, are permitted provided that the following conditions
101541Srgrimes * are met:
111541Srgrimes * 1. Redistributions of source code must retain the above copyright
121541Srgrimes *    notice, this list of conditions and the following disclaimer.
131541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
141541Srgrimes *    notice, this list of conditions and the following disclaimer in the
151541Srgrimes *    documentation and/or other materials provided with the distribution.
161541Srgrimes * 4. Neither the name of the University nor the names of its contributors
171541Srgrimes *    may be used to endorse or promote products derived from this software
181541Srgrimes *    without specific prior written permission.
191541Srgrimes *
201541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
211541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
221541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
231541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
241541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
251541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
261541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
271541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
281541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
291541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
301541Srgrimes * SUCH DAMAGE.
311541Srgrimes *
321817Sdg *	from: @(#)vm_param.h	8.1 (Berkeley) 6/11/93
331541Srgrimes *
341541Srgrimes *
351541Srgrimes * Copyright (c) 1987, 1990 Carnegie-Mellon University.
361541Srgrimes * All rights reserved.
371541Srgrimes *
381541Srgrimes * Authors: Avadis Tevanian, Jr., Michael Wayne Young
395455Sdg *
401541Srgrimes * Permission to use, copy, modify and distribute this software and
411541Srgrimes * its documentation is hereby granted, provided that both the copyright
421541Srgrimes * notice and this permission notice appear in all copies of the
431541Srgrimes * software, derivative works or modified versions, and any portions
441541Srgrimes * thereof, and that both notices appear in supporting documentation.
455455Sdg *
465455Sdg * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
475455Sdg * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
481541Srgrimes * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
495455Sdg *
501541Srgrimes * Carnegie Mellon requests users of this software to return to
511541Srgrimes *
521541Srgrimes *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
531541Srgrimes *  School of Computer Science
541541Srgrimes *  Carnegie Mellon University
551541Srgrimes *  Pittsburgh PA 15213-3890
561541Srgrimes *
571541Srgrimes * any improvements or extensions that they make and grant Carnegie the
581541Srgrimes * rights to redistribute these changes.
591817Sdg *
6050477Speter * $FreeBSD$
611541Srgrimes */
621541Srgrimes
631541Srgrimes/*
641541Srgrimes *	Machine independent virtual memory parameters.
651541Srgrimes */
661541Srgrimes
671541Srgrimes#ifndef	_VM_PARAM_
681541Srgrimes#define	_VM_PARAM_
691541Srgrimes
701541Srgrimes#include <machine/vmparam.h>
711541Srgrimes
721541Srgrimes/*
731541Srgrimes * CTL_VM identifiers
741541Srgrimes */
75109097Sdillon#define	VM_TOTAL		1	/* struct vmtotal */
76109496Sobrien#define	VM_METER                VM_TOTAL/* deprecated, use VM_TOTAL */
775455Sdg#define	VM_LOADAVG	 	2	/* struct loadavg */
785455Sdg#define VM_V_FREE_MIN		3	/* cnt.v_free_min */
795455Sdg#define VM_V_FREE_TARGET	4	/* cnt.v_free_target */
805455Sdg#define VM_V_FREE_RESERVED	5	/* cnt.v_free_reserved */
815455Sdg#define VM_V_INACTIVE_TARGET	6	/* cnt.v_inactive_target */
82168851Salc#define	VM_V_CACHE_MIN		7	/* cnt.v_cache_min */
83168851Salc#define	VM_V_CACHE_MAX		8	/* cnt.v_cache_max */
845455Sdg#define VM_V_PAGEOUT_FREE_MIN	9	/* cnt.v_pageout_free_min */
8516750Sdyson#define	VM_PAGEOUT_ALGORITHM	10	/* pageout algorithm */
8616750Sdyson#define VM_SWAPPING_ENABLED	11	/* swapping enabled */
8716750Sdyson#define	VM_MAXID		12	/* number of valid vm ids */
881541Srgrimes
891541Srgrimes#define CTL_VM_NAMES { \
901541Srgrimes	{ 0, 0 }, \
91109097Sdillon	{ "vmtotal", CTLTYPE_STRUCT }, \
921541Srgrimes	{ "loadavg", CTLTYPE_STRUCT }, \
93172700Sru	{ "v_free_min", CTLTYPE_UINT }, \
94172700Sru	{ "v_free_target", CTLTYPE_UINT }, \
95172700Sru	{ "v_free_reserved", CTLTYPE_UINT }, \
96172700Sru	{ "v_inactive_target", CTLTYPE_UINT }, \
97172700Sru	{ "v_cache_min", CTLTYPE_UINT }, \
98172700Sru	{ "v_cache_max", CTLTYPE_UINT }, \
99172700Sru	{ "v_pageout_free_min", CTLTYPE_UINT}, \
10016750Sdyson	{ "pageout_algorithm", CTLTYPE_INT}, \
101172700Sru	{ "swap_enabled", CTLTYPE_INT},\
1021541Srgrimes}
1031541Srgrimes
1045455Sdg/*
10577604Stmm * Structure for swap device statistics
10677604Stmm */
10777604Stmm#define XSWDEV_VERSION	1
10877604Stmmstruct xswdev {
10977604Stmm	u_int	xsw_version;
110130640Sphk	dev_t	xsw_dev;
11177604Stmm	int	xsw_flags;
11277604Stmm	int	xsw_nblks;
11377604Stmm	int     xsw_used;
11477604Stmm};
11577604Stmm
11677604Stmm/*
1171541Srgrimes *	Return values from the VM routines.
1181541Srgrimes */
1191541Srgrimes#define	KERN_SUCCESS		0
1201541Srgrimes#define	KERN_INVALID_ADDRESS	1
1211541Srgrimes#define	KERN_PROTECTION_FAILURE	2
1221541Srgrimes#define	KERN_NO_SPACE		3
1231541Srgrimes#define	KERN_INVALID_ARGUMENT	4
1241541Srgrimes#define	KERN_FAILURE		5
1251541Srgrimes#define	KERN_RESOURCE_SHORTAGE	6
1261541Srgrimes#define	KERN_NOT_RECEIVER	7
1271541Srgrimes#define	KERN_NO_ACCESS		8
1281541Srgrimes
129207410Skmacy#ifndef PA_LOCK_COUNT
130207410Skmacy#ifdef SMP
131207410Skmacy#define	PA_LOCK_COUNT	32
132207410Skmacy#else
133207410Skmacy#define PA_LOCK_COUNT	1
134207410Skmacy#endif	/* !SMP */
135207410Skmacy#endif	/* !PA_LOCK_COUNT */
136207410Skmacy
1371541Srgrimes#ifndef ASSEMBLER
13855206Speter#ifdef _KERNEL
1391541Srgrimes#define num_pages(x) \
1401541Srgrimes	((vm_offset_t)((((vm_offset_t)(x)) + PAGE_MASK) >> PAGE_SHIFT))
141137393Sdesextern	unsigned long maxtsiz;
142137393Sdesextern	unsigned long dfldsiz;
143137393Sdesextern	unsigned long maxdsiz;
144137393Sdesextern	unsigned long dflssiz;
145137393Sdesextern	unsigned long maxssiz;
146137393Sdesextern	unsigned long sgrowsiz;
14755206Speter#endif				/* _KERNEL */
1485455Sdg#endif				/* ASSEMBLER */
1495455Sdg#endif				/* _VM_PARAM_ */
150