15b81b6b3SRodney W. Grimes /*- 251369649SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 351369649SPedro F. Giffuni * 45b81b6b3SRodney W. Grimes * Copyright (c) 1990 The Regents of the University of California. 55b81b6b3SRodney W. Grimes * All rights reserved. 65b81b6b3SRodney W. Grimes * 75b81b6b3SRodney W. Grimes * This code is derived from software contributed to Berkeley by 85b81b6b3SRodney W. Grimes * William Jolitz. 95b81b6b3SRodney W. Grimes * 105b81b6b3SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 115b81b6b3SRodney W. Grimes * modification, are permitted provided that the following conditions 125b81b6b3SRodney W. Grimes * are met: 135b81b6b3SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 145b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 155b81b6b3SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 165b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 175b81b6b3SRodney W. Grimes * documentation and/or other materials provided with the distribution. 18fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors 195b81b6b3SRodney W. Grimes * may be used to endorse or promote products derived from this software 205b81b6b3SRodney W. Grimes * without specific prior written permission. 215b81b6b3SRodney W. Grimes * 225b81b6b3SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 235b81b6b3SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 245b81b6b3SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 255b81b6b3SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 265b81b6b3SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 275b81b6b3SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 285b81b6b3SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 295b81b6b3SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 305b81b6b3SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 315b81b6b3SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 325b81b6b3SRodney W. Grimes * SUCH DAMAGE. 335b81b6b3SRodney W. Grimes * 3489ec6ec6SRodney W. Grimes * from: @(#)param.h 5.8 (Berkeley) 6/28/91 35c3aac50fSPeter Wemm * $FreeBSD$ 365b81b6b3SRodney W. Grimes */ 375b81b6b3SRodney W. Grimes 38a254d1f1SPoul-Henning Kamp 39a254d1f1SPoul-Henning Kamp #ifndef _I386_INCLUDE_PARAM_H_ 40a254d1f1SPoul-Henning Kamp #define _I386_INCLUDE_PARAM_H_ 41a254d1f1SPoul-Henning Kamp 42c67f5b54STijl Coosemans #include <machine/_align.h> 43c67f5b54STijl Coosemans 445b81b6b3SRodney W. Grimes /* 455b81b6b3SRodney W. Grimes * Machine dependent constants for Intel 386. 465b81b6b3SRodney W. Grimes */ 476b1d8ceaSJeroen Ruigrok van der Werven 486b1d8ceaSJeroen Ruigrok van der Werven 49d5e61c97SWarner Losh #define __HAVE_ACPI 501368987aSJohn Baldwin #define __HAVE_PIR 51d5e61c97SWarner Losh #define __PCI_REROUTE_INTERRUPT 52d5e61c97SWarner Losh 536b1d8ceaSJeroen Ruigrok van der Werven #ifndef MACHINE 546b1d8ceaSJeroen Ruigrok van der Werven #define MACHINE "i386" 556b1d8ceaSJeroen Ruigrok van der Werven #endif 561684ea57SWarner Losh #ifndef MACHINE_ARCH 57582e5286SKATO Takenori #define MACHINE_ARCH "i386" 581684ea57SWarner Losh #endif 59f0c2a198SBruce Evans #define MID_MACHINE MID_I386 60f0c2a198SBruce Evans 61e4839437SJohn Birrell #if defined(SMP) || defined(KLD_MODULE) 6268b739cdSAttilio Rao #ifndef MAXCPU 633d074cf3SJohn Baldwin #define MAXCPU 32 6468b739cdSAttilio Rao #endif 6575d23f5fSSteve Passe #else 6692b123a0SPaul Saab #define MAXCPU 1 67e4839437SJohn Birrell #endif /* SMP || KLD_MODULE */ 684a73d99fSSteve Passe 69941646f5SAttilio Rao #ifndef MAXMEMDOM 70941646f5SAttilio Rao #define MAXMEMDOM 1 71941646f5SAttilio Rao #endif 72941646f5SAttilio Rao 736b1d8ceaSJeroen Ruigrok van der Werven #define ALIGNBYTES _ALIGNBYTES 746b1d8ceaSJeroen Ruigrok van der Werven #define ALIGN(p) _ALIGN(p) 758c393fd1SSam Leffler /* 768c393fd1SSam Leffler * ALIGNED_POINTER is a boolean macro that checks whether an address 778c393fd1SSam Leffler * is valid to fetch data elements of type t from on this architecture. 788c393fd1SSam Leffler * This does not reflect the optimal alignment, just the possibility 798c393fd1SSam Leffler * (within reasonable limits). 808c393fd1SSam Leffler */ 818c393fd1SSam Leffler #define ALIGNED_POINTER(p, t) 1 82f798d060SNate Williams 8322037b2dSRobert Watson /* 8422037b2dSRobert Watson * CACHE_LINE_SIZE is the compile-time maximum cache line size for an 8522037b2dSRobert Watson * architecture. It should be used with appropriate caution. 8622037b2dSRobert Watson */ 872744a0b6SConrad Meyer #define CACHE_LINE_SHIFT 6 88a93fa8f2SRobert Watson #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) 89a93fa8f2SRobert Watson 90e911eafcSPoul-Henning Kamp #define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ 91e911eafcSPoul-Henning Kamp #define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */ 92ec120393SDavid Greenman #define PAGE_MASK (PAGE_SIZE-1) 93e911eafcSPoul-Henning Kamp #define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) 945b81b6b3SRodney W. Grimes 9534c15db9SKonstantin Belousov #if defined(PAE) || defined(PAE_TABLES) 967ab9b220SJake Burkholder #define NPGPTD 4 977ab9b220SJake Burkholder #define PDRSHIFT 21 /* LOG2(NBPDR) */ 98dec9f635SKip Macy #define NPGPTD_SHIFT 9 997ab9b220SJake Burkholder #else 100910548deSJake Burkholder #define NPGPTD 1 1015b81b6b3SRodney W. Grimes #define PDRSHIFT 22 /* LOG2(NBPDR) */ 102dec9f635SKip Macy #define NPGPTD_SHIFT 10 1037ab9b220SJake Burkholder #endif 104910548deSJake Burkholder 105910548deSJake Burkholder #define NBPTD (NPGPTD<<PAGE_SHIFT) 106910548deSJake Burkholder #define NPDEPTD (NBPTD/(sizeof (pd_entry_t))) 107910548deSJake Burkholder #define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t))) 108c77ba360SRodney W. Grimes #define NBPDR (1<<PDRSHIFT) /* bytes/page dir */ 109d3d1eb99SJohn Dyson #define PDRMASK (NBPDR-1) 1105b81b6b3SRodney W. Grimes 111fe105d45SAlan Cox #define MAXPAGESIZES 2 /* maximum number of supported page sizes */ 112fe105d45SAlan Cox 11348a09cf2SJohn Dyson #define IOPAGES 2 /* pages of i/o permission bitmap */ 114268bdb43SPeter Wemm 115b40ce416SJulian Elischer #ifndef KSTACK_PAGES 116*3f6867efSConrad Meyer #define KSTACK_PAGES 4 /* Includes pcb! */ 117268bdb43SPeter Wemm #endif 11849a2507bSAlan Cox #define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ 1193208d3ffSKonstantin Belousov #if KSTACK_PAGES < 4 1203208d3ffSKonstantin Belousov #define TD0_KSTACK_PAGES 4 1213208d3ffSKonstantin Belousov #else 1223208d3ffSKonstantin Belousov #define TD0_KSTACK_PAGES KSTACK_PAGES 1233208d3ffSKonstantin Belousov #endif 124b40ce416SJulian Elischer 1255b81b6b3SRodney W. Grimes /* 126ae7f84a9SDag-Erling Smørgrav * Ceiling on amount of swblock kva space, can be changed via 127ae7f84a9SDag-Erling Smørgrav * the kern.maxswzone /boot/loader.conf variable. 128ae7f84a9SDag-Erling Smørgrav * 129ae7f84a9SDag-Erling Smørgrav * 276 is sizeof(struct swblock), but we do not always have a definition 130ae7f84a9SDag-Erling Smørgrav * in scope for struct swblock, so we have to hardcode it. Each struct 131ae7f84a9SDag-Erling Smørgrav * swblock holds metadata for 32 pages, so in theory, this is enough for 132ae7f84a9SDag-Erling Smørgrav * 16 GB of swap. In practice, however, the usable amount is considerably 133ae7f84a9SDag-Erling Smørgrav * lower due to fragmentation. 134ae7f84a9SDag-Erling Smørgrav */ 135ae7f84a9SDag-Erling Smørgrav #ifndef VM_SWZONE_SIZE_MAX 136ae7f84a9SDag-Erling Smørgrav #define VM_SWZONE_SIZE_MAX (276 * 128 * 1024) 137ae7f84a9SDag-Erling Smørgrav #endif 138ae7f84a9SDag-Erling Smørgrav 139ae7f84a9SDag-Erling Smørgrav /* 1402f9e4e80SMatthew Dillon * Ceiling on size of buffer cache (really only effects write queueing, 141ec61f55dSMatthew Dillon * the VM page cache is not effected), can be changed via 142ec61f55dSMatthew Dillon * the kern.maxbcache /boot/loader.conf variable. 143d4e9009cSKonstantin Belousov * 144d4e9009cSKonstantin Belousov * The value is equal to the size of the auto-tuned buffer map for 145d4e9009cSKonstantin Belousov * the machine with 4GB of RAM, see vfs_bio.c:kern_vfs_bio_buffer_alloc(). 1462f9e4e80SMatthew Dillon */ 1472f9e4e80SMatthew Dillon #ifndef VM_BCACHE_SIZE_MAX 148d4e9009cSKonstantin Belousov #define VM_BCACHE_SIZE_MAX (7224 * 16 * 1024) 1492f9e4e80SMatthew Dillon #endif 1502f9e4e80SMatthew Dillon 1515b81b6b3SRodney W. Grimes /* 1525b81b6b3SRodney W. Grimes * Mach derived conversion macros 1535b81b6b3SRodney W. Grimes */ 1546cde7a16SDavid Greenman #define trunc_page(x) ((x) & ~PAGE_MASK) 1556cde7a16SDavid Greenman #define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) 156227f9a1cSJake Burkholder #define trunc_4mpage(x) ((x) & ~PDRMASK) 157227f9a1cSJake Burkholder #define round_4mpage(x) ((((x)) + PDRMASK) & ~PDRMASK) 15826f9a767SRodney W. Grimes 159227f9a1cSJake Burkholder #define atop(x) ((x) >> PAGE_SHIFT) 160227f9a1cSJake Burkholder #define ptoa(x) ((x) << PAGE_SHIFT) 161ec120393SDavid Greenman 162227f9a1cSJake Burkholder #define i386_btop(x) ((x) >> PAGE_SHIFT) 163227f9a1cSJake Burkholder #define i386_ptob(x) ((x) << PAGE_SHIFT) 164d529c3d8SRodney W. Grimes 1651c6d46f9SLuoqi Chen #define pgtok(x) ((x) * (PAGE_SIZE / 1024)) 1661c6d46f9SLuoqi Chen 1676fdfd882SKonstantin Belousov #define INKERNEL(va) (((vm_offset_t)(va)) >= VM_MAXUSER_ADDRESS && \ 1686fdfd882SKonstantin Belousov ((vm_offset_t)(va)) < VM_MAX_KERNEL_ADDRESS) 1696fdfd882SKonstantin Belousov 170a254d1f1SPoul-Henning Kamp #endif /* !_I386_INCLUDE_PARAM_H_ */ 171