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