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*57185Sutashiro * @(#)param.h 7.4 (Berkeley) 12/17/92 1553899Smckusick */ 1653899Smckusick 1753899Smckusick /* 1853899Smckusick * Machine dependent constants for DEC Station 3100. 1953899Smckusick */ 2053899Smckusick #define MACHINE "news" 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 */ 28*57185Sutashiro #define ALIGNBYTES 3 29*57185Sutashiro #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 3653899Smckusick #define KERNBASE 0x80000000 /* start of kernel virtual */ 3753899Smckusick #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 3853899Smckusick 3953899Smckusick #define DEV_BSIZE 512 4053899Smckusick #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 4153899Smckusick #define BLKDEV_IOSIZE 2048 4253899Smckusick #define MAXPHYS (24 * 1024) /* max raw I/O transfer size */ 4353899Smckusick 4453899Smckusick #define CLSIZE 1 4553899Smckusick #define CLSIZELOG2 0 4653899Smckusick 4753899Smckusick /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ 4853899Smckusick #define SSIZE 1 /* initial stack size/NBPG */ 4953899Smckusick #define SINCR 1 /* increment of stack/NBPG */ 5053899Smckusick 5153899Smckusick #define UPAGES 2 /* pages of u-area */ 5253899Smckusick #define KERNELSTACK 0xffffe000 /* virtual address of kernel stack */ 5353899Smckusick #define UADDR 0xffffc000 /* address of u */ 5453899Smckusick #define UVPN (UADDR>>PGSHIFT)/* virtual page number of u */ 5553899Smckusick 5653899Smckusick /* 5753899Smckusick * Constants related to network buffer management. 5853899Smckusick * MCLBYTES must be no larger than CLBYTES (the software page size), and, 5953899Smckusick * on machines that exchange pages of input or output buffers with mbuf 6053899Smckusick * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 6153899Smckusick * of the hardware page size. 6253899Smckusick */ 6353899Smckusick #define MSIZE 128 /* size of an mbuf */ 6453899Smckusick #define MCLBYTES 1024 6553899Smckusick #define MCLSHIFT 10 6653899Smckusick #define MCLOFSET (MCLBYTES - 1) 6753899Smckusick #ifndef NMBCLUSTERS 6853899Smckusick #ifdef GATEWAY 6953899Smckusick #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 7053899Smckusick #else 7153899Smckusick #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 7253899Smckusick #endif 7353899Smckusick #endif 7453899Smckusick 7553899Smckusick /* 7653899Smckusick * Size of kernel malloc arena in CLBYTES-sized logical pages 7753899Smckusick */ 7853899Smckusick #ifndef NKMEMCLUSTERS 7953899Smckusick #define NKMEMCLUSTERS (2048*1024/CLBYTES) 8053899Smckusick #endif 8153899Smckusick 8253899Smckusick /* pages ("clicks") (4096 bytes) to disk blocks */ 8353899Smckusick #define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT)) 8453899Smckusick #define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT)) 8553899Smckusick #define dtob(x) ((x)<<DEV_BSHIFT) 8653899Smckusick 8753899Smckusick /* pages to bytes */ 8853899Smckusick #define ctob(x) ((x)<<PGSHIFT) 8953899Smckusick 9053899Smckusick /* bytes to pages */ 9153899Smckusick #define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT) 9253899Smckusick 9353899Smckusick #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 9453899Smckusick ((unsigned)(bytes) >> DEV_BSHIFT) 9553899Smckusick #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 9653899Smckusick ((unsigned)(db) << DEV_BSHIFT) 9753899Smckusick 9853899Smckusick /* 9953899Smckusick * Map a ``block device block'' to a file system block. 10053899Smckusick * This should be device dependent, and should use the bsize 10153899Smckusick * field from the disk label. 10253899Smckusick * For now though just use DEV_BSIZE. 10353899Smckusick */ 10453899Smckusick #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 10553899Smckusick 10653899Smckusick /* 10753899Smckusick * Mach derived conversion macros 10853899Smckusick */ 10953899Smckusick #define pmax_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) 11053899Smckusick #define pmax_trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) 11153899Smckusick #define pmax_btop(x) ((unsigned)(x) >> PGSHIFT) 11253899Smckusick #define pmax_ptob(x) ((unsigned)(x) << PGSHIFT) 11353899Smckusick 11453899Smckusick #ifdef news3400 11553899Smckusick #ifdef PMAXSPL 11653899Smckusick #define splnet Mach_spl0 11753899Smckusick #define splbio Mach_spl0 11853899Smckusick #define spltty Mach_spl1 11953899Smckusick #define splimp Mach_spl1 12053899Smckusick #define splclock Mach_spl2 12155765Sbostic #define splstatclock Mach_spl2 12253899Smckusick #else 12353899Smckusick #define splnet spl2 12453899Smckusick #define splsoftclock spl2 12553899Smckusick #define splbio spl3 12653899Smckusick #define spltty spl4 12753899Smckusick #define splimp spl4 12853899Smckusick #define splclock spl5 12955765Sbostic #define splstatclock spl5 13053899Smckusick #endif /* PMAXSPL */ 13153899Smckusick #endif /* news3400 */ 13253899Smckusick 13353899Smckusick #ifdef KERNEL 13453899Smckusick #ifndef LOCORE 13553899Smckusick extern int cpuspeed; 13653899Smckusick #define DELAY(n) { register int N = cpuspeed * (n) / 2; while (--N > 0); } 13753899Smckusick #endif 13853899Smckusick #else /* !KERNEL */ 13953899Smckusick #define DELAY(n) { register int N = (n); while (--N > 0); } 14053899Smckusick #endif /* !KERNEL */ 14153899Smckusick 14253899Smckusick #ifndef LOCORE 14353899Smckusick extern int intrcnt[]; 14453899Smckusick extern char *intrnames[]; 14553899Smckusick #endif /* !LOCORE */ 14653899Smckusick 14753899Smckusick #define INTR_CLOCK 0 14853899Smckusick #define INTR_SOFTCLK 1 14953899Smckusick #define INTR_SOFTINT 2 15053899Smckusick #define INTR_AST 3 15153899Smckusick #define INTR_SCSI00 4 15253899Smckusick #define INTR_SCSI01 5 15353899Smckusick #define INTR_SCSI02 6 15453899Smckusick #define INTR_SCSI03 7 15553899Smckusick #define INTR_SCSI04 8 15653899Smckusick #define INTR_SCSI05 9 15753899Smckusick #define INTR_SCSI06 10 15853899Smckusick #define INTR_SCSI07 11 15953899Smckusick #define INTR_SCSI10 12 16053899Smckusick #define INTR_SCSI11 13 16153899Smckusick #define INTR_SCSI12 14 16253899Smckusick #define INTR_SCSI13 15 16353899Smckusick #define INTR_SCSI14 16 16453899Smckusick #define INTR_SCSI15 17 16553899Smckusick #define INTR_SCSI16 18 16653899Smckusick #define INTR_SCSI17 19 16753899Smckusick #define INTR_ETHER0 20 16853899Smckusick #define INTR_ETHER1 21 16953899Smckusick #define INTR_ETHER2 22 17053899Smckusick #define INTR_VME2 23 17153899Smckusick #define INTR_VME4 24 17253899Smckusick #define INTR_RS0 25 17353899Smckusick #define INTR_RS1 26 17453899Smckusick #define INTR_RS2 27 17553899Smckusick #define INTR_RS3 28 17653899Smckusick #define INTR_RS4 29 17753899Smckusick #define INTR_RS5 30 17853899Smckusick #define INTR_RS6 31 17953899Smckusick #define INTR_RS7 32 18053899Smckusick #define INTR_RS8 33 18153899Smckusick #define INTR_RS9 34 18253899Smckusick #define INTR_RS10 35 18353899Smckusick #define INTR_RS11 36 18453899Smckusick #define INTR_PRINTER 37 18553899Smckusick #define INTR_FD 38 18653899Smckusick #define INTR_AUDIO 39 18753899Smckusick #define INTR_KEYBOARD 40 18853899Smckusick #define INTR_MOUSE 41 18953899Smckusick #define INTR_BITMAP 42 19053899Smckusick #define INTR_FDDI 43 19153899Smckusick #define INTR_RENDER 44 19253899Smckusick 19353899Smckusick #define NINTRSLOT 45 /* # of intrcnt[] slot */ 194