1 /* 2 * Copyright (c) 1982, 1986, 1988 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)param.h 7.3 (Berkeley) 12/30/89 7 */ 8 9 /* 10 * Machine dependent constants for TAHOE. 11 */ 12 #define MACHINE "tahoe" 13 14 #ifndef BYTE_ORDER 15 #include <machine/endian.h> 16 #endif 17 18 #include <machine/machlimits.h> 19 20 #define NBPG 1024 /* bytes/page */ 21 #define PGOFSET (NBPG-1) /* byte offset into page */ 22 #define PGSHIFT 10 /* LOG2(NBPG) */ 23 #define NPTEPG (NBPG/(sizeof (struct pte))) 24 25 #define KERNBASE 0xc0000000 /* start of kernel virtual */ 26 #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 27 28 #define DEV_BSIZE 1024 29 #define DEV_BSHIFT 10 /* log2(DEV_BSIZE) */ 30 #define BLKDEV_IOSIZE 1024 /* NBPG for physical controllers */ 31 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 32 33 #define CLSIZE 1 34 #define CLSIZELOG2 0 35 36 #define SSIZE 2 /* initial stack size/NBPG */ 37 #define SINCR 2 /* increment of stack/NBPG */ 38 #define UPAGES 8 /* pages of u-area (2 stack pages) */ 39 40 /* 41 * Constants related to network buffer management. 42 * MCLBYTES must be no larger than CLBYTES (the software page size), and, 43 * on machines that exchange pages of input or output buffers with mbuf 44 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 45 * of the hardware page size. 46 */ 47 #define MSIZE 128 /* size of an mbuf */ 48 #define MAPPED_MBUFS /* can do scatter-gather I/O */ 49 #if CLBYTES > 1024 50 #define MCLBYTES 1024 51 #define MCLSHIFT 10 52 #define MCLOFSET (MCLBYTES - 1) 53 #else 54 #define MCLBYTES CLBYTES 55 #define MCLSHIFT CLSHIFT 56 #define MCLOFSET CLOFSET 57 #endif 58 #ifdef GATEWAY 59 #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 60 #else 61 #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 62 #endif 63 64 #define MAXCKEY 255 /* maximal allowed code key */ 65 #define MAXDKEY 255 /* maximal allowed data key */ 66 #define NCKEY (MAXCKEY+1) /* # code keys, including 0 (reserved) */ 67 #define NDKEY (MAXDKEY+1) /* # data keys, including 0 (reserved) */ 68 69 /* 70 * Some macros for units conversion 71 */ 72 /* Core clicks (1024 bytes) to segments and vice versa */ 73 #define ctos(x) (x) 74 #define stoc(x) (x) 75 76 /* Core clicks (1024 bytes) to disk blocks */ 77 #define ctod(x) (x) 78 #define dtoc(x) (x) 79 #define dtob(x) ((x)<<PGSHIFT) 80 81 /* clicks to bytes */ 82 #define ctob(x) ((x)<<PGSHIFT) 83 84 /* bytes to clicks */ 85 #define btoc(x) ((((unsigned)(x)+NBPG-1) >> PGSHIFT)) 86 87 #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 88 ((unsigned)(bytes) >> DEV_BSHIFT) 89 #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 90 ((unsigned)(db) << DEV_BSHIFT) 91 92 /* 93 * Map a ``block device block'' to a file system block. 94 * This should be device dependent, and will be if we 95 * add an entry to cdevsw/bdevsw for that purpose. 96 * For now though just use DEV_BSIZE. 97 */ 98 #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 99 100 /* 101 * Macros to decode processor status word. 102 */ 103 #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) 104 #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) 105 106 #define DELAY(n) { register int N = 3*(n); while (--N > 0); } 107