1 /* 2 * Copyright (c) 1982, 1986 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.12 (Berkeley) 10/19/89 7 */ 8 9 /* 10 * Machine dependent constants for VAX. 11 */ 12 #define MACHINE "vax" 13 14 #ifndef BYTE_ORDER 15 #include <machine/endian.h> 16 #endif 17 18 #include <machine/machlimits.h> 19 20 #define NBPG 512 /* bytes/page */ 21 #define PGOFSET (NBPG-1) /* byte offset into page */ 22 #define PGSHIFT 9 /* LOG2(NBPG) */ 23 #define NPTEPG (NBPG/(sizeof (struct pte))) 24 25 #define KERNBASE 0x80000000 /* start of kernel virtual */ 26 #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 27 28 #define DEV_BSIZE 512 29 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 30 #define BLKDEV_IOSIZE 2048 31 #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ 32 33 #define CLSIZE 2 34 #define CLSIZELOG2 1 35 36 #define SSIZE 4 /* initial stack size/NBPG */ 37 #define SINCR 4 /* increment of stack/NBPG */ 38 39 #define UPAGES 12 /* pages of u-area */ 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 /* 66 * Some macros for units conversion 67 */ 68 /* Core clicks (512 bytes) to segments and vice versa */ 69 #define ctos(x) (x) 70 #define stoc(x) (x) 71 72 /* Core clicks (512 bytes) to disk blocks */ 73 #define ctod(x) (x) 74 #define dtoc(x) (x) 75 #define dtob(x) ((x)<<PGSHIFT) 76 77 /* clicks to bytes */ 78 #define ctob(x) ((x)<<9) 79 80 /* bytes to clicks */ 81 #define btoc(x) ((((unsigned)(x)+511)>>9)) 82 83 #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 84 ((unsigned)(bytes) >> DEV_BSHIFT) 85 #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 86 ((unsigned)(db) << DEV_BSHIFT) 87 88 /* 89 * Map a ``block device block'' to a file system block. 90 * This should be device dependent, and will be if we 91 * add an entry to cdevsw/bdevsw for that purpose. 92 * For now though just use DEV_BSIZE. 93 */ 94 #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 95 96 /* 97 * Macros to decode processor status word. 98 */ 99 #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) 100 #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) 101 102 #ifdef KERNEL 103 #ifndef LOCORE 104 int cpuspeed; 105 #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } 106 #endif 107 108 #else KERNEL 109 #define DELAY(n) { register int N = (n); while (--N > 0); } 110 #endif KERNEL 111