14Srgrimes/*-
24Srgrimes * Copyright (c) 1990 The Regents of the University of California.
34Srgrimes * All rights reserved.
44Srgrimes *
54Srgrimes * This code is derived from software contributed to Berkeley by
64Srgrimes * William Jolitz.
74Srgrimes *
84Srgrimes * Redistribution and use in source and binary forms, with or without
94Srgrimes * modification, are permitted provided that the following conditions
104Srgrimes * are met:
114Srgrimes * 1. Redistributions of source code must retain the above copyright
124Srgrimes *    notice, this list of conditions and the following disclaimer.
134Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
144Srgrimes *    notice, this list of conditions and the following disclaimer in the
154Srgrimes *    documentation and/or other materials provided with the distribution.
164Srgrimes * 4. Neither the name of the University nor the names of its contributors
174Srgrimes *    may be used to endorse or promote products derived from this software
184Srgrimes *    without specific prior written permission.
194Srgrimes *
204Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
214Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
224Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
234Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
244Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
254Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
264Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
274Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
284Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
294Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
304Srgrimes * SUCH DAMAGE.
314Srgrimes *
32551Srgrimes *	from: @(#)param.h	5.8 (Berkeley) 6/28/91
3350477Speter * $FreeBSD$
344Srgrimes */
354Srgrimes
36196994Sphk
37196994Sphk#ifndef _I386_INCLUDE_PARAM_H_
38196994Sphk#define	_I386_INCLUDE_PARAM_H_
39196994Sphk
40249722Stijl#include <machine/_align.h>
41249722Stijl
424Srgrimes/*
434Srgrimes * Machine dependent constants for Intel 386.
444Srgrimes */
4568498Sasmodai
4668498Sasmodai
47154128Simp#define __HAVE_ACPI
48223440Sjhb#define	__HAVE_PIR
49154128Simp#define __PCI_REROUTE_INTERRUPT
50154128Simp
5144364Simp#ifndef MACHINE
52551Srgrimes#define MACHINE		"i386"
5344364Simp#endif
5444364Simp#ifndef MACHINE_ARCH
5538673Skato#define	MACHINE_ARCH	"i386"
5644364Simp#endif
5736977Sbde#define MID_MACHINE	MID_I386
5836977Sbde
59177661Sjb#if defined(SMP) || defined(KLD_MODULE)
60224207Sattilio#ifndef MAXCPU
61183525Sjhb#define MAXCPU		32
62224207Sattilio#endif
6328354Sfsmp#else
6466296Sps#define MAXCPU		1
65177661Sjb#endif /* SMP || KLD_MODULE */
664Srgrimes
67250338Sattilio#ifndef MAXMEMDOM
68250338Sattilio#define	MAXMEMDOM	1
69250338Sattilio#endif
70250338Sattilio
7168498Sasmodai#define ALIGNBYTES	_ALIGNBYTES
7268498Sasmodai#define ALIGN(p)	_ALIGN(p)
73195376Ssam/*
74195376Ssam * ALIGNED_POINTER is a boolean macro that checks whether an address
75195376Ssam * is valid to fetch data elements of type t from on this architecture.
76195376Ssam * This does not reflect the optimal alignment, just the possibility
77195376Ssam * (within reasonable limits).
78195376Ssam */
79195376Ssam#define	ALIGNED_POINTER(p, t)	1
804Srgrimes
81191278Srwatson/*
82191278Srwatson * CACHE_LINE_SIZE is the compile-time maximum cache line size for an
83191278Srwatson * architecture.  It should be used with appropriate caution.
84191278Srwatson */
85192331Sjhb#define	CACHE_LINE_SHIFT	7
86191276Srwatson#define	CACHE_LINE_SIZE		(1 << CACHE_LINE_SHIFT)
87191276Srwatson
8815543Sphk#define PAGE_SHIFT	12		/* LOG2(PAGE_SIZE) */
8915565Sphk#define PAGE_SIZE	(1<<PAGE_SHIFT)	/* bytes/page */
901045Sdg#define PAGE_MASK	(PAGE_SIZE-1)
9115543Sphk#define NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
9215565Sphk
93112841Sjake#ifdef PAE
94112841Sjake#define NPGPTD		4
95112841Sjake#define PDRSHIFT	21		/* LOG2(NBPDR) */
96183343Skmacy#define NPGPTD_SHIFT	9
97112841Sjake#else
98111363Sjake#define NPGPTD		1
99111363Sjake#define PDRSHIFT	22		/* LOG2(NBPDR) */
100183343Skmacy#define NPGPTD_SHIFT	10
101112841Sjake#endif
102111363Sjake
103111363Sjake#define NBPTD		(NPGPTD<<PAGE_SHIFT)
104111363Sjake#define NPDEPTD		(NBPTD/(sizeof (pd_entry_t)))
10515543Sphk#define NPDEPG		(PAGE_SIZE/(sizeof (pd_entry_t)))
10615565Sphk#define NBPDR		(1<<PDRSHIFT)	/* bytes/page dir */
10727950Sdyson#define PDRMASK		(NBPDR-1)
1084Srgrimes
109197316Salc#define	MAXPAGESIZES	2	/* maximum number of supported page sizes */
110197316Salc
11127993Sdyson#define IOPAGES	2		/* pages of i/o permission bitmap */
11282309Speter
11383366Sjulian#ifndef KSTACK_PAGES
11483366Sjulian#define KSTACK_PAGES 2		/* Includes pcb! */
11582309Speter#endif
116116355Salc#define KSTACK_GUARD_PAGES 1	/* pages of kstack guard; 0 disables */
1174Srgrimes
1184Srgrimes/*
119239730Sdes * Ceiling on amount of swblock kva space, can be changed via
120239730Sdes * the kern.maxswzone /boot/loader.conf variable.
121239730Sdes *
122239730Sdes * 276 is sizeof(struct swblock), but we do not always have a definition
123239730Sdes * in scope for struct swblock, so we have to hardcode it.  Each struct
124239730Sdes * swblock holds metadata for 32 pages, so in theory, this is enough for
125239730Sdes * 16 GB of swap.  In practice, however, the usable amount is considerably
126239730Sdes * lower due to fragmentation.
127239730Sdes */
128239730Sdes#ifndef VM_SWZONE_SIZE_MAX
129239730Sdes#define VM_SWZONE_SIZE_MAX	(276 * 128 * 1024)
130239730Sdes#endif
131239730Sdes
132239730Sdes/*
13381933Sdillon * Ceiling on size of buffer cache (really only effects write queueing,
134102738Sdillon * the VM page cache is not effected), can be changed via
135102738Sdillon * the kern.maxbcache /boot/loader.conf variable.
136248789Skib *
137248789Skib * The value is equal to the size of the auto-tuned buffer map for
138248789Skib * the machine with 4GB of RAM, see vfs_bio.c:kern_vfs_bio_buffer_alloc().
13981933Sdillon */
14081933Sdillon#ifndef VM_BCACHE_SIZE_MAX
141248789Skib#define VM_BCACHE_SIZE_MAX	(7224 * 16 * 1024)
14281933Sdillon#endif
14381933Sdillon
14481933Sdillon/*
1454Srgrimes * Mach derived conversion macros
1464Srgrimes */
14740286Sdg#define trunc_page(x)		((x) & ~PAGE_MASK)
14840286Sdg#define round_page(x)		(((x) + PAGE_MASK) & ~PAGE_MASK)
149112569Sjake#define trunc_4mpage(x)		((x) & ~PDRMASK)
150112569Sjake#define round_4mpage(x)		((((x)) + PDRMASK) & ~PDRMASK)
1511549Srgrimes
152112569Sjake#define atop(x)			((x) >> PAGE_SHIFT)
153112569Sjake#define ptoa(x)			((x) << PAGE_SHIFT)
1541045Sdg
155112569Sjake#define i386_btop(x)		((x) >> PAGE_SHIFT)
156112569Sjake#define i386_ptob(x)		((x) << PAGE_SHIFT)
157584Srgrimes
15844157Sluoqi#define	pgtok(x)		((x) * (PAGE_SIZE / 1024))
15944157Sluoqi
160196994Sphk#endif /* !_I386_INCLUDE_PARAM_H_ */
161