vmparam.h revision 172317
1193323Sed/* $FreeBSD: head/sys/ia64/include/vmparam.h 172317 2007-09-25 06:25:06Z alc $ */
2193323Sed/* From: NetBSD: vmparam.h,v 1.6 1997/09/23 23:23:23 mjacob Exp */
3193323Sed#ifndef	_MACHINE_VMPARAM_H
4193323Sed#define	_MACHINE_VMPARAM_H
5193323Sed/*-
6193323Sed * Copyright (c) 1988 University of Utah.
7193323Sed * Copyright (c) 1992, 1993
8193323Sed *	The Regents of the University of California.  All rights reserved.
9193323Sed *
10193323Sed * This code is derived from software contributed to Berkeley by
11193323Sed * the Systems Programming Group of the University of Utah Computer
12193323Sed * Science Department and Ralph Campbell.
13193323Sed *
14193323Sed * Redistribution and use in source and binary forms, with or without
15193323Sed * modification, are permitted provided that the following conditions
16193323Sed * are met:
17193323Sed * 1. Redistributions of source code must retain the above copyright
18205407Srdivacky *    notice, this list of conditions and the following disclaimer.
19198090Srdivacky * 2. Redistributions in binary form must reproduce the above copyright
20193323Sed *    notice, this list of conditions and the following disclaimer in the
21218893Sdim *    documentation and/or other materials provided with the distribution.
22193323Sed * 4. Neither the name of the University nor the names of its contributors
23193323Sed *    may be used to endorse or promote products derived from this software
24193323Sed *    without specific prior written permission.
25193323Sed *
26193323Sed * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27212904Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28212904Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29212904Sdim * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30212904Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31212904Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32212904Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33212904Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34212904Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35212904Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36212904Sdim * SUCH DAMAGE.
37212904Sdim *
38212904Sdim * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
39212904Sdim *
40212904Sdim *	@(#)vmparam.h	8.2 (Berkeley) 4/22/94
41212904Sdim */
42212904Sdim
43212904Sdim/*
44212904Sdim * Machine dependent constants for ia64.
45212904Sdim */
46212904Sdim/*
47212904Sdim * USRSTACK is the top (end) of the user stack.  Immediately above the user
48212904Sdim * stack resides the syscall gateway page.
49212904Sdim */
50212904Sdim#define	USRSTACK	VM_MAX_ADDRESS
51212904Sdim
52212904Sdim/*
53212904Sdim * Virtual memory related constants, all in bytes
54212904Sdim */
55212904Sdim#ifndef MAXTSIZ
56212904Sdim#define	MAXTSIZ		(1<<30)			/* max text size (1G) */
57212904Sdim#endif
58193323Sed#ifndef DFLDSIZ
59193323Sed#define	DFLDSIZ		(1<<27)			/* initial data size (128M) */
60193323Sed#endif
61193323Sed#ifndef MAXDSIZ
62193323Sed#define	MAXDSIZ		(1<<30)			/* max data size (1G) */
63193323Sed#endif
64193323Sed#ifndef	DFLSSIZ
65193323Sed#define	DFLSSIZ		(1<<21)			/* initial stack size (2M) */
66193323Sed#endif
67226633Sdim#ifndef	MAXSSIZ
68226633Sdim#define	MAXSSIZ		(1<<28)			/* max stack size (256M) */
69193323Sed#endif
70193323Sed#ifndef SGROWSIZ
71193323Sed#define SGROWSIZ	(128UL*1024)		/* amount to grow stack */
72193323Sed#endif
73193323Sed
74193323Sed/*
75193323Sed * Boundary at which to place first MAPMEM segment if not explicitly
76193323Sed * specified.  Should be a power of two.  This allows some slop for
77193323Sed * the data segment to grow underneath the first mapped segment.
78193323Sed */
79193323Sed#define MMSEG		0x200000
80193323Sed
81193323Sed/*
82193323Sed * The size of the clock loop.
83193323Sed */
84193323Sed#define	LOOPPAGES	(maxfree - firstfree)
85198090Srdivacky
86193323Sed/*
87193323Sed * The time for a process to be blocked before being very swappable.
88193323Sed * This is a number of seconds which the system takes as being a non-trivial
89193323Sed * amount of real time.  You probably shouldn't change this;
90193323Sed * it is used in subtle ways (fractions and multiples of it are, that is, like
91193323Sed * half of a ``long time'', almost a long time, etc.)
92193323Sed * It is related to human patience and other factors which don't really
93223017Sdim * change over time.
94193323Sed */
95193323Sed#define	MAXSLP 		20
96193323Sed
97198090Srdivacky/*
98198090Srdivacky * A swapped in process is given a small amount of core without being bothered
99193323Sed * by the page replacement algorithm.  Basically this says that if you are
100193323Sed * swapped in you deserve some resources.  We protect the last SAFERSS
101193323Sed * pages against paging and will just swap you out rather than paging you.
102193323Sed * Note that each process has at least UPAGES pages which are not
103193323Sed * paged anyways, in addition to SAFERSS.
104198090Srdivacky */
105193323Sed#define	SAFERSS		10		/* nominal ``small'' resident set size
106193323Sed					   protected against replacement */
107193323Sed
108193323Sed/*
109193323Sed * We need region 7 virtual addresses for pagetables.
110193323Sed */
111193323Sed#define UMA_MD_SMALL_ALLOC
112218893Sdim
113218893Sdim/*
114218893Sdim * The physical address space is sparsely populated.
115218893Sdim */
116218893Sdim#define	VM_PHYSSEG_SPARSE
117218893Sdim
118218893Sdim/*
119218893Sdim * The number of PHYSSEG entries is equal to the number of phys_avail
120218893Sdim * entries.
121218893Sdim */
122218893Sdim#define	VM_PHYSSEG_MAX		49
123218893Sdim
124218893Sdim/*
125218893Sdim * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool
126218893Sdim * from which physical pages are allocated and VM_FREEPOOL_DIRECT is
127218893Sdim * the pool from which physical pages for small UMA objects are
128218893Sdim * allocated.
129218893Sdim */
130218893Sdim#define	VM_NFREEPOOL		3
131193323Sed#define	VM_FREEPOOL_CACHE	2
132193323Sed#define	VM_FREEPOOL_DEFAULT	0
133193323Sed#define	VM_FREEPOOL_DIRECT	1
134193323Sed
135193323Sed/*
136218893Sdim * Create one free page list.
137218893Sdim */
138193323Sed#define	VM_NFREELIST		1
139193323Sed#define	VM_FREELIST_DEFAULT	0
140193323Sed
141193323Sed/*
142193323Sed * An allocation size of 256MB is supported in order to optimize the
143193323Sed * use of the identity mappings in region 7 by UMA.
144193323Sed */
145193323Sed#define	VM_NFREEORDER		16
146193323Sed
147193323Sed/*
148221345Sdim * Manipulating region bits of an address.
149221345Sdim */
150221345Sdim#define IA64_RR_BASE(n)         (((u_int64_t) (n)) << 61)
151221345Sdim#define IA64_RR_MASK(x)         ((x) & ((1L << 61) - 1))
152221345Sdim
153193323Sed#define IA64_PHYS_TO_RR6(x)     ((x) | IA64_RR_BASE(6))
154193323Sed#define IA64_PHYS_TO_RR7(x)     ((x) | IA64_RR_BASE(7))
155193323Sed
156212904Sdim/*
157193323Sed * Page size of the identity mappings in region 7.
158193323Sed */
159193323Sed#ifndef LOG2_ID_PAGE_SIZE
160193323Sed#define	LOG2_ID_PAGE_SIZE	28		/* 256M */
161193323Sed#endif
162212904Sdim
163193323Sed#define	IA64_ID_PAGE_SHIFT	(LOG2_ID_PAGE_SIZE)
164193323Sed#define	IA64_ID_PAGE_SIZE	(1<<(LOG2_ID_PAGE_SIZE))
165212904Sdim#define	IA64_ID_PAGE_MASK	(IA64_ID_PAGE_SIZE-1)
166212904Sdim
167212904Sdim#define	IA64_BACKINGSTORE	IA64_RR_BASE(4)
168212904Sdim
169212904Sdim/*
170212904Sdim * Mach derived constants
171205407Srdivacky */
172205407Srdivacky
173205407Srdivacky/* user/kernel map constants */
174205407Srdivacky#define VM_MIN_ADDRESS		0
175205407Srdivacky#define	VM_MAX_ADDRESS		IA64_RR_BASE(5)
176205407Srdivacky#define	VM_GATEWAY_SIZE		PAGE_SIZE
177205407Srdivacky#define	VM_MAXUSER_ADDRESS	(VM_MAX_ADDRESS + VM_GATEWAY_SIZE)
178205407Srdivacky#define	VM_MIN_KERNEL_ADDRESS	VM_MAXUSER_ADDRESS
179205407Srdivacky#define VM_MAX_KERNEL_ADDRESS	(IA64_RR_BASE(6) - 1)
180193323Sed
181193323Sed#define	KERNBASE		VM_MAX_ADDRESS
182193323Sed
183193323Sed/* virtual sizes (bytes) for various kernel submaps */
184193323Sed#ifndef VM_KMEM_SIZE
185193323Sed#define VM_KMEM_SIZE		(12 * 1024 * 1024)
186193323Sed#endif
187193323Sed
188193323Sed/*
189193323Sed * How many physical pages per KVA page allocated.
190193323Sed * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE),
191193323Sed *     VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX)
192193323Sed * is the total KVA space allocated for kmem_map.
193193323Sed */
194193323Sed#ifndef VM_KMEM_SIZE_SCALE
195193323Sed#define	VM_KMEM_SIZE_SCALE	(4) /* XXX 8192 byte pages */
196193323Sed#endif
197193323Sed
198193323Sed/* initial pagein size of beginning of executable file */
199193323Sed#ifndef VM_INITIAL_PAGEIN
200193323Sed#define	VM_INITIAL_PAGEIN	16
201193323Sed#endif
202193323Sed
203193323Sed#endif	/* !_MACHINE_VMPARAM_H */
204193323Sed