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*53716Smckusick * @(#)param.h 7.5 (Berkeley) 05/28/92 1552131Smckusick */ 1652131Smckusick 1752131Smckusick /* 1852131Smckusick * Machine dependent constants for DEC Station 3100. 1952131Smckusick */ 2052131Smckusick #define MACHINE "mips" 2152131Smckusick #define COFF 2252131Smckusick 2352941Sralph /* 2452941Sralph * Round p (pointer or byte index) up to a correctly-aligned value for all 2552941Sralph * data types (int, long, ...). The result is u_int and must be cast to 2652941Sralph * any desired pointer type. 2752941Sralph */ 2853674Sbostic #define ALIGNBYTES 3 2953674Sbostic #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES) 3052941Sralph 3152131Smckusick #define NBPG 4096 /* bytes/page */ 3252131Smckusick #define PGOFSET (NBPG-1) /* byte offset into page */ 3352131Smckusick #define PGSHIFT 12 /* LOG2(NBPG) */ 3452131Smckusick #define NPTEPG (NBPG/4) 3552131Smckusick 3652131Smckusick #define KERNBASE 0x80000000 /* start of kernel virtual */ 3752131Smckusick #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 3852131Smckusick 3952131Smckusick #define DEV_BSIZE 512 4052131Smckusick #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 4152131Smckusick #define BLKDEV_IOSIZE 2048 4252131Smckusick #define MAXPHYS (24 * 1024) /* max raw I/O transfer size */ 4352131Smckusick 4452131Smckusick #define CLSIZE 1 4552131Smckusick #define CLSIZELOG2 0 4652131Smckusick 4752131Smckusick /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ 4852131Smckusick #define SSIZE 1 /* initial stack size/NBPG */ 4952131Smckusick #define SINCR 1 /* increment of stack/NBPG */ 5052131Smckusick 5152131Smckusick #define UPAGES 2 /* pages of u-area */ 52*53716Smckusick #define UADDR 0xffffd000 /* address of u */ 5352131Smckusick #define UVPN (UADDR>>PGSHIFT)/* virtual page number of u */ 5452131Smckusick #define KERNELSTACK (UADDR+UPAGES*NBPG) /* top of kernel stack */ 5552131Smckusick 5652131Smckusick /* 5752131Smckusick * Constants related to network buffer management. 5852131Smckusick * MCLBYTES must be no larger than CLBYTES (the software page size), and, 5952131Smckusick * on machines that exchange pages of input or output buffers with mbuf 6052131Smckusick * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 6152131Smckusick * of the hardware page size. 6252131Smckusick */ 6352131Smckusick #define MSIZE 128 /* size of an mbuf */ 6452131Smckusick #define MCLBYTES 1024 6552131Smckusick #define MCLSHIFT 10 6652131Smckusick #define MCLOFSET (MCLBYTES - 1) 6752131Smckusick #ifndef NMBCLUSTERS 6852131Smckusick #ifdef GATEWAY 6952131Smckusick #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 7052131Smckusick #else 7152131Smckusick #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 7252131Smckusick #endif 7352131Smckusick #endif 7452131Smckusick 7552131Smckusick /* 7652131Smckusick * Size of kernel malloc arena in CLBYTES-sized logical pages 7752131Smckusick */ 7852131Smckusick #ifndef NKMEMCLUSTERS 7952131Smckusick #define NKMEMCLUSTERS (512*1024/CLBYTES) 8052131Smckusick #endif 8152131Smckusick 8252131Smckusick /* pages ("clicks") (4096 bytes) to disk blocks */ 8352131Smckusick #define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT)) 8452131Smckusick #define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT)) 8552131Smckusick #define dtob(x) ((x)<<DEV_BSHIFT) 8652131Smckusick 8752131Smckusick /* pages to bytes */ 8852131Smckusick #define ctob(x) ((x)<<PGSHIFT) 8952131Smckusick 9052131Smckusick /* bytes to pages */ 9152131Smckusick #define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT) 9252131Smckusick 9352131Smckusick #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 9452131Smckusick ((unsigned)(bytes) >> DEV_BSHIFT) 9552131Smckusick #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 9652131Smckusick ((unsigned)(db) << DEV_BSHIFT) 9752131Smckusick 9852131Smckusick /* 9952131Smckusick * Map a ``block device block'' to a file system block. 10052131Smckusick * This should be device dependent, and should use the bsize 10152131Smckusick * field from the disk label. 10252131Smckusick * For now though just use DEV_BSIZE. 10352131Smckusick */ 10452131Smckusick #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 10552131Smckusick 10652131Smckusick /* 10752131Smckusick * Mach derived conversion macros 10852131Smckusick */ 10952131Smckusick #define pmax_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) 11052131Smckusick #define pmax_trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) 11152131Smckusick #define pmax_btop(x) ((unsigned)(x) >> PGSHIFT) 11252131Smckusick #define pmax_ptob(x) ((unsigned)(x) << PGSHIFT) 11352131Smckusick 11452750Sralph #ifdef DS3100 11552750Sralph #define splnet() Mach_spl1() 11652750Sralph #define splbio() Mach_spl0() 11752750Sralph #define splimp() Mach_spl1() 11852750Sralph #define spltty() Mach_spl2() 11952750Sralph #define splclock() Mach_spl3() 12052750Sralph #endif /* DS3100 */ 12152750Sralph 12252750Sralph #ifdef DS5000 12352750Sralph #define splnet() Mach_spl0() 12452750Sralph #define splbio() Mach_spl0() 12552750Sralph #define splimp() Mach_spl0() 12652750Sralph #define spltty() Mach_spl0() 12752750Sralph #define splclock() Mach_spl1() 12852750Sralph #endif /* DS5000 */ 12952750Sralph 13052131Smckusick #ifdef KERNEL 13152131Smckusick #ifndef LOCORE 13252131Smckusick extern int cpuspeed; 13352131Smckusick #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } 13452131Smckusick #endif 13552131Smckusick 13652131Smckusick #else /* !KERNEL */ 13752131Smckusick #define DELAY(n) { register int N = (n); while (--N > 0); } 13852131Smckusick #endif /* !KERNEL */ 139