1*52131Smckusick /* 2*52131Smckusick * Copyright (c) 1988 University of Utah. 3*52131Smckusick * Copyright (c) 1992 The Regents of the University of California. 4*52131Smckusick * All rights reserved. 5*52131Smckusick * 6*52131Smckusick * This code is derived from software contributed to Berkeley by 7*52131Smckusick * the Systems Programming Group of the University of Utah Computer 8*52131Smckusick * Science Department and Ralph Campbell. 9*52131Smckusick * 10*52131Smckusick * %sccs.include.redist.c% 11*52131Smckusick * 12*52131Smckusick * from: Utah $Hdr: machparam.h 1.11 89/08/14$ 13*52131Smckusick * 14*52131Smckusick * @(#)param.h 7.1 (Berkeley) 01/07/92 15*52131Smckusick */ 16*52131Smckusick 17*52131Smckusick /* 18*52131Smckusick * Machine dependent constants for DEC Station 3100. 19*52131Smckusick */ 20*52131Smckusick #define MACHINE "mips" 21*52131Smckusick #define COFF 22*52131Smckusick 23*52131Smckusick #define NBPG 4096 /* bytes/page */ 24*52131Smckusick #define PGOFSET (NBPG-1) /* byte offset into page */ 25*52131Smckusick #define PGSHIFT 12 /* LOG2(NBPG) */ 26*52131Smckusick #define NPTEPG (NBPG/4) 27*52131Smckusick 28*52131Smckusick #define KERNBASE 0x80000000 /* start of kernel virtual */ 29*52131Smckusick #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 30*52131Smckusick 31*52131Smckusick #define DEV_BSIZE 512 32*52131Smckusick #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 33*52131Smckusick #define BLKDEV_IOSIZE 2048 34*52131Smckusick #define MAXPHYS (24 * 1024) /* max raw I/O transfer size */ 35*52131Smckusick 36*52131Smckusick #define CLSIZE 1 37*52131Smckusick #define CLSIZELOG2 0 38*52131Smckusick 39*52131Smckusick /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ 40*52131Smckusick #define SSIZE 1 /* initial stack size/NBPG */ 41*52131Smckusick #define SINCR 1 /* increment of stack/NBPG */ 42*52131Smckusick 43*52131Smckusick #define UPAGES 2 /* pages of u-area */ 44*52131Smckusick #define UADDR 0xffffc000 /* address of u */ 45*52131Smckusick #define UVPN (UADDR>>PGSHIFT)/* virtual page number of u */ 46*52131Smckusick #define KERNELSTACK (UADDR+UPAGES*NBPG) /* top of kernel stack */ 47*52131Smckusick 48*52131Smckusick /* 49*52131Smckusick * Constants related to network buffer management. 50*52131Smckusick * MCLBYTES must be no larger than CLBYTES (the software page size), and, 51*52131Smckusick * on machines that exchange pages of input or output buffers with mbuf 52*52131Smckusick * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 53*52131Smckusick * of the hardware page size. 54*52131Smckusick */ 55*52131Smckusick #define MSIZE 128 /* size of an mbuf */ 56*52131Smckusick #define MCLBYTES 1024 57*52131Smckusick #define MCLSHIFT 10 58*52131Smckusick #define MCLOFSET (MCLBYTES - 1) 59*52131Smckusick #ifndef NMBCLUSTERS 60*52131Smckusick #ifdef GATEWAY 61*52131Smckusick #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 62*52131Smckusick #else 63*52131Smckusick #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 64*52131Smckusick #endif 65*52131Smckusick #endif 66*52131Smckusick 67*52131Smckusick /* 68*52131Smckusick * Size of kernel malloc arena in CLBYTES-sized logical pages 69*52131Smckusick */ 70*52131Smckusick #ifndef NKMEMCLUSTERS 71*52131Smckusick #define NKMEMCLUSTERS (512*1024/CLBYTES) 72*52131Smckusick #endif 73*52131Smckusick 74*52131Smckusick /* pages ("clicks") (4096 bytes) to disk blocks */ 75*52131Smckusick #define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT)) 76*52131Smckusick #define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT)) 77*52131Smckusick #define dtob(x) ((x)<<DEV_BSHIFT) 78*52131Smckusick 79*52131Smckusick /* pages to bytes */ 80*52131Smckusick #define ctob(x) ((x)<<PGSHIFT) 81*52131Smckusick 82*52131Smckusick /* bytes to pages */ 83*52131Smckusick #define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT) 84*52131Smckusick 85*52131Smckusick #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 86*52131Smckusick ((unsigned)(bytes) >> DEV_BSHIFT) 87*52131Smckusick #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 88*52131Smckusick ((unsigned)(db) << DEV_BSHIFT) 89*52131Smckusick 90*52131Smckusick /* 91*52131Smckusick * Map a ``block device block'' to a file system block. 92*52131Smckusick * This should be device dependent, and should use the bsize 93*52131Smckusick * field from the disk label. 94*52131Smckusick * For now though just use DEV_BSIZE. 95*52131Smckusick */ 96*52131Smckusick #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 97*52131Smckusick 98*52131Smckusick /* 99*52131Smckusick * Mach derived conversion macros 100*52131Smckusick */ 101*52131Smckusick #define pmax_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) 102*52131Smckusick #define pmax_trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) 103*52131Smckusick #define pmax_btop(x) ((unsigned)(x) >> PGSHIFT) 104*52131Smckusick #define pmax_ptob(x) ((unsigned)(x) << PGSHIFT) 105*52131Smckusick 106*52131Smckusick #ifdef KERNEL 107*52131Smckusick #ifndef LOCORE 108*52131Smckusick extern int cpuspeed; 109*52131Smckusick #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } 110*52131Smckusick #endif 111*52131Smckusick 112*52131Smckusick #else /* !KERNEL */ 113*52131Smckusick #define DELAY(n) { register int N = (n); while (--N > 0); } 114*52131Smckusick #endif /* !KERNEL */ 115