1*41474Smckusick /* 2*41474Smckusick * Copyright (c) 1988 University of Utah. 3*41474Smckusick * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. 4*41474Smckusick * All rights reserved. 5*41474Smckusick * 6*41474Smckusick * This code is derived from software contributed to Berkeley by 7*41474Smckusick * the Systems Programming Group of the University of Utah Computer 8*41474Smckusick * Science Department. 9*41474Smckusick * 10*41474Smckusick * %sccs.include.redist.c% 11*41474Smckusick * 12*41474Smckusick * from: Utah $Hdr: machparam.h 1.11 89/08/14$ 13*41474Smckusick * 14*41474Smckusick * @(#)param.h 7.1 (Berkeley) 05/08/90 15*41474Smckusick */ 16*41474Smckusick 17*41474Smckusick /* 18*41474Smckusick * Machine dependent constants for HP9000 series 300. 19*41474Smckusick */ 20*41474Smckusick #define MACHINE "hp300" 21*41474Smckusick 22*41474Smckusick #ifndef BYTE_ORDER 23*41474Smckusick #include <machine/endian.h> 24*41474Smckusick #endif 25*41474Smckusick 26*41474Smckusick #include <machine/machlimits.h> 27*41474Smckusick 28*41474Smckusick #define NBPG 4096 /* bytes/page */ 29*41474Smckusick #define PGOFSET (NBPG-1) /* byte offset into page */ 30*41474Smckusick #define PGSHIFT 12 /* LOG2(NBPG) */ 31*41474Smckusick #define NPTEPG (NBPG/(sizeof (struct pte))) 32*41474Smckusick 33*41474Smckusick #define NBSEG (1024*NBPG) /* bytes/segment */ 34*41474Smckusick #define SEGOFSET (NBSEG-1) /* byte offset into segment */ 35*41474Smckusick #define SEGSHIFT 22 /* LOG2(NBSEG) */ 36*41474Smckusick 37*41474Smckusick #define KERNBASE 0x00000000 /* start of kernel virtual */ 38*41474Smckusick #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) 39*41474Smckusick 40*41474Smckusick #define DEV_BSIZE 512 41*41474Smckusick #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 42*41474Smckusick #define BLKDEV_IOSIZE 2048 43*41474Smckusick #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ 44*41474Smckusick 45*41474Smckusick #define CLSIZE 1 46*41474Smckusick #define CLSIZELOG2 0 47*41474Smckusick 48*41474Smckusick #define SSIZE 1 /* initial stack size/NBPG */ 49*41474Smckusick #define SINCR 1 /* increment of stack/NBPG */ 50*41474Smckusick 51*41474Smckusick #define UPAGES 3 /* pages of u-area */ 52*41474Smckusick 53*41474Smckusick /* 54*41474Smckusick * Constants related to network buffer management. 55*41474Smckusick * MCLBYTES must be no larger than CLBYTES (the software page size), and, 56*41474Smckusick * on machines that exchange pages of input or output buffers with mbuf 57*41474Smckusick * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 58*41474Smckusick * of the hardware page size. 59*41474Smckusick */ 60*41474Smckusick #define MSIZE 128 /* size of an mbuf */ 61*41474Smckusick #define MCLBYTES 1024 62*41474Smckusick #define MCLSHIFT 10 63*41474Smckusick #define MCLOFSET (MCLBYTES - 1) 64*41474Smckusick #ifndef NMBCLUSTERS 65*41474Smckusick #ifdef GATEWAY 66*41474Smckusick #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 67*41474Smckusick #else 68*41474Smckusick #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 69*41474Smckusick #endif 70*41474Smckusick #endif 71*41474Smckusick 72*41474Smckusick /* 73*41474Smckusick * Size of kernel malloc arena in CLBYTES-sized logical pages 74*41474Smckusick */ 75*41474Smckusick #ifndef NKMEMCLUSTERS 76*41474Smckusick #define NKMEMCLUSTERS (512*1024/CLBYTES) 77*41474Smckusick #endif 78*41474Smckusick 79*41474Smckusick /* 80*41474Smckusick * Some macros for units conversion 81*41474Smckusick */ 82*41474Smckusick /* Core clicks (4096 bytes) to segments and vice versa */ 83*41474Smckusick #define ctos(x) (x) 84*41474Smckusick #define stoc(x) (x) 85*41474Smckusick 86*41474Smckusick /* Core clicks (4096 bytes) to disk blocks */ 87*41474Smckusick #define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT)) 88*41474Smckusick #define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT)) 89*41474Smckusick #define dtob(x) ((x)<<DEV_BSHIFT) 90*41474Smckusick 91*41474Smckusick /* clicks to bytes */ 92*41474Smckusick #define ctob(x) ((x)<<PGSHIFT) 93*41474Smckusick 94*41474Smckusick /* bytes to clicks */ 95*41474Smckusick #define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT) 96*41474Smckusick 97*41474Smckusick #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 98*41474Smckusick ((unsigned)(bytes) >> DEV_BSHIFT) 99*41474Smckusick #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 100*41474Smckusick ((unsigned)(db) << DEV_BSHIFT) 101*41474Smckusick 102*41474Smckusick /* 103*41474Smckusick * Map a ``block device block'' to a file system block. 104*41474Smckusick * This should be device dependent, and will be if we 105*41474Smckusick * add an entry to cdevsw/bdevsw for that purpose. 106*41474Smckusick * For now though just use DEV_BSIZE. 107*41474Smckusick */ 108*41474Smckusick #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) 109*41474Smckusick 110*41474Smckusick /* 111*41474Smckusick * Macros to decode processor status word. 112*41474Smckusick */ 113*41474Smckusick #define USERMODE(ps) (((ps) & PSL_S) == 0) 114*41474Smckusick #define BASEPRI(ps) (((ps) & PSL_IPL7) == 0) 115*41474Smckusick 116*41474Smckusick #ifdef KERNEL 117*41474Smckusick #ifndef LOCORE 118*41474Smckusick int cpuspeed; 119*41474Smckusick #define DELAY(n) { register int N = cpuspeed * (n); while (--N > 0); } 120*41474Smckusick #endif 121*41474Smckusick 122*41474Smckusick #else KERNEL 123*41474Smckusick #define DELAY(n) { register int N = (n); while (--N > 0); } 124*41474Smckusick #endif KERNEL 125*41474Smckusick 126*41474Smckusick #ifdef HPUXCOMPAT 127*41474Smckusick /* 128*41474Smckusick * Constants/macros for HPUX multiple mapping of user address space. 129*41474Smckusick * Pages in the first 256Mb are mapped in at every 256Mb segment. 130*41474Smckusick */ 131*41474Smckusick #define HPMMMASK 0xF0000000 132*41474Smckusick #define ISHPMMADDR(v) \ 133*41474Smckusick ((u.u_pcb.pcb_flags&PCB_HPUXMMAP) && ((unsigned)(v)&HPMMMASK) != HPMMMASK) 134*41474Smckusick #define HPMMBASEADDR(v) ((unsigned)(v) & ~HPMMMASK) 135*41474Smckusick #endif 136