xref: /csrg-svn/sys/vax/include/param.h (revision 40211)
1 /*
2  * Copyright (c) 1982, 1986 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)param.h	7.14 (Berkeley) 02/23/90
7  */
8 
9 /*
10  * Machine dependent constants for VAX.
11  */
12 #define	MACHINE	"vax"
13 
14 #ifndef BYTE_ORDER
15 #include <machine/endian.h>
16 #endif
17 
18 #include <machine/machlimits.h>
19 
20 #define	NBPG		512		/* bytes/page */
21 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
22 #define	PGSHIFT		9		/* LOG2(NBPG) */
23 #define	NPTEPG		(NBPG/(sizeof (struct pte)))
24 
25 #define	KERNBASE	0x80000000	/* start of kernel virtual */
26 #define	KERNTEXTOFF	KERNBASE	/* start of kernel text */
27 #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
28 
29 #define	DEV_BSIZE	512
30 #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
31 #define BLKDEV_IOSIZE	2048
32 #define	MAXPHYS		(63 * 1024)	/* max raw I/O transfer size */
33 
34 #define	CLSIZE		2
35 #define	CLSIZELOG2	1
36 
37 #define	SSIZE		4		/* initial stack size/NBPG */
38 #define	SINCR		4		/* increment of stack/NBPG */
39 
40 #define	UPAGES		16		/* pages of u-area */
41 
42 /*
43  * Constants related to network buffer management.
44  * MCLBYTES must be no larger than CLBYTES (the software page size), and,
45  * on machines that exchange pages of input or output buffers with mbuf
46  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
47  * of the hardware page size.
48  */
49 #define	MSIZE		128		/* size of an mbuf */
50 #define	MAPPED_MBUFS			/* can do scatter-gather I/O */
51 #if CLBYTES > 1024
52 #define	MCLBYTES	1024
53 #define	MCLSHIFT	10
54 #define	MCLOFSET	(MCLBYTES - 1)
55 #else
56 #define	MCLBYTES	CLBYTES
57 #define	MCLSHIFT	CLSHIFT
58 #define	MCLOFSET	CLOFSET
59 #endif
60 #ifdef GATEWAY
61 #define	NMBCLUSTERS	512		/* map size, max cluster allocation */
62 #else
63 #define	NMBCLUSTERS	256		/* map size, max cluster allocation */
64 #endif
65 
66 /*
67  * Some macros for units conversion
68  */
69 /* Core clicks (512 bytes) to segments and vice versa */
70 #define	ctos(x)	(x)
71 #define	stoc(x)	(x)
72 
73 /* Core clicks (512 bytes) to disk blocks */
74 #define	ctod(x)	(x)
75 #define	dtoc(x)	(x)
76 #define	dtob(x)	((x)<<PGSHIFT)
77 
78 /* clicks to bytes */
79 #define	ctob(x)	((x)<<9)
80 
81 /* bytes to clicks */
82 #define	btoc(x)	((((unsigned)(x)+511)>>9))
83 
84 #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
85 	((unsigned)(bytes) >> DEV_BSHIFT)
86 #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
87 	((unsigned)(db) << DEV_BSHIFT)
88 
89 /*
90  * Map a ``block device block'' to a file system block.
91  * This should be device dependent, and will be if we
92  * add an entry to cdevsw/bdevsw for that purpose.
93  * For now though just use DEV_BSIZE.
94  */
95 #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
96 
97 /*
98  * Macros to decode processor status word.
99  */
100 #define	USERMODE(ps)	(((ps) & PSL_CURMOD) == PSL_CURMOD)
101 #define	BASEPRI(ps)	(((ps) & PSL_IPL) == 0)
102 
103 #ifdef KERNEL
104 #ifndef LOCORE
105 int	cpuspeed;
106 #define	DELAY(n)	{ register int N = cpuspeed * (n); while (--N > 0); }
107 #endif
108 
109 #else KERNEL
110 #define	DELAY(n)	{ register int N = (n); while (--N > 0); }
111 #endif KERNEL
112