xref: /csrg-svn/sys/vax/include/param.h (revision 52586)
149436Sbostic /*-
249436Sbostic  * Copyright (c) 1982, 1986 The Regents of the University of California.
349436Sbostic  * All rights reserved.
423264Smckusick  *
549436Sbostic  * %sccs.include.proprietary.c%
649436Sbostic  *
7*52586Sbostic  *	@(#)param.h	7.21 (Berkeley) 02/19/92
823264Smckusick  */
99118Ssam 
109118Ssam /*
1133278Sbostic  * Machine dependent constants for VAX.
129118Ssam  */
1331162Sbostic #define	MACHINE	"vax"
1431162Sbostic 
1540721Skarels /*
16*52586Sbostic  * Round p (pointer or byte index) up to a correctly-aligned value for all
17*52586Sbostic  * data types (int, long, ...).   The result is u_int and must be cast to
18*52586Sbostic  * any desired pointer type.
1940721Skarels  */
20*52586Sbostic #define	ALIGN(p)	(((u_int)(p) + 3) &~ 3)
2140721Skarels 
2230407Skarels #define	NBPG		512		/* bytes/page */
2330407Skarels #define	PGOFSET		(NBPG-1)	/* byte offset into page */
2430407Skarels #define	PGSHIFT		9		/* LOG2(NBPG) */
2530407Skarels #define	NPTEPG		(NBPG/(sizeof (struct pte)))
269118Ssam 
2733278Sbostic #define	KERNBASE	0x80000000	/* start of kernel virtual */
2840211Smarc #define	KERNTEXTOFF	KERNBASE	/* start of kernel text */
2933278Sbostic #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
3033278Sbostic 
3130407Skarels #define	DEV_BSIZE	512
3230407Skarels #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
3330407Skarels #define BLKDEV_IOSIZE	2048
3430766Skarels #define	MAXPHYS		(63 * 1024)	/* max raw I/O transfer size */
3530407Skarels 
369118Ssam #define	CLSIZE		2
379118Ssam #define	CLSIZELOG2	1
389118Ssam 
3948794Sbostic /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
4030407Skarels #define	SSIZE		4		/* initial stack size/NBPG */
4130407Skarels #define	SINCR		4		/* increment of stack/NBPG */
429118Ssam 
4339820Smckusick #define	UPAGES		16		/* pages of u-area */
449118Ssam 
459118Ssam /*
4638966Skarels  * Constants related to network buffer management.
4738966Skarels  * MCLBYTES must be no larger than CLBYTES (the software page size), and,
4838966Skarels  * on machines that exchange pages of input or output buffers with mbuf
4938966Skarels  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
5038966Skarels  * of the hardware page size.
5138966Skarels  */
5238966Skarels #define	MSIZE		128		/* size of an mbuf */
5338966Skarels #define	MAPPED_MBUFS			/* can do scatter-gather I/O */
5438966Skarels #if CLBYTES > 1024
5538966Skarels #define	MCLBYTES	1024
5638966Skarels #define	MCLSHIFT	10
5738966Skarels #define	MCLOFSET	(MCLBYTES - 1)
5838966Skarels #else
5938966Skarels #define	MCLBYTES	CLBYTES
6038966Skarels #define	MCLSHIFT	CLSHIFT
6138966Skarels #define	MCLOFSET	CLOFSET
6238966Skarels #endif
6338966Skarels #ifdef GATEWAY
6438966Skarels #define	NMBCLUSTERS	512		/* map size, max cluster allocation */
6538966Skarels #else
6638966Skarels #define	NMBCLUSTERS	256		/* map size, max cluster allocation */
6738966Skarels #endif
6838966Skarels 
6938966Skarels /*
7041523Smckusick  * Size of kernel malloc arena in CLBYTES-sized logical pages
7141523Smckusick  */
7241523Smckusick #ifndef NKMEMCLUSTERS
7341523Smckusick #define	NKMEMCLUSTERS	(512*1024/CLBYTES)
7441523Smckusick #endif
7541523Smckusick 
7641523Smckusick /*
779118Ssam  * Some macros for units conversion
789118Ssam  */
799118Ssam /* Core clicks (512 bytes) to segments and vice versa */
809118Ssam #define	ctos(x)	(x)
819118Ssam #define	stoc(x)	(x)
829118Ssam 
839118Ssam /* Core clicks (512 bytes) to disk blocks */
849118Ssam #define	ctod(x)	(x)
859118Ssam #define	dtoc(x)	(x)
8630766Skarels #define	dtob(x)	((x)<<PGSHIFT)
879118Ssam 
889118Ssam /* clicks to bytes */
899118Ssam #define	ctob(x)	((x)<<9)
909118Ssam 
919118Ssam /* bytes to clicks */
929118Ssam #define	btoc(x)	((((unsigned)(x)+511)>>9))
939118Ssam 
9430407Skarels #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
9530407Skarels 	((unsigned)(bytes) >> DEV_BSHIFT)
9630407Skarels #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
9730407Skarels 	((unsigned)(db) << DEV_BSHIFT)
9830407Skarels 
999118Ssam /*
10030407Skarels  * Map a ``block device block'' to a file system block.
10130407Skarels  * This should be device dependent, and will be if we
10230407Skarels  * add an entry to cdevsw/bdevsw for that purpose.
10330407Skarels  * For now though just use DEV_BSIZE.
10430407Skarels  */
10530407Skarels #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
10630407Skarels 
10730407Skarels /*
1089118Ssam  * Macros to decode processor status word.
1099118Ssam  */
1109118Ssam #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
1119600Ssam #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
1129118Ssam 
11324887Skarels #ifdef KERNEL
11424887Skarels #ifndef LOCORE
11524887Skarels int	cpuspeed;
11629953Skarels #define	DELAY(n)	{ register int N = cpuspeed * (n); while (--N > 0); }
11724887Skarels #endif
11824887Skarels 
11950032Sbostic #else
1209118Ssam #define	DELAY(n)	{ register int N = (n); while (--N > 0); }
12150032Sbostic #endif
122