xref: /csrg-svn/sys/pmax/include/param.h (revision 52750)
152131Smckusick /*
252131Smckusick  * Copyright (c) 1988 University of Utah.
352131Smckusick  * Copyright (c) 1992 The Regents of the University of California.
452131Smckusick  * All rights reserved.
552131Smckusick  *
652131Smckusick  * This code is derived from software contributed to Berkeley by
752131Smckusick  * the Systems Programming Group of the University of Utah Computer
852131Smckusick  * Science Department and Ralph Campbell.
952131Smckusick  *
1052131Smckusick  * %sccs.include.redist.c%
1152131Smckusick  *
1252131Smckusick  * from: Utah $Hdr: machparam.h 1.11 89/08/14$
1352131Smckusick  *
14*52750Sralph  *	@(#)param.h	7.2 (Berkeley) 02/29/92
1552131Smckusick  */
1652131Smckusick 
1752131Smckusick /*
1852131Smckusick  * Machine dependent constants for DEC Station 3100.
1952131Smckusick  */
2052131Smckusick #define	MACHINE	"mips"
2152131Smckusick #define COFF
2252131Smckusick 
2352131Smckusick #define	NBPG		4096		/* bytes/page */
2452131Smckusick #define	PGOFSET		(NBPG-1)	/* byte offset into page */
2552131Smckusick #define	PGSHIFT		12		/* LOG2(NBPG) */
2652131Smckusick #define	NPTEPG		(NBPG/4)
2752131Smckusick 
2852131Smckusick #define	KERNBASE	0x80000000	/* start of kernel virtual */
2952131Smckusick #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
3052131Smckusick 
3152131Smckusick #define	DEV_BSIZE	512
3252131Smckusick #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
3352131Smckusick #define BLKDEV_IOSIZE	2048
3452131Smckusick #define	MAXPHYS		(24 * 1024)	/* max raw I/O transfer size */
3552131Smckusick 
3652131Smckusick #define	CLSIZE		1
3752131Smckusick #define	CLSIZELOG2	0
3852131Smckusick 
3952131Smckusick /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
4052131Smckusick #define	SSIZE		1		/* initial stack size/NBPG */
4152131Smckusick #define	SINCR		1		/* increment of stack/NBPG */
4252131Smckusick 
4352131Smckusick #define	UPAGES		2		/* pages of u-area */
4452131Smckusick #define	UADDR		0xffffc000	/* address of u */
4552131Smckusick #define	UVPN		(UADDR>>PGSHIFT)/* virtual page number of u */
4652131Smckusick #define	KERNELSTACK	(UADDR+UPAGES*NBPG)	/* top of kernel stack */
4752131Smckusick 
4852131Smckusick /*
4952131Smckusick  * Constants related to network buffer management.
5052131Smckusick  * MCLBYTES must be no larger than CLBYTES (the software page size), and,
5152131Smckusick  * on machines that exchange pages of input or output buffers with mbuf
5252131Smckusick  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
5352131Smckusick  * of the hardware page size.
5452131Smckusick  */
5552131Smckusick #define	MSIZE		128		/* size of an mbuf */
5652131Smckusick #define	MCLBYTES	1024
5752131Smckusick #define	MCLSHIFT	10
5852131Smckusick #define	MCLOFSET	(MCLBYTES - 1)
5952131Smckusick #ifndef NMBCLUSTERS
6052131Smckusick #ifdef GATEWAY
6152131Smckusick #define	NMBCLUSTERS	512		/* map size, max cluster allocation */
6252131Smckusick #else
6352131Smckusick #define	NMBCLUSTERS	256		/* map size, max cluster allocation */
6452131Smckusick #endif
6552131Smckusick #endif
6652131Smckusick 
6752131Smckusick /*
6852131Smckusick  * Size of kernel malloc arena in CLBYTES-sized logical pages
6952131Smckusick  */
7052131Smckusick #ifndef NKMEMCLUSTERS
7152131Smckusick #define	NKMEMCLUSTERS	(512*1024/CLBYTES)
7252131Smckusick #endif
7352131Smckusick 
7452131Smckusick /* pages ("clicks") (4096 bytes) to disk blocks */
7552131Smckusick #define	ctod(x)	((x)<<(PGSHIFT-DEV_BSHIFT))
7652131Smckusick #define	dtoc(x)	((x)>>(PGSHIFT-DEV_BSHIFT))
7752131Smckusick #define	dtob(x)	((x)<<DEV_BSHIFT)
7852131Smckusick 
7952131Smckusick /* pages to bytes */
8052131Smckusick #define	ctob(x)	((x)<<PGSHIFT)
8152131Smckusick 
8252131Smckusick /* bytes to pages */
8352131Smckusick #define	btoc(x)	(((unsigned)(x)+(NBPG-1))>>PGSHIFT)
8452131Smckusick 
8552131Smckusick #define	btodb(bytes)	 		/* calculates (bytes / DEV_BSIZE) */ \
8652131Smckusick 	((unsigned)(bytes) >> DEV_BSHIFT)
8752131Smckusick #define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
8852131Smckusick 	((unsigned)(db) << DEV_BSHIFT)
8952131Smckusick 
9052131Smckusick /*
9152131Smckusick  * Map a ``block device block'' to a file system block.
9252131Smckusick  * This should be device dependent, and should use the bsize
9352131Smckusick  * field from the disk label.
9452131Smckusick  * For now though just use DEV_BSIZE.
9552131Smckusick  */
9652131Smckusick #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
9752131Smckusick 
9852131Smckusick /*
9952131Smckusick  * Mach derived conversion macros
10052131Smckusick  */
10152131Smckusick #define pmax_round_page(x)	((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
10252131Smckusick #define pmax_trunc_page(x)	((unsigned)(x) & ~(NBPG-1))
10352131Smckusick #define pmax_btop(x)		((unsigned)(x) >> PGSHIFT)
10452131Smckusick #define pmax_ptob(x)		((unsigned)(x) << PGSHIFT)
10552131Smckusick 
106*52750Sralph #ifdef DS3100
107*52750Sralph #define splnet()        Mach_spl1()
108*52750Sralph #define splbio()        Mach_spl0()
109*52750Sralph #define splimp()        Mach_spl1()
110*52750Sralph #define spltty()        Mach_spl2()
111*52750Sralph #define splclock()      Mach_spl3()
112*52750Sralph #endif /* DS3100 */
113*52750Sralph 
114*52750Sralph #ifdef DS5000
115*52750Sralph #define splnet()        Mach_spl0()
116*52750Sralph #define splbio()        Mach_spl0()
117*52750Sralph #define splimp()        Mach_spl0()
118*52750Sralph #define spltty()        Mach_spl0()
119*52750Sralph #define splclock()      Mach_spl1()
120*52750Sralph #endif /* DS5000 */
121*52750Sralph 
12252131Smckusick #ifdef KERNEL
12352131Smckusick #ifndef LOCORE
12452131Smckusick extern	int cpuspeed;
12552131Smckusick #define	DELAY(n)	{ register int N = cpuspeed * (n); while (--N > 0); }
12652131Smckusick #endif
12752131Smckusick 
12852131Smckusick #else /* !KERNEL */
12952131Smckusick #define	DELAY(n)	{ register int N = (n); while (--N > 0); }
13052131Smckusick #endif /* !KERNEL */
131