Home | History | Annotate | Line # | Download | only in include
param.h revision 1.11.16.1
      1  1.11.16.1     skrll /*	$NetBSD: param.h,v 1.11.16.1 2004/08/03 10:36:40 skrll Exp $	*/
      2        1.1     veego 
      3        1.1     veego /*
      4        1.1     veego  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
      5        1.1     veego  * All rights reserved.
      6        1.1     veego  *
      7        1.1     veego  * This code is derived from software contributed to Berkeley by
      8        1.1     veego  * the Systems Programming Group of the University of Utah Computer
      9        1.1     veego  * Science Department.
     10        1.1     veego  *
     11        1.1     veego  * Redistribution and use in source and binary forms, with or without
     12        1.1     veego  * modification, are permitted provided that the following conditions
     13        1.1     veego  * are met:
     14        1.1     veego  * 1. Redistributions of source code must retain the above copyright
     15        1.1     veego  *    notice, this list of conditions and the following disclaimer.
     16        1.1     veego  * 2. Redistributions in binary form must reproduce the above copyright
     17        1.1     veego  *    notice, this list of conditions and the following disclaimer in the
     18        1.1     veego  *    documentation and/or other materials provided with the distribution.
     19  1.11.16.1     skrll  * 3. Neither the name of the University nor the names of its contributors
     20  1.11.16.1     skrll  *    may be used to endorse or promote products derived from this software
     21  1.11.16.1     skrll  *    without specific prior written permission.
     22  1.11.16.1     skrll  *
     23  1.11.16.1     skrll  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24  1.11.16.1     skrll  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  1.11.16.1     skrll  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  1.11.16.1     skrll  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27  1.11.16.1     skrll  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  1.11.16.1     skrll  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  1.11.16.1     skrll  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  1.11.16.1     skrll  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  1.11.16.1     skrll  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  1.11.16.1     skrll  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  1.11.16.1     skrll  * SUCH DAMAGE.
     34  1.11.16.1     skrll  *
     35  1.11.16.1     skrll  * from: Utah $Hdr: machparam.h 1.16 92/12/20$
     36  1.11.16.1     skrll  *
     37  1.11.16.1     skrll  *	@(#)param.h	8.1 (Berkeley) 6/10/93
     38  1.11.16.1     skrll  */
     39  1.11.16.1     skrll /*
     40  1.11.16.1     skrll  * Copyright (c) 1988 University of Utah.
     41  1.11.16.1     skrll  *
     42  1.11.16.1     skrll  * This code is derived from software contributed to Berkeley by
     43  1.11.16.1     skrll  * the Systems Programming Group of the University of Utah Computer
     44  1.11.16.1     skrll  * Science Department.
     45  1.11.16.1     skrll  *
     46  1.11.16.1     skrll  * Redistribution and use in source and binary forms, with or without
     47  1.11.16.1     skrll  * modification, are permitted provided that the following conditions
     48  1.11.16.1     skrll  * are met:
     49  1.11.16.1     skrll  * 1. Redistributions of source code must retain the above copyright
     50  1.11.16.1     skrll  *    notice, this list of conditions and the following disclaimer.
     51  1.11.16.1     skrll  * 2. Redistributions in binary form must reproduce the above copyright
     52  1.11.16.1     skrll  *    notice, this list of conditions and the following disclaimer in the
     53  1.11.16.1     skrll  *    documentation and/or other materials provided with the distribution.
     54        1.1     veego  * 3. All advertising materials mentioning features or use of this software
     55        1.1     veego  *    must display the following acknowledgement:
     56        1.1     veego  *	This product includes software developed by the University of
     57        1.1     veego  *	California, Berkeley and its contributors.
     58        1.1     veego  * 4. Neither the name of the University nor the names of its contributors
     59        1.1     veego  *    may be used to endorse or promote products derived from this software
     60        1.1     veego  *    without specific prior written permission.
     61        1.1     veego  *
     62        1.1     veego  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     63        1.1     veego  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     64        1.1     veego  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     65        1.1     veego  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     66        1.1     veego  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     67        1.1     veego  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     68        1.1     veego  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     69        1.1     veego  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     70        1.1     veego  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     71        1.1     veego  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     72        1.1     veego  * SUCH DAMAGE.
     73        1.1     veego  *
     74        1.2     veego  * from: Utah $Hdr: machparam.h 1.16 92/12/20$
     75        1.1     veego  *
     76        1.2     veego  *	@(#)param.h	8.1 (Berkeley) 6/10/93
     77        1.1     veego  */
     78        1.1     veego #ifndef _M68K_PARAM_H_
     79        1.1     veego #define _M68K_PARAM_H_
     80        1.1     veego 
     81        1.1     veego /*
     82        1.1     veego  * Machine independent constants for m68k
     83        1.1     veego  */
     84        1.9  fredette #ifndef	MACHINE_ARCH
     85        1.1     veego #define	_MACHINE_ARCH	m68k
     86        1.1     veego #define	MACHINE_ARCH	"m68k"
     87        1.9  fredette #endif
     88        1.9  fredette #ifndef	MID_MACHINE
     89        1.1     veego #define	MID_MACHINE	MID_M68K
     90        1.9  fredette #endif
     91        1.1     veego 
     92        1.1     veego /*
     93        1.1     veego  * Round p (pointer or byte index) up to a correctly-aligned value for all
     94        1.1     veego  * data types (int, long, ...).   The result is u_int and must be cast to
     95        1.1     veego  * any desired pointer type.
     96        1.1     veego  *
     97        1.1     veego  * ALIGNED_POINTER is a boolean macro that checks whether an address
     98        1.1     veego  * is valid to fetch data elements of type t from on this architecture.
     99        1.1     veego  * This does not reflect the optimal alignment, just the possibility
    100        1.1     veego  * (within reasonable limits).
    101        1.1     veego  *
    102        1.1     veego  */
    103        1.1     veego #define ALIGNBYTES		(sizeof(int) - 1)
    104        1.1     veego #define	ALIGN(p)		(((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
    105        1.1     veego #define ALIGNED_POINTER(p,t)	((((u_long)(p)) & (sizeof(t)-1)) == 0)
    106        1.1     veego 
    107        1.1     veego #define	NBPG		(1 << PGSHIFT)	/* bytes/page */
    108        1.1     veego #define	PGOFSET		(NBPG-1)	/* byte offset into page */
    109        1.1     veego 
    110        1.1     veego #define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
    111        1.1     veego 
    112        1.1     veego #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
    113        1.1     veego #define	DEV_BSIZE	(1 << DEV_BSHIFT)
    114        1.1     veego #define BLKDEV_IOSIZE	2048
    115  1.11.16.1     skrll #ifndef MAXPHYS
    116        1.1     veego #define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
    117  1.11.16.1     skrll #endif
    118        1.1     veego 
    119        1.1     veego #define	SSIZE		1		/* initial stack size/NBPG */
    120        1.1     veego #define	SINCR		1		/* increment of stack/NBPG */
    121        1.1     veego 
    122        1.1     veego #define	USPACE		(UPAGES * NBPG)
    123        1.4       leo 
    124        1.4       leo #ifndef MSGBUFSIZE
    125        1.4       leo #define MSGBUFSIZE	NBPG		/* default message buffer size */
    126        1.4       leo #endif
    127        1.1     veego 
    128        1.1     veego /*
    129        1.1     veego  * Constants related to network buffer management.
    130       1.11    simonb  * MCLBYTES must be no larger than NBPG (the software page size), and,
    131        1.1     veego  * on machines that exchange pages of input or output buffers with mbuf
    132        1.1     veego  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
    133        1.1     veego  * of the hardware page size.
    134        1.1     veego  */
    135        1.8    itojun #define	MSIZE		256		/* size of an mbuf */
    136        1.1     veego 
    137       1.11    simonb #ifndef MCLSHIFT
    138       1.11    simonb #define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
    139       1.11    simonb 					/* 2K cluster can hold Ether frame */
    140        1.1     veego #endif	/* MCLSHIFT */
    141        1.1     veego 
    142       1.11    simonb #define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
    143       1.11    simonb 
    144        1.1     veego #ifndef NMBCLUSTERS
    145       1.10       mrg #if defined(_KERNEL_OPT)
    146        1.5   thorpej #include "opt_gateway.h"
    147       1.10       mrg #endif
    148        1.5   thorpej 
    149        1.1     veego #ifdef GATEWAY
    150        1.1     veego # define	NMBCLUSTERS	512	/* map size, max cluster allocation */
    151        1.1     veego #else
    152        1.1     veego # define	NMBCLUSTERS	256	/* map size, max cluster allocation */
    153        1.1     veego #endif
    154        1.1     veego #endif
    155        1.1     veego 
    156        1.1     veego /* pages ("clicks") to disk blocks */
    157        1.1     veego #define	ctod(x)		((x) << (PGSHIFT - DEV_BSHIFT))
    158        1.1     veego #define	dtoc(x)		((x) >> (PGSHIFT - DEV_BSHIFT))
    159        1.1     veego 
    160        1.1     veego /* pages to bytes */
    161        1.1     veego #define	ctob(x)		((x) << PGSHIFT)
    162        1.1     veego #define	btoc(x)		(((x) + PGOFSET) >> PGSHIFT)
    163        1.1     veego 
    164        1.1     veego /* bytes to disk blocks */
    165        1.1     veego #define	btodb(x)	((x) >> DEV_BSHIFT)
    166        1.1     veego #define	dbtob(x)	((x) << DEV_BSHIFT)
    167        1.1     veego 
    168        1.1     veego /*
    169        1.1     veego  * Map a ``block device block'' to a file system block.
    170        1.1     veego  * This should be device dependent, and should use the bsize
    171        1.1     veego  * field from the disk label.
    172        1.1     veego  * For now though just use DEV_BSIZE.
    173        1.1     veego  */
    174        1.1     veego #define	bdbtofsb(bn)	((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
    175        1.2     veego 
    176        1.2     veego /*
    177        1.7    scottr  * Mach-derived conversion macros
    178        1.2     veego  */
    179        1.2     veego #define	m68k_round_seg(x)	((((unsigned)(x)) + SEGOFSET) & ~SEGOFSET)
    180        1.2     veego #define	m68k_trunc_seg(x)	((unsigned)(x) & ~SEGOFSET)
    181        1.7    scottr #define	m68k_seg_offset(x)	((unsigned)(x) & SEGOFSET)
    182        1.2     veego #define	m68k_round_page(x)	((((unsigned)(x)) + PGOFSET) & ~PGOFSET)
    183        1.2     veego #define	m68k_trunc_page(x)	((unsigned)(x) & ~PGOFSET)
    184        1.7    scottr #define	m68k_page_offset(x)	((unsigned)(x) & PGOFSET)
    185        1.2     veego #define	m68k_btop(x)		((unsigned)(x) >> PGSHIFT)
    186        1.2     veego #define	m68k_ptob(x)		((unsigned)(x) << PGSHIFT)
    187        1.1     veego 
    188        1.1     veego #endif	/* !_M68K_PARAM_H_ */
    189