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