1129198Scognet/*	$NetBSD: vmparam.h,v 1.26 2003/08/07 16:27:47 agc Exp $	*/
2129198Scognet
3139735Simp/*-
4129198Scognet * Copyright (c) 1988 The Regents of the University of California.
5129198Scognet * All rights reserved.
6129198Scognet *
7129198Scognet * Redistribution and use in source and binary forms, with or without
8129198Scognet * modification, are permitted provided that the following conditions
9129198Scognet * are met:
10129198Scognet * 1. Redistributions of source code must retain the above copyright
11129198Scognet *    notice, this list of conditions and the following disclaimer.
12129198Scognet * 2. Redistributions in binary form must reproduce the above copyright
13129198Scognet *    notice, this list of conditions and the following disclaimer in the
14129198Scognet *    documentation and/or other materials provided with the distribution.
15129198Scognet * 3. Neither the name of the University nor the names of its contributors
16129198Scognet *    may be used to endorse or promote products derived from this software
17129198Scognet *    without specific prior written permission.
18129198Scognet *
19129198Scognet * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20129198Scognet * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21129198Scognet * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22129198Scognet * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23129198Scognet * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24129198Scognet * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25129198Scognet * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26129198Scognet * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27129198Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28129198Scognet * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29129198Scognet * SUCH DAMAGE.
30129198Scognet *
31129198Scognet * $FreeBSD: stable/11/sys/arm/include/vmparam.h 327658 2018-01-07 00:04:13Z ian $
32129198Scognet */
33129198Scognet
34129198Scognet#ifndef	_MACHINE_VMPARAM_H_
35129198Scognet#define	_MACHINE_VMPARAM_H_
36129198Scognet
37247610Sandrew/*
38247610Sandrew * Machine dependent constants for ARM.
39247610Sandrew */
40129198Scognet
41129198Scognet/*
42247610Sandrew * Virtual memory related constants, all in bytes
43247610Sandrew */
44247610Sandrew#ifndef	MAXTSIZ
45318637Smmel#define	MAXTSIZ		(256UL*1024*1024)	/* max text size */
46247610Sandrew#endif
47247610Sandrew#ifndef	DFLDSIZ
48247610Sandrew#define	DFLDSIZ		(128UL*1024*1024)	/* initial data size limit */
49247610Sandrew#endif
50247610Sandrew#ifndef	MAXDSIZ
51247610Sandrew#define	MAXDSIZ		(512UL*1024*1024)	/* max data size */
52247610Sandrew#endif
53247610Sandrew#ifndef	DFLSSIZ
54247610Sandrew#define	DFLSSIZ		(2UL*1024*1024)		/* initial stack size limit */
55247610Sandrew#endif
56247610Sandrew#ifndef	MAXSSIZ
57247610Sandrew#define	MAXSSIZ		(8UL*1024*1024)		/* max stack size */
58247610Sandrew#endif
59247610Sandrew#ifndef	SGROWSIZ
60247610Sandrew#define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */
61247610Sandrew#endif
62247610Sandrew
63247610Sandrew/*
64129198Scognet * Address space constants
65129198Scognet */
66129198Scognet
67129198Scognet/*
68129198Scognet * The line between user space and kernel space
69129198Scognet * Mappings >= KERNEL_BASE are constant across all processes
70129198Scognet */
71280278Szbb#ifndef KERNBASE
72129198Scognet#define	KERNBASE		0xc0000000
73280278Szbb#endif
74129198Scognet
75129198Scognet/*
76327658Sian * The virtual address the kernel is linked to run at.  For armv4/5 platforms
77327658Sian * the low-order 30 bits of this must match the low-order bits of the physical
78327658Sian * address the kernel is loaded at, so the value is most often provided as a
79327658Sian * kernel config option in the std.platform file. For armv6/7 the kernel can
80327658Sian * be loaded at any 2MB boundary, and KERNVIRTADDR can also be set to any 2MB
81327658Sian * boundary.  It is typically overridden in the std.platform file only when
82327658Sian * KERNBASE is also set to a lower address to provide more KVA.
83327658Sian */
84327658Sian#ifndef KERNVIRTADDR
85327658Sian#define	KERNVIRTADDR		0xc0000000
86327658Sian#endif
87327658Sian
88327658Sian/*
89129198Scognet * max number of non-contig chunks of physical RAM you can have
90129198Scognet */
91129198Scognet
92129198Scognet#define	VM_PHYSSEG_MAX		32
93129198Scognet
94129198Scognet/*
95264203Sian * The physical address space may be sparsely populated on some ARM systems.
96169291Salc */
97264203Sian#define	VM_PHYSSEG_SPARSE
98169291Salc
99169291Salc/*
100284147Salc * Create one free page pool.  Since the ARM kernel virtual address
101261642Sian * space does not include a mapping onto the machine's entire physical
102261642Sian * memory, VM_FREEPOOL_DIRECT is defined as an alias for the default
103261642Sian * pool, VM_FREEPOOL_DEFAULT.
104170277Salc */
105284147Salc#define	VM_NFREEPOOL		1
106261642Sian#define	VM_FREEPOOL_DEFAULT	0
107257549Salc#define	VM_FREEPOOL_DIRECT	0
108170277Salc
109170277Salc/*
110264135Sian * We need just one free list:  DEFAULT.
111129198Scognet */
112264135Sian#define	VM_NFREELIST		1
113129198Scognet#define	VM_FREELIST_DEFAULT	0
114129198Scognet
115170277Salc/*
116170277Salc * The largest allocation size is 1MB.
117170277Salc */
118170277Salc#define	VM_NFREEORDER		9
119170277Salc
120174938Salc/*
121254915Sraj * Enable superpage reservations: 1 level.
122174938Salc */
123174938Salc#ifndef	VM_NRESERVLEVEL
124254915Sraj#define	VM_NRESERVLEVEL		1
125174938Salc#endif
126174938Salc
127254915Sraj/*
128254915Sraj * Level 0 reservations consist of 256 pages.
129254915Sraj */
130254915Sraj#ifndef	VM_LEVEL_0_ORDER
131254915Sraj#define	VM_LEVEL_0_ORDER	8
132254915Sraj#endif
133254915Sraj
134129198Scognet#define VM_MIN_ADDRESS          (0x00001000)
135239268Sgonzo#ifndef VM_MAXUSER_ADDRESS
136280712Sian#define VM_MAXUSER_ADDRESS      (KERNBASE - 0x00400000) /* !!! PT2MAP_SIZE */
137280712Sian#endif
138129198Scognet#define VM_MAX_ADDRESS          VM_MAXUSER_ADDRESS
139129198Scognet
140291937Skib#define	SHAREDPAGE		(VM_MAXUSER_ADDRESS - PAGE_SIZE)
141291937Skib#define	USRSTACK		SHAREDPAGE
142129198Scognet
143129198Scognet/* initial pagein size of beginning of executable file */
144129198Scognet#ifndef VM_INITIAL_PAGEIN
145129198Scognet#define VM_INITIAL_PAGEIN       16
146129198Scognet#endif
147129198Scognet
148129198Scognet#ifndef VM_MIN_KERNEL_ADDRESS
149129198Scognet#define VM_MIN_KERNEL_ADDRESS KERNBASE
150129198Scognet#endif
151129198Scognet
152246926Salc#define	VM_MAX_KERNEL_ADDRESS	(vm_max_kernel_address)
153246204Sandre
154129198Scognet/*
155257854Salc * How many physical pages per kmem arena virtual page.
156133011Scognet */
157246204Sandre#ifndef VM_KMEM_SIZE_SCALE
158257854Salc#define	VM_KMEM_SIZE_SCALE	(3)
159246204Sandre#endif
160129198Scognet
161246929Salc/*
162257854Salc * Optional floor (in bytes) on the size of the kmem arena.
163246929Salc */
164257854Salc#ifndef VM_KMEM_SIZE_MIN
165257854Salc#define	VM_KMEM_SIZE_MIN	(12 * 1024 * 1024)
166257854Salc#endif
167257854Salc
168257854Salc/*
169257854Salc * Optional ceiling (in bytes) on the size of the kmem arena: 40% of the
170257854Salc * kernel map.
171257854Salc */
172246929Salc#ifndef VM_KMEM_SIZE_MAX
173254166Scognet#define	VM_KMEM_SIZE_MAX	((vm_max_kernel_address - \
174254166Scognet    VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
175246929Salc#endif
176246929Salc
177246926Salcextern vm_offset_t vm_max_kernel_address;
178246926Salc
179221855Smdf#define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */
180221855Smdf
181247535Salc#ifndef VM_MAX_AUTOTUNE_MAXUSERS
182247535Salc#define	VM_MAX_AUTOTUNE_MAXUSERS	384
183247535Salc#endif
184247535Salc
185269577Sglebius#define	SFBUF
186269577Sglebius#define	SFBUF_MAP
187269577Sglebius
188298627Sbr#define	DEVMAP_MAX_VADDR	ARM_VECTORS_HIGH
189298627Sbr
190129198Scognet#endif	/* _MACHINE_VMPARAM_H_ */
191