166458Sdfr/* $FreeBSD$ */
266458Sdfr/* From: NetBSD: param.h,v 1.20 1997/09/19 13:52:53 leo Exp */
366458Sdfr
4139790Simp/*-
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 * 4. Neither the name of the University nor the names of its contributors
2266458Sdfr *    may be used to endorse or promote products derived from this software
2366458Sdfr *    without specific prior written permission.
2466458Sdfr *
2566458Sdfr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2666458Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2766458Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2866458Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2966458Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3066458Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3166458Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3266458Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3366458Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3466458Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3566458Sdfr * SUCH DAMAGE.
3666458Sdfr *
3766458Sdfr * from: Utah $Hdr: machparam.h 1.11 89/08/14$
3866458Sdfr *
3966458Sdfr *	@(#)param.h	8.1 (Berkeley) 6/10/93
4066458Sdfr */
4166458Sdfr
42196994Sphk#ifndef _IA64_INCLUDE_PARAM_H_
43196994Sphk#define	_IA64_INCLUDE_PARAM_H_
44196994Sphk
4566458Sdfr/*
4666458Sdfr * Machine dependent constants for the IA64.
4766458Sdfr */
4870508Sdfr
49196994Sphk#include <machine/_align.h>
5096912Smarcel
51154128Simp#define __HAVE_ACPI
52154128Simp#define __PCI_REROUTE_INTERRUPT
53154128Simp
5466458Sdfr#ifndef MACHINE
5566458Sdfr#define	MACHINE		"ia64"
5666458Sdfr#endif
5766458Sdfr#ifndef MACHINE_ARCH
5866458Sdfr#define	MACHINE_ARCH	"ia64"
5966458Sdfr#endif
60210369Skib#ifndef MACHINE_ARCH32
61210369Skib#define	MACHINE_ARCH32	"i386"
62210369Skib#endif
6366458Sdfr
64177661Sjb#if defined(SMP) || defined(KLD_MODULE)
65224207Sattilio#ifndef MAXCPU
66224217Sattilio#define	MAXCPU		64
67224207Sattilio#endif
6874733Sjhb#else
6974733Sjhb#define MAXCPU		1
7074733Sjhb#endif
7166458Sdfr
72250338Sattilio#ifndef MAXMEMDOM
73250338Sattilio#define	MAXMEMDOM	1
74250338Sattilio#endif
75250338Sattilio
76195376Ssam#define	ALIGNBYTES		_ALIGNBYTES
77195376Ssam#define	ALIGN(p)		_ALIGN(p)
7866458Sdfr/*
7966458Sdfr * ALIGNED_POINTER is a boolean macro that checks whether an address
8066458Sdfr * is valid to fetch data elements of type t from on this architecture.
8166458Sdfr * This does not reflect the optimal alignment, just the possibility
8266458Sdfr * (within reasonable limits).
8366458Sdfr */
84195376Ssam#define	ALIGNED_POINTER(p,t)	((((u_long)(p)) & (sizeof(t)-1)) == 0)
8566458Sdfr
86191278Srwatson/*
87191278Srwatson * CACHE_LINE_SIZE is the compile-time maximum cache line size for an
88191278Srwatson * architecture.  It should be used with appropriate caution.
89191278Srwatson */
90191309Srwatson#define	CACHE_LINE_SHIFT	7
91191276Srwatson#define	CACHE_LINE_SIZE		(1 << CACHE_LINE_SHIFT)
92191276Srwatson
93119347Smarcel#ifndef LOG2_PAGE_SIZE
94119347Smarcel#define	LOG2_PAGE_SIZE		13		/* 8K pages by default. */
9583198Sdfr#endif
96119347Smarcel#define	PAGE_SHIFT	(LOG2_PAGE_SIZE)
97119347Smarcel#define	PAGE_SIZE	(1<<(LOG2_PAGE_SIZE))
9866458Sdfr#define PAGE_MASK	(PAGE_SIZE-1)
9966458Sdfr#define NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
10066458Sdfr
101197316Salc#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
102197316Salc
103118239Speter#ifndef	KSTACK_PAGES
104199719Smarcel#define	KSTACK_PAGES	4		/* pages of kernel stack */
105118239Speter#endif
106116355Salc#define	KSTACK_GUARD_PAGES 0		/* pages of kstack guard; 0 disables */
10766458Sdfr
108261985Smarcel/* The default size of identity mappings in region 6 & 7. */
109261985Smarcel#ifndef LOG2_ID_PAGE_SIZE
110261985Smarcel#define	LOG2_ID_PAGE_SIZE	16
111261985Smarcel#endif
112261985Smarcel
11366458Sdfr/*
11466458Sdfr * Mach derived conversion macros
11566458Sdfr */
11666458Sdfr#define	round_page(x)	((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))
11766458Sdfr#define	trunc_page(x)	((unsigned long)(x) & ~(PAGE_MASK))
11866458Sdfr
11966458Sdfr#define atop(x)			((unsigned long)(x) >> PAGE_SHIFT)
12066458Sdfr#define ptoa(x)			((unsigned long)(x) << PAGE_SHIFT)
12166458Sdfr
12266458Sdfr#define pgtok(x)                ((x) * (PAGE_SIZE / 1024))
12396912Smarcel
124196994Sphk#endif	/* !_IA64_INCLUDE_PARAM_H_ */
125