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) 06/04/92 15 */ 16 17 /* 18 * Machine dependent constants for DEC Station 3100. 19 */ 20 #define MACHINE "news" 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 KERNELSTACK 0xffffe000 /* virtual address of kernel stack */ 52 #define UADDR 0xffffc000 /* address of u */ 53 #define UVPN (UADDR>>PGSHIFT)/* virtual page number of u */ 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 (2048*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 news3400 114 #ifdef PMAXSPL 115 #define splnet Mach_spl0 116 #define splbio Mach_spl0 117 #define spltty Mach_spl1 118 #define splimp Mach_spl1 119 #define splclock Mach_spl2 120 #else 121 #define splnet spl2 122 #define splsoftclock spl2 123 #define splbio spl3 124 #define spltty spl4 125 #define splimp spl4 126 #define splclock spl5 127 #endif /* PMAXSPL */ 128 #endif /* news3400 */ 129 130 #ifdef KERNEL 131 #ifndef LOCORE 132 extern int cpuspeed; 133 #define DELAY(n) { register int N = cpuspeed * (n) / 2; while (--N > 0); } 134 #endif 135 #else /* !KERNEL */ 136 #define DELAY(n) { register int N = (n); while (--N > 0); } 137 #endif /* !KERNEL */ 138 139 #define SYSCALL_BSDOFFSET 1000 140 141 #ifndef LOCORE 142 extern int intrcnt[]; 143 extern char *intrnames[]; 144 #endif /* !LOCORE */ 145 146 #define INTR_CLOCK 0 147 #define INTR_SOFTCLK 1 148 #define INTR_SOFTINT 2 149 #define INTR_AST 3 150 #define INTR_SCSI00 4 151 #define INTR_SCSI01 5 152 #define INTR_SCSI02 6 153 #define INTR_SCSI03 7 154 #define INTR_SCSI04 8 155 #define INTR_SCSI05 9 156 #define INTR_SCSI06 10 157 #define INTR_SCSI07 11 158 #define INTR_SCSI10 12 159 #define INTR_SCSI11 13 160 #define INTR_SCSI12 14 161 #define INTR_SCSI13 15 162 #define INTR_SCSI14 16 163 #define INTR_SCSI15 17 164 #define INTR_SCSI16 18 165 #define INTR_SCSI17 19 166 #define INTR_ETHER0 20 167 #define INTR_ETHER1 21 168 #define INTR_ETHER2 22 169 #define INTR_VME2 23 170 #define INTR_VME4 24 171 #define INTR_RS0 25 172 #define INTR_RS1 26 173 #define INTR_RS2 27 174 #define INTR_RS3 28 175 #define INTR_RS4 29 176 #define INTR_RS5 30 177 #define INTR_RS6 31 178 #define INTR_RS7 32 179 #define INTR_RS8 33 180 #define INTR_RS9 34 181 #define INTR_RS10 35 182 #define INTR_RS11 36 183 #define INTR_PRINTER 37 184 #define INTR_FD 38 185 #define INTR_AUDIO 39 186 #define INTR_KEYBOARD 40 187 #define INTR_MOUSE 41 188 #define INTR_BITMAP 42 189 #define INTR_FDDI 43 190 #define INTR_RENDER 44 191 192 #define NINTRSLOT 45 /* # of intrcnt[] slot */ 193