1*55121Storek /* 2*55121Storek * Copyright (c) 1992 The Regents of the University of California. 3*55121Storek * All rights reserved. 4*55121Storek * 5*55121Storek * This software was developed by the Computer Systems Engineering group 6*55121Storek * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7*55121Storek * contributed to Berkeley. 8*55121Storek * 9*55121Storek * %sccs.include.redist.c% 10*55121Storek * 11*55121Storek * @(#)param.h 7.1 (Berkeley) 07/13/92 12*55121Storek * 13*55121Storek * from: $Header: param.h,v 1.11 92/06/24 08:52:05 torek Exp $ (LBL) 14*55121Storek */ 15*55121Storek 16*55121Storek /* 17*55121Storek * Machine dependent constants for Sun-4c (SPARCstation) 18*55121Storek */ 19*55121Storek #define MACHINE "sparc" 20*55121Storek 21*55121Storek #ifdef KERNEL /* XXX */ 22*55121Storek #include "machine/cpu.h" /* XXX */ 23*55121Storek #endif /* XXX */ 24*55121Storek 25*55121Storek /* 26*55121Storek * Round p (pointer or byte index) up to a correctly-aligned value for 27*55121Storek * the machine's strictest data type. The result is u_int and must be 28*55121Storek * cast to any desired pointer type. 29*55121Storek */ 30*55121Storek #define ALIGNBYTES 7 31*55121Storek #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES) 32*55121Storek 33*55121Storek #define NBPG 4096 /* bytes/page */ 34*55121Storek #define PGOFSET (NBPG-1) /* byte offset into page */ 35*55121Storek #define PGSHIFT 12 /* log2(NBPG) */ 36*55121Storek 37*55121Storek #define KERNBASE 0xf8000000 /* start of kernel virtual space */ 38*55121Storek #define KERNTEXTOFF 0xf8004000 /* start of kernel text */ 39*55121Storek #define BTOPKERNBASE ((u_long)KERNBASE >> PG_SHIFT) 40*55121Storek 41*55121Storek #define DEV_BSIZE 512 42*55121Storek #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 43*55121Storek #define BLKDEV_IOSIZE 2048 44*55121Storek #define MAXPHYS (64 * 1024) 45*55121Storek 46*55121Storek #define CLSIZE 1 47*55121Storek #define CLSIZELOG2 0 48*55121Storek 49*55121Storek /* NOTE: SSIZE and UPAGES must be multiples of CLSIZE */ 50*55121Storek #define SSIZE 1 /* initial stack size/NBPG */ 51*55121Storek #define UPAGES 2 /* pages of u-area */ 52*55121Storek 53*55121Storek /* 54*55121Storek * Constants related to network buffer management. 55*55121Storek * MCLBYTES must be no larger than CLBYTES (the software page size), and, 56*55121Storek * on machines that exchange pages of input or output buffers with mbuf 57*55121Storek * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 58*55121Storek * of the hardware page size. 59*55121Storek */ 60*55121Storek #define MSIZE 128 /* size of an mbuf */ 61*55121Storek #define MCLBYTES 2048 /* enough for whole Ethernet packet */ 62*55121Storek #define MCLSHIFT 11 /* log2(MCLBYTES) */ 63*55121Storek #define MCLOFSET (MCLBYTES - 1) 64*55121Storek 65*55121Storek #ifndef NMBCLUSTERS 66*55121Storek #ifdef GATEWAY 67*55121Storek #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 68*55121Storek #else 69*55121Storek #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 70*55121Storek #endif 71*55121Storek #endif 72*55121Storek 73*55121Storek /* 74*55121Storek * Size of kernel malloc arena in CLBYTES-sized logical pages. 75*55121Storek */ 76*55121Storek #ifndef NKMEMCLUSTERS 77*55121Storek #define NKMEMCLUSTERS (3 * 1024 * 1024 / CLBYTES) 78*55121Storek #endif 79*55121Storek 80*55121Storek /* pages ("clicks") (4096 bytes) to disk blocks */ 81*55121Storek #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) 82*55121Storek #define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) 83*55121Storek #define dtob(x) ((x) << DEV_BSHIFT) 84*55121Storek 85*55121Storek /* pages to bytes */ 86*55121Storek #define ctob(x) ((x) << PGSHIFT) 87*55121Storek 88*55121Storek /* bytes to pages */ 89*55121Storek #define btoc(x) (((unsigned)(x) + PGOFSET) >> PGSHIFT) 90*55121Storek 91*55121Storek #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 92*55121Storek ((unsigned)(bytes) >> DEV_BSHIFT) 93*55121Storek #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 94*55121Storek ((unsigned)(db) << DEV_BSHIFT) 95*55121Storek 96*55121Storek /* 97*55121Storek * Map a ``block device block'' to a file system block. 98*55121Storek * This should be device dependent, and should use the bsize 99*55121Storek * field from the disk label. 100*55121Storek * For now though just use DEV_BSIZE. 101*55121Storek */ 102*55121Storek #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE / DEV_BSIZE)) 103*55121Storek 104*55121Storek #ifdef KERNEL 105*55121Storek #ifndef LOCORE 106*55121Storek #define DELAY(n) delay(n) 107*55121Storek #endif 108*55121Storek #else 109*55121Storek #define DELAY(n) { register volatile int N = (n); while (--N > 0); } 110*55121Storek #endif 111