1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_MACHPARAM_H 28 #define _SYS_MACHPARAM_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #ifndef _ASM 37 #define ADDRESS_C(c) c ## ul 38 #else /* _ASM */ 39 #define ADDRESS_C(c) (c) 40 #endif /* _ASM */ 41 42 /* 43 * Machine dependent parameters and limits - sun4v version. 44 */ 45 46 /* 47 * Define the VAC symbol (etc.) if we could run on a machine 48 * which has a Virtual Address Cache 49 */ 50 51 /* 52 * The maximum possible number of UPA devices in a system. 53 * MAX_UPA maybe defined in a platform's makefile. 54 */ 55 #ifndef MAX_UPA 56 #define MAX_UPA 32 57 #endif 58 59 /* 60 * Maximum cpuid value that we support. NCPU can be defined in a platform's 61 * makefile. 62 */ 63 #ifndef NCPU 64 #define NCPU 64 65 #endif 66 67 /* 68 * Maximum number of processors that we support. With CMP processors, the 69 * portid may not be equal to cpuid. MAX_CPU_CHIPID can be defined in a 70 * platform's makefile. 71 */ 72 #ifndef MAX_CPU_CHIPID 73 #define MAX_CPU_CHIPID NCPU 74 #endif 75 76 /* 77 * Define the FPU symbol if we could run on a machine with an external 78 * FPU (i.e. not integrated with the normal machine state like the vax). 79 * 80 * The fpu is defined in the architecture manual, and the kernel hides 81 * its absence if it is not present, that's pretty integrated, no? 82 */ 83 84 /* 85 * MMU_PAGES* describes the physical page size used by the mapping hardware. 86 * PAGES* describes the logical page size used by the system. 87 */ 88 #define MMU_PAGE_SIZES 6 /* max sun4v mmu-supported page sizes */ 89 #define DEFAULT_MMU_PAGE_SIZES 4 /* default sun4v supported page sizes */ 90 91 /* 92 * XXX make sure the MMU_PAGESHIFT definition here is 93 * consistent with the one in param.h 94 */ 95 #define MMU_PAGESHIFT 13 96 #define MMU_PAGESIZE (1<<MMU_PAGESHIFT) 97 #define MMU_PAGEOFFSET (MMU_PAGESIZE - 1) 98 #define MMU_PAGEMASK (~MMU_PAGEOFFSET) 99 100 #define MMU_PAGESHIFT64K 16 101 #define MMU_PAGESIZE64K (1 << MMU_PAGESHIFT64K) 102 #define MMU_PAGEOFFSET64K (MMU_PAGESIZE64K - 1) 103 #define MMU_PAGEMASK64K (~MMU_PAGEOFFSET64K) 104 105 #define MMU_PAGESHIFT512K 19 106 #define MMU_PAGESIZE512K (1 << MMU_PAGESHIFT512K) 107 #define MMU_PAGEOFFSET512K (MMU_PAGESIZE512K - 1) 108 #define MMU_PAGEMASK512K (~MMU_PAGEOFFSET512K) 109 110 #define MMU_PAGESHIFT4M 22 111 #define MMU_PAGESIZE4M (1 << MMU_PAGESHIFT4M) 112 #define MMU_PAGEOFFSET4M (MMU_PAGESIZE4M - 1) 113 #define MMU_PAGEMASK4M (~MMU_PAGEOFFSET4M) 114 115 #define MMU_PAGESHIFT32M 25 116 #define MMU_PAGESIZE32M (1 << MMU_PAGESHIFT32M) 117 #define MMU_PAGEOFFSET32M (MMU_PAGESIZE32M - 1) 118 #define MMU_PAGEMASK32M (~MMU_PAGEOFFSET32M) 119 120 #define MMU_PAGESHIFT256M 28 121 #define MMU_PAGESIZE256M (1 << MMU_PAGESHIFT256M) 122 #define MMU_PAGEOFFSET256M (MMU_PAGESIZE256M - 1) 123 #define MMU_PAGEMASK256M (~MMU_PAGEOFFSET256M) 124 125 #define PAGESHIFT 13 126 #define PAGESIZE (1<<PAGESHIFT) 127 #define PAGEOFFSET (PAGESIZE - 1) 128 #define PAGEMASK (~PAGEOFFSET) 129 130 /* 131 * DATA_ALIGN is used to define the alignment of the Unix data segment. 132 */ 133 #define DATA_ALIGN ADDRESS_C(0x2000) 134 135 /* 136 * DEFAULT KERNEL THREAD stack size. 137 */ 138 139 #define DEFAULTSTKSZ (3*PAGESIZE) 140 141 /* 142 * DEFAULT initial thread stack size. 143 */ 144 #define T0STKSZ (2 * DEFAULTSTKSZ) 145 146 /* 147 * KERNELBASE is the virtual address which 148 * the kernel text/data mapping starts in all contexts. 149 */ 150 #define KERNELBASE ADDRESS_C(0x01000000) 151 152 /* 153 * Define the userlimits 154 */ 155 156 #define USERLIMIT ADDRESS_C(0xFFFFFFFF80000000) 157 #define USERLIMIT32 ADDRESS_C(0xFFC00000) 158 159 /* 160 * Define SEGKPBASE, start of the segkp segment. 161 */ 162 163 #define SEGKPBASE ADDRESS_C(0x2a100000000) 164 165 /* 166 * Define SEGMAPBASE, start of the segmap segment. 167 */ 168 169 #define SEGMAPBASE ADDRESS_C(0x2a750000000) 170 171 /* 172 * SYSBASE is the virtual address which the kernel allocated memory 173 * mapping starts in all contexts. SYSLIMIT is the end of the Sysbase segment. 174 */ 175 176 #define SYSBASE ADDRESS_C(0x30000000000) 177 #define SYSLIMIT ADDRESS_C(0x70000000000) 178 #define SYSBASE32 ADDRESS_C(0x70000000) 179 #define SYSLIMIT32 ADDRESS_C(0x80000000) 180 181 /* 182 * MEMSCRUBBASE is the base virtual address for the memory scrubber 183 * to read large pages. It MUST be 4MB page aligned. 184 */ 185 186 #define MEMSCRUBBASE 0x2a000000000 187 188 /* 189 * Define the kernel address space range allocated to Open Firmware 190 */ 191 #define OFW_START_ADDR 0xf0000000 192 #define OFW_END_ADDR 0xffffffff 193 194 /* 195 * ARGSBASE is the base virtual address of the range which 196 * the kernel uses to map the arguments for exec. 197 */ 198 #define ARGSBASE (MEMSCRUBBASE - NCARGS) 199 200 /* 201 * PPMAPBASE is the base virtual address of the range which 202 * the kernel uses to quickly map pages for operations such 203 * as ppcopy, pagecopy, pagezero, and pagesum. 204 */ 205 #define PPMAPSIZE (512 * 1024) 206 #define PPMAPBASE (ARGSBASE - PPMAPSIZE) 207 208 #define MAXPP_SLOTS ADDRESS_C(16) 209 #define PPMAP_FAST_SIZE (MAXPP_SLOTS * PAGESIZE * NCPU) 210 #define PPMAP_FAST_BASE (PPMAPBASE - PPMAP_FAST_SIZE) 211 212 /* 213 * PIOMAPBASE is the base virtual address at which programmable I/O registers 214 * are mapped. This allows such memory -- which may induce side effects when 215 * read -- to be cordoned off from the system at-large. 216 */ 217 #define PIOMAPSIZE (1024 * 1024 * 1024 * (uintptr_t)5) 218 #define PIOMAPBASE (PPMAP_FAST_BASE - PIOMAPSIZE) 219 220 /* 221 * Allocate space for kernel modules on nucleus pages 222 */ 223 #define MODDATA 1024 * 256 224 225 /* 226 * On systems with <MODTEXT_SM_SIZE MB available physical memory, 227 * cap the in-nucleus module text to MODTEXT_SM_CAP bytes. The 228 * cap must be a multiple of the base page size. Also see startup.c. 229 */ 230 #define MODTEXT_SM_CAP (0x200000) /* bytes */ 231 #define MODTEXT_SM_SIZE (256) /* MB */ 232 233 /* 234 * The heap has a region allocated from it specifically for module text that 235 * cannot fit on the nucleus page. This region -- which starts at address 236 * HEAPTEXT_BASE and runs for HEAPTEXT_SIZE bytes -- has virtual holes 237 * punched in it: for every HEAPTEXT_MAPPED bytes of available virtual, there 238 * is a virtual hole of size HEAPTEXT_UNMAPPED bytes sitting beneath it. This 239 * assures that any text address is within HEAPTEXT_MAPPED of an unmapped 240 * region. The unmapped regions themselves are managed with the routines 241 * kobj_texthole_alloc() and kobj_texthole_free(). 242 */ 243 #define HEAPTEXT_SIZE (128 * 1024 * 1024) /* bytes */ 244 #define HEAPTEXT_OVERSIZE (64 * 1024 * 1024) /* bytes */ 245 #define HEAPTEXT_BASE (SYSLIMIT32 - HEAPTEXT_SIZE) 246 #define HEAPTEXT_MAPPED (2 * 1024 * 1024) 247 #define HEAPTEXT_UNMAPPED (2 * 1024 * 1024) 248 249 #define HEAPTEXT_NARENAS \ 250 (HEAPTEXT_SIZE / (HEAPTEXT_MAPPED + HEAPTEXT_UNMAPPED) + 2) 251 252 /* 253 * Preallocate an area for setting up the user stack during 254 * the exec(). This way we have a faster allocator and also 255 * make sure the stack is always VAC aligned correctly. see 256 * get_arg_base() in startup.c. 257 */ 258 #define ARG_SLOT_SIZE (0x8000) 259 #define ARG_SLOT_SHIFT (15) 260 #define N_ARG_SLOT (0x80) 261 262 #define NARG_BASE (PIOMAPBASE - (ARG_SLOT_SIZE * N_ARG_SLOT)) 263 264 /* 265 * ktextseg+kvalloc should not use space beyond KERNEL_LIMIT32. 266 */ 267 268 /* 269 * For 64-bit kernels, rename KERNEL_LIMIT to KERNEL_LIMIT32 to more accurately 270 * reflect the fact that it's actually the limit for 32-bit kernel virtual 271 * addresses. 272 */ 273 #define KERNEL_LIMIT32 (SYSBASE32) 274 275 #define BUSTYPE_TO_PFN(btype, pfn) \ 276 (((btype) << 19) | ((pfn) & 0x7FFFF)) 277 278 /* 279 * Defines used for the ptl1_panic parameter, which is passed to the 280 * ptl1_panic assembly routine in %g1. These #defines have string 281 * names defined in sun4u/os/mach_cpu_states.c which should be kept up to 282 * date if new #defines are added. 283 */ 284 #define PTL1_BAD_DEBUG 0 285 #define PTL1_BAD_WTRAP 1 286 #define PTL1_BAD_KMISS 2 287 #define PTL1_BAD_KPROT_FAULT 3 288 #define PTL1_BAD_ISM 4 289 #define PTL1_BAD_MMUTRAP 5 290 #define PTL1_BAD_TRAP 6 291 #define PTL1_BAD_FPTRAP 7 292 #define PTL1_BAD_INTR_REQ 8 293 #define PTL1_BAD_TRACE_PTR 9 294 #define PTL1_BAD_STACK 10 295 #define PTL1_BAD_DTRACE_FLAGS 11 296 #define PTL1_BAD_CTX_STEAL 12 297 #define PTL1_BAD_ECC 13 298 #define PTL1_BAD_HCALL 14 299 #define PTL1_BAD_GL 15 300 301 /* 302 * Defines the max trap level allowed 303 */ 304 #define MAXPTL 2 305 306 /* 307 * Defines used for ptl1 related data structs. 308 */ 309 #define PTL1_MAXTL MAXPTL 310 #define PTL1_MAXGL 2 311 #define PTL1_DEBUG_TRAP 0x7C 312 #define PTL1_SSIZE 1024 /* minimum stack size */ 313 #define CPU_ALLOC_SIZE MMU_PAGESIZE 314 315 #ifdef __cplusplus 316 } 317 #endif 318 319 #endif /* _SYS_MACHPARAM_H */ 320