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