Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / powerpc / include / oea / vmparam.h
blob6c67fefad4ae96417e7c89e81d9fb43136a93fc9
1 /*-
2 * Copyright (c) 2001 The NetBSD Foundation, Inc.
3 * All rights reserved.
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Matt Thomas <matt@3am-softwre.com> of Allegro Networks, Inc.
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.
17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
30 #ifndef _POWERPC_OEA_VMPARAM_H_
31 #define _POWERPC_OEA_VMPARAM_H_
33 #include <sys/queue.h>
36 * Most of the definitions in this can be overriden by a machine-specific
37 * vmparam.h if required. Otherwise a port can just include this file
38 * get the right thing to happen.
42 * OEA processors have 4K pages. Override the PAGE_* definitions
43 * to be compile-time constants.
45 #define PAGE_SHIFT 12
46 #define PAGE_SIZE (1 << PAGE_SHIFT)
47 #define PAGE_MASK (PAGE_SIZE - 1)
49 #ifndef USRSTACK
50 #define USRSTACK VM_MAXUSER_ADDRESS
51 #endif
53 #ifndef USRSTACK32
54 #define USRSTACK32 ((uint32_t)VM_MAXUSER_ADDRESS)
55 #endif
57 #ifndef MAXTSIZ
58 #define MAXTSIZ (64*1024*1024) /* maximum text size */
59 #endif
61 #ifndef MAXDSIZ
62 #define MAXDSIZ (1024*1024*1024) /* maximum data size */
63 #endif
65 #ifndef MAXSSIZ
66 #define MAXSSIZ (32*1024*1024) /* maximum stack size */
67 #endif
69 #ifndef DFLDSIZ
70 #define DFLDSIZ (256*1024*1024) /* default data size */
71 #endif
73 #ifndef DFLSSIZ
74 #define DFLSSIZ (2*1024*1024) /* default stack size */
75 #endif
78 * Default number of pages in the user raw I/O map.
80 #ifndef USRIOSIZE
81 #define USRIOSIZE 1024
82 #endif
85 * The number of seconds for a process to be blocked before being
86 * considered very swappable.
88 #ifndef MAXSLP
89 #define MAXSLP 20
90 #endif
93 * Segment handling stuff
95 #define SEGMENT_LENGTH ( 0x10000000L)
96 #define SEGMENT_MASK (~0x0fffffffL)
99 * Macros to manipulate VSIDs
101 #if 0
103 * Move the SR# to the top bits to make the lower bits entirely random
104 * so to give better PTE distribution.
106 #define VSID__KEYSHFT (SR_VSID_WIDTH - SR_KEY_LEN)
107 #define VSID_SR_INCREMENT ((1L << VSID__KEYSHFT) - 1)
108 #define VSID__HASHMASK (VSID_SR_INCREMENT - 1)
109 #define VSID_MAKE(sr, hash) \
110 (( \
111 (((sr) << VSID__KEYSHFT) | ((hash) & VSID__HASMASK))
112 << SR_VSID_SHFT) & SR_VSID)
113 #define VSID_TO_SR(vsid) \
114 (((vsid) & SR_VSID) >> (SR_VSID_SHFT + VSID__KEYSHFT))
115 #define VSID_TO_HASH(vsid) \
116 (((vsid) & SR_VSID) >> SR_VSID_SHFT) & VSID__HASHMASK)
117 #else
118 #define VSID__HASHSHFT (SR_KEY_LEN)
119 #define VSID_SR_INCREMENT (1L << 0)
120 #define VSID__KEYMASK ((1L << VSID__HASHSHFT) - 1)
121 #define VSID_MAKE(sr, hash) \
122 (( \
123 (((hash) << VSID__HASHSHFT) | ((sr) & VSID__KEYMASK)) \
124 << SR_VSID_SHFT) & SR_VSID)
125 #define VSID_TO_SR(vsid) \
126 (((vsid) >> SR_VSID_SHFT) & VSID__KEYMASK)
127 #define VSID_TO_HASH(vsid) \
128 (((vsid) & SR_VSID) >> (SR_VSID_SHFT + VSID__HASHSHFT))
129 #endif /*0*/
132 * Fixed segments
134 #ifndef USER_SR
135 #define USER_SR 12
136 #endif
137 #ifndef KERNEL_SR
138 #define KERNEL_SR 13
139 #endif
140 #ifndef KERNEL2_SR
141 #define KERNEL2_SR 14
142 #endif
143 #define KERNEL2_SEGMENT VSID_MAKE(KERNEL2_SR, KERNEL_VSIDBITS)
144 #define KERNEL_VSIDBITS 0xfffff
145 #define PHYSMAP_VSIDBITS 0xffffe
146 #define PHYSMAPN_SEGMENT(s) VSID_MAKE(s, PHYSMAP_VSIDBITS)
147 #define KERNEL_SEGMENT VSID_MAKE(KERNEL_SR, KERNEL_VSIDBITS)
148 #define KERNELN_SEGMENT(s) VSID_MAKE(s, KERNEL_VSIDBITS)
149 /* XXXSL: need something here that will never be mapped */
150 #define EMPTY_SEGMENT VSID_MAKE(0, 0xffffe)
151 #define USER_ADDR ((void *)(USER_SR << ADDR_SR_SHFT))
154 * Some system constants
156 #ifndef NPMAPS
157 #define NPMAPS 32768 /* Number of pmaps in system */
158 #endif
160 #define VM_MIN_ADDRESS ((vaddr_t) 0)
161 #define VM_MAXUSER_ADDRESS ((vaddr_t) ~0xfffL)
162 #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
163 #define VM_MIN_KERNEL_ADDRESS ((vaddr_t) (KERNEL_SR << ADDR_SR_SHFT))
164 #define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH)
167 * The address to which unspecified mapping requests default
168 * Put the stack in it's own segment and start mmaping at the
169 * top of the next lower segment.
171 #ifdef _KERNEL_OPT
172 #include "opt_uvm.h"
173 #endif
174 #define __USE_TOPDOWN_VM
175 #define VM_DEFAULT_ADDRESS(da, sz) \
176 (((VM_MAXUSER_ADDRESS - MAXSSIZ) & SEGMENT_MASK) - round_page(sz))
178 #ifndef VM_PHYSSEG_MAX
179 #define VM_PHYSSEG_MAX 16
180 #endif
181 #define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST
182 #define VM_PHYSSEG_NOADD
184 #ifndef VM_PHYS_SIZE
185 #define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE)
186 #endif
188 #ifndef VM_MAX_KERNEL_BUF
189 #define VM_MAX_KERNEL_BUF (SEGMENT_LENGTH * 3 / 4)
190 #endif
192 #define VM_NFREELIST 16 /* 16 distinct memory segments */
193 #define VM_FREELIST_DEFAULT 0
194 #define VM_FREELIST_FIRST256 1
195 #define VM_FREELIST_FIRST16 2
196 #define VM_FREELIST_MAX 3
198 #ifndef _LOCORE
200 LIST_HEAD(pvo_head, pvo_entry);
202 #define __HAVE_VM_PAGE_MD
204 struct vm_page_md {
205 struct pvo_head mdpg_pvoh;
206 unsigned int mdpg_attrs;
209 #define VM_MDPAGE_INIT(pg) do { \
210 LIST_INIT(&(pg)->mdpage.mdpg_pvoh); \
211 (pg)->mdpage.mdpg_attrs = 0; \
212 } while (/*CONSTCOND*/0)
214 #endif /* _LOCORE */
216 #endif /* _POWERPC_OEA_VMPARAM_H_ */