xref: /csrg-svn/sys/tahoe/include/param.h (revision 38968)
133282Skarels /*
234408Skarels  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
333282Skarels  * All rights reserved.  The Berkeley software License Agreement
433282Skarels  * specifies the terms and conditions for redistribution.
533282Skarels  *
6*38968Skarels  *	@(#)param.h	7.2 (Berkeley) 09/04/89
733282Skarels  */
825681Ssam 
925681Ssam /*
1025681Ssam  * Machine dependent constants for TAHOE.
1125681Ssam  */
1231163Sbostic #define	MACHINE	"tahoe"
1331163Sbostic 
1433380Skarels #ifndef BYTE_ORDER
1533282Skarels #include <machine/endian.h>
1633282Skarels #endif
1733282Skarels 
18*38968Skarels #include <machine/machlimits.h>
1932564Sbostic 
2030407Skarels #define	NBPG		1024		/* bytes/page */
2130407Skarels #define	PGOFSET		(NBPG-1)	/* byte offset into page */
2230407Skarels #define	PGSHIFT		10		/* LOG2(NBPG) */
2330407Skarels #define	NPTEPG		(NBPG/(sizeof (struct pte)))
2425681Ssam 
2530752Skarels #define	KERNBASE	0xc0000000	/* start of kernel virtual */
2630752Skarels #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
2730752Skarels 
2830407Skarels #define	DEV_BSIZE	1024
2930407Skarels #define	DEV_BSHIFT	10		/* log2(DEV_BSIZE) */
3030407Skarels #define BLKDEV_IOSIZE	1024		/* NBPG for physical controllers */
3130752Skarels #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
3230407Skarels 
3325681Ssam #define	CLSIZE		1
3425681Ssam #define	CLSIZELOG2	0
3525681Ssam 
3630407Skarels #define	SSIZE		2		/* initial stack size/NBPG */
3730407Skarels #define	SINCR		2		/* increment of stack/NBPG */
3830407Skarels #define	UPAGES		6		/* pages of u-area (2 stack pages) */
3925681Ssam 
40*38968Skarels /*
41*38968Skarels  * Constants related to network buffer management.
42*38968Skarels  * MCLBYTES must be no larger than CLBYTES (the software page size), and,
43*38968Skarels  * on machines that exchange pages of input or output buffers with mbuf
44*38968Skarels  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
45*38968Skarels  * of the hardware page size.
46*38968Skarels  */
47*38968Skarels #define	MSIZE		128		/* size of an mbuf */
48*38968Skarels #define	MAPPED_MBUFS			/* can do scatter-gather I/O */
49*38968Skarels #if CLBYTES > 1024
50*38968Skarels #define	MCLBYTES	1024
51*38968Skarels #define	MCLSHIFT	10
52*38968Skarels #define	MCLOFSET	(MCLBYTES - 1)
53*38968Skarels #else
54*38968Skarels #define	MCLBYTES	CLBYTES
55*38968Skarels #define	MCLSHIFT	CLSHIFT
56*38968Skarels #define	MCLOFSET	CLOFSET
57*38968Skarels #endif
58*38968Skarels #ifdef GATEWAY
59*38968Skarels #define	NMBCLUSTERS	512		/* map size, max cluster allocation */
60*38968Skarels #else
61*38968Skarels #define	NMBCLUSTERS	256		/* map size, max cluster allocation */
62*38968Skarels #endif
63*38968Skarels 
6425681Ssam #define	MAXCKEY	255		/* maximal allowed code key */
6525681Ssam #define	MAXDKEY	255		/* maximal allowed data key */
6625681Ssam #define	NCKEY	(MAXCKEY+1)	/* # code keys, including 0 (reserved) */
6725681Ssam #define	NDKEY	(MAXDKEY+1)	/* # data keys, including 0 (reserved) */
6825681Ssam 
6925681Ssam /*
7025681Ssam  * Some macros for units conversion
7125681Ssam  */
7225681Ssam /* Core clicks (1024 bytes) to segments and vice versa */
7325681Ssam #define	ctos(x)	(x)
7425681Ssam #define	stoc(x)	(x)
7525681Ssam 
7625681Ssam /* Core clicks (1024 bytes) to disk blocks */
7725681Ssam #define	ctod(x)	(x)
7825681Ssam #define	dtoc(x)	(x)
7925681Ssam #define	dtob(x)	((x)<<PGSHIFT)
8025681Ssam 
8125681Ssam /* clicks to bytes */
8225681Ssam #define	ctob(x)	((x)<<PGSHIFT)
8325681Ssam 
8425681Ssam /* bytes to clicks */
8525681Ssam #define	btoc(x)	((((unsigned)(x)+NBPG-1) >> PGSHIFT))
8625681Ssam 
8730407Skarels #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
8830407Skarels 	((unsigned)(bytes) >> DEV_BSHIFT)
8930407Skarels #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
9030407Skarels 	((unsigned)(db) << DEV_BSHIFT)
9130407Skarels 
9225681Ssam /*
9330407Skarels  * Map a ``block device block'' to a file system block.
9430407Skarels  * This should be device dependent, and will be if we
9530407Skarels  * add an entry to cdevsw/bdevsw for that purpose.
9630407Skarels  * For now though just use DEV_BSIZE.
9730407Skarels  */
9830407Skarels #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
9930407Skarels 
10030407Skarels /*
10125681Ssam  * Macros to decode processor status word.
10225681Ssam  */
10325681Ssam #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
10425681Ssam #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
10525681Ssam 
10625681Ssam #define	DELAY(n)	{ register int N = 3*(n); while (--N > 0); }
107