1*b1b36fc1Ssimonb /* $NetBSD: param.h,v 1.88 2021/05/31 14:38:55 simonb Exp $ */ 2022ee8f7Scgd 361f28255Scgd /*- 461f28255Scgd * Copyright (c) 1990 The Regents of the University of California. 561f28255Scgd * All rights reserved. 661f28255Scgd * 761f28255Scgd * This code is derived from software contributed to Berkeley by 861f28255Scgd * William Jolitz. 961f28255Scgd * 1061f28255Scgd * Redistribution and use in source and binary forms, with or without 1161f28255Scgd * modification, are permitted provided that the following conditions 1261f28255Scgd * are met: 1361f28255Scgd * 1. Redistributions of source code must retain the above copyright 1461f28255Scgd * notice, this list of conditions and the following disclaimer. 1561f28255Scgd * 2. Redistributions in binary form must reproduce the above copyright 1661f28255Scgd * notice, this list of conditions and the following disclaimer in the 1761f28255Scgd * documentation and/or other materials provided with the distribution. 18aad01611Sagc * 3. Neither the name of the University nor the names of its contributors 1961f28255Scgd * may be used to endorse or promote products derived from this software 2061f28255Scgd * without specific prior written permission. 2161f28255Scgd * 2261f28255Scgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2361f28255Scgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2461f28255Scgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2561f28255Scgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2661f28255Scgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2761f28255Scgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2861f28255Scgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2961f28255Scgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3061f28255Scgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3161f28255Scgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3261f28255Scgd * SUCH DAMAGE. 3361f28255Scgd * 34022ee8f7Scgd * @(#)param.h 5.8 (Berkeley) 6/28/91 3561f28255Scgd */ 3661f28255Scgd 3725609732Sfvdl #ifndef _I386_PARAM_H_ 3825609732Sfvdl #define _I386_PARAM_H_ 3925609732Sfvdl 40*b1b36fc1Ssimonb #ifdef _KERNEL_OPT 41*b1b36fc1Ssimonb #include "opt_param.h" 42*b1b36fc1Ssimonb #endif 43*b1b36fc1Ssimonb 4461f28255Scgd /* 4561f28255Scgd * Machine dependent constants for Intel 386. 4661f28255Scgd */ 4761f28255Scgd 480c794722Srmind /* 490c794722Srmind * MAXCPUS must be defined before cpu.h inclusion. Note: i386 might 500c794722Srmind * support more CPUs, but due to the limited KVA space available on 510c794722Srmind * i386, such support would be inefficient. Use amd64 instead. 520c794722Srmind */ 530c794722Srmind #define MAXCPUS 32 540c794722Srmind 5571ab4ed9Sjtc #ifdef _KERNEL 563ce26e4fSmycroft #include <machine/cpu.h> 573ce26e4fSmycroft #endif 583ce26e4fSmycroft 5918ec26aaScgd #define _MACHINE i386 6061f28255Scgd #define MACHINE "i386" 6118ec26aaScgd #define _MACHINE_ARCH i386 62b26f063eScgd #define MACHINE_ARCH "i386" 63c8bdad05Scgd #define MID_MACHINE MID_I386 6461f28255Scgd 65115b6d92Sfvdl #define ALIGNED_POINTER(p,t) 1 66001c9b0eSriastradh #define ALIGNED_POINTER_LOAD(q,p,t) memcpy((q), (p), sizeof(t)) 6761f28255Scgd 6861f28255Scgd #define PGSHIFT 12 /* LOG2(NBPG) */ 697b64280aScgd #define NBPG (1 << PGSHIFT) /* bytes/page */ 707b64280aScgd #define PGOFSET (NBPG-1) /* byte offset into page */ 715f275681Smycroft #define NPTEPG (NBPG/(sizeof (pt_entry_t))) 7261f28255Scgd 7315149c9aSmaya #define MAXIOMEM 0xffffffff 7415149c9aSmaya 75b58f1fcbSmaxv /* 76b58f1fcbSmaxv * Maximum physical memory supported by the implementation. 77b58f1fcbSmaxv */ 78b58f1fcbSmaxv #ifdef PAE 79b58f1fcbSmaxv #define MAXPHYSMEM 0x1000000000ULL /* 64GB */ 80b58f1fcbSmaxv #else 81b58f1fcbSmaxv #define MAXPHYSMEM 0x100000000ULL /* 4GB */ 82b58f1fcbSmaxv #endif 83b58f1fcbSmaxv 849a5c3116Sad #if defined(_KERNEL_OPT) 859a5c3116Sad #include "opt_kernbase.h" 869a5c3116Sad #endif /* defined(_KERNEL_OPT) */ 879a5c3116Sad 88443e88c5Syamt #ifndef KERNBASE 89443e88c5Syamt #define KERNBASE 0xc0000000UL /* start of kernel virtual space */ 90bbb5cbabSchristos #endif 91dacf9875Stls 92443e88c5Syamt #define KERNTEXTOFF (KERNBASE + 0x100000) /* start of kernel text */ 93bbb5cbabSchristos #define BTOPKERNBASE (KERNBASE >> PGSHIFT) 9461f28255Scgd 9561f28255Scgd #define SSIZE 1 /* initial stack size/NBPG */ 9661f28255Scgd #define SINCR 1 /* increment of stack/NBPG */ 9725609732Sfvdl 9818e9385dSperry #ifndef UPAGES 995e34fbf9Sad # ifdef DIAGNOSTIC 1005e34fbf9Sad # define UPAGES 3 /* 2 + 1 page for redzone */ 10125609732Sfvdl # else 1025e34fbf9Sad # define UPAGES 2 /* normal pages of u-area */ 1035e34fbf9Sad # endif /* DIAGNOSTIC */ 10418e9385dSperry #endif /* !defined(UPAGES) */ 105d20de153Smycroft #define USPACE (UPAGES * NBPG) /* total size of u-area */ 10698cfc473Syamt #define INTRSTACKSIZE 8192 10761f28255Scgd 108d4713d24Sleo #ifndef MSGBUFSIZE 109a96590afSsborrill #define MSGBUFSIZE (16*NBPG) /* default message buffer size */ 110d4713d24Sleo #endif 111d4713d24Sleo 11261f28255Scgd /* 11361f28255Scgd * Constants related to network buffer management. 11405132683Sragge * MCLBYTES must be no larger than NBPG (the software page size), and, 11561f28255Scgd * on machines that exchange pages of input or output buffers with mbuf 11661f28255Scgd * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 11761f28255Scgd * of the hardware page size. 11861f28255Scgd */ 119d738f90fSitojun #define MSIZE 256 /* size of an mbuf */ 120a2ff9d96Sjonathan 121a2ff9d96Sjonathan #ifndef MCLSHIFT 122e52125aaScgd #define MCLSHIFT 11 /* convert bytes to m_buf clusters */ 123d9ab16baSsimonb /* 2K cluster can hold Ether frame */ 124a2ff9d96Sjonathan #endif /* MCLSHIFT */ 125a2ff9d96Sjonathan 1262250fff2Smycroft #define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ 12763c0a317Smycroft 128d621e29eSjoerg #ifndef NMBCLUSTERS_MAX 1291925e54dSmlelstv #define NMBCLUSTERS_MAX (0x4000000 / MCLBYTES) /* Limit to 64MB for clusters */ 1302250fff2Smycroft #endif 13161f28255Scgd 132ecca8808Sfvdl #ifndef NFS_RSIZE 133ecca8808Sfvdl #define NFS_RSIZE 32768 134ecca8808Sfvdl #endif 135ecca8808Sfvdl #ifndef NFS_WSIZE 136ecca8808Sfvdl #define NFS_WSIZE 32768 137ecca8808Sfvdl #endif 138ecca8808Sfvdl 13961f28255Scgd /* 140dded044fSthorpej * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized 141dded044fSthorpej * logical pages. 14261f28255Scgd */ 1434c23b30cSpara #define NKMEMPAGES_MIN_DEFAULT ((16 * 1024 * 1024) >> PAGE_SHIFT) 1444c23b30cSpara #define NKMEMPAGES_MAX_DEFAULT ((360 * 1024 * 1024) >> PAGE_SHIFT) 14561f28255Scgd 14661f28255Scgd /* 14761f28255Scgd * Mach derived conversion macros 14861f28255Scgd */ 14924a1632cSyamt #define x86_round_pdr(x) \ 15024a1632cSyamt ((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1)) 15124a1632cSyamt #define x86_trunc_pdr(x) ((unsigned long)(x) & ~(NBPD_L2 - 1)) 15224a1632cSyamt #define x86_btod(x) ((unsigned long)(x) >> L2_SHIFT) 15324a1632cSyamt #define x86_dtob(x) ((unsigned long)(x) << L2_SHIFT) 154f5f016d3Sbouyer #define x86_round_page(x) ((((paddr_t)(x)) + PGOFSET) & ~PGOFSET) 155f5f016d3Sbouyer #define x86_trunc_page(x) ((paddr_t)(x) & ~PGOFSET) 156f5f016d3Sbouyer #define x86_btop(x) ((paddr_t)(x) >> PGSHIFT) 157f5f016d3Sbouyer #define x86_ptob(x) ((paddr_t)(x) << PGSHIFT) 15825609732Sfvdl 15925609732Sfvdl #endif /* _I386_PARAM_H_ */ 160