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