BSD 4_4 development
[unix-history] / .ref-6294d633e80db8e89697db796e6f6025d5af0cae / usr / src / sys / sparc / include / param.h
CommitLineData
fe663dea
CT
1/*
2 * Copyright (c) 1992 The Regents of the University of California.
3 * All rights reserved.
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 *
fe663dea
CT
14 * %sccs.include.redist.c%
15 *
d35066dd 16 * @(#)param.h 7.5 (Berkeley) %G%
fe663dea 17 *
d35066dd 18 * from: $Header: param.h,v 1.13 92/11/26 02:04:38 torek Exp $ (LBL)
fe663dea
CT
19 */
20
21/*
22 * Machine dependent constants for Sun-4c (SPARCstation)
23 */
24#define MACHINE "sparc"
25
26#ifdef KERNEL /* XXX */
5548a02f 27#include <machine/cpu.h> /* XXX */
fe663dea
CT
28#endif /* XXX */
29
30/*
31 * Round p (pointer or byte index) up to a correctly-aligned value for
32 * the machine's strictest data type. The result is u_int and must be
33 * cast to any desired pointer type.
34 */
35#define ALIGNBYTES 7
36#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES)
37
38#define NBPG 4096 /* bytes/page */
39#define PGOFSET (NBPG-1) /* byte offset into page */
40#define PGSHIFT 12 /* log2(NBPG) */
41
42#define KERNBASE 0xf8000000 /* start of kernel virtual space */
43#define KERNTEXTOFF 0xf8004000 /* start of kernel text */
44#define BTOPKERNBASE ((u_long)KERNBASE >> PG_SHIFT)
45
46#define DEV_BSIZE 512
47#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
48#define BLKDEV_IOSIZE 2048
49#define MAXPHYS (64 * 1024)
50
51#define CLSIZE 1
52#define CLSIZELOG2 0
53
54/* NOTE: SSIZE and UPAGES must be multiples of CLSIZE */
55#define SSIZE 1 /* initial stack size/NBPG */
56#define UPAGES 2 /* pages of u-area */
57
58/*
59 * Constants related to network buffer management.
60 * MCLBYTES must be no larger than CLBYTES (the software page size), and,
61 * on machines that exchange pages of input or output buffers with mbuf
62 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
63 * of the hardware page size.
64 */
65#define MSIZE 128 /* size of an mbuf */
66#define MCLBYTES 2048 /* enough for whole Ethernet packet */
67#define MCLSHIFT 11 /* log2(MCLBYTES) */
68#define MCLOFSET (MCLBYTES - 1)
69
70#ifndef NMBCLUSTERS
71#ifdef GATEWAY
72#define NMBCLUSTERS 512 /* map size, max cluster allocation */
73#else
74#define NMBCLUSTERS 256 /* map size, max cluster allocation */
75#endif
76#endif
77
78/*
79 * Size of kernel malloc arena in CLBYTES-sized logical pages.
80 */
81#ifndef NKMEMCLUSTERS
dc41e9e6 82#define NKMEMCLUSTERS (6 * 1024 * 1024 / CLBYTES)
fe663dea
CT
83#endif
84
85/* pages ("clicks") (4096 bytes) to disk blocks */
86#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
87#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
88#define dtob(x) ((x) << DEV_BSHIFT)
89
90/* pages to bytes */
91#define ctob(x) ((x) << PGSHIFT)
92
93/* bytes to pages */
94#define btoc(x) (((unsigned)(x) + PGOFSET) >> PGSHIFT)
95
96#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
97 ((unsigned)(bytes) >> DEV_BSHIFT)
98#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
99 ((unsigned)(db) << DEV_BSHIFT)
100
101/*
102 * Map a ``block device block'' to a file system block.
103 * This should be device dependent, and should use the bsize
104 * field from the disk label.
105 * For now though just use DEV_BSIZE.
106 */
107#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE / DEV_BSIZE))
108
109#ifdef KERNEL
110#ifndef LOCORE
111#define DELAY(n) delay(n)
112#endif
113#else
114#define DELAY(n) { register volatile int N = (n); while (--N > 0); }
115#endif