vmparam.h revision 1.3 1 /*-
2 * Copyright (c) 2001 The NetBSD Foundation, Inc.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Matt Thomas <matt (at) 3am-softwre.com> of Allegro Networks, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the NetBSD
19 * Foundation, Inc. and its contributors.
20 * 4. Neither the name of The NetBSD Foundation nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
25 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
28 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37 #ifndef _POWERPC_OEA_VMPARAM_H_
38 #define _POWERPC_OEA_VMPARAM_H_
39
40 #include <sys/queue.h>
41
42 /*
43 * Most of the definitions in this can be overriden by a machine-specific
44 * vmparam.h if required. Otherwise a port can just include this file
45 * get the right thing to happen.
46 */
47
48 #ifndef USRSTACK
49 #define USRSTACK VM_MAXUSER_ADDRESS
50 #endif
51
52 #ifndef USRSTACK32
53 #define USRSTACK32 ((uint32_t)VM_MAXUSER_ADDRESS)
54 #endif
55
56 #ifndef MAXTSIZ
57 #define MAXTSIZ (64*1024*1024) /* maximum text size */
58 #endif
59
60 #ifndef MAXDSIZ
61 #define MAXDSIZ (1024*1024*1024) /* maximum data size */
62 #endif
63
64 #ifndef MAXSSIZ
65 #define MAXSSIZ (32*1024*1024) /* maximum stack size */
66 #endif
67
68 #ifndef DFLDSIZ
69 #define DFLDSIZ (128*1024*1024) /* default data size */
70 #endif
71
72 #ifndef DFLSSIZ
73 #define DFLSSIZ (2*1024*1024) /* default stack size */
74 #endif
75
76 /*
77 * Default maximum amount of shared memory pages
78 */
79 #ifndef SHMMAXPGS
80 #define SHMMAXPGS 1024
81 #endif
82
83 /*
84 * Default number of pages in the user raw I/O map.
85 */
86 #ifndef USRIOSIZE
87 #define USRIOSIZE 1024
88 #endif
89
90 /*
91 * The number of seconds for a process to be blocked before being
92 * considered very swappable.
93 */
94 #ifndef MAXSLP
95 #define MAXSLP 20
96 #endif
97
98 /*
99 * Segment handling stuff
100 */
101 #define SEGMENT_LENGTH ( 0x10000000L)
102 #define SEGMENT_MASK (~0x0fffffffL)
103
104 /*
105 * Macros to manipulate VSIDs
106 */
107 #if 0
108 /*
109 * Move the SR# to the top 4 bits to make the lower 20 bits entirely random
110 * so to give better PTE distribution.
111 */
112 #define VSID_MAKE(sr, hash) (((sr) << (ADDR_SR_SHFT-4))|((hash) & 0xfffff))
113 #define VSID_TO_SR(vsid) (((vsid) >> (ADDR_SR_SHFT-4)) & 0xF)
114 #define VSID_TO_HASH(vsid) ((vsid) & 0xfffff)
115 #define VSID_SR_INCREMENT 0x00100000
116 #else
117 #define VSID_MAKE(sr, hash) ((sr) | (((hash) & 0xfffff) << 4))
118 #define VSID_TO_SR(vsid) ((vsid) & 0xF)
119 #define VSID_TO_HASH(vsid) (((vsid) >> 4) & 0xfffff)
120 #define VSID_SR_INCREMENT 0x00000001
121 #endif
122
123 /*
124 * Fixed segments
125 */
126 #ifndef USER_SR
127 #define USER_SR 12
128 #endif
129 #ifndef KERNEL_SR
130 #define KERNEL_SR 13
131 #endif
132 #ifndef KERNEL2_SR
133 #define KERNEL2_SR 14
134 #endif
135 #define KERNEL2_SEGMENT VSID_MAKE(KERNEL2_SR, KERNEL_VSIDBITS)
136 #define KERNEL_VSIDBITS 0xfffff
137 #define KERNEL_SEGMENT VSID_MAKE(KERNEL_SR, KERNEL_VSIDBITS)
138 #define EMPTY_SEGMENT VSID_MAKE(0, KERNEL_VSIDBITS)
139 #define USER_ADDR ((void *)(USER_SR << ADDR_SR_SHFT))
140
141 /*
142 * Some system constants
143 */
144 #ifndef NPMAPS
145 #define NPMAPS 32768 /* Number of pmaps in system */
146 #endif
147
148 #define VM_MIN_ADDRESS ((vaddr_t) 0)
149 #define VM_MAXUSER_ADDRESS ((vaddr_t) ~0xfffL)
150 #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
151 #define VM_MIN_KERNEL_ADDRESS ((vaddr_t) (KERNEL_SR << ADDR_SR_SHFT))
152 #define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH)
153
154 #ifndef VM_PHYSSEG_MAX
155 #define VM_PHYSSEG_MAX 16
156 #endif
157 #define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST
158 #define VM_PHYSSEG_NOADD
159
160 #ifndef VM_PHYS_SIZE
161 #define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE)
162 #endif
163
164 #ifndef VM_MAX_KERNEL_BUF
165 #define VM_MAX_KERNEL_BUF (SEGMENT_LENGTH * 3 / 4)
166 #endif
167
168 #define VM_NFREELIST 16 /* 16 distinct memory segments */
169 #define VM_FREELIST_DEFAULT 0
170 #define VM_FREELIST_FIRST256 1
171 #define VM_FREELIST_FIRST16 2
172 #define VM_FREELIST_MAX 3
173
174 #ifndef _LOCORE
175
176 LIST_HEAD(pvo_head, pvo_entry);
177
178 #if __NetBSD_Version__ > 105180000
179 #define __HAVE_VM_PAGE_MD
180
181 struct vm_page_md {
182 struct pvo_head mdpg_pvoh;
183 unsigned int mdpg_attrs;
184 };
185
186 #define VM_MDPAGE_INIT(pg) do { \
187 LIST_INIT(&(pg)->mdpage.mdpg_pvoh); \
188 (pg)->mdpage.mdpg_attrs = 0; \
189 } while (/*CONSTCOND*/0)
190
191 #else
192
193 #define __HAVE_PMAP_PHYSSEG
194
195 struct pmap_physseg {
196 struct pvo_head *pvoh;
197 char *attrs;
198 };
199
200 #endif
201
202 #endif /* _LOCORE */
203
204 #endif /* _POWERPC_OEA_VMPARAM_H_ */
205