1 /* 2 * Copyright (c) 1988 University of Utah. 3 * Copyright (c) 1992, 1993 4 * The Regents of the University of California. 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 8.2 (Berkeley) 03/29/95 15 */ 16 17 /* 18 * Machine dependent constants for DEC Station 3100. 19 */ 20 #define MACHINE "news3400" 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 ALIGNBYTES 7 29 #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES) 30 31 #define NBPG 4096 /* bytes/page */ 32 #define PGOFSET (NBPG-1) /* byte offset into page */ 33 #define PGSHIFT 12 /* LOG2(NBPG) */ 34 #define NPTEPG (NBPG/4) 35 36 #define NBSEG 0x400000 /* bytes/segment */ 37 #define SEGOFSET (NBSEG-1) /* byte offset into segment */ 38 #define SEGSHIFT 22 /* LOG2(NBSEG) */ 39 40 #define KERNBASE 0x80000000 /* start of kernel virtual */ 41 #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 42 43 #define DEV_BSIZE 512 44 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 45 #define BLKDEV_IOSIZE 2048 46 #define MAXPHYS (128 * 1024) /* max raw I/O transfer size */ 47 48 #define CLSIZE 1 49 #define CLSIZELOG2 0 50 51 /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ 52 #define SSIZE 1 /* initial stack size/NBPG */ 53 #define SINCR 1 /* increment of stack/NBPG */ 54 55 #define UPAGES 2 /* pages of u-area */ 56 #define UADDR 0xffffd000 /* address of u */ 57 #define UVPN (UADDR>>PGSHIFT)/* virtual page number of u */ 58 #define KERNELSTACK (UADDR+UPAGES*NBPG) /* top of kernel stack */ 59 60 /* 61 * Constants related to network buffer management. 62 * MCLBYTES must be no larger than CLBYTES (the software page size), and, 63 * on machines that exchange pages of input or output buffers with mbuf 64 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 65 * of the hardware page size. 66 */ 67 #define MSIZE 128 /* size of an mbuf */ 68 #define MCLBYTES 1024 69 #define MCLSHIFT 10 70 #define MCLOFSET (MCLBYTES - 1) 71 #ifndef NMBCLUSTERS 72 #ifdef GATEWAY 73 #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 74 #else 75 #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 76 #endif 77 #endif 78 79 /* 80 * Size of kernel malloc arena in CLBYTES-sized logical pages 81 */ 82 #ifndef NKMEMCLUSTERS 83 #define NKMEMCLUSTERS (2048*1024/CLBYTES) 84 #endif 85 86 /* pages ("clicks") (4096 bytes) to disk blocks */ 87 #define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT)) 88 #define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT)) 89 #define dtob(x) ((x)<<DEV_BSHIFT) 90 91 /* pages to bytes */ 92 #define ctob(x) ((x)<<PGSHIFT) 93 94 /* bytes to pages */ 95 #define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT) 96 97 #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 98 ((bytes) >> DEV_BSHIFT) 99 #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 100 ((db) << DEV_BSHIFT) 101 102 /* 103 * Map a ``block device block'' to a file system block. 104 * This should be device dependent, and should use the bsize 105 * field from the disk label. 106 * For now though just use DEV_BSIZE. 107 */ 108 #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 109 110 /* 111 * Mach derived conversion macros 112 */ 113 #define pmax_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) 114 #define pmax_trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) 115 #define pmax_btop(x) ((unsigned)(x) >> PGSHIFT) 116 #define pmax_ptob(x) ((unsigned)(x) << PGSHIFT) 117 118 #ifdef news3400 119 #define splnet spl2 120 #define splsoftclock spl2 121 #define splbio spl3 122 #define spltty spl4 123 #define splimp spl4 124 #define splclock spl5 125 #define splstatclock spl5 126 #endif /* news3400 */ 127 128 #ifdef KERNEL 129 #ifndef LOCORE 130 extern int cpuspeed; 131 #define DELAY(n) { register int N = cpuspeed * (n) / 2; while (--N > 0); } 132 #endif 133 #else /* !KERNEL */ 134 #define DELAY(n) { register int N = (n); while (--N > 0); } 135 #endif /* !KERNEL */ 136 137 #ifndef LOCORE 138 extern int intrcnt[]; 139 extern char *intrnames[]; 140 #endif /* !LOCORE */ 141 142 #define INTR_CLOCK 0 143 #define INTR_SOFTCLK 1 144 #define INTR_SOFTINT 2 145 #define INTR_AST 3 146 #define INTR_SCSI00 4 147 #define INTR_SCSI01 5 148 #define INTR_SCSI02 6 149 #define INTR_SCSI03 7 150 #define INTR_SCSI04 8 151 #define INTR_SCSI05 9 152 #define INTR_SCSI06 10 153 #define INTR_SCSI07 11 154 #define INTR_SCSI10 12 155 #define INTR_SCSI11 13 156 #define INTR_SCSI12 14 157 #define INTR_SCSI13 15 158 #define INTR_SCSI14 16 159 #define INTR_SCSI15 17 160 #define INTR_SCSI16 18 161 #define INTR_SCSI17 19 162 #define INTR_ETHER0 20 163 #define INTR_ETHER1 21 164 #define INTR_ETHER2 22 165 #define INTR_VME2 23 166 #define INTR_VME4 24 167 #define INTR_RS0 25 168 #define INTR_RS1 26 169 #define INTR_RS2 27 170 #define INTR_RS3 28 171 #define INTR_RS4 29 172 #define INTR_RS5 30 173 #define INTR_RS6 31 174 #define INTR_RS7 32 175 #define INTR_RS8 33 176 #define INTR_RS9 34 177 #define INTR_RS10 35 178 #define INTR_RS11 36 179 #define INTR_PRINTER 37 180 #define INTR_FD 38 181 #define INTR_AUDIO 39 182 #define INTR_KEYBOARD 40 183 #define INTR_MOUSE 41 184 #define INTR_BITMAP 42 185 #define INTR_FDDI 43 186 #define INTR_RENDER 44 187 188 #define NINTRSLOT 45 /* # of intrcnt[] slot */ 189