xref: /original-bsd/sys/news3400/include/param.h (revision 3f14a87d)
1 /*
2  * Copyright (c) 1988 University of Utah.
3  * Copyright (c) 1992 The Regents of the University of California.
4  * All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * the Systems Programming Group of the University of Utah Computer
8  * Science Department and Ralph Campbell.
9  *
10  * %sccs.include.redist.c%
11  *
12  * from: Utah $Hdr: machparam.h 1.11 89/08/14$
13  *
14  *	@(#)param.h	7.5 (Berkeley) 03/09/93
15  */
16 
17 /*
18  * Machine dependent constants for DEC Station 3100.
19  */
20 #define	MACHINE	"news3400"
21 #define COFF
22 
23 /*
24  * Round p (pointer or byte index) up to a correctly-aligned value for all
25  * data types (int, long, ...).   The result is u_int and must be cast to
26  * any desired pointer type.
27  */
28 #define	ALIGNBYTES	7
29 #define	ALIGN(p)	(((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
30 
31 #define	NBPG		4096		/* bytes/page */
32 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
33 #define	PGSHIFT		12		/* LOG2(NBPG) */
34 #define	NPTEPG		(NBPG/4)
35 
36 #define	KERNBASE	0x80000000	/* start of kernel virtual */
37 #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
38 
39 #define	DEV_BSIZE	512
40 #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
41 #define BLKDEV_IOSIZE	2048
42 #define	MAXPHYS		(24 * 1024)	/* max raw I/O transfer size */
43 
44 #define	CLSIZE		1
45 #define	CLSIZELOG2	0
46 
47 /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
48 #define	SSIZE		1		/* initial stack size/NBPG */
49 #define	SINCR		1		/* increment of stack/NBPG */
50 
51 #define	UPAGES		2		/* pages of u-area */
52 #define	UADDR		0xffffd000	/* address of u */
53 #define	UVPN		(UADDR>>PGSHIFT)/* virtual page number of u */
54 #define	KERNELSTACK	(UADDR+UPAGES*NBPG)	/* top of kernel stack */
55 
56 /*
57  * Constants related to network buffer management.
58  * MCLBYTES must be no larger than CLBYTES (the software page size), and,
59  * on machines that exchange pages of input or output buffers with mbuf
60  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
61  * of the hardware page size.
62  */
63 #define	MSIZE		128		/* size of an mbuf */
64 #define	MCLBYTES	1024
65 #define	MCLSHIFT	10
66 #define	MCLOFSET	(MCLBYTES - 1)
67 #ifndef NMBCLUSTERS
68 #ifdef GATEWAY
69 #define	NMBCLUSTERS	512		/* map size, max cluster allocation */
70 #else
71 #define	NMBCLUSTERS	256		/* map size, max cluster allocation */
72 #endif
73 #endif
74 
75 /*
76  * Size of kernel malloc arena in CLBYTES-sized logical pages
77  */
78 #ifndef NKMEMCLUSTERS
79 #define	NKMEMCLUSTERS	(2048*1024/CLBYTES)
80 #endif
81 
82 /* pages ("clicks") (4096 bytes) to disk blocks */
83 #define	ctod(x)	((x)<<(PGSHIFT-DEV_BSHIFT))
84 #define	dtoc(x)	((x)>>(PGSHIFT-DEV_BSHIFT))
85 #define	dtob(x)	((x)<<DEV_BSHIFT)
86 
87 /* pages to bytes */
88 #define	ctob(x)	((x)<<PGSHIFT)
89 
90 /* bytes to pages */
91 #define	btoc(x)	(((unsigned)(x)+(NBPG-1))>>PGSHIFT)
92 
93 #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
94 	((unsigned)(bytes) >> DEV_BSHIFT)
95 #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
96 	((unsigned)(db) << DEV_BSHIFT)
97 
98 /*
99  * Map a ``block device block'' to a file system block.
100  * This should be device dependent, and should use the bsize
101  * field from the disk label.
102  * For now though just use DEV_BSIZE.
103  */
104 #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
105 
106 /*
107  * Mach derived conversion macros
108  */
109 #define pmax_round_page(x)	((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
110 #define pmax_trunc_page(x)	((unsigned)(x) & ~(NBPG-1))
111 #define pmax_btop(x)		((unsigned)(x) >> PGSHIFT)
112 #define pmax_ptob(x)		((unsigned)(x) << PGSHIFT)
113 
114 #ifdef news3400
115 #define	splnet		spl2
116 #define	splsoftclock	spl2
117 #define	splbio		spl3
118 #define	spltty		spl4
119 #define	splimp		spl4
120 #define	splclock	spl5
121 #define	splstatclock	spl5
122 #endif /* news3400 */
123 
124 #ifdef KERNEL
125 #ifndef LOCORE
126 extern	int cpuspeed;
127 #define	DELAY(n)	{ register int N = cpuspeed * (n) / 2; while (--N > 0); }
128 #endif
129 #else /* !KERNEL */
130 #define	DELAY(n)	{ register int N = (n); while (--N > 0); }
131 #endif /* !KERNEL */
132 
133 #ifndef LOCORE
134 extern int	intrcnt[];
135 extern char	*intrnames[];
136 #endif /* !LOCORE */
137 
138 #define	INTR_CLOCK	0
139 #define	INTR_SOFTCLK	1
140 #define	INTR_SOFTINT	2
141 #define	INTR_AST	3
142 #define	INTR_SCSI00	4
143 #define	INTR_SCSI01	5
144 #define	INTR_SCSI02	6
145 #define	INTR_SCSI03	7
146 #define	INTR_SCSI04	8
147 #define	INTR_SCSI05	9
148 #define	INTR_SCSI06	10
149 #define	INTR_SCSI07	11
150 #define	INTR_SCSI10	12
151 #define	INTR_SCSI11	13
152 #define	INTR_SCSI12	14
153 #define	INTR_SCSI13	15
154 #define	INTR_SCSI14	16
155 #define	INTR_SCSI15	17
156 #define	INTR_SCSI16	18
157 #define	INTR_SCSI17	19
158 #define	INTR_ETHER0	20
159 #define	INTR_ETHER1	21
160 #define	INTR_ETHER2	22
161 #define	INTR_VME2	23
162 #define	INTR_VME4	24
163 #define	INTR_RS0	25
164 #define	INTR_RS1	26
165 #define	INTR_RS2	27
166 #define	INTR_RS3	28
167 #define	INTR_RS4	29
168 #define	INTR_RS5	30
169 #define	INTR_RS6	31
170 #define	INTR_RS7	32
171 #define	INTR_RS8	33
172 #define	INTR_RS9	34
173 #define	INTR_RS10	35
174 #define	INTR_RS11	36
175 #define	INTR_PRINTER	37
176 #define	INTR_FD		38
177 #define	INTR_AUDIO	39
178 #define	INTR_KEYBOARD	40
179 #define	INTR_MOUSE	41
180 #define	INTR_BITMAP	42
181 #define	INTR_FDDI	43
182 #define INTR_RENDER	44
183 
184 #define	NINTRSLOT	45		/* # of intrcnt[] slot */
185