Home | History | Annotate | Line # | Download | only in include
param.h revision 1.56
      1 /*      $NetBSD: param.h,v 1.56 2008/07/02 17:28:57 ad 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. Neither the name of the University nor the names of its contributors
     18  *    may be used to endorse or promote products derived from this software
     19  *    without specific prior written permission.
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31  * SUCH DAMAGE.
     32  *
     33  *	@(#)param.h	5.8 (Berkeley) 6/28/91
     34  */
     35 
     36 #ifndef _VAX_PARAM_H_
     37 #define _VAX_PARAM_H_
     38 
     39 /*
     40  * Machine dependent constants for VAX.
     41  */
     42 
     43 #define	_MACHINE	vax
     44 #define	MACHINE		"vax"
     45 #define	_MACHINE_ARCH	vax
     46 #define	MACHINE_ARCH	"vax"
     47 #define	MID_MACHINE	MID_VAX
     48 
     49 /*
     50  * Round p (pointer or byte index) up to a correctly-aligned value
     51  * for all data types (int, long, ...).   The result is u_int and
     52  * must be cast to any desired pointer type.
     53  *
     54  * ALIGNED_POINTER is a boolean macro that checks whether an address
     55  * is valid to fetch data elements of type t from on this architecture.
     56  * This does not reflect the optimal alignment, just the possibility
     57  * (within reasonable limits).
     58  *
     59  */
     60 
     61 #define ALIGNBYTES		(sizeof(int) - 1)
     62 #define ALIGN(p)		(((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
     63 #define ALIGNED_POINTER(p,t)	((((u_long)(p)) & (sizeof(t)-1)) == 0)
     64 
     65 #define	PGSHIFT		12			/* LOG2(NBPG) */
     66 #define	NBPG		(1 << PGSHIFT)		/* (1 << PGSHIFT) bytes/page */
     67 #define	PGOFSET		(NBPG - 1)		/* byte offset into page */
     68 
     69 #define	VAX_PGSHIFT	9
     70 #define	VAX_NBPG	(1 << VAX_PGSHIFT)
     71 #define	VAX_PGOFSET	(VAX_NBPG - 1)
     72 #define	VAX_NPTEPG	(VAX_NBPG / 4)
     73 
     74 #define	KERNBASE	0x80000000		/* start of kernel virtual */
     75 
     76 #define	DEV_BSHIFT	9		               /* log2(DEV_BSIZE) */
     77 #define	DEV_BSIZE	(1 << DEV_BSHIFT)
     78 
     79 #define BLKDEV_IOSIZE	2048
     80 #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
     81 #define	MAXBSIZE	0x4000		/* max FS block size - XXX */
     82 
     83 #define	UPAGES		2		/* pages of u-area */
     84 #define USPACE		(NBPG*UPAGES)
     85 #define	REDZONEADDR	(VAX_NBPG*3)	/* Must be > sizeof(struct user) */
     86 
     87 #ifndef MSGBUFSIZE
     88 #define MSGBUFSIZE	NBPG		/* default message buffer size */
     89 #endif
     90 
     91 /*
     92  * KVA is very tight on vax, reduce the amount of KVA used by pipe
     93  * "direct" write code to reasonably low value.
     94  */
     95 #ifndef PIPE_DIRECT_CHUNK
     96 #define PIPE_DIRECT_CHUNK	65536
     97 #endif
     98 
     99 /*
    100  * Constants related to network buffer management.
    101  * MCLBYTES must be no larger than NBPG (the software page size), and,
    102  * on machines that exchange pages of input or output buffers with mbuf
    103  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
    104  * of the hardware page size.
    105  */
    106 #define	MSIZE		256		/* size of an mbuf */
    107 
    108 #ifndef	MCLSHIFT
    109 #define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
    110 					/* 2K cluster can hold Ether frame */
    111 #endif	/* MCLSHIFT */
    112 
    113 #define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
    114 
    115 #ifndef NMBCLUSTERS
    116 #if defined(_KERNEL_OPT)
    117 #include "opt_gateway.h"
    118 #endif
    119 
    120 #ifdef GATEWAY
    121 #define	NMBCLUSTERS	512		/* map size, max cluster allocation */
    122 #else
    123 #define	NMBCLUSTERS	256		/* map size, max cluster allocation */
    124 #endif
    125 #endif
    126 
    127 /*
    128  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
    129  * logical pages.
    130  */
    131 #define	NKMEMPAGES_MIN_DEFAULT	((4 * 1024 * 1024) >> PAGE_SHIFT)
    132 #define	NKMEMPAGES_MAX_DEFAULT	((4 * 1024 * 1024) >> PAGE_SHIFT)
    133 
    134 /*
    135  * Some macros for units conversion
    136  */
    137 
    138 #define	btop(x)		((x) >> PGSHIFT)
    139 
    140 /* MD conversion macros */
    141 #define	vax_btoc(x)	(((unsigned)(x) + VAX_PGOFSET) >> VAX_PGSHIFT)
    142 #define	vax_btop(x)	(((unsigned)(x)) >> VAX_PGSHIFT)
    143 
    144 #ifdef _KERNEL
    145 #include <machine/intr.h>
    146 
    147 /* Prototype needed for delay() */
    148 #ifndef	_LOCORE
    149 void	delay(int);
    150 /* inline macros used inside kernel */
    151 #include <machine/macros.h>
    152 #endif
    153 
    154 #define	DELAY(x) delay(x)
    155 #define	MAXEXEC	1
    156 #endif /* _KERNEL */
    157 
    158 #endif /* _VAX_PARAM_H_ */
    159