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