| Current File : //usr/share/src/uts/i86pc/sys/machparam.h |
/*
* Copyright (c) 1992, 2015, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
#ifndef _SYS_MACHPARAM_H
#define _SYS_MACHPARAM_H
#if !defined(_ASM)
#include <sys/types.h>
#if defined(__xpv)
#include <sys/xpv_impl.h>
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASM
#define ADDRESS_C(c) c ## ul
#else /* _ASM */
#define ADDRESS_C(c) (c)
#endif /* _ASM */
/*
* Machine dependent parameters and limits.
*/
#define NCPU 1024
#define NCPU_LOG2 LOG2UP_CONST(NCPU)
/* NCPU_P2 is NCPU rounded to a power of 2 */
#define NCPU_P2 (1 << NCPU_LOG2)
/*
* The value defined below could grow to 16. hat structure and
* page_t have room for 16 nodes.
*/
#define MAXNODES 4
#define NUMA_NODEMASK 0x0f
/*
* Define the FPU symbol if we could run on a machine with an external
* FPU (i.e. not integrated with the normal machine state like the vax).
*
* The fpu is defined in the architecture manual, and the kernel hides
* its absence if it is not present, that's pretty integrated, no?
*/
/* supported page sizes */
#define MMU_PAGE_SIZES 3
/*
* MMU_PAGES* describes the physical page size used by the mapping hardware.
* PAGES* describes the logical page size used by the system.
*/
#define MMU_PAGESHIFT 12
#define MMU_PAGESIZE (1<<MMU_PAGESHIFT)
#define MMU_PAGEOFFSET (MMU_PAGESIZE - 1)
#define MMU_PAGEMASK (~MMU_PAGEOFFSET)
#if !defined(_ASM)
#define MMU_PAGESHIFT2M 21
#define MMU_PAGESIZE2M (1<<MMU_PAGESHIFT2M)
#define MMU_PAGEOFFSET2M (MMU_PAGESIZE2M - 1)
#define MMU_PAGEMASK2M (~MMU_PAGEOFFSET2M)
#define MMU_PAGESHIFT1G 30
#define MMU_PAGESIZE1G (1<<MMU_PAGESHIFT1G)
#define MMU_PAGEOFFSET1G (MMU_PAGESIZE1G - 1)
#define MMU_PAGEMASK1G (~MMU_PAGEOFFSET1G)
#endif
#define PAGESIZE MMU_PAGESIZE
#define PAGESHIFT MMU_PAGESHIFT
#define PAGEOFFSET MMU_PAGEOFFSET
#define PAGEMASK MMU_PAGEMASK
/*
* DATA_ALIGN is used to define the alignment of the Unix data segment.
*/
#define DATA_ALIGN PAGESIZE
/*
* DEFAULT KERNEL THREAD stack size (in pages).
*/
#define DEFAULTSTKSZ_NPGS 5
#if !defined(_ASM)
#define DEFAULTSTKSZ (DEFAULTSTKSZ_NPGS * PAGESIZE)
#else /* !_ASM */
#define DEFAULTSTKSZ _MUL(DEFAULTSTKSZ_NPGS, PAGESIZE) /* as(1) lameness */
#endif /* !_ASM */
/*
* KERNELBASE is the virtual address at which the kernel segments start in
* all contexts.
*
* common/conf/param.c requires a compile time defined value for KERNELBASE.
* This value is stored in the variable _kernelbase. _kernelbase is now fixed
* and may not be modified to different values as was supported in the past
* before Solaris 11 update 1.
*
* Most code should include <sys/param.h>, which #defines KERNELBASE to be
* a reference to the global variable _kernelbase.
*/
#define KERNELBASE ADDRESS_C(0xffff810000000000)
/*
* Base of 'core' heap area, which is used for kernel and module text/data
* that must be within a 2GB range to allow for rip-relative addressing.
*/
#define COREHEAP_BASE ADDRESS_C(0xffffffffc0000000)
/*
* PIOMAPBASE is the base virtual address at which programmable I/O registers
* are mapped. This allows such memory -- which may induce side effects when
* read -- to be cordoned off from the system at-large.
*/
#define PIOMAPSIZE (4L * 1024L * 1024L * 1024L)
#define PIOMAPBASE (COREHEAP_BASE - PIOMAPSIZE)
/*
* The virtual address space to be used by the seg_map segment
* driver for fast kernel mappings.
*
* Was always 64M but now rounding up to 1G to be MMU_PAGESIZE1G
* friendly.
*/
#define SEGMAPSIZE (1L * 1024L * 1024L * 1024L) /* 1G */
#define SEGMAPBASE (PIOMAPBASE - SEGMAPSIZE)
/*
* Define SEGKPBASE, start of the segkp segment along with
* default and boundary sizes for segkp
*/
#define SEGKPDEFSIZE (2L * 1024L * 1024L * 1024L) /* 2G */
#define SEGKP_MEMSCALE (256L << 30) /* scale per 256G of memory */
#define SEGKP_CPUSCALE 128 /* ncpu threshold for scaling */
#define SEGKPMAXSIZE (8L * 1024L * 1024L * 1024L) /* 8G */
#define SEGKPMINSIZE (200L * 1024 * 1024L) /* 200M */
#define SEGKPBASE (SEGMAPBASE - SEGKPMAXSIZE)
/*
* Defdump Boot VA range. Area for mapping defdump metadata.
*
* Contains enough VA space to map the metadata for the largest dump possible
* from a 32TB system. See the "Memory requirements calculations" comment in
* defdump_panic.c for details.
*/
#define DEFDUMPBOOTSIZE (100L * 1024L * 1024L * 1024L) /* 100G */
/* reserve 1T space for UEFI runtime services memory mapping */
#define DEFDUMPBOOTBASE (SEGKPBASE - (1L << 40) - DEFDUMPBOOTSIZE)
/*
* Beginning of the segkpm window which is at KERNELBASE. Enough to
* support 32T of physical address. See i86pc/os/startup.c
*/
#define SEGKPM_BASE KERNELBASE
/*
* Define KHEAPBASE. 64T starting at SEGKPM_BASE.
*/
#define KHEAPBASE ADDRESS_C(0xffffa10000000000)
/*
* VA region for mapping page_t's linearly. (reserved for future use)
* Would map 2^33 page_t's or 32T of physical memory.
*/
#define PPVM_BASE ADDRESS_C(0xffffe10000000000)
#define PPVM_SIZE (1L * 1024L * 1024L * 1024L * 1024L) /* 1T */
/*
* The current home of the page_t's, memsegs, memlists, bios reserved
* memlists, page hash, and pse mutexes.
*/
#define VALLOC_BASE ADDRESS_C(0xffffe33000000000)
/*
* VMWare works best if we don't use the top 64Meg of memory for amd64.
* Set KERNEL_TEXT to top_o_memory - 64Meg - 8 Meg for 8Meg of nucleus pages.
*/
#define KERNEL_TEXT_amd64 UINT64_C(0xfffffffffb800000)
#define KERNEL_TEXT KERNEL_TEXT_amd64
/*
* Virtual address range available to the debugger
*/
#define SEGDEBUGBASE ADDRESS_C(0xfffffffffc800000)
#define SEGDEBUGSIZE ADDRESS_C(0x1400000) /* KCTL_MEM_GOALSZ (20M) */
/*
* The upper limit on a user address space.
*
* In amd64, the upper limit on a 64-bit user address space is 1 large page
* (1GB) below kernelbase. The upper limit for a 32-bit user address space
* is 4KB + 16MB below the top of the 32-bit range. These limits provide a
* red zone between the user and kernel address spaces, which several parts
* of the kernel rely on.
*/
#if defined(__xpv)
#define USERLIMIT ADDRESS_C(0x00007fffffe00000)
#else
#define USERLIMIT ADDRESS_C(0xffff80ffc0000000)
#endif
#define USERLIMIT32 ADDRESS_C(0xfefff000)
/*
* Reserve pages just below KERNEL_TEXT for the GDT, IDT, trap traced IDT,
* TSS, auxiliary state, and debug info.
*
* For now, DEBUG_INFO_VA must be first in this list for "xm" initiated dumps
* of solaris domUs to be usable with mdb. Relying on a fixed VA is not viable
* long term, but it's the best we've got for now.
*/
#if !defined(_ASM)
#define DEBUG_INFO_VA (KERNEL_TEXT - MMU_PAGESIZE)
#define AUX_STATE_VA (DEBUG_INFO_VA - MMU_PAGESIZE)
#define GDT_VA (AUX_STATE_VA - MMU_PAGESIZE)
#define IDT_VA (GDT_VA - MMU_PAGESIZE * 2)
#define KTSS_VA (IDT_VA - MMU_PAGESIZE)
#define DFTSS_VA (KTSS_VA - MMU_PAGESIZE)
#define MISC_VA_BASE (DFTSS_VA)
#define MISC_VA_SIZE (KERNEL_TEXT - MISC_VA_BASE)
#endif /* !_ASM */
#if !defined(_ASM) && !defined(_KMDB)
extern uintptr_t userlimit, kernelbase, segmap_start, segmapsize;
#endif
/*
* reserve space for modules
*/
#define MODTEXT (1024 * 1024 * 2)
#define MODDATA (1024 * 300)
/*
* The heap has a region allocated from it of HEAPTEXT_SIZE bytes specifically
* for module text.
*/
#define HEAPTEXT_SIZE (64 * 1024 * 1024) /* bytes */
/*
* Size of a kernel threads stack. It must be a whole number of pages
* since the segment it comes from will only allocate space in pages.
*/
#define T_STACKSZ 2*PAGESIZE
/*
* Size of a cpu startup thread stack. (It must be a whole number of pages
* since the containing segment only allocates space in pages.)
*/
#define STARTUP_STKSZ 3*PAGESIZE
/*
* Bus types
*/
#define BTISA 1
#define BTEISA 2
#define BTMCA 3
#ifdef __cplusplus
}
#endif
#endif /* _SYS_MACHPARAM_H */