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*40211Smarc * @(#)param.h 7.14 (Berkeley) 02/23/90 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 1838966Skarels #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 */ 26*40211Smarc #define KERNTEXTOFF KERNBASE /* start of kernel text */ 2733278Sbostic #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 2833278Sbostic 2930407Skarels #define DEV_BSIZE 512 3030407Skarels #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 3130407Skarels #define BLKDEV_IOSIZE 2048 3230766Skarels #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ 3330407Skarels 349118Ssam #define CLSIZE 2 359118Ssam #define CLSIZELOG2 1 369118Ssam 3730407Skarels #define SSIZE 4 /* initial stack size/NBPG */ 3830407Skarels #define SINCR 4 /* increment of stack/NBPG */ 399118Ssam 4039820Smckusick #define UPAGES 16 /* pages of u-area */ 419118Ssam 429118Ssam /* 4338966Skarels * Constants related to network buffer management. 4438966Skarels * MCLBYTES must be no larger than CLBYTES (the software page size), and, 4538966Skarels * on machines that exchange pages of input or output buffers with mbuf 4638966Skarels * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 4738966Skarels * of the hardware page size. 4838966Skarels */ 4938966Skarels #define MSIZE 128 /* size of an mbuf */ 5038966Skarels #define MAPPED_MBUFS /* can do scatter-gather I/O */ 5138966Skarels #if CLBYTES > 1024 5238966Skarels #define MCLBYTES 1024 5338966Skarels #define MCLSHIFT 10 5438966Skarels #define MCLOFSET (MCLBYTES - 1) 5538966Skarels #else 5638966Skarels #define MCLBYTES CLBYTES 5738966Skarels #define MCLSHIFT CLSHIFT 5838966Skarels #define MCLOFSET CLOFSET 5938966Skarels #endif 6038966Skarels #ifdef GATEWAY 6138966Skarels #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 6238966Skarels #else 6338966Skarels #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 6438966Skarels #endif 6538966Skarels 6638966Skarels /* 679118Ssam * Some macros for units conversion 689118Ssam */ 699118Ssam /* Core clicks (512 bytes) to segments and vice versa */ 709118Ssam #define ctos(x) (x) 719118Ssam #define stoc(x) (x) 729118Ssam 739118Ssam /* Core clicks (512 bytes) to disk blocks */ 749118Ssam #define ctod(x) (x) 759118Ssam #define dtoc(x) (x) 7630766Skarels #define dtob(x) ((x)<<PGSHIFT) 779118Ssam 789118Ssam /* clicks to bytes */ 799118Ssam #define ctob(x) ((x)<<9) 809118Ssam 819118Ssam /* bytes to clicks */ 829118Ssam #define btoc(x) ((((unsigned)(x)+511)>>9)) 839118Ssam 8430407Skarels #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 8530407Skarels ((unsigned)(bytes) >> DEV_BSHIFT) 8630407Skarels #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 8730407Skarels ((unsigned)(db) << DEV_BSHIFT) 8830407Skarels 899118Ssam /* 9030407Skarels * Map a ``block device block'' to a file system block. 9130407Skarels * This should be device dependent, and will be if we 9230407Skarels * add an entry to cdevsw/bdevsw for that purpose. 9330407Skarels * For now though just use DEV_BSIZE. 9430407Skarels */ 9530407Skarels #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 9630407Skarels 9730407Skarels /* 989118Ssam * Macros to decode processor status word. 999118Ssam */ 1009118Ssam #define USERMODE(ps) (((ps) & PSL_CURMOD) == PSL_CURMOD) 1019600Ssam #define BASEPRI(ps) (((ps) & PSL_IPL) == 0) 1029118Ssam 10324887Skarels #ifdef KERNEL 10424887Skarels #ifndef LOCORE 10524887Skarels int cpuspeed; 10629953Skarels #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } 10724887Skarels #endif 10824887Skarels 10924887Skarels #else KERNEL 1109118Ssam #define DELAY(n) { register int N = (n); while (--N > 0); } 11124887Skarels #endif KERNEL 112