170651Sobrien/*-
270651Sobrien * Copyright (c) 2001 David E. O'Brien
370651Sobrien * Copyright (c) 1990 The Regents of the University of California.
470651Sobrien * All rights reserved.
570651Sobrien *
670651Sobrien * This code is derived from software contributed to Berkeley by
770651Sobrien * William Jolitz.
870651Sobrien *
970651Sobrien * Redistribution and use in source and binary forms, with or without
1070651Sobrien * modification, are permitted provided that the following conditions
1170651Sobrien * are met:
1270651Sobrien * 1. Redistributions of source code must retain the above copyright
1370651Sobrien *    notice, this list of conditions and the following disclaimer.
1470651Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1570651Sobrien *    notice, this list of conditions and the following disclaimer in the
1670651Sobrien *    documentation and/or other materials provided with the distribution.
1770651Sobrien * 3. All advertising materials mentioning features or use of this software
1870651Sobrien *    must display the following acknowledgement:
1970651Sobrien *	This product includes software developed by the University of
2070651Sobrien *	California, Berkeley and its contributors.
2170651Sobrien * 4. Neither the name of the University nor the names of its contributors
2270651Sobrien *    may be used to endorse or promote products derived from this software
2370651Sobrien *    without specific prior written permission.
2470651Sobrien *
2570651Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2670651Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2770651Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2870651Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2970651Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3070651Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3170651Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3270651Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3370651Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3470651Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3570651Sobrien * SUCH DAMAGE.
3670651Sobrien *
3770651Sobrien *	from: @(#)param.h	5.8 (Berkeley) 6/28/91
3870651Sobrien * $FreeBSD$
3970651Sobrien */
4070651Sobrien
41196994Sphk#ifndef _ARM_INCLUDE_PARAM_H_
42196994Sphk#define	_ARM_INCLUDE_PARAM_H_
43196994Sphk
4470651Sobrien/*
4570651Sobrien * Machine dependent constants for StrongARM
4670651Sobrien */
4770651Sobrien
48196994Sphk#include <machine/_align.h>
4970651Sobrien
50135660Scognet#define STACKALIGNBYTES	(8 - 1)
51135660Scognet#define STACKALIGN(p)	((u_int)(p) & ~STACKALIGNBYTES)
5270651Sobrien
53154128Simp#define __PCI_REROUTE_INTERRUPT
54154128Simp
55248119Sandrew#if defined(__FreeBSD_ARCH_armv6__) || (defined(__ARM_ARCH) && __ARM_ARCH >= 6)
56266337Sian#define	_V6_SUFFIX "v6"
57239268Sgonzo#else
58266337Sian#define	_V6_SUFFIX ""
59239268Sgonzo#endif
60266337Sian
61266337Sian#ifdef __ARM_PCS_VFP
62266337Sian#define	_HF_SUFFIX "hf"
63239268Sgonzo#else
64266337Sian#define	_HF_SUFFIX ""
65266337Sian#endif
66266337Sian
67239268Sgonzo#ifdef __ARMEB__
68266337Sian#define	_EB_SUFFIX "eb"
69235072Simp#else
70266337Sian#define	_EB_SUFFIX ""
7170651Sobrien#endif
72266337Sian
73266337Sian#ifndef MACHINE
74266337Sian#define	MACHINE		"arm"
75235072Simp#endif
76266337Sian#ifndef MACHINE_ARCH
77266337Sian#define	MACHINE_ARCH	"arm" _V6_SUFFIX _HF_SUFFIX _EB_SUFFIX
78239268Sgonzo#endif
7970651Sobrien
80177661Sjb#if defined(SMP) || defined(KLD_MODULE)
81224207Sattilio#ifndef MAXCPU
82239268Sgonzo#define	MAXCPU		4
83224207Sattilio#endif
8470651Sobrien#else
8570651Sobrien#define	MAXCPU		1
86177661Sjb#endif /* SMP || KLD_MODULE */
8770651Sobrien
88250338Sattilio#ifndef MAXMEMDOM
89250338Sattilio#define	MAXMEMDOM	1
90250338Sattilio#endif
91250338Sattilio
9270651Sobrien#define	ALIGNBYTES	_ALIGNBYTES
9370651Sobrien#define	ALIGN(p)	_ALIGN(p)
94195376Ssam/*
95195376Ssam * ALIGNED_POINTER is a boolean macro that checks whether an address
96195376Ssam * is valid to fetch data elements of type t from on this architecture.
97195376Ssam * This does not reflect the optimal alignment, just the possibility
98236992Simp * (within reasonable limits).
99195376Ssam */
100195376Ssam#define	ALIGNED_POINTER(p, t)	((((unsigned)(p)) & (sizeof(t)-1)) == 0)
10170651Sobrien
102191278Srwatson/*
103191278Srwatson * CACHE_LINE_SIZE is the compile-time maximum cache line size for an
104191278Srwatson * architecture.  It should be used with appropriate caution.
105191278Srwatson */
106191276Srwatson#define	CACHE_LINE_SHIFT	6
107191276Srwatson#define	CACHE_LINE_SIZE		(1 << CACHE_LINE_SHIFT)
108191276Srwatson
10970651Sobrien#define	PAGE_SHIFT	12
11070651Sobrien#define	PAGE_SIZE	(1 << PAGE_SHIFT)	/* Page size */
11170651Sobrien#define	PAGE_MASK	(PAGE_SIZE - 1)
11270651Sobrien#define	NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
11370651Sobrien
114129198Scognet#define PDR_SHIFT	20 /* log2(NBPDR) */
115129198Scognet#define NBPDR		(1 << PDR_SHIFT)
116254918Sraj#define PDRMASK		(NBPDR - 1)
117129198Scognet#define NPDEPG          (1 << (32 - PDR_SHIFT))
11870651Sobrien
119254918Sraj#define	MAXPAGESIZES	2		/* maximum number of supported page sizes */
120197316Salc
121129198Scognet#ifndef KSTACK_PAGES
122137227Scognet#define KSTACK_PAGES    2
123129198Scognet#endif /* !KSTACK_PAGES */
12470651Sobrien
125129198Scognet#ifndef FPCONTEXTSIZE
126129198Scognet#define FPCONTEXTSIZE	(0x100)
127129198Scognet#endif
128129198Scognet
129129198Scognet#ifndef KSTACK_GUARD_PAGES
130129198Scognet#define KSTACK_GUARD_PAGES	1
131129198Scognet#endif /* !KSTACK_GUARD_PAGES */
132129198Scognet
133266277Sian#define USPACE_SVC_STACK_TOP		(KSTACK_PAGES * PAGE_SIZE)
134266277Sian
13570651Sobrien/*
13670651Sobrien * Mach derived conversion macros
13770651Sobrien */
13870651Sobrien#define	trunc_page(x)		((x) & ~PAGE_MASK)
13970651Sobrien#define	round_page(x)		(((x) + PAGE_MASK) & ~PAGE_MASK)
140254918Sraj#define	trunc_1mpage(x)		((unsigned)(x) & ~PDRMASK)
141254918Sraj#define	round_1mpage(x)		((((unsigned)(x)) + PDRMASK) & ~PDRMASK)
14270651Sobrien
14370651Sobrien#define	atop(x)			((unsigned)(x) >> PAGE_SHIFT)
14470651Sobrien#define	ptoa(x)			((unsigned)(x) << PAGE_SHIFT)
14570651Sobrien
14670651Sobrien#define	arm32_btop(x)		((unsigned)(x) >> PAGE_SHIFT)
14770651Sobrien#define	arm32_ptob(x)		((unsigned)(x) << PAGE_SHIFT)
14870651Sobrien
14970651Sobrien#define	pgtok(x)		((x) * (PAGE_SIZE / 1024))
15070651Sobrien
151196994Sphk#endif /* !_ARM_INCLUDE_PARAM_H_ */
152