153899Smckusick /* 253899Smckusick * Copyright (c) 1988 University of Utah. 353899Smckusick * Copyright (c) 1992 The Regents of the University of California. 453899Smckusick * All rights reserved. 553899Smckusick * 653899Smckusick * This code is derived from software contributed to Berkeley by 753899Smckusick * the Systems Programming Group of the University of Utah Computer 853899Smckusick * Science Department and Ralph Campbell. 953899Smckusick * 1053899Smckusick * %sccs.include.redist.c% 1153899Smckusick * 1253899Smckusick * from: Utah $Hdr: machparam.h 1.11 89/08/14$ 1353899Smckusick * 14*60003Sutashiro * @(#)param.h 7.6 (Berkeley) 05/13/93 1553899Smckusick */ 1653899Smckusick 1753899Smckusick /* 1853899Smckusick * Machine dependent constants for DEC Station 3100. 1953899Smckusick */ 2058616Sutashiro #define MACHINE "news3400" 2153899Smckusick #define COFF 2253899Smckusick 2353899Smckusick /* 2453899Smckusick * Round p (pointer or byte index) up to a correctly-aligned value for all 2553899Smckusick * data types (int, long, ...). The result is u_int and must be cast to 2653899Smckusick * any desired pointer type. 2753899Smckusick */ 2858616Sutashiro #define ALIGNBYTES 7 2957185Sutashiro #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES) 3053899Smckusick 3153899Smckusick #define NBPG 4096 /* bytes/page */ 3253899Smckusick #define PGOFSET (NBPG-1) /* byte offset into page */ 3353899Smckusick #define PGSHIFT 12 /* LOG2(NBPG) */ 3453899Smckusick #define NPTEPG (NBPG/4) 3553899Smckusick 36*60003Sutashiro #define NBSEG 0x400000 /* bytes/segment */ 37*60003Sutashiro #define SEGOFSET (NBSEG-1) /* byte offset into segment */ 38*60003Sutashiro #define SEGSHIFT 22 /* LOG2(NBSEG) */ 39*60003Sutashiro 4053899Smckusick #define KERNBASE 0x80000000 /* start of kernel virtual */ 4153899Smckusick #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 4253899Smckusick 4353899Smckusick #define DEV_BSIZE 512 4453899Smckusick #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 4553899Smckusick #define BLKDEV_IOSIZE 2048 46*60003Sutashiro #define MAXPHYS (128 * 1024) /* max raw I/O transfer size */ 4753899Smckusick 4853899Smckusick #define CLSIZE 1 4953899Smckusick #define CLSIZELOG2 0 5053899Smckusick 5153899Smckusick /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ 5253899Smckusick #define SSIZE 1 /* initial stack size/NBPG */ 5353899Smckusick #define SINCR 1 /* increment of stack/NBPG */ 5453899Smckusick 5553899Smckusick #define UPAGES 2 /* pages of u-area */ 5658616Sutashiro #define UADDR 0xffffd000 /* address of u */ 5753899Smckusick #define UVPN (UADDR>>PGSHIFT)/* virtual page number of u */ 5858616Sutashiro #define KERNELSTACK (UADDR+UPAGES*NBPG) /* top of kernel stack */ 5953899Smckusick 6053899Smckusick /* 6153899Smckusick * Constants related to network buffer management. 6253899Smckusick * MCLBYTES must be no larger than CLBYTES (the software page size), and, 6353899Smckusick * on machines that exchange pages of input or output buffers with mbuf 6453899Smckusick * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 6553899Smckusick * of the hardware page size. 6653899Smckusick */ 6753899Smckusick #define MSIZE 128 /* size of an mbuf */ 6853899Smckusick #define MCLBYTES 1024 6953899Smckusick #define MCLSHIFT 10 7053899Smckusick #define MCLOFSET (MCLBYTES - 1) 7153899Smckusick #ifndef NMBCLUSTERS 7253899Smckusick #ifdef GATEWAY 7353899Smckusick #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 7453899Smckusick #else 7553899Smckusick #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 7653899Smckusick #endif 7753899Smckusick #endif 7853899Smckusick 7953899Smckusick /* 8053899Smckusick * Size of kernel malloc arena in CLBYTES-sized logical pages 8153899Smckusick */ 8253899Smckusick #ifndef NKMEMCLUSTERS 8353899Smckusick #define NKMEMCLUSTERS (2048*1024/CLBYTES) 8453899Smckusick #endif 8553899Smckusick 8653899Smckusick /* pages ("clicks") (4096 bytes) to disk blocks */ 8753899Smckusick #define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT)) 8853899Smckusick #define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT)) 8953899Smckusick #define dtob(x) ((x)<<DEV_BSHIFT) 9053899Smckusick 9153899Smckusick /* pages to bytes */ 9253899Smckusick #define ctob(x) ((x)<<PGSHIFT) 9353899Smckusick 9453899Smckusick /* bytes to pages */ 9553899Smckusick #define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT) 9653899Smckusick 9753899Smckusick #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 9853899Smckusick ((unsigned)(bytes) >> DEV_BSHIFT) 9953899Smckusick #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 10053899Smckusick ((unsigned)(db) << DEV_BSHIFT) 10153899Smckusick 10253899Smckusick /* 10353899Smckusick * Map a ``block device block'' to a file system block. 10453899Smckusick * This should be device dependent, and should use the bsize 10553899Smckusick * field from the disk label. 10653899Smckusick * For now though just use DEV_BSIZE. 10753899Smckusick */ 10853899Smckusick #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 10953899Smckusick 11053899Smckusick /* 11153899Smckusick * Mach derived conversion macros 11253899Smckusick */ 11353899Smckusick #define pmax_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) 11453899Smckusick #define pmax_trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) 11553899Smckusick #define pmax_btop(x) ((unsigned)(x) >> PGSHIFT) 11653899Smckusick #define pmax_ptob(x) ((unsigned)(x) << PGSHIFT) 11753899Smckusick 11853899Smckusick #ifdef news3400 11953899Smckusick #define splnet spl2 12053899Smckusick #define splsoftclock spl2 12153899Smckusick #define splbio spl3 12253899Smckusick #define spltty spl4 12353899Smckusick #define splimp spl4 12453899Smckusick #define splclock spl5 12555765Sbostic #define splstatclock spl5 12653899Smckusick #endif /* news3400 */ 12753899Smckusick 12853899Smckusick #ifdef KERNEL 12953899Smckusick #ifndef LOCORE 13053899Smckusick extern int cpuspeed; 13153899Smckusick #define DELAY(n) { register int N = cpuspeed * (n) / 2; while (--N > 0); } 13253899Smckusick #endif 13353899Smckusick #else /* !KERNEL */ 13453899Smckusick #define DELAY(n) { register int N = (n); while (--N > 0); } 13553899Smckusick #endif /* !KERNEL */ 13653899Smckusick 13753899Smckusick #ifndef LOCORE 13853899Smckusick extern int intrcnt[]; 13953899Smckusick extern char *intrnames[]; 14053899Smckusick #endif /* !LOCORE */ 14153899Smckusick 14253899Smckusick #define INTR_CLOCK 0 14353899Smckusick #define INTR_SOFTCLK 1 14453899Smckusick #define INTR_SOFTINT 2 14553899Smckusick #define INTR_AST 3 14653899Smckusick #define INTR_SCSI00 4 14753899Smckusick #define INTR_SCSI01 5 14853899Smckusick #define INTR_SCSI02 6 14953899Smckusick #define INTR_SCSI03 7 15053899Smckusick #define INTR_SCSI04 8 15153899Smckusick #define INTR_SCSI05 9 15253899Smckusick #define INTR_SCSI06 10 15353899Smckusick #define INTR_SCSI07 11 15453899Smckusick #define INTR_SCSI10 12 15553899Smckusick #define INTR_SCSI11 13 15653899Smckusick #define INTR_SCSI12 14 15753899Smckusick #define INTR_SCSI13 15 15853899Smckusick #define INTR_SCSI14 16 15953899Smckusick #define INTR_SCSI15 17 16053899Smckusick #define INTR_SCSI16 18 16153899Smckusick #define INTR_SCSI17 19 16253899Smckusick #define INTR_ETHER0 20 16353899Smckusick #define INTR_ETHER1 21 16453899Smckusick #define INTR_ETHER2 22 16553899Smckusick #define INTR_VME2 23 16653899Smckusick #define INTR_VME4 24 16753899Smckusick #define INTR_RS0 25 16853899Smckusick #define INTR_RS1 26 16953899Smckusick #define INTR_RS2 27 17053899Smckusick #define INTR_RS3 28 17153899Smckusick #define INTR_RS4 29 17253899Smckusick #define INTR_RS5 30 17353899Smckusick #define INTR_RS6 31 17453899Smckusick #define INTR_RS7 32 17553899Smckusick #define INTR_RS8 33 17653899Smckusick #define INTR_RS9 34 17753899Smckusick #define INTR_RS10 35 17853899Smckusick #define INTR_RS11 36 17953899Smckusick #define INTR_PRINTER 37 18053899Smckusick #define INTR_FD 38 18153899Smckusick #define INTR_AUDIO 39 18253899Smckusick #define INTR_KEYBOARD 40 18353899Smckusick #define INTR_MOUSE 41 18453899Smckusick #define INTR_BITMAP 42 18553899Smckusick #define INTR_FDDI 43 18653899Smckusick #define INTR_RENDER 44 18753899Smckusick 18853899Smckusick #define NINTRSLOT 45 /* # of intrcnt[] slot */ 189