2 * Copyright (c) 1990 The Regents of the University of California.
\r
3 * All rights reserved.
\r
5 * This code is derived from software contributed to Berkeley by
\r
8 * Redistribution and use in source and binary forms, with or without
\r
9 * modification, are permitted provided that the following conditions
\r
11 * 1. Redistributions of source code must retain the above copyright
\r
12 * notice, this list of conditions and the following disclaimer.
\r
13 * 2. Redistributions in binary form must reproduce the above copyright
\r
14 * notice, this list of conditions and the following disclaimer in the
\r
15 * documentation and/or other materials provided with the distribution.
\r
16 * 3. All advertising materials mentioning features or use of this software
\r
17 * must display the following acknowledgement:
\r
18 * This product includes software developed by the University of
\r
19 * California, Berkeley and its contributors.
\r
20 * 4. Neither the name of the University nor the names of its contributors
\r
21 * may be used to endorse or promote products derived from this software
\r
22 * without specific prior written permission.
\r
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
\r
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\r
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
\r
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
\r
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
\r
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
\r
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
\r
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
\r
36 * from: @(#)param.h 5.8 (Berkeley) 6/28/91
\r
37 * $FreeBSD: src/sys/i386/boot/dosboot/param.h,v 1.6 1999/09/26 19:05:39 peter Exp $
\r
38 * $DragonFly: src/sys/platform/pc32/boot/dosboot/Attic/param.h,v 1.2 2003/06/17 04:28:34 dillon Exp $
\r
41 #ifndef _MACHINE_PARAM_H_
\r
42 #define _MACHINE_PARAM_H_
\r
45 * Machine dependent constants for Intel 386.
\r
48 #define MACHINE "i386"
\r
49 #define MID_MACHINE MID_I386
\r
52 * Round p (pointer or byte index) up to a correctly-aligned value
\r
53 * for all data types (int, long, ...). The result is unsigned int
\r
54 * and must be cast to any desired pointer type.
\r
56 #define ALIGNBYTES (sizeof(long) - 1)
\r
57 #define ALIGN(p) (((unsigned long)(p) + ALIGNBYTES) & ~ALIGNBYTES)
\r
59 /* XXX PGSHIFT and PG_SHIFT are two names for the same thing */
\r
60 #define PGSHIFT 12 /* LOG2(NBPG) */
\r
61 #define PAGE_SHIFT 12
\r
62 #define NBPG (1 << PAGE_SHIFT) /* bytes/page */
\r
63 #define PAGE_SIZE (1 << PAGE_SHIFT)
\r
64 #define PAGE_MASK (PAGE_SIZE-1)
\r
65 #define PGOFSET (NBPG-1) /* byte offset into page */
\r
66 #define NPTEPG (NBPG/(sizeof (pt_entry_t)))
\r
68 /* XXX PDRSHIFT and PD_SHIFT are two names for the same thing */
\r
69 #define PDRSHIFT 22 /* LOG2(NBPDR) */
\r
70 #define NBPDR (1 << PDRSHIFT) /* bytes/page dir */
\r
71 #define PDROFSET (NBPDR-1) /* byte offset into page dir */
\r
74 * XXX This should really be KPTDPTDI << PDRSHIFT, but since KPTDPTDI is
\r
75 * defined in pmap.h which is included after this we can't do that
\r
78 #define BTOPKERNBASE (KERNBASE >> PGSHIFT)
\r
80 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
\r
81 #define DEV_BSIZE (1 << DEV_BSHIFT)
\r
83 #define BLKDEV_IOSIZE 2048
\r
84 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
\r
86 #define CLSIZELOG2 0
\r
87 #define CLSIZE (1 << CLSIZELOG2)
\r
89 /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
\r
90 #define SSIZE 1 /* initial stack size/NBPG */
\r
91 #define SINCR 1 /* increment of stack/NBPG */
\r
93 #define UPAGES 2 /* pages of u-area */
\r
96 * Constants related to network buffer management.
\r
97 * MCLBYTES must be no larger than CLBYTES (the software page size), and,
\r
98 * on machines that exchange pages of input or output buffers with mbuf
\r
99 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
\r
100 * of the hardware page size.
\r
103 #define MSIZE 128 /* size of an mbuf */
\r
107 #define MCLSHIFT 12 /* convert bytes to m_buf clusters */
\r
108 #endif /* MCLSHIFT */
\r
109 #define MCLBYTES (1 << MCLSHIFT) /* size of an m_buf cluster */
\r
110 #define MCLOFSET (MCLBYTES - 1) /* offset within an m_buf cluster */
\r
112 #ifndef NMBCLUSTERS
\r
114 #define NMBCLUSTERS 512 /* map size, max cluster allocation */
\r
116 #define NMBCLUSTERS 256 /* map size, max cluster allocation */
\r
117 #endif /* GATEWAY */
\r
118 #endif /* NMBCLUSTERS */
\r
121 * Some macros for units conversion
\r
123 /* Core clicks (4096 bytes) to segments and vice versa */
\r
124 #define ctos(x) (x)
\r
125 #define stoc(x) (x)
\r
127 /* Core clicks (4096 bytes) to disk blocks */
\r
128 #define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT))
\r
129 #define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT))
\r
130 #define dtob(x) ((x)<<DEV_BSHIFT)
\r
132 /* clicks to bytes */
\r
133 #define ctob(x) ((x)<<PGSHIFT)
\r
135 /* bytes to clicks */
\r
136 #define btoc(x) (((unsigned long)(x)+(NBPG-1))>>PGSHIFT)
\r
138 #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
\r
139 ((unsigned long)(bytes) >> DEV_BSHIFT)
\r
140 #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
\r
141 ((unsigned long)(db) << DEV_BSHIFT)
\r
144 * Mach derived conversion macros
\r
146 #define trunc_page(x) ((unsigned long)(x) & ~(NBPG-1))
\r
147 #define round_page(x) ((((unsigned long)(x)) + NBPG - 1) & ~(NBPG-1))
\r
149 #define atop(x) ((unsigned long)(x) >> PG_SHIFT)
\r
150 #define ptoa(x) ((unsigned long)(x) << PG_SHIFT)
\r
152 #define i386_round_pdr(x) ((((unsigned long)(x)) + NBPDR - 1) & ~(NBPDR-1))
\r
153 #define i386_trunc_pdr(x) ((unsigned long)(x) & ~(NBPDR-1))
\r
154 #define i386_round_page(x) ((((unsigned long)(x)) + NBPG - 1) & ~(NBPG-1))
\r
155 #define i386_trunc_page(x) ((unsigned long)(x) & ~(NBPG-1))
\r
156 #define i386_btod(x) ((unsigned long)(x) >> PDRSHIFT)
\r
157 #define i386_dtob(x) ((unsigned long)(x) << PDRSHIFT)
\r
158 #define i386_btop(x) ((unsigned long)(x) >> PGSHIFT)
\r
159 #define i386_ptob(x) ((unsigned long)(x) << PGSHIFT)
\r
161 #include "sysparam.h"
\r
163 #endif /* !_MACHINE_PARAM_H_ */
\r