xref: /freebsd/sys/powerpc/include/vmparam.h (revision aa0a1e58)
1 /*-
2  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
3  * Copyright (C) 1995, 1996 TooLs GmbH.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *	This product includes software developed by TooLs GmbH.
17  * 4. The name of TooLs GmbH may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  *	$NetBSD: vmparam.h,v 1.11 2000/02/11 19:25:16 thorpej Exp $
32  * $FreeBSD$
33  */
34 
35 #ifndef _MACHINE_VMPARAM_H_
36 #define	_MACHINE_VMPARAM_H_
37 
38 #define	USRSTACK	SHAREDPAGE
39 
40 #ifndef	MAXTSIZ
41 #define	MAXTSIZ		(64*1024*1024)		/* max text size */
42 #endif
43 
44 #ifndef	DFLDSIZ
45 #define	DFLDSIZ		(128*1024*1024)		/* default data size */
46 #endif
47 
48 #ifndef	MAXDSIZ
49 #define	MAXDSIZ		(1*1024*1024*1024)	/* max data size */
50 #endif
51 
52 #ifndef	DFLSSIZ
53 #define	DFLSSIZ		(8*1024*1024)		/* default stack size */
54 #endif
55 
56 #ifndef	MAXSSIZ
57 #define	MAXSSIZ		(64*1024*1024)		/* max stack size */
58 #endif
59 
60 /*
61  * Would like to have MAX addresses = 0, but this doesn't (currently) work
62  */
63 #if !defined(LOCORE)
64 #ifdef __powerpc64__
65 #define	VM_MIN_ADDRESS		(0x0000000000000000UL)
66 #define	VM_MAXUSER_ADDRESS	(0x7ffffffffffff000UL)
67 #define	SHAREDPAGE		(VM_MAXUSER_ADDRESS - PAGE_SIZE)
68 #define	VM_MAX_ADDRESS		(0xffffffffffffffffUL)
69 #else
70 #define	VM_MIN_ADDRESS		((vm_offset_t)0)
71 #define	VM_MAXUSER_ADDRESS	((vm_offset_t)0x7ffff000)
72 #define	SHAREDPAGE		(VM_MAXUSER_ADDRESS - PAGE_SIZE)
73 #define	VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
74 #endif
75 #else /* LOCORE */
76 #ifndef __powerpc64__
77 #define	VM_MIN_ADDRESS		0
78 #define	VM_MAXUSER_ADDRESS	0x7ffff000
79 #endif
80 #endif /* LOCORE */
81 
82 #define	FREEBSD32_SHAREDPAGE	(0x7ffff000 - PAGE_SIZE)
83 #define	FREEBSD32_USRSTACK	FREEBSD32_SHAREDPAGE
84 
85 #ifdef AIM
86 #define	KERNBASE		0x00100000UL	/* start of kernel virtual */
87 
88 #ifdef __powerpc64__
89 #define	VM_MIN_KERNEL_ADDRESS		0xc000000000000000UL
90 #define	VM_MAX_KERNEL_ADDRESS		0xc0000001c7ffffffUL
91 #define	VM_MAX_SAFE_KERNEL_ADDRESS	VM_MAX_KERNEL_ADDRESS
92 #else
93 #define	VM_MIN_KERNEL_ADDRESS	((vm_offset_t)KERNEL_SR << ADDR_SR_SHFT)
94 #define	VM_MAX_SAFE_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH -1)
95 #define	VM_MAX_KERNEL_ADDRESS	(VM_MIN_KERNEL_ADDRESS + 3*SEGMENT_LENGTH - 1)
96 #endif
97 
98 /*
99  * Use the direct-mapped BAT registers for UMA small allocs. This
100  * takes pressure off the small amount of available KVA.
101  */
102 #define UMA_MD_SMALL_ALLOC
103 
104 #else /* Book-E */
105 
106 /*
107  * Kernel CCSRBAR location. We make this the reset location.
108  */
109 #define	CCSRBAR_VA		0xfef00000
110 #define	CCSRBAR_SIZE		0x00100000
111 
112 #define	KERNBASE		0xc0000000	/* start of kernel virtual */
113 
114 #define	VM_MIN_KERNEL_ADDRESS	KERNBASE
115 #define	VM_MAX_KERNEL_ADDRESS	0xf8000000
116 
117 #endif /* AIM/E500 */
118 
119 /* XXX max. amount of KVM to be used by buffers. */
120 #ifndef VM_MAX_KERNEL_BUF
121 #define	VM_MAX_KERNEL_BUF	(SEGMENT_LENGTH * 7 / 10)
122 #endif
123 
124 #if !defined(LOCORE)
125 struct pmap_physseg {
126 	struct pv_entry *pvent;
127 	char *attrs;
128 };
129 #endif
130 
131 #define	VM_PHYSSEG_MAX		16	/* 1? */
132 
133 /*
134  * The physical address space is densely populated on 32-bit systems,
135  * but may not be on 64-bit ones.
136  */
137 #ifdef __powerpc64__
138 #define	VM_PHYSSEG_SPARSE
139 #else
140 #define	VM_PHYSSEG_DENSE
141 #endif
142 
143 /*
144  * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool
145  * from which physical pages are allocated and VM_FREEPOOL_DIRECT is
146  * the pool from which physical pages for small UMA objects are
147  * allocated.
148  */
149 #define	VM_NFREEPOOL		3
150 #define	VM_FREEPOOL_CACHE	2
151 #define	VM_FREEPOOL_DEFAULT	0
152 #define	VM_FREEPOOL_DIRECT	1
153 
154 /*
155  * Create one free page list.
156  */
157 #define	VM_NFREELIST		1
158 #define	VM_FREELIST_DEFAULT	0
159 
160 /*
161  * The largest allocation size is 4MB.
162  */
163 #define	VM_NFREEORDER		11
164 
165 /*
166  * Only one memory domain.
167  */
168 #ifndef VM_NDOMAIN
169 #define	VM_NDOMAIN		1
170 #endif
171 
172 /*
173  * Disable superpage reservations.
174  */
175 #ifndef	VM_NRESERVLEVEL
176 #define	VM_NRESERVLEVEL		0
177 #endif
178 
179 #ifndef VM_INITIAL_PAGEIN
180 #define	VM_INITIAL_PAGEIN	16
181 #endif
182 
183 #ifndef SGROWSIZ
184 #define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */
185 #endif
186 
187 #ifndef VM_KMEM_SIZE
188 #define	VM_KMEM_SIZE		(12 * 1024 * 1024)
189 #endif
190 
191 #ifdef __powerpc64__
192 #ifndef VM_KMEM_SIZE_SCALE
193 #define VM_KMEM_SIZE_SCALE      (3)
194 #endif
195 
196 #ifndef VM_KMEM_SIZE_MAX
197 #define VM_KMEM_SIZE_MAX        0x1c0000000  /* 7 GB */
198 #endif
199 #endif
200 
201 #endif /* _MACHINE_VMPARAM_H_ */
202