Home | History | Annotate | Line # | Download | only in include
param.h revision 1.49
      1 /*      $NetBSD: param.h,v 1.49 2002/03/24 19:08:17 jdolecek 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 /*
     44  * Machine dependent constants for VAX.
     45  */
     46 
     47 #define	_MACHINE	vax
     48 #define	MACHINE		"vax"
     49 #define	_MACHINE_ARCH	vax
     50 #define	MACHINE_ARCH	"vax"
     51 #define	MID_MACHINE	MID_VAX
     52 
     53 /*
     54  * Round p (pointer or byte index) up to a correctly-aligned value
     55  * for all data types (int, long, ...).   The result is u_int and
     56  * must be cast to any desired pointer type.
     57  *
     58  * ALIGNED_POINTER is a boolean macro that checks whether an address
     59  * is valid to fetch data elements of type t from on this architecture.
     60  * This does not reflect the optimal alignment, just the possibility
     61  * (within reasonable limits).
     62  *
     63  */
     64 
     65 #define ALIGNBYTES		(sizeof(int) - 1)
     66 #define ALIGN(p)		(((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
     67 #define ALIGNED_POINTER(p,t)	((((u_long)(p)) & (sizeof(t)-1)) == 0)
     68 
     69 #define	PGSHIFT		12			/* LOG2(NBPG) */
     70 #define	NBPG		(1 << PGSHIFT)		/* (1 << PGSHIFT) bytes/page */
     71 #define	PGOFSET		(NBPG - 1)		/* byte offset into page */
     72 
     73 #define	VAX_PGSHIFT	9
     74 #define	VAX_NBPG	(1 << VAX_PGSHIFT)
     75 #define	VAX_PGOFSET	(VAX_NBPG - 1)
     76 #define	VAX_NPTEPG	(VAX_NBPG / 4)
     77 
     78 #define	KERNBASE	0x80000000		/* start of kernel virtual */
     79 
     80 #define	DEV_BSHIFT	9		               /* log2(DEV_BSIZE) */
     81 #define	DEV_BSIZE	(1 << DEV_BSHIFT)
     82 
     83 #define BLKDEV_IOSIZE	2048
     84 #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
     85 #define	MAXBSIZE	0x4000		/* max FS block size - XXX */
     86 
     87 #define	UPAGES		2		/* pages of u-area */
     88 #define USPACE		(NBPG*UPAGES)
     89 #define	REDZONEADDR	(VAX_NBPG*3)	/* Must be > sizeof(struct user) */
     90 
     91 #ifndef MSGBUFSIZE
     92 #define MSGBUFSIZE	NBPG		/* default message buffer size */
     93 #endif
     94 
     95 /*
     96  * KVA is very tight on vax, reduce the amount of KVA used by pipe
     97  * "direct" write code to reasonably low value.
     98  */
     99 #ifndef PIPE_DIRECT_CHUNK
    100 #define PIPE_DIRECT_CHUNK	65536
    101 #endif
    102 
    103 /*
    104  * Constants related to network buffer management.
    105  * MCLBYTES must be no larger than NBPG (the software page size), and,
    106  * on machines that exchange pages of input or output buffers with mbuf
    107  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
    108  * of the hardware page size.
    109  */
    110 #define	MSIZE		256		/* size of an mbuf */
    111 
    112 #ifndef	MCLSHIFT
    113 #define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
    114 					/* 2K cluster can hold Ether frame */
    115 #endif	/* MCLSHIFT */
    116 
    117 #define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
    118 
    119 #ifndef NMBCLUSTERS
    120 #if defined(_KERNEL_OPT)
    121 #include "opt_gateway.h"
    122 #endif
    123 
    124 #ifdef GATEWAY
    125 #define	NMBCLUSTERS	512		/* map size, max cluster allocation */
    126 #else
    127 #define	NMBCLUSTERS	256		/* map size, max cluster allocation */
    128 #endif
    129 #endif
    130 
    131 /*
    132  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
    133  * logical pages.
    134  */
    135 #define	NKMEMPAGES_MIN_DEFAULT	((4 * 1024 * 1024) >> PAGE_SHIFT)
    136 #define	NKMEMPAGES_MAX_DEFAULT	((4 * 1024 * 1024) >> PAGE_SHIFT)
    137 
    138 /*
    139  * Some macros for units conversion
    140  */
    141 
    142 /* pages ("clicks") to disk blocks */
    143 #define	ctod(x)		((x) << (PGSHIFT - DEV_BSHIFT))
    144 #define	dtoc(x)		((x) >> (PGSHIFT - DEV_BSHIFT))
    145 
    146 /* clicks to bytes */
    147 #define	ctob(x)		((x) << PGSHIFT)
    148 #define	btoc(x)		(((unsigned)(x) + PGOFSET) >> PGSHIFT)
    149 #define	btop(x)		(((unsigned)(x)) >> PGSHIFT)
    150 
    151 /* bytes to disk blocks */
    152 #define	btodb(x)	((x) >> DEV_BSHIFT)
    153 #define	dbtob(x)	((x) << DEV_BSHIFT)
    154 
    155 /* MD conversion macros */
    156 #define	vax_btoc(x)	(((unsigned)(x) + VAX_PGOFSET) >> VAX_PGSHIFT)
    157 #define	vax_btop(x)	(((unsigned)(x)) >> VAX_PGSHIFT)
    158 
    159 /*
    160  * Map a ``block device block'' to a file system block.
    161  * This should be device dependent, and will be if we
    162  * add an entry to cdevsw/bdevsw for that purpose.
    163  * For now though just use DEV_BSIZE.
    164  */
    165 
    166 #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
    167 
    168 #ifdef _KERNEL
    169 #include <machine/intr.h>
    170 
    171 /* Prototype needed for delay() */
    172 #ifndef	_LOCORE
    173 void	delay __P((int));
    174 /* inline macros used inside kernel */
    175 #include <machine/macros.h>
    176 #endif
    177 
    178 #define	DELAY(x) delay(x)
    179 #endif /* _KERNEL */
    180 
    181 #endif /* _VAX_PARAM_H_ */
    182