141058Swilliam /*- 241058Swilliam * Copyright (c) 1990 The Regents of the University of California. 341058Swilliam * All rights reserved. 441058Swilliam * 541058Swilliam * This code is derived from software contributed to Berkeley by 641058Swilliam * William Jolitz. 741058Swilliam * 841058Swilliam * %sccs.include.noredist.c% 941058Swilliam * 10*45964Swilliam * @(#)param.h 5.2 (Berkeley) 01/15/91 1141058Swilliam */ 1241058Swilliam 1340461Sbill /* 1440461Sbill * Machine dependent constants for Intel 386. 1540461Sbill */ 1640461Sbill 1740461Sbill #define MACHINE "i386" 1840461Sbill 1940461Sbill #define NBPG 4096 /* bytes/page */ 2040461Sbill #define PGOFSET (NBPG-1) /* byte offset into page */ 2140461Sbill #define PGSHIFT 12 /* LOG2(NBPG) */ 2240461Sbill #define NPTEPG (NBPG/(sizeof (struct pte))) 2340461Sbill 2440461Sbill #define NBPDR (1024*NBPG) /* bytes/page dir */ 2540461Sbill #define PDROFSET (NBPDR-1) /* byte offset into page dir */ 2640461Sbill #define PDRSHIFT 22 /* LOG2(NBPDR) */ 2740461Sbill 2840461Sbill #define KERNBASE 0xFE000000 /* start of kernel virtual */ 2940461Sbill #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 3040461Sbill 3140461Sbill #define DEV_BSIZE 512 3240461Sbill #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 3340461Sbill #define BLKDEV_IOSIZE 2048 3440461Sbill #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 3540461Sbill 3640461Sbill #define CLSIZE 1 3740461Sbill #define CLSIZELOG2 0 3840461Sbill 3940461Sbill #define SSIZE 1 /* initial stack size/NBPG */ 4040461Sbill #define SINCR 1 /* increment of stack/NBPG */ 4140461Sbill 4241058Swilliam #define UPAGES 2 /* pages of u-area */ 4340461Sbill 4440461Sbill /* 45*45964Swilliam * Constants related to network buffer management. 46*45964Swilliam * MCLBYTES must be no larger than CLBYTES (the software page size), and, 47*45964Swilliam * on machines that exchange pages of input or output buffers with mbuf 48*45964Swilliam * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 49*45964Swilliam * of the hardware page size. 50*45964Swilliam */ 51*45964Swilliam #define MSIZE 128 /* size of an mbuf */ 52*45964Swilliam #define MCLBYTES 1024 53*45964Swilliam #define MCLSHIFT 10 54*45964Swilliam #define MCLOFSET (MCLBYTES - 1) 55*45964Swilliam #ifndef NMBCLUSTERS 56*45964Swilliam #ifdef GATEWAY 57*45964Swilliam #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 58*45964Swilliam #else 59*45964Swilliam #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 60*45964Swilliam #endif 61*45964Swilliam #endif 62*45964Swilliam 63*45964Swilliam /* 64*45964Swilliam * Size of kernel malloc arena in CLBYTES-sized logical pages 65*45964Swilliam */ 66*45964Swilliam #ifndef NKMEMCLUSTERS 67*45964Swilliam #define NKMEMCLUSTERS (512*1024/CLBYTES) 68*45964Swilliam #endif 69*45964Swilliam /* 7040461Sbill * Some macros for units conversion 7140461Sbill */ 7240461Sbill /* Core clicks (4096 bytes) to segments and vice versa */ 7340461Sbill #define ctos(x) (x) 7440461Sbill #define stoc(x) (x) 7540461Sbill 7640461Sbill /* Core clicks (4096 bytes) to disk blocks */ 7740461Sbill #define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT)) 7840461Sbill #define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT)) 7940461Sbill #define dtob(x) ((x)<<DEV_BSHIFT) 8040461Sbill 8140461Sbill /* clicks to bytes */ 8240461Sbill #define ctob(x) ((x)<<PGSHIFT) 8340461Sbill 8440461Sbill /* bytes to clicks */ 8540461Sbill #define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT) 8640461Sbill 8740461Sbill #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 8840461Sbill ((unsigned)(bytes) >> DEV_BSHIFT) 8940461Sbill #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 9040461Sbill ((unsigned)(db) << DEV_BSHIFT) 9140461Sbill 9240461Sbill /* 9340461Sbill * Map a ``block device block'' to a file system block. 9440461Sbill * This should be device dependent, and will be if we 9540461Sbill * add an entry to cdevsw/bdevsw for that purpose. 9640461Sbill * For now though just use DEV_BSIZE. 9740461Sbill */ 9840461Sbill #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 9940461Sbill 10040461Sbill #ifdef KERNEL 10140461Sbill #ifndef LOCORE 10240461Sbill int cpuspeed; 10340461Sbill #endif 10440461Sbill #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } 10540461Sbill 10640461Sbill #else KERNEL 10740461Sbill #define DELAY(n) { register int N = (n); while (--N > 0); } 10840461Sbill #endif KERNEL 109