xref: /minix3/sys/arch/i386/include/param.h (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1b1c4ba4aSLionel Sambuc /*	$NetBSD: param.h,v 1.77 2012/04/20 22:23:24 rmind Exp $	*/
2f6aac1c3SLionel Sambuc 
3f6aac1c3SLionel Sambuc /*-
4f6aac1c3SLionel Sambuc  * Copyright (c) 1990 The Regents of the University of California.
5f6aac1c3SLionel Sambuc  * All rights reserved.
6f6aac1c3SLionel Sambuc  *
7f6aac1c3SLionel Sambuc  * This code is derived from software contributed to Berkeley by
8f6aac1c3SLionel Sambuc  * William Jolitz.
9f6aac1c3SLionel Sambuc  *
10f6aac1c3SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
11f6aac1c3SLionel Sambuc  * modification, are permitted provided that the following conditions
12f6aac1c3SLionel Sambuc  * are met:
13f6aac1c3SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
14f6aac1c3SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
15f6aac1c3SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
16f6aac1c3SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
17f6aac1c3SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
18f6aac1c3SLionel Sambuc  * 3. Neither the name of the University nor the names of its contributors
19f6aac1c3SLionel Sambuc  *    may be used to endorse or promote products derived from this software
20f6aac1c3SLionel Sambuc  *    without specific prior written permission.
21f6aac1c3SLionel Sambuc  *
22f6aac1c3SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23f6aac1c3SLionel Sambuc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24f6aac1c3SLionel Sambuc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25f6aac1c3SLionel Sambuc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26f6aac1c3SLionel Sambuc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27f6aac1c3SLionel Sambuc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28f6aac1c3SLionel Sambuc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29f6aac1c3SLionel Sambuc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30f6aac1c3SLionel Sambuc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31f6aac1c3SLionel Sambuc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32f6aac1c3SLionel Sambuc  * SUCH DAMAGE.
33f6aac1c3SLionel Sambuc  *
34f6aac1c3SLionel Sambuc  *	@(#)param.h	5.8 (Berkeley) 6/28/91
35f6aac1c3SLionel Sambuc  */
36f6aac1c3SLionel Sambuc 
37f6aac1c3SLionel Sambuc #ifndef _I386_PARAM_H_
38f6aac1c3SLionel Sambuc #define _I386_PARAM_H_
39f6aac1c3SLionel Sambuc 
40f6aac1c3SLionel Sambuc /*
41f6aac1c3SLionel Sambuc  * Machine dependent constants for Intel 386.
42f6aac1c3SLionel Sambuc  */
43f6aac1c3SLionel Sambuc 
44*ff102743SBen Gras /*
45*ff102743SBen Gras  * MAXCPUS must be defined before cpu.h inclusion.  Note: i386 might
46*ff102743SBen Gras  * support more CPUs, but due to the limited KVA space available on
47*ff102743SBen Gras  * i386, such support would be inefficient.  Use amd64 instead.
48*ff102743SBen Gras  */
49*ff102743SBen Gras #define	MAXCPUS		32
50*ff102743SBen Gras 
51b1c4ba4aSLionel Sambuc #ifdef _KERNEL
52b1c4ba4aSLionel Sambuc #include <machine/cpu.h>
53b1c4ba4aSLionel Sambuc #endif
54b1c4ba4aSLionel Sambuc 
55b1c4ba4aSLionel Sambuc #define	_MACHINE	i386
56b1c4ba4aSLionel Sambuc #define	MACHINE		"i386"
57b1c4ba4aSLionel Sambuc #define	_MACHINE_ARCH	i386
58b1c4ba4aSLionel Sambuc #define	MACHINE_ARCH	"i386"
59b1c4ba4aSLionel Sambuc #define	MID_MACHINE	MID_I386
60b1c4ba4aSLionel Sambuc 
61f6aac1c3SLionel Sambuc #define ALIGNED_POINTER(p,t)	1
62f6aac1c3SLionel Sambuc 
63f6aac1c3SLionel Sambuc #define	PGSHIFT		12		/* LOG2(NBPG) */
64f6aac1c3SLionel Sambuc #define	NBPG		(1 << PGSHIFT)	/* bytes/page */
65f6aac1c3SLionel Sambuc #define	PGOFSET		(NBPG-1)	/* byte offset into page */
66f6aac1c3SLionel Sambuc #define	NPTEPG		(NBPG/(sizeof (pt_entry_t)))
67f6aac1c3SLionel Sambuc 
68b1c4ba4aSLionel Sambuc #if defined(_KERNEL_OPT)
69b1c4ba4aSLionel Sambuc #include "opt_kernbase.h"
70b1c4ba4aSLionel Sambuc #endif /* defined(_KERNEL_OPT) */
71b1c4ba4aSLionel Sambuc 
72b1c4ba4aSLionel Sambuc #ifdef KERNBASE_LOCORE
73b1c4ba4aSLionel Sambuc #error "You should only re-define KERNBASE"
74b1c4ba4aSLionel Sambuc #endif
75b1c4ba4aSLionel Sambuc 
76*ff102743SBen Gras #ifndef	KERNBASE
77*ff102743SBen Gras #define	KERNBASE	0xc0000000UL	/* start of kernel virtual space */
78*ff102743SBen Gras #endif
79*ff102743SBen Gras 
80*ff102743SBen Gras #define	KERNTEXTOFF	(KERNBASE + 0x100000) /* start of kernel text */
81*ff102743SBen Gras #define	BTOPKERNBASE	(KERNBASE >> PGSHIFT)
82*ff102743SBen Gras 
83f6aac1c3SLionel Sambuc #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
84f6aac1c3SLionel Sambuc #define	DEV_BSIZE	(1 << DEV_BSHIFT)
85*ff102743SBen Gras #define	BLKDEV_IOSIZE	2048
86*ff102743SBen Gras #ifndef	MAXPHYS
87*ff102743SBen Gras #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
88*ff102743SBen Gras #endif
89*ff102743SBen Gras 
90*ff102743SBen Gras #define	SSIZE		1		/* initial stack size/NBPG */
91*ff102743SBen Gras #define	SINCR		1		/* increment of stack/NBPG */
92*ff102743SBen Gras 
93*ff102743SBen Gras #ifndef UPAGES
94*ff102743SBen Gras # ifdef DIAGNOSTIC
95*ff102743SBen Gras #  define	UPAGES		3	/* 2 + 1 page for redzone */
96*ff102743SBen Gras # else
97*ff102743SBen Gras #  define	UPAGES		2	/* normal pages of u-area */
98*ff102743SBen Gras # endif /* DIAGNOSTIC */
99*ff102743SBen Gras #endif /* !defined(UPAGES) */
100*ff102743SBen Gras #define	USPACE		(UPAGES * NBPG)	/* total size of u-area */
101*ff102743SBen Gras #define	INTRSTACKSIZE	8192
102*ff102743SBen Gras 
103*ff102743SBen Gras #ifndef MSGBUFSIZE
104*ff102743SBen Gras #define MSGBUFSIZE	8*NBPG		/* default message buffer size */
105*ff102743SBen Gras #endif
106*ff102743SBen Gras 
107*ff102743SBen Gras /*
108*ff102743SBen Gras  * Constants related to network buffer management.
109*ff102743SBen Gras  * MCLBYTES must be no larger than NBPG (the software page size), and,
110*ff102743SBen Gras  * on machines that exchange pages of input or output buffers with mbuf
111*ff102743SBen Gras  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
112*ff102743SBen Gras  * of the hardware page size.
113*ff102743SBen Gras  */
114*ff102743SBen Gras #define	MSIZE		256		/* size of an mbuf */
115*ff102743SBen Gras 
116*ff102743SBen Gras #ifndef MCLSHIFT
117*ff102743SBen Gras #define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
118*ff102743SBen Gras 					/* 2K cluster can hold Ether frame */
119*ff102743SBen Gras #endif	/* MCLSHIFT */
120*ff102743SBen Gras 
121*ff102743SBen Gras #define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
122*ff102743SBen Gras 
123*ff102743SBen Gras #ifndef NMBCLUSTERS_MAX
124*ff102743SBen Gras #define	NMBCLUSTERS_MAX	(0x2000000 / MCLBYTES)	/* Limit to 64MB for clusters */
125*ff102743SBen Gras #endif
126*ff102743SBen Gras 
127*ff102743SBen Gras #ifndef NFS_RSIZE
128*ff102743SBen Gras #define NFS_RSIZE	32768
129*ff102743SBen Gras #endif
130*ff102743SBen Gras #ifndef NFS_WSIZE
131*ff102743SBen Gras #define NFS_WSIZE	32768
132*ff102743SBen Gras #endif
133*ff102743SBen Gras 
134*ff102743SBen Gras /*
135*ff102743SBen Gras  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
136*ff102743SBen Gras  * logical pages.
137*ff102743SBen Gras  */
138*ff102743SBen Gras #define	NKMEMPAGES_MIN_DEFAULT	((16 * 1024 * 1024) >> PAGE_SHIFT)
139*ff102743SBen Gras #define	NKMEMPAGES_MAX_DEFAULT	((360 * 1024 * 1024) >> PAGE_SHIFT)
140f6aac1c3SLionel Sambuc 
141f6aac1c3SLionel Sambuc /*
142f6aac1c3SLionel Sambuc  * Mach derived conversion macros
143f6aac1c3SLionel Sambuc  */
144f6aac1c3SLionel Sambuc #define	x86_round_pdr(x) \
145f6aac1c3SLionel Sambuc 	((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1))
146f6aac1c3SLionel Sambuc #define	x86_trunc_pdr(x)	((unsigned long)(x) & ~(NBPD_L2 - 1))
147f6aac1c3SLionel Sambuc #define	x86_btod(x)		((unsigned long)(x) >> L2_SHIFT)
148f6aac1c3SLionel Sambuc #define	x86_dtob(x)		((unsigned long)(x) << L2_SHIFT)
149f6aac1c3SLionel Sambuc #define	x86_round_page(x)	((((paddr_t)(x)) + PGOFSET) & ~PGOFSET)
150f6aac1c3SLionel Sambuc #define	x86_trunc_page(x)	((paddr_t)(x) & ~PGOFSET)
151f6aac1c3SLionel Sambuc #define	x86_btop(x)		((paddr_t)(x) >> PGSHIFT)
152f6aac1c3SLionel Sambuc #define	x86_ptob(x)		((paddr_t)(x) << PGSHIFT)
153f6aac1c3SLionel Sambuc 
154f6aac1c3SLionel Sambuc #endif /* _I386_PARAM_H_ */
155