BSD 4_4_Lite1 release
[unix-history] / usr / src / sys / sparc / include / param.h
CommitLineData
fe663dea 1/*
ad787160
C
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
fe663dea
CT
4 *
5 * This software was developed by the Computer Systems Engineering group
6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7 * contributed to Berkeley.
8 *
b480239a
KB
9 * All advertising materials mentioning features or use of this software
10 * must display the following acknowledgement:
11 * This product includes software developed by the University of
dc41e9e6 12 * California, Lawrence Berkeley Laboratory.
b480239a 13 *
ad787160
C
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * 3. All advertising materials mentioning features or use of this software
23 * must display the following acknowledgement:
24 * This product includes software developed by the University of
25 * California, Berkeley and its contributors.
26 * 4. Neither the name of the University nor the names of its contributors
27 * may be used to endorse or promote products derived from this software
28 * without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 * SUCH DAMAGE.
fe663dea 41 *
ad787160 42 * @(#)param.h 8.1 (Berkeley) 6/11/93
fe663dea 43 *
d35066dd 44 * from: $Header: param.h,v 1.13 92/11/26 02:04:38 torek Exp $ (LBL)
fe663dea
CT
45 */
46
47/*
48 * Machine dependent constants for Sun-4c (SPARCstation)
49 */
50#define MACHINE "sparc"
51
52#ifdef KERNEL /* XXX */
5548a02f 53#include <machine/cpu.h> /* XXX */
fe663dea
CT
54#endif /* XXX */
55
56/*
57 * Round p (pointer or byte index) up to a correctly-aligned value for
58 * the machine's strictest data type. The result is u_int and must be
59 * cast to any desired pointer type.
60 */
61#define ALIGNBYTES 7
62#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES)
63
64#define NBPG 4096 /* bytes/page */
65#define PGOFSET (NBPG-1) /* byte offset into page */
66#define PGSHIFT 12 /* log2(NBPG) */
67
68#define KERNBASE 0xf8000000 /* start of kernel virtual space */
69#define KERNTEXTOFF 0xf8004000 /* start of kernel text */
70#define BTOPKERNBASE ((u_long)KERNBASE >> PG_SHIFT)
71
72#define DEV_BSIZE 512
73#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
74#define BLKDEV_IOSIZE 2048
75#define MAXPHYS (64 * 1024)
76
77#define CLSIZE 1
78#define CLSIZELOG2 0
79
80/* NOTE: SSIZE and UPAGES must be multiples of CLSIZE */
81#define SSIZE 1 /* initial stack size/NBPG */
82#define UPAGES 2 /* pages of u-area */
83
84/*
85 * Constants related to network buffer management.
86 * MCLBYTES must be no larger than CLBYTES (the software page size), and,
87 * on machines that exchange pages of input or output buffers with mbuf
88 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
89 * of the hardware page size.
90 */
91#define MSIZE 128 /* size of an mbuf */
92#define MCLBYTES 2048 /* enough for whole Ethernet packet */
93#define MCLSHIFT 11 /* log2(MCLBYTES) */
94#define MCLOFSET (MCLBYTES - 1)
95
96#ifndef NMBCLUSTERS
97#ifdef GATEWAY
98#define NMBCLUSTERS 512 /* map size, max cluster allocation */
99#else
100#define NMBCLUSTERS 256 /* map size, max cluster allocation */
101#endif
102#endif
103
104/*
105 * Size of kernel malloc arena in CLBYTES-sized logical pages.
106 */
107#ifndef NKMEMCLUSTERS
dc41e9e6 108#define NKMEMCLUSTERS (6 * 1024 * 1024 / CLBYTES)
fe663dea
CT
109#endif
110
111/* pages ("clicks") (4096 bytes) to disk blocks */
112#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
113#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
114#define dtob(x) ((x) << DEV_BSHIFT)
115
116/* pages to bytes */
117#define ctob(x) ((x) << PGSHIFT)
118
119/* bytes to pages */
120#define btoc(x) (((unsigned)(x) + PGOFSET) >> PGSHIFT)
121
122#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
123 ((unsigned)(bytes) >> DEV_BSHIFT)
124#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
125 ((unsigned)(db) << DEV_BSHIFT)
126
127/*
128 * Map a ``block device block'' to a file system block.
129 * This should be device dependent, and should use the bsize
130 * field from the disk label.
131 * For now though just use DEV_BSIZE.
132 */
133#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE / DEV_BSIZE))
134
135#ifdef KERNEL
136#ifndef LOCORE
137#define DELAY(n) delay(n)
138#endif
139#else
140#define DELAY(n) { register volatile int N = (n); while (--N > 0); }
141#endif