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