Home | History | Annotate | Line # | Download | only in include
param.h revision 1.18
      1 /*      $NetBSD: param.h,v 1.18 1996/03/02 14:27:55 ragge Exp $    */
      2 /*-
      3  * Copyright (c) 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  * William Jolitz.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  * 2. Redistributions in binary form must reproduce the above copyright
     15  *    notice, this list of conditions and the following disclaimer in the
     16  *    documentation and/or other materials provided with the distribution.
     17  * 3. All advertising materials mentioning features or use of this software
     18  *    must display the following acknowledgement:
     19  *	This product includes software developed by the University of
     20  *	California, Berkeley and its contributors.
     21  * 4. Neither the name of the University nor the names of its contributors
     22  *    may be used to endorse or promote products derived from this software
     23  *    without specific prior written permission.
     24  *
     25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     35  * SUCH DAMAGE.
     36  *
     37  *	@(#)param.h	5.8 (Berkeley) 6/28/91
     38  */
     39 
     40 #ifndef _VAX_PARAM_H_
     41 #define _VAX_PARAM_H_
     42 
     43 #include <machine/macros.h>
     44 #include <machine/psl.h>
     45 
     46 /*
     47  * Machine dependent constants for VAX.
     48  */
     49 
     50 #define	MACHINE		"vax"
     51 #define	MACHINE_ARCH	"vax"
     52 #define	MID_MACHINE	MID_VAX
     53 
     54 /*
     55  * Round p (pointer or byte index) up to a correctly-aligned value
     56  * for all data types (int, long, ...).   The result is u_int and
     57  * must be cast to any desired pointer type.
     58  */
     59 
     60 #define ALIGNBYTES	(sizeof(int) - 1)
     61 #define ALIGN(p)	(((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
     62 
     63 #define	PGSHIFT	 9                             /* LOG2(NBPG) */
     64 #define	NBPG     (1<<PGSHIFT)                  /* (1 << PGSHIFT) bytes/page */
     65 #define	PGOFSET	 (NBPG-1)	               /* byte offset into page */
     66 #define	NPTEPG	 (NBPG/(sizeof (struct pte)))
     67 
     68 #define	KERNBASE     0x80000000	               /* start of kernel virtual */
     69 #define	BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
     70 
     71 #define	DEV_BSHIFT   9		               /* log2(DEV_BSIZE) */
     72 #define	DEV_BSIZE    (1 << DEV_BSHIFT)
     73 
     74 #define BLKDEV_IOSIZE 2048
     75 #define	MAXPHYS	      (63 * 1024)     /* max raw I/O transfer size */
     76 
     77 #define	CLSIZELOG2    1
     78 #define	CLSIZE	      2
     79 
     80 /* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
     81 #define	SSIZE	4		/* initial stack size/NBPG */
     82 #define	SINCR	4		/* increment of stack/NBPG */
     83 
     84 #define	UPAGES	16		/* pages of u-area */
     85 #define USPACE  (NBPG*UPAGES)
     86 
     87 /*
     88  * Constants related to network buffer management.
     89  * MCLBYTES must be no larger than CLBYTES (the software page size), and,
     90  * on machines that exchange pages of input or output buffers with mbuf
     91  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
     92  * of the hardware page size.
     93  */
     94 
     95 #ifndef	MSIZE
     96 #define	MSIZE		128		/* size of an mbuf */
     97 #endif	/* MSIZE */
     98 
     99 #ifndef	MCLSHIFT
    100 #define	MCLSHIFT	10		/* convert bytes to m_buf clusters */
    101 #endif	/* MCLSHIFT */
    102 #define	MCLBYTES	(1 << MCLSHIFT)	/* size of an m_buf cluster */
    103 #define	MCLOFSET	(MCLBYTES - 1)	/* offset within an m_buf cluster */
    104 
    105 #ifndef NMBCLUSTERS
    106 #ifdef GATEWAY
    107 #define	NMBCLUSTERS	512		/* map size, max cluster allocation */
    108 #else
    109 #define	NMBCLUSTERS	256		/* map size, max cluster allocation */
    110 #endif	/* GATEWAY */
    111 #endif	/* NMBCLUSTERS */
    112 
    113 /*
    114  * Size of kernel malloc arena in CLBYTES-sized logical pages
    115  */
    116 
    117 #ifndef NKMEMCLUSTERS
    118 #define	NKMEMCLUSTERS	(2048*1024/CLBYTES)
    119 #endif
    120 
    121 /*
    122  * Some macros for units conversion
    123  */
    124 
    125 /* pages ("clicks") to disk blocks */
    126 #define	ctod(x)		((x) << (PGSHIFT - DEV_BSHIFT))
    127 #define	dtoc(x)		((x) >> (PGSHIFT - DEV_BSHIFT))
    128 
    129 /* clicks to bytes */
    130 #define	ctob(x)		((x) << PGSHIFT)
    131 #define	btoc(x)		(((x) + PGOFSET) >> PGSHIFT)
    132 #define	btop(x)		(((unsigned)(x)) >> PGSHIFT)
    133 
    134 /* bytes to disk blocks */
    135 #define	btodb(x)	((x) >> DEV_BSHIFT)
    136 #define	dbtob(x)	((x) << DEV_BSHIFT)
    137 
    138 /*
    139  * Map a ``block device block'' to a file system block.
    140  * This should be device dependent, and will be if we
    141  * add an entry to cdevsw/bdevsw for that purpose.
    142  * For now though just use DEV_BSIZE.
    143  */
    144 
    145 #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
    146 
    147 #define splx(reg)                                       \
    148 ({                                                      \
    149         register int val;                               \
    150         asm __volatile ("mfpr $0x12,%0;mtpr %1,$0x12"	\
    151                         : "&=g" (val)                   \
    152                         : "g" (reg));                   \
    153         val;                                            \
    154 })
    155 
    156 
    157 #define	spl0()		splx(0)		/* IPL0  */
    158 #define splsoftclock()  splx(8)		/* IPL08 */
    159 #define splsoftnet()    splx(0xc)	/* IPL0C */
    160 #define	splddb()	splx(0xf)	/* IPL0F */
    161 #define spl4()          splx(0x14)	/* IPL14 */
    162 #define splbio()        splx(0x15)	/* IPL15 */
    163 #define splnet()        splx(0x15)	/* IPL15 */
    164 #define spltty()        splx(0x15)	/* IPL15 */
    165 #define splimp()        splx(0x17)	/* IPL17 */
    166 #define splclock()      splx(0x18)	/* IPL18 */
    167 #define splhigh()       splx(0x1f)	/* IPL1F */
    168 #define	splstatclock()	splclock()
    169 
    170 #define	ovbcopy(x,y,z)	bcopy(x,y,z)
    171 
    172 #define vmapbuf(p,q)
    173 #define vunmapbuf(p,q)
    174 
    175 /* Prototype needed for delay() */
    176 #ifndef	_LOCORE
    177 void	delay __P((int));
    178 #endif
    179 
    180 #define	DELAY(x) delay(x)
    181 
    182 #endif /* _VAX_PARAM_H_ */
    183