param.h revision 118239
166458Sdfr/* $FreeBSD: head/sys/ia64/include/param.h 118239 2003-07-31 01:31:32Z peter $ */
266458Sdfr/* From: NetBSD: param.h,v 1.20 1997/09/19 13:52:53 leo Exp */
366458Sdfr
466458Sdfr/*
566458Sdfr * Copyright (c) 1988 University of Utah.
666458Sdfr * Copyright (c) 1992, 1993
766458Sdfr *	The Regents of the University of California.  All rights reserved.
866458Sdfr *
966458Sdfr * This code is derived from software contributed to Berkeley by
1066458Sdfr * the Systems Programming Group of the University of Utah Computer
1166458Sdfr * Science Department and Ralph Campbell.
1266458Sdfr *
1366458Sdfr * Redistribution and use in source and binary forms, with or without
1466458Sdfr * modification, are permitted provided that the following conditions
1566458Sdfr * are met:
1666458Sdfr * 1. Redistributions of source code must retain the above copyright
1766458Sdfr *    notice, this list of conditions and the following disclaimer.
1866458Sdfr * 2. Redistributions in binary form must reproduce the above copyright
1966458Sdfr *    notice, this list of conditions and the following disclaimer in the
2066458Sdfr *    documentation and/or other materials provided with the distribution.
2166458Sdfr * 3. All advertising materials mentioning features or use of this software
2266458Sdfr *    must display the following acknowledgement:
2366458Sdfr *	This product includes software developed by the University of
2466458Sdfr *	California, Berkeley and its contributors.
2566458Sdfr * 4. Neither the name of the University nor the names of its contributors
2666458Sdfr *    may be used to endorse or promote products derived from this software
2766458Sdfr *    without specific prior written permission.
2866458Sdfr *
2966458Sdfr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
3066458Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3166458Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3266458Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3366458Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3466458Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3566458Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3666458Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3766458Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3866458Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3966458Sdfr * SUCH DAMAGE.
4066458Sdfr *
4166458Sdfr * from: Utah $Hdr: machparam.h 1.11 89/08/14$
4266458Sdfr *
4366458Sdfr *	@(#)param.h	8.1 (Berkeley) 6/10/93
4466458Sdfr */
4566458Sdfr
4666458Sdfr/*
4766458Sdfr * Machine dependent constants for the IA64.
4866458Sdfr */
4970508Sdfr/*
5070508Sdfr * Round p (pointer or byte index) up to a correctly-aligned value for all
5170508Sdfr * data types (int, long, ...).   The result is u_long and must be cast to
5270508Sdfr * any desired pointer type.
5370508Sdfr *
5470508Sdfr * ALIGNED_POINTER is a boolean macro that checks whether an address
5570508Sdfr * is valid to fetch data elements of type t from on this architecture.
5670508Sdfr * This does not reflect the optimal alignment, just the possibility
5770508Sdfr * (within reasonable limits).
5870508Sdfr *
5970508Sdfr */
6070508Sdfr#ifndef _ALIGNBYTES
61111031Smarcel#define	_ALIGNBYTES		15
6270508Sdfr#endif
6370508Sdfr#ifndef _ALIGN
6470508Sdfr#define	_ALIGN(p)		(((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES)
6570508Sdfr#endif
6670508Sdfr#ifndef _ALIGNED_POINTER
6770508Sdfr#define _ALIGNED_POINTER(p,t)	((((u_long)(p)) & (sizeof(t)-1)) == 0)
6870508Sdfr#endif
6970508Sdfr
7066458Sdfr#ifndef _MACHINE
7166458Sdfr#define	_MACHINE	ia64
7266458Sdfr#endif
7396912Smarcel#ifndef _MACHINE_ARCH
7496912Smarcel#define	_MACHINE_ARCH	ia64
7596912Smarcel#endif
7696912Smarcel
7796912Smarcel#ifndef _NO_NAMESPACE_POLLUTION
7896912Smarcel
7996912Smarcel#ifndef _MACHINE_PARAM_H_
8096912Smarcel#define	_MACHINE_PARAM_H_
8196912Smarcel
8266458Sdfr#ifndef MACHINE
8366458Sdfr#define	MACHINE		"ia64"
8466458Sdfr#endif
8566458Sdfr#ifndef MACHINE_ARCH
8666458Sdfr#define	MACHINE_ARCH	"ia64"
8766458Sdfr#endif
8866458Sdfr
8974733Sjhb#ifdef SMP
9074733Sjhb#define	MAXCPU		16
9174733Sjhb#else
9274733Sjhb#define MAXCPU		1
9374733Sjhb#endif
9466458Sdfr
9566458Sdfr/*
9666458Sdfr * Round p (pointer or byte index) up to a correctly-aligned value for all
9766458Sdfr * data types (int, long, ...).   The result is u_long and must be cast to
9866458Sdfr * any desired pointer type.
9966458Sdfr *
10066458Sdfr * ALIGNED_POINTER is a boolean macro that checks whether an address
10166458Sdfr * is valid to fetch data elements of type t from on this architecture.
10266458Sdfr * This does not reflect the optimal alignment, just the possibility
10366458Sdfr * (within reasonable limits).
10466458Sdfr *
10566458Sdfr */
10670508Sdfr#define	ALIGNBYTES		_ALIGNBYTES
10770508Sdfr#define	ALIGN(p)		_ALIGN(p)
10870508Sdfr#define ALIGNED_POINTER(p,t)	_ALIGNED_POINTER(p,t)
10966458Sdfr
11083198Sdfr#if !defined(PAGE_SIZE_4K) && !defined(PAGE_SIZE_8K) && !defined(PAGE_SIZE_16K)
11183198Sdfr#define PAGE_SIZE_8K
11283198Sdfr#endif
11383198Sdfr
11483198Sdfr#ifdef PAGE_SIZE_4K
11566458Sdfr#define	PAGE_SIZE	4096			/* bytes/page */
11666458Sdfr#define PAGE_SHIFT	12
11783198Sdfr#endif
11883198Sdfr#ifdef PAGE_SIZE_8K
11983198Sdfr#define	PAGE_SIZE	8192			/* bytes/page */
12083198Sdfr#define PAGE_SHIFT	13
12183198Sdfr#endif
12283198Sdfr#ifdef PAGE_SIZE_16K
12383198Sdfr#define	PAGE_SIZE	16384			/* bytes/page */
12483198Sdfr#define PAGE_SHIFT	14
12583198Sdfr#endif
12683198Sdfr
12766458Sdfr#define PAGE_MASK	(PAGE_SIZE-1)
12866458Sdfr#define NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
12966458Sdfr
13066458Sdfr#define	CLSIZE		1
13166458Sdfr#define	CLSIZELOG2	0
13266458Sdfr
13366458Sdfr/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
13466458Sdfr#define	SSIZE		1		/* initial stack size/NBPG */
13566458Sdfr#define	SINCR		1		/* increment of stack/NBPG */
13666458Sdfr
137118239Speter#ifndef	KSTACK_PAGES
13883366Sjulian#define	KSTACK_PAGES	4		/* pages of kernel stack */
139118239Speter#endif
140116355Salc#define	KSTACK_GUARD_PAGES 0		/* pages of kstack guard; 0 disables */
14183366Sjulian#define	UAREA_PAGES	1		/* pages of u-area */
14266458Sdfr
14366458Sdfr/*
14466458Sdfr * Mach derived conversion macros
14566458Sdfr */
14666458Sdfr#define	round_page(x)	((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
14766458Sdfr#define	trunc_page(x)	((unsigned long)(x) & ~(PAGE_MASK))
14866458Sdfr
14966458Sdfr#define atop(x)			((unsigned long)(x) >> PAGE_SHIFT)
15066458Sdfr#define ptoa(x)			((unsigned long)(x) << PAGE_SHIFT)
15166458Sdfr
15266458Sdfr#define	ia64_btop(x)		((unsigned long)(x) >> PAGE_SHIFT)
15366458Sdfr#define	ia64_ptob(x)		((unsigned long)(x) << PAGE_SHIFT)
15466458Sdfr
15566458Sdfr#define pgtok(x)                ((x) * (PAGE_SIZE / 1024))
15696912Smarcel
15796912Smarcel#endif	/* !_MACHINE_PARAM_H_ */
15896912Smarcel#endif	/* !_NO_NAMESPACE_POLLUTION */
159