Home | History | Annotate | Line # | Download | only in include
param.h revision 1.1
      1  1.1  cherry /*	$NetBSD: param.h,v 1.1 2006/04/07 14:21:18 cherry Exp $	*/
      2  1.1  cherry 
      3  1.1  cherry /*-
      4  1.1  cherry  * Copyright (c) 1990 The Regents of the University of California.
      5  1.1  cherry  * All rights reserved.
      6  1.1  cherry  *
      7  1.1  cherry  * This code is derived from software contributed to Berkeley by
      8  1.1  cherry  * William Jolitz.
      9  1.1  cherry  *
     10  1.1  cherry  * Redistribution and use in source and binary forms, with or without
     11  1.1  cherry  * modification, are permitted provided that the following conditions
     12  1.1  cherry  * are met:
     13  1.1  cherry  * 1. Redistributions of source code must retain the above copyright
     14  1.1  cherry  *    notice, this list of conditions and the following disclaimer.
     15  1.1  cherry  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  cherry  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  cherry  *    documentation and/or other materials provided with the distribution.
     18  1.1  cherry  * 3. Neither the name of the University nor the names of its contributors
     19  1.1  cherry  *    may be used to endorse or promote products derived from this software
     20  1.1  cherry  *    without specific prior written permission.
     21  1.1  cherry  *
     22  1.1  cherry  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23  1.1  cherry  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  1.1  cherry  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  1.1  cherry  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26  1.1  cherry  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27  1.1  cherry  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28  1.1  cherry  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  1.1  cherry  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  1.1  cherry  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  1.1  cherry  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  1.1  cherry  * SUCH DAMAGE.
     33  1.1  cherry  *
     34  1.1  cherry  *	@(#)param.h	5.8 (Berkeley) 6/28/91
     35  1.1  cherry  */
     36  1.1  cherry 
     37  1.1  cherry #ifndef _IA64_PARAM_H_
     38  1.1  cherry #define _IA64_PARAM_H_
     39  1.1  cherry 
     40  1.1  cherry /*
     41  1.1  cherry  * Machine dependent constants for Intel Itanium.
     42  1.1  cherry  */
     43  1.1  cherry 
     44  1.1  cherry #define	_MACHINE	ia64
     45  1.1  cherry #define	MACHINE		"ia64"
     46  1.1  cherry #define	_MACHINE_ARCH	ia64
     47  1.1  cherry #define	MACHINE_ARCH	"ia64"
     48  1.1  cherry #define	MID_MACHINE	MID_IA64
     49  1.1  cherry 
     50  1.1  cherry #ifdef SMP
     51  1.1  cherry #define	MAXCPU		16
     52  1.1  cherry #else
     53  1.1  cherry #define MAXCPU		1
     54  1.1  cherry #endif
     55  1.1  cherry 
     56  1.1  cherry #define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
     57  1.1  cherry #define	DEV_BSIZE	(1<<DEV_BSHIFT)
     58  1.1  cherry #define	BLKDEV_IOSIZE	2048
     59  1.1  cherry 
     60  1.1  cherry #ifndef MAXPHYS
     61  1.1  cherry #define MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
     62  1.1  cherry #endif
     63  1.1  cherry 
     64  1.1  cherry #define UPAGES		4
     65  1.1  cherry #define	USPACE		(UPAGES * NBPG)	/* total size of u-area */
     66  1.1  cherry 
     67  1.1  cherry #ifndef MSGBUFSIZE
     68  1.1  cherry #define MSGBUFSIZE	NBPG		/* default message buffer size */
     69  1.1  cherry #endif
     70  1.1  cherry 
     71  1.1  cherry #ifndef	KSTACK_PAGES
     72  1.1  cherry #define	KSTACK_PAGES	4		/* pages of kernel stack */
     73  1.1  cherry #endif
     74  1.1  cherry #define	KSTACK_GUARD_PAGES 0		/* pages of kstack guard; 0 disables */
     75  1.1  cherry 
     76  1.1  cherry /*
     77  1.1  cherry  * Round p (pointer or byte index) up to a correctly-aligned value
     78  1.1  cherry  * for all data types (int, long, ...).   The result is u_int and
     79  1.1  cherry  * must be cast to any desired pointer type.
     80  1.1  cherry  *
     81  1.1  cherry  * ALIGNED_POINTER is a boolean macro that checks whether an address
     82  1.1  cherry  * is valid to fetch data elements of type t from on this architecture.
     83  1.1  cherry  * This does not reflect the optimal alignment, just the possibility
     84  1.1  cherry  * (within reasonable limits).
     85  1.1  cherry  *
     86  1.1  cherry  */
     87  1.1  cherry 
     88  1.1  cherry #define	ALIGNBYTES		15
     89  1.1  cherry #define	ALIGN(p)		(((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
     90  1.1  cherry #define ALIGNED_POINTER(p,t)	((((u_long)(p)) & (sizeof(t)-1)) == 0)
     91  1.1  cherry 
     92  1.1  cherry #define ALIGNBYTES32		(sizeof(int) - 1)
     93  1.1  cherry #define ALIGN32(p)		(((u_long)(p) + ALIGNBYTES32) &~ALIGNBYTES32)
     94  1.1  cherry 
     95  1.1  cherry #define	PGSHIFT		14		/* LOG2(NBPG) */
     96  1.1  cherry #define	NBPG		(1 << PGSHIFT)	/* bytes/page */
     97  1.1  cherry #define	PGOFSET		(NBPG-1)	/* byte offset into page */
     98  1.1  cherry #define	NPTEPG		(NBPG/(sizeof (pt_entry_t)))
     99  1.1  cherry /*
    100  1.1  cherry  * Constants related to network buffer management.
    101  1.1  cherry  * MCLBYTES must be no larger than NBPG (the software page size), and,
    102  1.1  cherry  * on machines that exchange pages of input or output buffers with mbuf
    103  1.1  cherry  * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
    104  1.1  cherry  * of the hardware page size.
    105  1.1  cherry  */
    106  1.1  cherry #define	MSIZE		256		/* size of an mbuf */
    107  1.1  cherry 
    108  1.1  cherry #ifndef MCLSHIFT
    109  1.1  cherry #define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
    110  1.1  cherry 					/* 2K cluster can hold Ether frame */
    111  1.1  cherry #endif	/* MCLSHIFT */
    112  1.1  cherry 
    113  1.1  cherry #define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
    114  1.1  cherry 
    115  1.1  cherry #ifndef NMBCLUSTERS
    116  1.1  cherry #if defined(_KERNEL_OPT)
    117  1.1  cherry #include "opt_gateway.h"
    118  1.1  cherry #endif
    119  1.1  cherry 
    120  1.1  cherry #ifdef GATEWAY
    121  1.1  cherry #define	NMBCLUSTERS	2048		/* map size, max cluster allocation */
    122  1.1  cherry #else
    123  1.1  cherry #define	NMBCLUSTERS	1024		/* map size, max cluster allocation */
    124  1.1  cherry #endif
    125  1.1  cherry #endif
    126  1.1  cherry 
    127  1.1  cherry /*
    128  1.1  cherry  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
    129  1.1  cherry  * logical pages.
    130  1.1  cherry  */
    131  1.1  cherry #define	NKMEMPAGES_MIN_DEFAULT	((12 * 1024 * 1024) >> PAGE_SHIFT)
    132  1.1  cherry #define	NKMEMPAGES_MAX_DEFAULT	((128 * 1024 * 1024) >> PAGE_SHIFT)
    133  1.1  cherry 
    134  1.1  cherry /* pages ("clicks") to disk blocks */
    135  1.1  cherry #define	ctod(x)		((x) << (PGSHIFT - DEV_BSHIFT))
    136  1.1  cherry #define	dtoc(x)		((x) >> (PGSHIFT - DEV_BSHIFT))
    137  1.1  cherry 
    138  1.1  cherry /* pages to bytes */
    139  1.1  cherry #define	ctob(x)		((x) << PGSHIFT)
    140  1.1  cherry #define	btoc(x)		(((x) + PGOFSET) >> PGSHIFT)
    141  1.1  cherry 
    142  1.1  cherry /* bytes to disk blocks */
    143  1.1  cherry #define	btodb(x)	((x) >> DEV_BSHIFT)
    144  1.1  cherry #define	dbtob(x)	((x) << DEV_BSHIFT)
    145  1.1  cherry 
    146  1.1  cherry /*
    147  1.1  cherry  * Mach derived conversion macros
    148  1.1  cherry  */
    149  1.1  cherry 
    150  1.1  cherry #define ia64_round_page(x)   ((((unsigned long)(x)) + NBPG - 1) & ~(NBPG - 1))
    151  1.1  cherry #define ia64_trunc_page(x)   ((unsigned long)(x) & ~(NBPG - 1))
    152  1.1  cherry 
    153  1.1  cherry #define ia64_btop(x)            ((unsigned long)(x) >> PGSHIFT)
    154  1.1  cherry #define ia64_ptob(x)            ((unsigned long)(x) << PGSHIFT)
    155  1.1  cherry 
    156  1.1  cherry #ifdef _KERNEL
    157  1.1  cherry #ifndef _LOCORE
    158  1.1  cherry 
    159  1.1  cherry #include <machine/intr.h>
    160  1.1  cherry 
    161  1.1  cherry #endif /* _LOCORE */
    162  1.1  cherry #endif /* _KERNEL */
    163  1.1  cherry 
    164  1.1  cherry #endif /* _IA64_PARAM_H_ */
    165