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.4 (Berkeley) 02/23/90 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 KERNTEXTOFF (KERNBASE + 0x800) /* start of kernel text */ 27 #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 28 29 #define DEV_BSIZE 1024 30 #define DEV_BSHIFT 10 /* log2(DEV_BSIZE) */ 31 #define BLKDEV_IOSIZE 1024 /* NBPG for physical controllers */ 32 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 33 34 #define CLSIZE 1 35 #define CLSIZELOG2 0 36 37 #define SSIZE 2 /* initial stack size/NBPG */ 38 #define SINCR 2 /* increment of stack/NBPG */ 39 #define UPAGES 8 /* pages of u-area (2 stack pages) */ 40 41 /* 42 * Constants related to network buffer management. 43 * MCLBYTES must be no larger than CLBYTES (the software page size), and, 44 * on machines that exchange pages of input or output buffers with mbuf 45 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 46 * of the hardware page size. 47 */ 48 #define MSIZE 128 /* size of an mbuf */ 49 #define MAPPED_MBUFS /* can do scatter-gather I/O */ 50 #if CLBYTES > 1024 51 #define MCLBYTES 1024 52 #define MCLSHIFT 10 53 #define MCLOFSET (MCLBYTES - 1) 54 #else 55 #define MCLBYTES CLBYTES 56 #define MCLSHIFT CLSHIFT 57 #define MCLOFSET CLOFSET 58 #endif 59 #ifdef GATEWAY 60 #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 61 #else 62 #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 63 #endif 64 65 #define MAXCKEY 255 /* maximal allowed code key */ 66 #define MAXDKEY 255 /* maximal allowed data key */ 67 #define NCKEY (MAXCKEY+1) /* # code keys, including 0 (reserved) */ 68 #define NDKEY (MAXDKEY+1) /* # data keys, including 0 (reserved) */ 69 70 /* 71 * Some macros for units conversion 72 */ 73 /* Core clicks (1024 bytes) to segments and vice versa */ 74 #define ctos(x) (x) 75 #define stoc(x) (x) 76 77 /* Core clicks (1024 bytes) to disk blocks */ 78 #define ctod(x) (x) 79 #define dtoc(x) (x) 80 #define dtob(x) ((x)<<PGSHIFT) 81 82 /* clicks to bytes */ 83 #define ctob(x) ((x)<<PGSHIFT) 84 85 /* bytes to clicks */ 86 #define btoc(x) ((((unsigned)(x)+NBPG-1) >> PGSHIFT)) 87 88 #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 89 ((unsigned)(bytes) >> DEV_BSHIFT) 90 #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 91 ((unsigned)(db) << DEV_BSHIFT) 92 93 /* 94 * Map a ``block device block'' to a file system block. 95 * This should be device dependent, and will be if we 96 * add an entry to cdevsw/bdevsw for that purpose. 97 * For now though just use DEV_BSIZE. 98 */ 99 #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 100 101 /* 102 * Macros to decode processor status word. 103 */ 104 #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) 105 #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) 106 107 #define DELAY(n) { register int N = 3*(n); while (--N > 0); } 108