xref: /onnv-gate/usr/src/uts/sun4v/sys/machparam.h (revision 12230:12df01648ca5)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51991Sheppo  * Common Development and Distribution License (the "License").
61991Sheppo  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
2212173SMichael.Corcoran@Sun.COM  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate #ifndef _SYS_MACHPARAM_H
260Sstevel@tonic-gate #define	_SYS_MACHPARAM_H
270Sstevel@tonic-gate 
280Sstevel@tonic-gate #ifdef	__cplusplus
290Sstevel@tonic-gate extern "C" {
300Sstevel@tonic-gate #endif
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #ifndef _ASM
330Sstevel@tonic-gate #define	ADDRESS_C(c)    c ## ul
340Sstevel@tonic-gate #else   /* _ASM */
350Sstevel@tonic-gate #define	ADDRESS_C(c)    (c)
360Sstevel@tonic-gate #endif	/* _ASM */
370Sstevel@tonic-gate 
380Sstevel@tonic-gate /*
390Sstevel@tonic-gate  * Machine dependent parameters and limits - sun4v version.
400Sstevel@tonic-gate  */
410Sstevel@tonic-gate 
420Sstevel@tonic-gate /*
430Sstevel@tonic-gate  * Define the VAC symbol (etc.) if we could run on a machine
440Sstevel@tonic-gate  * which has a Virtual Address Cache
450Sstevel@tonic-gate  */
460Sstevel@tonic-gate 
470Sstevel@tonic-gate /*
480Sstevel@tonic-gate  * The maximum possible number of UPA devices in a system.
490Sstevel@tonic-gate  * MAX_UPA maybe defined in a platform's makefile.
500Sstevel@tonic-gate  */
510Sstevel@tonic-gate #ifndef MAX_UPA
520Sstevel@tonic-gate #define	MAX_UPA			32
530Sstevel@tonic-gate #endif
540Sstevel@tonic-gate 
550Sstevel@tonic-gate /*
560Sstevel@tonic-gate  * Maximum cpuid value that we support.  NCPU can be defined in a platform's
570Sstevel@tonic-gate  * makefile.
580Sstevel@tonic-gate  */
590Sstevel@tonic-gate #ifndef NCPU
6011304SJanie.Lu@Sun.COM #define	NCPU	512
6112173SMichael.Corcoran@Sun.COM #define	NCPU_LOG2	9
6212173SMichael.Corcoran@Sun.COM #elif (!defined(NCPU_LOG2))
6312173SMichael.Corcoran@Sun.COM #error "Must define NCPU_LOG2 together with NCPU"
640Sstevel@tonic-gate #endif
650Sstevel@tonic-gate 
66*12230SFrank.Rival@oracle.com /* NCPU_P2 is NCPU rounded to a power of 2 */
67*12230SFrank.Rival@oracle.com #define	NCPU_P2	(1 << NCPU_LOG2)
68*12230SFrank.Rival@oracle.com 
690Sstevel@tonic-gate /*
700Sstevel@tonic-gate  * Maximum number of processors that we support.  With CMP processors, the
710Sstevel@tonic-gate  * portid may not be equal to cpuid.  MAX_CPU_CHIPID can be defined in a
720Sstevel@tonic-gate  * platform's makefile.
730Sstevel@tonic-gate  */
740Sstevel@tonic-gate #ifndef	MAX_CPU_CHIPID
750Sstevel@tonic-gate #define	MAX_CPU_CHIPID	NCPU
760Sstevel@tonic-gate #endif
770Sstevel@tonic-gate 
780Sstevel@tonic-gate /*
790Sstevel@tonic-gate  * Define the FPU symbol if we could run on a machine with an external
800Sstevel@tonic-gate  * FPU (i.e. not integrated with the normal machine state like the vax).
810Sstevel@tonic-gate  *
820Sstevel@tonic-gate  * The fpu is defined in the architecture manual, and the kernel hides
830Sstevel@tonic-gate  * its absence if it is not present, that's pretty integrated, no?
840Sstevel@tonic-gate  */
850Sstevel@tonic-gate 
860Sstevel@tonic-gate /*
870Sstevel@tonic-gate  * MMU_PAGES* describes the physical page size used by the mapping hardware.
880Sstevel@tonic-gate  * PAGES* describes the logical page size used by the system.
890Sstevel@tonic-gate  */
900Sstevel@tonic-gate #define	MMU_PAGE_SIZES		6	/* max sun4v mmu-supported page sizes */
910Sstevel@tonic-gate #define	DEFAULT_MMU_PAGE_SIZES	4	/* default sun4v supported page sizes */
920Sstevel@tonic-gate 
930Sstevel@tonic-gate /*
940Sstevel@tonic-gate  * XXX make sure the MMU_PAGESHIFT definition here is
950Sstevel@tonic-gate  * consistent with the one in param.h
960Sstevel@tonic-gate  */
970Sstevel@tonic-gate #define	MMU_PAGESHIFT		13
980Sstevel@tonic-gate #define	MMU_PAGESIZE		(1<<MMU_PAGESHIFT)
990Sstevel@tonic-gate #define	MMU_PAGEOFFSET		(MMU_PAGESIZE - 1)
1000Sstevel@tonic-gate #define	MMU_PAGEMASK		(~MMU_PAGEOFFSET)
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate #define	MMU_PAGESHIFT64K	16
1030Sstevel@tonic-gate #define	MMU_PAGESIZE64K		(1 << MMU_PAGESHIFT64K)
1040Sstevel@tonic-gate #define	MMU_PAGEOFFSET64K	(MMU_PAGESIZE64K - 1)
1050Sstevel@tonic-gate #define	MMU_PAGEMASK64K		(~MMU_PAGEOFFSET64K)
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate #define	MMU_PAGESHIFT512K	19
1080Sstevel@tonic-gate #define	MMU_PAGESIZE512K	(1 << MMU_PAGESHIFT512K)
1090Sstevel@tonic-gate #define	MMU_PAGEOFFSET512K	(MMU_PAGESIZE512K - 1)
1100Sstevel@tonic-gate #define	MMU_PAGEMASK512K	(~MMU_PAGEOFFSET512K)
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate #define	MMU_PAGESHIFT4M		22
1130Sstevel@tonic-gate #define	MMU_PAGESIZE4M		(1 << MMU_PAGESHIFT4M)
1140Sstevel@tonic-gate #define	MMU_PAGEOFFSET4M	(MMU_PAGESIZE4M - 1)
1150Sstevel@tonic-gate #define	MMU_PAGEMASK4M		(~MMU_PAGEOFFSET4M)
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate #define	MMU_PAGESHIFT32M	25
1180Sstevel@tonic-gate #define	MMU_PAGESIZE32M		(1 << MMU_PAGESHIFT32M)
1190Sstevel@tonic-gate #define	MMU_PAGEOFFSET32M	(MMU_PAGESIZE32M - 1)
1200Sstevel@tonic-gate #define	MMU_PAGEMASK32M		(~MMU_PAGEOFFSET32M)
1210Sstevel@tonic-gate 
1220Sstevel@tonic-gate #define	MMU_PAGESHIFT256M	28
1230Sstevel@tonic-gate #define	MMU_PAGESIZE256M	(1 << MMU_PAGESHIFT256M)
1240Sstevel@tonic-gate #define	MMU_PAGEOFFSET256M	(MMU_PAGESIZE256M - 1)
1250Sstevel@tonic-gate #define	MMU_PAGEMASK256M	(~MMU_PAGEOFFSET256M)
1260Sstevel@tonic-gate 
1270Sstevel@tonic-gate #define	PAGESHIFT	13
1280Sstevel@tonic-gate #define	PAGESIZE	(1<<PAGESHIFT)
1290Sstevel@tonic-gate #define	PAGEOFFSET	(PAGESIZE - 1)
1300Sstevel@tonic-gate #define	PAGEMASK	(~PAGEOFFSET)
1310Sstevel@tonic-gate 
1320Sstevel@tonic-gate /*
1330Sstevel@tonic-gate  * DATA_ALIGN is used to define the alignment of the Unix data segment.
1340Sstevel@tonic-gate  */
1350Sstevel@tonic-gate #define	DATA_ALIGN	ADDRESS_C(0x2000)
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate /*
1380Sstevel@tonic-gate  * DEFAULT KERNEL THREAD stack size.
1390Sstevel@tonic-gate  */
1400Sstevel@tonic-gate 
1410Sstevel@tonic-gate #define	DEFAULTSTKSZ	(3*PAGESIZE)
1420Sstevel@tonic-gate 
1430Sstevel@tonic-gate /*
1440Sstevel@tonic-gate  * DEFAULT initial thread stack size.
1450Sstevel@tonic-gate  */
1460Sstevel@tonic-gate #define	T0STKSZ		(2 * DEFAULTSTKSZ)
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate /*
1490Sstevel@tonic-gate  * KERNELBASE is the virtual address which
1500Sstevel@tonic-gate  * the kernel text/data mapping starts in all contexts.
1510Sstevel@tonic-gate  */
1520Sstevel@tonic-gate #define	KERNELBASE	ADDRESS_C(0x01000000)
1530Sstevel@tonic-gate 
1540Sstevel@tonic-gate /*
1553446Smrj  * Virtual address range available to the debugger
1563446Smrj  */
1573446Smrj #define	SEGDEBUGBASE	ADDRESS_C(0xedd00000)
1583446Smrj #define	SEGDEBUGSIZE	(ADDRESS_C(0xf0000000) - SEGDEBUGBASE)
1593446Smrj 
1603446Smrj /*
1610Sstevel@tonic-gate  * Define the userlimits
1620Sstevel@tonic-gate  */
1630Sstevel@tonic-gate 
1640Sstevel@tonic-gate #define	USERLIMIT	ADDRESS_C(0xFFFFFFFF80000000)
1650Sstevel@tonic-gate #define	USERLIMIT32	ADDRESS_C(0xFFC00000)
1660Sstevel@tonic-gate 
1670Sstevel@tonic-gate /*
1680Sstevel@tonic-gate  * Define SEGKPBASE, start of the segkp segment.
1690Sstevel@tonic-gate  */
1700Sstevel@tonic-gate 
1710Sstevel@tonic-gate #define	SEGKPBASE	ADDRESS_C(0x2a100000000)
1720Sstevel@tonic-gate 
1730Sstevel@tonic-gate /*
1740Sstevel@tonic-gate  * Define SEGMAPBASE, start of the segmap segment.
1750Sstevel@tonic-gate  */
1760Sstevel@tonic-gate 
1770Sstevel@tonic-gate #define	SEGMAPBASE	ADDRESS_C(0x2a750000000)
1780Sstevel@tonic-gate 
1790Sstevel@tonic-gate /*
1800Sstevel@tonic-gate  * SYSBASE is the virtual address which the kernel allocated memory
1810Sstevel@tonic-gate  * mapping starts in all contexts.  SYSLIMIT is the end of the Sysbase segment.
1820Sstevel@tonic-gate  */
1830Sstevel@tonic-gate 
1840Sstevel@tonic-gate #define	SYSBASE		ADDRESS_C(0x30000000000)
1850Sstevel@tonic-gate #define	SYSLIMIT	ADDRESS_C(0x70000000000)
1860Sstevel@tonic-gate #define	SYSBASE32	ADDRESS_C(0x70000000)
1870Sstevel@tonic-gate #define	SYSLIMIT32	ADDRESS_C(0x80000000)
1880Sstevel@tonic-gate 
1890Sstevel@tonic-gate /*
1905648Ssetje  * BOOTTMPBASE is the base of a space that can be reclaimed
1915648Ssetje  * after the kernel takes over the machine.  It contains the
1925648Ssetje  * boot archive and memory allocated by krtld before kmem_alloc
1935648Ssetje  * is brought online.
1945648Ssetje  */
1955648Ssetje #define	BOOTTMPBASE	ADDRESS_C(0x4C000000)
1965648Ssetje 
1975648Ssetje /*
1980Sstevel@tonic-gate  * MEMSCRUBBASE is the base virtual address for the memory scrubber
1990Sstevel@tonic-gate  * to read large pages.  It MUST be 4MB page aligned.
2000Sstevel@tonic-gate  */
2010Sstevel@tonic-gate 
2020Sstevel@tonic-gate #define	MEMSCRUBBASE	0x2a000000000
2030Sstevel@tonic-gate 
2040Sstevel@tonic-gate /*
2050Sstevel@tonic-gate  * Define the kernel address space range allocated to Open Firmware
2060Sstevel@tonic-gate  */
2070Sstevel@tonic-gate #define	OFW_START_ADDR	0xf0000000
2080Sstevel@tonic-gate #define	OFW_END_ADDR	0xffffffff
2090Sstevel@tonic-gate 
2100Sstevel@tonic-gate /*
2110Sstevel@tonic-gate  * ARGSBASE is the base virtual address of the range which
2120Sstevel@tonic-gate  * the kernel uses to map the arguments for exec.
2130Sstevel@tonic-gate  */
2140Sstevel@tonic-gate #define	ARGSBASE	(MEMSCRUBBASE - NCARGS)
2150Sstevel@tonic-gate 
2160Sstevel@tonic-gate /*
2170Sstevel@tonic-gate  * PPMAPBASE is the base virtual address of the range which
2180Sstevel@tonic-gate  * the kernel uses to quickly map pages for operations such
2190Sstevel@tonic-gate  * as ppcopy, pagecopy, pagezero, and pagesum.
2200Sstevel@tonic-gate  */
2210Sstevel@tonic-gate #define	PPMAPSIZE	(512 * 1024)
2220Sstevel@tonic-gate #define	PPMAPBASE	(ARGSBASE - PPMAPSIZE)
2230Sstevel@tonic-gate 
2240Sstevel@tonic-gate #define	MAXPP_SLOTS	ADDRESS_C(16)
2250Sstevel@tonic-gate #define	PPMAP_FAST_SIZE	(MAXPP_SLOTS * PAGESIZE * NCPU)
2260Sstevel@tonic-gate #define	PPMAP_FAST_BASE	(PPMAPBASE - PPMAP_FAST_SIZE)
2270Sstevel@tonic-gate 
2280Sstevel@tonic-gate /*
2290Sstevel@tonic-gate  * PIOMAPBASE is the base virtual address at which programmable I/O registers
2300Sstevel@tonic-gate  * are mapped.  This allows such memory -- which may induce side effects when
2310Sstevel@tonic-gate  * read -- to be cordoned off from the system at-large.
2320Sstevel@tonic-gate  */
2330Sstevel@tonic-gate #define	PIOMAPSIZE	(1024 * 1024 * 1024 * (uintptr_t)5)
2340Sstevel@tonic-gate #define	PIOMAPBASE	(PPMAP_FAST_BASE - PIOMAPSIZE)
2350Sstevel@tonic-gate 
2360Sstevel@tonic-gate /*
2370Sstevel@tonic-gate  * Allocate space for kernel modules on nucleus pages
2380Sstevel@tonic-gate  */
2395648Ssetje #define	MODDATA	1024 * 512
2400Sstevel@tonic-gate 
2410Sstevel@tonic-gate /*
2420Sstevel@tonic-gate  * The heap has a region allocated from it specifically for module text that
2430Sstevel@tonic-gate  * cannot fit on the nucleus page.  This region -- which starts at address
2440Sstevel@tonic-gate  * HEAPTEXT_BASE and runs for HEAPTEXT_SIZE bytes -- has virtual holes
2450Sstevel@tonic-gate  * punched in it: for every HEAPTEXT_MAPPED bytes of available virtual, there
2460Sstevel@tonic-gate  * is a virtual hole of size HEAPTEXT_UNMAPPED bytes sitting beneath it.  This
2470Sstevel@tonic-gate  * assures that any text address is within HEAPTEXT_MAPPED of an unmapped
2480Sstevel@tonic-gate  * region.  The unmapped regions themselves are managed with the routines
2490Sstevel@tonic-gate  * kobj_texthole_alloc() and kobj_texthole_free().
2500Sstevel@tonic-gate  */
2510Sstevel@tonic-gate #define	HEAPTEXT_SIZE		(128 * 1024 * 1024)	/* bytes */
2520Sstevel@tonic-gate #define	HEAPTEXT_OVERSIZE	(64 * 1024 * 1024)	/* bytes */
2530Sstevel@tonic-gate #define	HEAPTEXT_BASE		(SYSLIMIT32 - HEAPTEXT_SIZE)
2540Sstevel@tonic-gate #define	HEAPTEXT_MAPPED		(2 * 1024 * 1024)
2550Sstevel@tonic-gate #define	HEAPTEXT_UNMAPPED	(2 * 1024 * 1024)
2560Sstevel@tonic-gate 
2570Sstevel@tonic-gate #define	HEAPTEXT_NARENAS	\
2580Sstevel@tonic-gate 	(HEAPTEXT_SIZE / (HEAPTEXT_MAPPED + HEAPTEXT_UNMAPPED) + 2)
2590Sstevel@tonic-gate 
2600Sstevel@tonic-gate /*
2615358Sjc25722  * Establish the space for the MPO support to store its data
2625358Sjc25722  * structures at startup
2635358Sjc25722  */
2645358Sjc25722 
2655358Sjc25722 #define	MPOBUF_SIZE	(2 * 1024 * 1024)
2665358Sjc25722 #define	MPOBUF_BASE	(HEAPTEXT_BASE - MPOBUF_SIZE)
2675358Sjc25722 
2685358Sjc25722 /*
2690Sstevel@tonic-gate  * Preallocate an area for setting up the user stack during
2700Sstevel@tonic-gate  * the exec(). This way we have a faster allocator and also
2710Sstevel@tonic-gate  * make sure the stack is always VAC aligned correctly. see
2720Sstevel@tonic-gate  * get_arg_base() in startup.c.
2730Sstevel@tonic-gate  */
2740Sstevel@tonic-gate #define	ARG_SLOT_SIZE	(0x8000)
2750Sstevel@tonic-gate #define	ARG_SLOT_SHIFT	(15)
2760Sstevel@tonic-gate #define	N_ARG_SLOT	(0x80)
2770Sstevel@tonic-gate 
2780Sstevel@tonic-gate #define	NARG_BASE	(PIOMAPBASE - (ARG_SLOT_SIZE * N_ARG_SLOT))
2790Sstevel@tonic-gate 
2800Sstevel@tonic-gate /*
2810Sstevel@tonic-gate  * ktextseg+kvalloc should not use space beyond KERNEL_LIMIT32.
2820Sstevel@tonic-gate  */
2830Sstevel@tonic-gate 
2840Sstevel@tonic-gate /*
2850Sstevel@tonic-gate  * For 64-bit kernels, rename KERNEL_LIMIT to KERNEL_LIMIT32 to more accurately
2860Sstevel@tonic-gate  * reflect the fact that it's actually the limit for 32-bit kernel virtual
2870Sstevel@tonic-gate  * addresses.
2880Sstevel@tonic-gate  */
2895648Ssetje #define	KERNEL_LIMIT32	BOOTTMPBASE
2900Sstevel@tonic-gate 
2910Sstevel@tonic-gate /*
2920Sstevel@tonic-gate  * Defines used for the ptl1_panic parameter, which is passed to the
2930Sstevel@tonic-gate  * ptl1_panic assembly routine in %g1.  These #defines have string
2940Sstevel@tonic-gate  * names defined in sun4u/os/mach_cpu_states.c which should be kept up to
2950Sstevel@tonic-gate  * date if new #defines are added.
2960Sstevel@tonic-gate  */
2971991Sheppo #define	PTL1_BAD_DEBUG				0
2981991Sheppo #define	PTL1_BAD_WTRAP				1
2991991Sheppo #define	PTL1_BAD_KMISS				2
3001991Sheppo #define	PTL1_BAD_KPROT_FAULT			3
3011991Sheppo #define	PTL1_BAD_ISM				4
3021991Sheppo #define	PTL1_BAD_MMUTRAP			5
3031991Sheppo #define	PTL1_BAD_TRAP				6
3041991Sheppo #define	PTL1_BAD_FPTRAP				7
3052973Sgovinda #define	PTL1_BAD_INTR_VEC			8
3061991Sheppo #define	PTL1_BAD_TRACE_PTR			9
3071991Sheppo #define	PTL1_BAD_STACK				10
3081991Sheppo #define	PTL1_BAD_DTRACE_FLAGS			11
3091991Sheppo #define	PTL1_BAD_CTX_STEAL			12
3101991Sheppo #define	PTL1_BAD_ECC				13
3111991Sheppo #define	PTL1_BAD_HCALL				14
3121991Sheppo #define	PTL1_BAD_GL				15
3131991Sheppo #define	PTL1_BAD_WATCHDOG			16
3141991Sheppo #define	PTL1_BAD_RED				17
3151991Sheppo #define	PTL1_BAD_HCALL_UNMAP_PERM_EINVAL	18
3161991Sheppo #define	PTL1_BAD_HCALL_UNMAP_PERM_ENOMAP	19
3172241Shuah #define	PTL1_BAD_RAISE_TSBEXCP			20
3184528Spaulsan #define	PTL1_NO_SCDTSB8K			21
3190Sstevel@tonic-gate 
3200Sstevel@tonic-gate /*
3211457Swh94709  * Defines the max trap level allowed
3221457Swh94709  */
3231457Swh94709 #define	MAXPTL			2
3241457Swh94709 
3251457Swh94709 /*
3260Sstevel@tonic-gate  * Defines used for ptl1 related data structs.
3270Sstevel@tonic-gate  */
3281457Swh94709 #define	PTL1_MAXTL		MAXPTL
329357Ssvemuri #define	PTL1_MAXGL		2
3300Sstevel@tonic-gate #define	PTL1_DEBUG_TRAP		0x7C
3310Sstevel@tonic-gate #define	PTL1_SSIZE		1024	/* minimum stack size */
3320Sstevel@tonic-gate #define	CPU_ALLOC_SIZE		MMU_PAGESIZE
3330Sstevel@tonic-gate 
3340Sstevel@tonic-gate #ifdef	__cplusplus
3350Sstevel@tonic-gate }
3360Sstevel@tonic-gate #endif
3370Sstevel@tonic-gate 
3380Sstevel@tonic-gate #endif	/* _SYS_MACHPARAM_H */
339