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