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