123264Smckusick /* 229186Smckusick * Copyright (c) 1982, 1986 Regents of the University of California. 323264Smckusick * All rights reserved. The Berkeley software License Agreement 423264Smckusick * specifies the terms and conditions for redistribution. 523264Smckusick * 6*38966Skarels * @(#)param.h 7.11 (Berkeley) 09/04/89 723264Smckusick */ 89118Ssam 99118Ssam /* 1033278Sbostic * Machine dependent constants for VAX. 119118Ssam */ 1231162Sbostic #define MACHINE "vax" 1331162Sbostic 1433381Skarels #ifndef BYTE_ORDER 1533278Sbostic #include <machine/endian.h> 1633278Sbostic #endif 1733278Sbostic 18*38966Skarels #include <machine/machlimits.h> 1932563Sbostic 2030407Skarels #define NBPG 512 /* bytes/page */ 2130407Skarels #define PGOFSET (NBPG-1) /* byte offset into page */ 2230407Skarels #define PGSHIFT 9 /* LOG2(NBPG) */ 2330407Skarels #define NPTEPG (NBPG/(sizeof (struct pte))) 249118Ssam 2533278Sbostic #define KERNBASE 0x80000000 /* start of kernel virtual */ 2633278Sbostic #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 2733278Sbostic 2830407Skarels #define DEV_BSIZE 512 2930407Skarels #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 3030407Skarels #define BLKDEV_IOSIZE 2048 3130766Skarels #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ 3230407Skarels 339118Ssam #define CLSIZE 2 349118Ssam #define CLSIZELOG2 1 359118Ssam 3630407Skarels #define SSIZE 4 /* initial stack size/NBPG */ 3730407Skarels #define SINCR 4 /* increment of stack/NBPG */ 389118Ssam 3930407Skarels #define UPAGES 10 /* pages of u-area */ 409118Ssam 419118Ssam /* 42*38966Skarels * Constants related to network buffer management. 43*38966Skarels * MCLBYTES must be no larger than CLBYTES (the software page size), and, 44*38966Skarels * on machines that exchange pages of input or output buffers with mbuf 45*38966Skarels * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 46*38966Skarels * of the hardware page size. 47*38966Skarels */ 48*38966Skarels #define MSIZE 128 /* size of an mbuf */ 49*38966Skarels #define MAPPED_MBUFS /* can do scatter-gather I/O */ 50*38966Skarels #if CLBYTES > 1024 51*38966Skarels #define MCLBYTES 1024 52*38966Skarels #define MCLSHIFT 10 53*38966Skarels #define MCLOFSET (MCLBYTES - 1) 54*38966Skarels #else 55*38966Skarels #define MCLBYTES CLBYTES 56*38966Skarels #define MCLSHIFT CLSHIFT 57*38966Skarels #define MCLOFSET CLOFSET 58*38966Skarels #endif 59*38966Skarels #ifdef GATEWAY 60*38966Skarels #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 61*38966Skarels #else 62*38966Skarels #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 63*38966Skarels #endif 64*38966Skarels 65*38966Skarels /* 669118Ssam * Some macros for units conversion 679118Ssam */ 689118Ssam /* Core clicks (512 bytes) to segments and vice versa */ 699118Ssam #define ctos(x) (x) 709118Ssam #define stoc(x) (x) 719118Ssam 729118Ssam /* Core clicks (512 bytes) to disk blocks */ 739118Ssam #define ctod(x) (x) 749118Ssam #define dtoc(x) (x) 7530766Skarels #define dtob(x) ((x)<<PGSHIFT) 769118Ssam 779118Ssam /* clicks to bytes */ 789118Ssam #define ctob(x) ((x)<<9) 799118Ssam 809118Ssam /* bytes to clicks */ 819118Ssam #define btoc(x) ((((unsigned)(x)+511)>>9)) 829118Ssam 8330407Skarels #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 8430407Skarels ((unsigned)(bytes) >> DEV_BSHIFT) 8530407Skarels #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 8630407Skarels ((unsigned)(db) << DEV_BSHIFT) 8730407Skarels 889118Ssam /* 8930407Skarels * Map a ``block device block'' to a file system block. 9030407Skarels * This should be device dependent, and will be if we 9130407Skarels * add an entry to cdevsw/bdevsw for that purpose. 9230407Skarels * For now though just use DEV_BSIZE. 9330407Skarels */ 9430407Skarels #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 9530407Skarels 9630407Skarels /* 979118Ssam * Macros to decode processor status word. 989118Ssam */ 999118Ssam #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) 1009600Ssam #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) 1019118Ssam 10224887Skarels #ifdef KERNEL 10324887Skarels #ifndef LOCORE 10424887Skarels int cpuspeed; 10529953Skarels #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } 10624887Skarels #endif 10724887Skarels 10824887Skarels #else KERNEL 1099118Ssam #define DELAY(n) { register int N = (n); while (--N > 0); } 11024887Skarels #endif KERNEL 111