xref: /freebsd/sys/arm/include/vmparam.h (revision e137643ef3a21fcca8c88fb6282a06a85c74280a)
16fc729afSOlivier Houchard /*	$NetBSD: vmparam.h,v 1.26 2003/08/07 16:27:47 agc Exp $	*/
26fc729afSOlivier Houchard 
3d8315c79SWarner Losh /*-
46fc729afSOlivier Houchard  * Copyright (c) 1988 The Regents of the University of California.
56fc729afSOlivier Houchard  * All rights reserved.
66fc729afSOlivier Houchard  *
76fc729afSOlivier Houchard  * Redistribution and use in source and binary forms, with or without
86fc729afSOlivier Houchard  * modification, are permitted provided that the following conditions
96fc729afSOlivier Houchard  * are met:
106fc729afSOlivier Houchard  * 1. Redistributions of source code must retain the above copyright
116fc729afSOlivier Houchard  *    notice, this list of conditions and the following disclaimer.
126fc729afSOlivier Houchard  * 2. Redistributions in binary form must reproduce the above copyright
136fc729afSOlivier Houchard  *    notice, this list of conditions and the following disclaimer in the
146fc729afSOlivier Houchard  *    documentation and/or other materials provided with the distribution.
156fc729afSOlivier Houchard  * 3. Neither the name of the University nor the names of its contributors
166fc729afSOlivier Houchard  *    may be used to endorse or promote products derived from this software
176fc729afSOlivier Houchard  *    without specific prior written permission.
186fc729afSOlivier Houchard  *
196fc729afSOlivier Houchard  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
206fc729afSOlivier Houchard  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
216fc729afSOlivier Houchard  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
226fc729afSOlivier Houchard  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
236fc729afSOlivier Houchard  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
246fc729afSOlivier Houchard  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
256fc729afSOlivier Houchard  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
266fc729afSOlivier Houchard  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
276fc729afSOlivier Houchard  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
286fc729afSOlivier Houchard  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
296fc729afSOlivier Houchard  * SUCH DAMAGE.
306fc729afSOlivier Houchard  *
316fc729afSOlivier Houchard  * $FreeBSD$
326fc729afSOlivier Houchard  */
336fc729afSOlivier Houchard 
346fc729afSOlivier Houchard #ifndef	_MACHINE_VMPARAM_H_
356fc729afSOlivier Houchard #define	_MACHINE_VMPARAM_H_
366fc729afSOlivier Houchard 
37e40f53aaSAndrew Turner /*
38e40f53aaSAndrew Turner  * Machine dependent constants for ARM.
396fc729afSOlivier Houchard  */
40e40f53aaSAndrew Turner 
41e40f53aaSAndrew Turner /*
42e40f53aaSAndrew Turner  * Virtual memory related constants, all in bytes
43e40f53aaSAndrew Turner  */
44e40f53aaSAndrew Turner #ifndef	MAXTSIZ
45e40f53aaSAndrew Turner #define	MAXTSIZ		(64UL*1024*1024)	/* max text size */
46e40f53aaSAndrew Turner #endif
47e40f53aaSAndrew Turner #ifndef	DFLDSIZ
48e40f53aaSAndrew Turner #define	DFLDSIZ		(128UL*1024*1024)	/* initial data size limit */
49e40f53aaSAndrew Turner #endif
50e40f53aaSAndrew Turner #ifndef	MAXDSIZ
51e40f53aaSAndrew Turner #define	MAXDSIZ		(512UL*1024*1024)	/* max data size */
52e40f53aaSAndrew Turner #endif
53e40f53aaSAndrew Turner #ifndef	DFLSSIZ
54e40f53aaSAndrew Turner #define	DFLSSIZ		(2UL*1024*1024)		/* initial stack size limit */
55e40f53aaSAndrew Turner #endif
56e40f53aaSAndrew Turner #ifndef	MAXSSIZ
57e40f53aaSAndrew Turner #define	MAXSSIZ		(8UL*1024*1024)		/* max stack size */
58e40f53aaSAndrew Turner #endif
59e40f53aaSAndrew Turner #ifndef	SGROWSIZ
60e40f53aaSAndrew Turner #define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */
61e40f53aaSAndrew Turner #endif
62e40f53aaSAndrew Turner 
636fc729afSOlivier Houchard /*
646fc729afSOlivier Houchard  * Address space constants
656fc729afSOlivier Houchard  */
666fc729afSOlivier Houchard 
676fc729afSOlivier Houchard /*
686fc729afSOlivier Houchard  * The line between user space and kernel space
696fc729afSOlivier Houchard  * Mappings >= KERNEL_BASE are constant across all processes
706fc729afSOlivier Houchard  */
716fc729afSOlivier Houchard #define	KERNBASE		0xc0000000
726fc729afSOlivier Houchard 
736fc729afSOlivier Houchard /*
746fc729afSOlivier Houchard  * max number of non-contig chunks of physical RAM you can have
756fc729afSOlivier Houchard  */
766fc729afSOlivier Houchard 
776fc729afSOlivier Houchard #define	VM_PHYSSEG_MAX		32
786fc729afSOlivier Houchard 
796fc729afSOlivier Houchard /*
8004a18977SAlan Cox  * The physical address space is densely populated.
8104a18977SAlan Cox  */
8204a18977SAlan Cox #define	VM_PHYSSEG_DENSE
8304a18977SAlan Cox 
8404a18977SAlan Cox /*
857bfda801SAlan Cox  * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool
869211decaSAlan Cox  * from which physical pages are allocated and VM_FREEPOOL_DIRECT is
879211decaSAlan Cox  * the pool from which physical pages for small UMA objects are
889211decaSAlan Cox  * allocated.
899211decaSAlan Cox  */
907bfda801SAlan Cox #define	VM_NFREEPOOL		3
917bfda801SAlan Cox #define	VM_FREEPOOL_CACHE	2
929211decaSAlan Cox #define	VM_FREEPOOL_DEFAULT	0
939211decaSAlan Cox #define	VM_FREEPOOL_DIRECT	1
949211decaSAlan Cox 
959211decaSAlan Cox /*
966fc729afSOlivier Houchard  * we support 2 free lists:
976fc729afSOlivier Houchard  *
986fc729afSOlivier Houchard  *	- DEFAULT for all systems
996fc729afSOlivier Houchard  *	- ISADMA for the ISA DMA range on Sharks only
1006fc729afSOlivier Houchard  */
1016fc729afSOlivier Houchard 
1026fc729afSOlivier Houchard #define	VM_NFREELIST		2
1036fc729afSOlivier Houchard #define	VM_FREELIST_DEFAULT	0
1046fc729afSOlivier Houchard #define	VM_FREELIST_ISADMA	1
1056fc729afSOlivier Houchard 
1069211decaSAlan Cox /*
1079211decaSAlan Cox  * The largest allocation size is 1MB.
1089211decaSAlan Cox  */
1099211decaSAlan Cox #define	VM_NFREEORDER		9
1109211decaSAlan Cox 
111b8e7fc24SAlan Cox /*
112b8e7fc24SAlan Cox  * Disable superpage reservations.
113b8e7fc24SAlan Cox  */
114b8e7fc24SAlan Cox #ifndef	VM_NRESERVLEVEL
115b8e7fc24SAlan Cox #define	VM_NRESERVLEVEL		0
116b8e7fc24SAlan Cox #endif
117b8e7fc24SAlan Cox 
1186fc729afSOlivier Houchard #define UPT_MAX_ADDRESS		VADDR(UPTPTDI + 3, 0)
1196fc729afSOlivier Houchard #define UPT_MIN_ADDRESS		VADDR(UPTPTDI, 0)
1206fc729afSOlivier Houchard 
1216fc729afSOlivier Houchard #define VM_MIN_ADDRESS          (0x00001000)
12249953e11SOlivier Houchard #ifdef ARM_USE_SMALL_ALLOC
1237202abb6SOlivier Houchard /*
1247202abb6SOlivier Houchard  * ARM_KERN_DIRECTMAP is used to make sure there's enough space between
1257202abb6SOlivier Houchard  * VM_MAXUSER_ADDRESS and KERNBASE to map the whole memory.
1267202abb6SOlivier Houchard  * It has to be a compile-time constant, even if arm_init_smallalloc(),
1277202abb6SOlivier Houchard  * which will do the mapping, gets the real amount of memory at runtime,
1287202abb6SOlivier Houchard  * because VM_MAXUSER_ADDRESS is a constant.
1297202abb6SOlivier Houchard  */
13049953e11SOlivier Houchard #ifndef ARM_KERN_DIRECTMAP
13149953e11SOlivier Houchard #define ARM_KERN_DIRECTMAP 512 * 1024 * 1024 /* 512 MB */
13249953e11SOlivier Houchard #endif
13349953e11SOlivier Houchard #define VM_MAXUSER_ADDRESS	KERNBASE - ARM_KERN_DIRECTMAP
13449953e11SOlivier Houchard #else /* ARM_USE_SMALL_ALLOC */
135cf1a573fSOleksandr Tymoshenko #ifndef VM_MAXUSER_ADDRESS
1366fc729afSOlivier Houchard #define VM_MAXUSER_ADDRESS      KERNBASE
137cf1a573fSOleksandr Tymoshenko #endif /* VM_MAXUSER_ADDRESS */
13849953e11SOlivier Houchard #endif /* ARM_USE_SMALL_ALLOC */
1396fc729afSOlivier Houchard #define VM_MAX_ADDRESS          VM_MAXUSER_ADDRESS
1406fc729afSOlivier Houchard 
1416fc729afSOlivier Houchard #define USRSTACK        VM_MAXUSER_ADDRESS
1426fc729afSOlivier Houchard 
1436fc729afSOlivier Houchard /* initial pagein size of beginning of executable file */
1446fc729afSOlivier Houchard #ifndef VM_INITIAL_PAGEIN
1456fc729afSOlivier Houchard #define VM_INITIAL_PAGEIN       16
1466fc729afSOlivier Houchard #endif
1476fc729afSOlivier Houchard 
1486fc729afSOlivier Houchard #ifndef VM_MIN_KERNEL_ADDRESS
1496fc729afSOlivier Houchard #define VM_MIN_KERNEL_ADDRESS KERNBASE
1506fc729afSOlivier Houchard #endif
1516fc729afSOlivier Houchard 
152fc23011bSAlan Cox #define	VM_MAX_KERNEL_ADDRESS	(vm_max_kernel_address)
1531211375fSAndre Oppermann 
1546fc729afSOlivier Houchard /*
1555b17d1f9SOlivier Houchard  * Virtual size (bytes) for various kernel submaps.
1565b17d1f9SOlivier Houchard  */
1576fc729afSOlivier Houchard #ifndef VM_KMEM_SIZE
1586fc729afSOlivier Houchard #define VM_KMEM_SIZE		(12*1024*1024)
1596fc729afSOlivier Houchard #endif
1601211375fSAndre Oppermann #ifndef VM_KMEM_SIZE_SCALE
161219d9565SAlan Cox #define VM_KMEM_SIZE_SCALE	(3)
1621211375fSAndre Oppermann #endif
1636fc729afSOlivier Houchard 
164837a2c51SAlan Cox /*
165219d9565SAlan Cox  * Ceiling on the size of the kmem submap: 40% of the kernel map.
166837a2c51SAlan Cox  */
167837a2c51SAlan Cox #ifndef VM_KMEM_SIZE_MAX
168*e137643eSOlivier Houchard #define	VM_KMEM_SIZE_MAX	((vm_max_kernel_address - \
169*e137643eSOlivier Houchard     VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
170837a2c51SAlan Cox #endif
171837a2c51SAlan Cox 
17256e472e2SOlivier Houchard #ifdef ARM_USE_SMALL_ALLOC
17356e472e2SOlivier Houchard #define UMA_MD_SMALL_ALLOC
17456e472e2SOlivier Houchard #endif /* ARM_USE_SMALL_ALLOC */
175cfb00e5aSMatthew D Fleming 
176fc23011bSAlan Cox extern vm_offset_t vm_max_kernel_address;
177fc23011bSAlan Cox 
178cfb00e5aSMatthew D Fleming #define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */
179cfb00e5aSMatthew D Fleming 
18099c89998SAlan Cox #ifndef VM_MAX_AUTOTUNE_MAXUSERS
18199c89998SAlan Cox #define	VM_MAX_AUTOTUNE_MAXUSERS	384
18299c89998SAlan Cox #endif
18399c89998SAlan Cox 
1846fc729afSOlivier Houchard #endif	/* _MACHINE_VMPARAM_H_ */
185