133282Skarels /* 234408Skarels * Copyright (c) 1982, 1986, 1988 Regents of the University of California. 333282Skarels * All rights reserved. The Berkeley software License Agreement 433282Skarels * specifies the terms and conditions for redistribution. 533282Skarels * 6*40212Smarc * @(#)param.h 7.4 (Berkeley) 02/23/90 733282Skarels */ 825681Ssam 925681Ssam /* 1025681Ssam * Machine dependent constants for TAHOE. 1125681Ssam */ 1231163Sbostic #define MACHINE "tahoe" 1331163Sbostic 1433380Skarels #ifndef BYTE_ORDER 1533282Skarels #include <machine/endian.h> 1633282Skarels #endif 1733282Skarels 1838968Skarels #include <machine/machlimits.h> 1932564Sbostic 2030407Skarels #define NBPG 1024 /* bytes/page */ 2130407Skarels #define PGOFSET (NBPG-1) /* byte offset into page */ 2230407Skarels #define PGSHIFT 10 /* LOG2(NBPG) */ 2330407Skarels #define NPTEPG (NBPG/(sizeof (struct pte))) 2425681Ssam 2530752Skarels #define KERNBASE 0xc0000000 /* start of kernel virtual */ 26*40212Smarc #define KERNTEXTOFF (KERNBASE + 0x800) /* start of kernel text */ 2730752Skarels #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 2830752Skarels 2930407Skarels #define DEV_BSIZE 1024 3030407Skarels #define DEV_BSHIFT 10 /* log2(DEV_BSIZE) */ 3130407Skarels #define BLKDEV_IOSIZE 1024 /* NBPG for physical controllers */ 3230752Skarels #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 3330407Skarels 3425681Ssam #define CLSIZE 1 3525681Ssam #define CLSIZELOG2 0 3625681Ssam 3730407Skarels #define SSIZE 2 /* initial stack size/NBPG */ 3830407Skarels #define SINCR 2 /* increment of stack/NBPG */ 3939819Smckusick #define UPAGES 8 /* pages of u-area (2 stack pages) */ 4025681Ssam 4138968Skarels /* 4238968Skarels * Constants related to network buffer management. 4338968Skarels * MCLBYTES must be no larger than CLBYTES (the software page size), and, 4438968Skarels * on machines that exchange pages of input or output buffers with mbuf 4538968Skarels * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 4638968Skarels * of the hardware page size. 4738968Skarels */ 4838968Skarels #define MSIZE 128 /* size of an mbuf */ 4938968Skarels #define MAPPED_MBUFS /* can do scatter-gather I/O */ 5038968Skarels #if CLBYTES > 1024 5138968Skarels #define MCLBYTES 1024 5238968Skarels #define MCLSHIFT 10 5338968Skarels #define MCLOFSET (MCLBYTES - 1) 5438968Skarels #else 5538968Skarels #define MCLBYTES CLBYTES 5638968Skarels #define MCLSHIFT CLSHIFT 5738968Skarels #define MCLOFSET CLOFSET 5838968Skarels #endif 5938968Skarels #ifdef GATEWAY 6038968Skarels #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 6138968Skarels #else 6238968Skarels #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 6338968Skarels #endif 6438968Skarels 6525681Ssam #define MAXCKEY 255 /* maximal allowed code key */ 6625681Ssam #define MAXDKEY 255 /* maximal allowed data key */ 6725681Ssam #define NCKEY (MAXCKEY+1) /* # code keys, including 0 (reserved) */ 6825681Ssam #define NDKEY (MAXDKEY+1) /* # data keys, including 0 (reserved) */ 6925681Ssam 7025681Ssam /* 7125681Ssam * Some macros for units conversion 7225681Ssam */ 7325681Ssam /* Core clicks (1024 bytes) to segments and vice versa */ 7425681Ssam #define ctos(x) (x) 7525681Ssam #define stoc(x) (x) 7625681Ssam 7725681Ssam /* Core clicks (1024 bytes) to disk blocks */ 7825681Ssam #define ctod(x) (x) 7925681Ssam #define dtoc(x) (x) 8025681Ssam #define dtob(x) ((x)<<PGSHIFT) 8125681Ssam 8225681Ssam /* clicks to bytes */ 8325681Ssam #define ctob(x) ((x)<<PGSHIFT) 8425681Ssam 8525681Ssam /* bytes to clicks */ 8625681Ssam #define btoc(x) ((((unsigned)(x)+NBPG-1) >> PGSHIFT)) 8725681Ssam 8830407Skarels #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 8930407Skarels ((unsigned)(bytes) >> DEV_BSHIFT) 9030407Skarels #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 9130407Skarels ((unsigned)(db) << DEV_BSHIFT) 9230407Skarels 9325681Ssam /* 9430407Skarels * Map a ``block device block'' to a file system block. 9530407Skarels * This should be device dependent, and will be if we 9630407Skarels * add an entry to cdevsw/bdevsw for that purpose. 9730407Skarels * For now though just use DEV_BSIZE. 9830407Skarels */ 9930407Skarels #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 10030407Skarels 10130407Skarels /* 10225681Ssam * Macros to decode processor status word. 10325681Ssam */ 10425681Ssam #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) 10525681Ssam #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) 10625681Ssam 10725681Ssam #define DELAY(n) { register int N = 3*(n); while (--N > 0); } 108