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 * 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. 28 */ 29 30 #ifndef _POWERPC_OEA_VMPARAM_H_ 31 #define _POWERPC_OEA_VMPARAM_H_ 32 33 #include <sys/queue.h> 34 35 /* 36 * Most of the definitions in this can be overridden by a machine-specific 37 * vmparam.h if required. Otherwise a port can just include this file 38 * get the right thing to happen. 39 */ 40 41 /* 42 * OEA processors have 4K pages. Override the PAGE_* definitions 43 * to be compile-time constants. 44 */ 45 #define PAGE_SHIFT 12 46 #define PAGE_SIZE (1 << PAGE_SHIFT) 47 #define PAGE_MASK (PAGE_SIZE - 1) 48 49 #ifndef USRSTACK 50 #define USRSTACK VM_MAXUSER_ADDRESS 51 #endif 52 53 #ifndef USRSTACK32 54 #define USRSTACK32 VM_MAXUSER_ADDRESS32 55 #endif 56 57 #ifndef MAXTSIZ 58 #define MAXTSIZ (256*1024*1024) /* maximum text size */ 59 #endif 60 61 #ifndef MAXDSIZ 62 #define MAXDSIZ (1024*1024*1024) /* maximum data size */ 63 #endif 64 65 #ifndef MAXDSIZ32 66 #define MAXDSIZ32 (1024*1024*1024) /* maximum data size */ 67 #endif 68 69 #ifndef MAXSSIZ 70 #define MAXSSIZ (32*1024*1024) /* maximum stack size */ 71 #endif 72 73 #ifndef MAXSSIZ32 74 #define MAXSSIZ32 (32*1024*1024) /* maximum stack size */ 75 #endif 76 77 #ifndef DFLDSIZ 78 #define DFLDSIZ (256*1024*1024) /* default data size */ 79 #endif 80 81 #ifndef DFLDSIZ32 82 #define DFLSSIZ32 (256*1024*1024) 83 #endif 84 85 #ifndef DFLSSIZ 86 #define DFLSSIZ (2*1024*1024) /* default stack size */ 87 #endif 88 89 #ifndef DFLSSIZ32 90 #define DFLSSIZ32 (2*1024*1024) /* default stack size */ 91 #endif 92 93 /* 94 * Default number of pages in the user raw I/O map. 95 */ 96 #ifndef USRIOSIZE 97 #define USRIOSIZE 1024 98 #endif 99 100 /* 101 * The number of seconds for a process to be blocked before being 102 * considered very swappable. 103 */ 104 #ifndef MAXSLP 105 #define MAXSLP 20 106 #endif 107 108 /* 109 * Segment handling stuff 110 */ 111 #define SEGMENT_LENGTH ( 0x10000000L) 112 #define SEGMENT_MASK (~0x0fffffffL) 113 #define NSEGREG 16 /* number of PowerPC segment registers */ 114 115 /* 116 * Macros to manipulate VSIDs 117 */ 118 #if 0 119 /* 120 * Move the SR# to the top bits to make the lower bits entirely random 121 * so to give better PTE distribution. 122 */ 123 #define VSID__KEYSHFT (SR_VSID_WIDTH - SR_KEY_LEN) 124 #define VSID_SR_INCREMENT ((1L << VSID__KEYSHFT) - 1) 125 #define VSID__HASHMASK (VSID_SR_INCREMENT - 1) 126 #define VSID_MAKE(sr, hash) \ 127 (( \ 128 (((sr) << VSID__KEYSHFT) | ((hash) & VSID__HASMASK)) 129 << SR_VSID_SHFT) & SR_VSID) 130 #define VSID_TO_SR(vsid) \ 131 (((vsid) & SR_VSID) >> (SR_VSID_SHFT + VSID__KEYSHFT)) 132 #define VSID_TO_HASH(vsid) \ 133 (((vsid) & SR_VSID) >> SR_VSID_SHFT) & VSID__HASHMASK) 134 #else 135 #define VSID__HASHSHFT (SR_KEY_LEN) 136 #define VSID_SR_INCREMENT (1L << 0) 137 #define VSID__KEYMASK ((1L << VSID__HASHSHFT) - 1) 138 #define VSID_MAKE(sr, hash) \ 139 (( \ 140 (((hash) << VSID__HASHSHFT) | ((sr) & VSID__KEYMASK)) \ 141 << SR_VSID_SHFT) & SR_VSID) 142 #define VSID_TO_SR(vsid) \ 143 (((vsid) >> SR_VSID_SHFT) & VSID__KEYMASK) 144 #define VSID_TO_HASH(vsid) \ 145 (((vsid) & SR_VSID) >> (SR_VSID_SHFT + VSID__HASHSHFT)) 146 #endif /*0*/ 147 148 #ifndef _LP64 149 /* 150 * Fixed segments 151 */ 152 #ifndef USER_SR 153 #define USER_SR 12 154 #endif 155 #ifndef KERNEL_SR 156 #define KERNEL_SR 13 157 #endif 158 #ifndef KERNEL2_SR 159 #define KERNEL2_SR 14 160 #endif 161 #define KERNEL2_SEGMENT VSID_MAKE(KERNEL2_SR, KERNEL_VSIDBITS) 162 #endif 163 #define KERNEL_VSIDBITS 0xfffff 164 #define PHYSMAP_VSIDBITS 0xffffe 165 #define PHYSMAPN_SEGMENT(s) VSID_MAKE(s, PHYSMAP_VSIDBITS) 166 #define KERNEL_SEGMENT VSID_MAKE(KERNEL_SR, KERNEL_VSIDBITS) 167 #define KERNELN_SEGMENT(s) VSID_MAKE(s, KERNEL_VSIDBITS) 168 /* XXXSL: need something here that will never be mapped */ 169 #define EMPTY_SEGMENT VSID_MAKE(0, 0xffffe) 170 #define USER_ADDR ((void *)(USER_SR << ADDR_SR_SHFT)) 171 172 /* 173 * Some system constants 174 */ 175 #ifndef NPMAPS 176 #define NPMAPS 32768 /* Number of pmaps in system */ 177 #endif 178 179 #define VM_MIN_ADDRESS ((vaddr_t) 0) 180 #define VM_MAXUSER_ADDRESS32 ((vaddr_t) (uint32_t) ~0xfffL) 181 #ifdef _LP64 182 #define VM_MAXUSER_ADDRESS ((vaddr_t) 1UL << 48) /* 256TB */ 183 #else 184 #define VM_MAXUSER_ADDRESS VM_MAXUSER_ADDRESS32 185 #endif 186 #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS 187 #ifdef _LP64 188 #define VM_MIN_KERNEL_ADDRESS ((vaddr_t) 0xffffffUL << 40) /* top 1TB */ 189 #define VM_MAX_KERNEL_ADDRESS ((vaddr_t) -32768) 190 #else 191 #define VM_MIN_KERNEL_ADDRESS ((vaddr_t) (KERNEL_SR << ADDR_SR_SHFT)) 192 #define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH) 193 #endif 194 195 #define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST 196 197 #ifndef VM_PHYS_SIZE 198 #define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE) 199 #endif 200 201 #endif /* _POWERPC_OEA_VMPARAM_H_ */ 202