xref: /csrg-svn/sys/vax/include/param.h (revision 53670)
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*53670Sbostic  *	@(#)param.h	7.22 (Berkeley) 05/26/92
823264Smckusick  */
99118Ssam 
109118Ssam /*
1133278Sbostic  * Machine dependent constants for VAX.
129118Ssam  */
1331162Sbostic #define	MACHINE	"vax"
1431162Sbostic 
1540721Skarels /*
1652586Sbostic  * Round p (pointer or byte index) up to a correctly-aligned value for all
1752586Sbostic  * data types (int, long, ...).   The result is u_int and must be cast to
1852586Sbostic  * any desired pointer type.
1940721Skarels  */
20*53670Sbostic #define	ALIGNBYTES	3
21*53670Sbostic #define	ALIGN(p)	(((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
2240721Skarels 
2330407Skarels #define	NBPG		512		/* bytes/page */
2430407Skarels #define	PGOFSET		(NBPG-1)	/* byte offset into page */
2530407Skarels #define	PGSHIFT		9		/* LOG2(NBPG) */
2630407Skarels #define	NPTEPG		(NBPG/(sizeof (struct pte)))
279118Ssam 
2833278Sbostic #define	KERNBASE	0x80000000	/* start of kernel virtual */
2940211Smarc #define	KERNTEXTOFF	KERNBASE	/* start of kernel text */
3033278Sbostic #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
3133278Sbostic 
3230407Skarels #define	DEV_BSIZE	512
3330407Skarels #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
3430407Skarels #define BLKDEV_IOSIZE	2048
3530766Skarels #define	MAXPHYS		(63 * 1024)	/* max raw I/O transfer size */
3630407Skarels 
379118Ssam #define	CLSIZE		2
389118Ssam #define	CLSIZELOG2	1
399118Ssam 
4048794Sbostic /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
4130407Skarels #define	SSIZE		4		/* initial stack size/NBPG */
4230407Skarels #define	SINCR		4		/* increment of stack/NBPG */
439118Ssam 
4439820Smckusick #define	UPAGES		16		/* pages of u-area */
459118Ssam 
469118Ssam /*
4738966Skarels  * Constants related to network buffer management.
4838966Skarels  * MCLBYTES must be no larger than CLBYTES (the software page size), and,
4938966Skarels  * on machines that exchange pages of input or output buffers with mbuf
5038966Skarels  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
5138966Skarels  * of the hardware page size.
5238966Skarels  */
5338966Skarels #define	MSIZE		128		/* size of an mbuf */
5438966Skarels #define	MAPPED_MBUFS			/* can do scatter-gather I/O */
5538966Skarels #if CLBYTES > 1024
5638966Skarels #define	MCLBYTES	1024
5738966Skarels #define	MCLSHIFT	10
5838966Skarels #define	MCLOFSET	(MCLBYTES - 1)
5938966Skarels #else
6038966Skarels #define	MCLBYTES	CLBYTES
6138966Skarels #define	MCLSHIFT	CLSHIFT
6238966Skarels #define	MCLOFSET	CLOFSET
6338966Skarels #endif
6438966Skarels #ifdef GATEWAY
6538966Skarels #define	NMBCLUSTERS	512		/* map size, max cluster allocation */
6638966Skarels #else
6738966Skarels #define	NMBCLUSTERS	256		/* map size, max cluster allocation */
6838966Skarels #endif
6938966Skarels 
7038966Skarels /*
7141523Smckusick  * Size of kernel malloc arena in CLBYTES-sized logical pages
7241523Smckusick  */
7341523Smckusick #ifndef NKMEMCLUSTERS
7441523Smckusick #define	NKMEMCLUSTERS	(512*1024/CLBYTES)
7541523Smckusick #endif
7641523Smckusick 
7741523Smckusick /*
789118Ssam  * Some macros for units conversion
799118Ssam  */
809118Ssam /* Core clicks (512 bytes) to segments and vice versa */
819118Ssam #define	ctos(x)	(x)
829118Ssam #define	stoc(x)	(x)
839118Ssam 
849118Ssam /* Core clicks (512 bytes) to disk blocks */
859118Ssam #define	ctod(x)	(x)
869118Ssam #define	dtoc(x)	(x)
8730766Skarels #define	dtob(x)	((x)<<PGSHIFT)
889118Ssam 
899118Ssam /* clicks to bytes */
909118Ssam #define	ctob(x)	((x)<<9)
919118Ssam 
929118Ssam /* bytes to clicks */
939118Ssam #define	btoc(x)	((((unsigned)(x)+511)>>9))
949118Ssam 
9530407Skarels #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
9630407Skarels 	((unsigned)(bytes) >> DEV_BSHIFT)
9730407Skarels #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
9830407Skarels 	((unsigned)(db) << DEV_BSHIFT)
9930407Skarels 
1009118Ssam /*
10130407Skarels  * Map a ``block device block'' to a file system block.
10230407Skarels  * This should be device dependent, and will be if we
10330407Skarels  * add an entry to cdevsw/bdevsw for that purpose.
10430407Skarels  * For now though just use DEV_BSIZE.
10530407Skarels  */
10630407Skarels #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
10730407Skarels 
10830407Skarels /*
1099118Ssam  * Macros to decode processor status word.
1109118Ssam  */
1119118Ssam #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
1129600Ssam #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
1139118Ssam 
11424887Skarels #ifdef KERNEL
11524887Skarels #ifndef LOCORE
11624887Skarels int	cpuspeed;
11729953Skarels #define	DELAY(n)	{ register int N = cpuspeed * (n); while (--N > 0); }
11824887Skarels #endif
11924887Skarels 
12050032Sbostic #else
1219118Ssam #define	DELAY(n)	{ register int N = (n); while (--N > 0); }
12250032Sbostic #endif
123