1 /* 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This software was developed by the Computer Systems Engineering group 6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 7 * contributed to Berkeley. 8 * 9 * All advertising materials mentioning features or use of this software 10 * must display the following acknowledgement: 11 * This product includes software developed by the University of 12 * California, Lawrence Berkeley Laboratory. 13 * 14 * Redistribution and use in source and binary forms, with or without 15 * modification, are permitted provided that the following conditions 16 * are met: 17 * 1. Redistributions of source code must retain the above copyright 18 * notice, this list of conditions and the following disclaimer. 19 * 2. Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in the 21 * documentation and/or other materials provided with the distribution. 22 * 3. All advertising materials mentioning features or use of this software 23 * must display the following acknowledgement: 24 * This product includes software developed by the University of 25 * California, Berkeley and its contributors. 26 * 4. Neither the name of the University nor the names of its contributors 27 * may be used to endorse or promote products derived from this software 28 * without specific prior written permission. 29 * 30 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 33 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 36 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 40 * SUCH DAMAGE. 41 * 42 * @(#)param.h 8.1 (Berkeley) 6/11/93 43 * 44 * from: Header: param.h,v 1.13 92/11/26 02:04:38 torek Exp (LBL) 45 * $Id: param.h,v 1.7 1994/08/20 01:26:41 deraadt Exp $ 46 */ 47 48 /* 49 * Machine dependent constants for Sun-4c (SPARCstation) 50 */ 51 #define MACHINE "sparc" 52 #define MACHINE_ARCH "sparc" 53 #define MID_MACHINE MID_SPARC 54 55 #ifdef KERNEL /* XXX */ 56 #include <machine/cpu.h> /* XXX */ 57 #endif /* XXX */ 58 59 /* 60 * Round p (pointer or byte index) up to a correctly-aligned value for 61 * the machine's strictest data type. The result is u_int and must be 62 * cast to any desired pointer type. 63 */ 64 #define ALIGNBYTES 7 65 #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES) 66 67 #define SUN4_PGSHIFT 13 /* for a sun4 machine */ 68 #define SUN4CM_PGSHIFT 12 /* for a sun4c or sun4m machine */ 69 70 #if defined(KERNEL) && !defined(LOCORE) 71 extern int nbpg, pgofset, pgshift; 72 #endif 73 74 /* 75 * Three possible cases: 76 * sun4 only 8192 bytes/page 77 * sun4c/sun4m only 4096 bytes/page 78 * sun4/sun4c/sun4m either of the above 79 * 80 * In the later case NBPG, PGOFSET, and PGSHIFT are encoded in variables 81 * initialized early in locore.s. Since they are variables, rather than 82 * simple constants, the kernel will not perform slighly worse. 83 */ 84 #if defined(SUN4) && !defined(SUN4C) && !defined(SUN4M) 85 #define NBPG 8192 /* bytes/page */ 86 #define PGOFSET (NBPG-1) /* byte offset into page */ 87 #define PGSHIFT SUN4_PGSHIFT /* log2(NBPG) */ 88 #endif 89 #if !defined(SUN4) && (defined(SUN4C) || defined(SUN4M)) 90 #define NBPG 4096 /* bytes/page */ 91 #define PGOFSET (NBPG-1) /* byte offset into page */ 92 #define PGSHIFT SUN4CM_PGSHIFT /* log2(NBPG) */ 93 #endif 94 #if defined(SUN4) && (defined(SUN4C) || defined(SUN4M)) 95 #define NBPG nbpg /* bytes/page */ 96 #define PGOFSET pgofset /* byte offset into page */ 97 #define PGSHIFT pgshift /* log2(NBPG) */ 98 #endif 99 100 #define KERNBASE 0xf8000000 /* start of kernel virtual space */ 101 #define KERNTEXTOFF 0xf8004000 /* start of kernel text */ 102 103 #define DEV_BSIZE 512 104 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ 105 #define BLKDEV_IOSIZE 2048 106 #define MAXPHYS (64 * 1024) 107 108 #define CLSIZE 1 109 #define CLSIZELOG2 0 110 111 /* NOTE: SSIZE and UPAGES must be multiples of CLSIZE */ 112 #define SSIZE 1 /* initial stack size/NBPG */ 113 #define USPACE 8192 114 #define UPAGES (USPACE/4096) /* # 4K pages of u-area */ 115 116 /* 117 * Constants related to network buffer management. 118 * MCLBYTES must be no larger than CLBYTES (the software page size), and, 119 * on machines that exchange pages of input or output buffers with mbuf 120 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple 121 * of the hardware page size. 122 */ 123 #define MSIZE 128 /* size of an mbuf */ 124 #define MCLBYTES 2048 /* enough for whole Ethernet packet */ 125 #define MCLSHIFT 11 /* log2(MCLBYTES) */ 126 #define MCLOFSET (MCLBYTES - 1) 127 128 #ifndef NMBCLUSTERS 129 #ifdef GATEWAY 130 #define NMBCLUSTERS 512 /* map size, max cluster allocation */ 131 #else 132 #define NMBCLUSTERS 256 /* map size, max cluster allocation */ 133 #endif 134 #endif 135 136 /* 137 * Size of kernel malloc arena in CLBYTES-sized logical pages. 138 */ 139 #ifndef NKMEMCLUSTERS 140 #define NKMEMCLUSTERS (6 * 1024 * 1024 / CLBYTES) 141 #endif 142 143 /* pages ("clicks") (4096 bytes) to disk blocks */ 144 #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) 145 #define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) 146 #define dtob(x) ((x) << DEV_BSHIFT) 147 148 /* pages to bytes */ 149 #define ctob(x) ((x) << PGSHIFT) 150 151 /* bytes to pages */ 152 #define btoc(x) (((unsigned)(x) + PGOFSET) >> PGSHIFT) 153 154 #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ 155 ((unsigned)(bytes) >> DEV_BSHIFT) 156 #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ 157 ((unsigned)(db) << DEV_BSHIFT) 158 159 /* 160 * Map a ``block device block'' to a file system block. 161 * This should be device dependent, and should use the bsize 162 * field from the disk label. 163 * For now though just use DEV_BSIZE. 164 */ 165 #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE / DEV_BSIZE)) 166 167 #ifdef KERNEL 168 #ifndef LOCORE 169 #define DELAY(n) delay(n) 170 #endif 171 #else 172 #define DELAY(n) { register volatile int N = (n); while (--N > 0); } 173 #endif 174 175 #ifdef KERNEL 176 extern int cputyp; 177 #endif 178 /* 179 * Values for the cputyp variable. 180 */ 181 #define CPU_SUN4 0 182 #define CPU_SUN4C 1 183 #define CPU_SUN4M 2 184