param.h revision 191278
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: head/sys/arm/include/param.h 191278 2009-04-19 21:26:36Z rwatson $
3970651Sobrien */
4070651Sobrien
4170651Sobrien/*
4270651Sobrien * Machine dependent constants for StrongARM
4370651Sobrien */
4470651Sobrien
4570651Sobrien/*
4670651Sobrien * Round p (pointer or byte index) up to a correctly-aligned value
4770651Sobrien * for all data types (int, long, ...).   The result is unsigned int
4870651Sobrien * and must be cast to any desired pointer type.
4970651Sobrien */
5070651Sobrien#ifndef _ALIGNBYTES
5170651Sobrien#define	_ALIGNBYTES	(sizeof(int) - 1)
5270651Sobrien#endif
5370651Sobrien#ifndef _ALIGN
5470651Sobrien#define	_ALIGN(p)	(((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
5570651Sobrien#endif
5670651Sobrien
57135660Scognet#define STACKALIGNBYTES	(8 - 1)
58135660Scognet#define STACKALIGN(p)	((u_int)(p) & ~STACKALIGNBYTES)
5970651Sobrien
6070651Sobrien#ifndef _NO_NAMESPACE_POLLUTION
6170651Sobrien
62154128Simp#define __PCI_REROUTE_INTERRUPT
63154128Simp
6470651Sobrien#ifndef _MACHINE_PARAM_H_
6570651Sobrien#define	_MACHINE_PARAM_H_
6670651Sobrien
6770651Sobrien#ifndef MACHINE
68129198Scognet#define	MACHINE		"arm"
6970651Sobrien#endif
7070651Sobrien#ifndef MACHINE_ARCH
71129198Scognet#define	MACHINE_ARCH	"arm"
7270651Sobrien#endif
73129198Scognet#define	MID_MACHINE	MID_ARM6
7470651Sobrien
75177661Sjb#if defined(SMP) || defined(KLD_MODULE)
7670651Sobrien#define	MAXCPU		2
7770651Sobrien#else
7870651Sobrien#define	MAXCPU		1
79177661Sjb#endif /* SMP || KLD_MODULE */
8070651Sobrien
8170651Sobrien#define	ALIGNBYTES	_ALIGNBYTES
8270651Sobrien#define	ALIGN(p)	_ALIGN(p)
8370651Sobrien
84191278Srwatson/*
85191278Srwatson * CACHE_LINE_SIZE is the compile-time maximum cache line size for an
86191278Srwatson * architecture.  It should be used with appropriate caution.
87191278Srwatson */
88191276Srwatson#ifndef CACHE_LINE_SHIFT
89191276Srwatson#define	CACHE_LINE_SHIFT	6
90191276Srwatson#endif
91191276Srwatson#define	CACHE_LINE_SIZE		(1 << CACHE_LINE_SHIFT)
92191276Srwatson
9370651Sobrien#define	PAGE_SHIFT	12
9470651Sobrien#define	PAGE_SIZE	(1 << PAGE_SHIFT)	/* Page size */
9570651Sobrien#define	PAGE_MASK	(PAGE_SIZE - 1)
9670651Sobrien#define	NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
9770651Sobrien
98129198Scognet#define PDR_SHIFT	20 /* log2(NBPDR) */
99129198Scognet#define NBPDR		(1 << PDR_SHIFT)
100129198Scognet#define NPDEPG          (1 << (32 - PDR_SHIFT))
10170651Sobrien
102129198Scognet#ifndef KSTACK_PAGES
103137227Scognet#define KSTACK_PAGES    2
104129198Scognet#endif /* !KSTACK_PAGES */
10570651Sobrien
106129198Scognet#ifndef FPCONTEXTSIZE
107129198Scognet#define FPCONTEXTSIZE	(0x100)
108129198Scognet#endif
109129198Scognet
110129198Scognet#ifndef KSTACK_GUARD_PAGES
111129198Scognet#define KSTACK_GUARD_PAGES	1
112129198Scognet#endif /* !KSTACK_GUARD_PAGES */
113129198Scognet
114137939Scognet#define USPACE_SVC_STACK_TOP		KSTACK_PAGES * PAGE_SIZE
115129198Scognet#define USPACE_SVC_STACK_BOTTOM		(USPACE_SVC_STACK_TOP - 0x1000)
116129198Scognet#define USPACE_UNDEF_STACK_TOP		(USPACE_SVC_STACK_BOTTOM - 0x10)
117129198Scognet#define USPACE_UNDEF_STACK_BOTTOM	(FPCONTEXTSIZE + 10)
11870651Sobrien/*
11970651Sobrien * Mach derived conversion macros
12070651Sobrien */
12170651Sobrien#define	trunc_page(x)		((x) & ~PAGE_MASK)
12270651Sobrien#define	round_page(x)		(((x) + PAGE_MASK) & ~PAGE_MASK)
12370651Sobrien#define	trunc_4mpage(x)		((unsigned)(x) & ~PDRMASK)
12470651Sobrien#define	round_4mpage(x)		((((unsigned)(x)) + PDRMASK) & ~PDRMASK)
12570651Sobrien
12670651Sobrien#define	atop(x)			((unsigned)(x) >> PAGE_SHIFT)
12770651Sobrien#define	ptoa(x)			((unsigned)(x) << PAGE_SHIFT)
12870651Sobrien
12970651Sobrien#define	arm32_btop(x)		((unsigned)(x) >> PAGE_SHIFT)
13070651Sobrien#define	arm32_ptob(x)		((unsigned)(x) << PAGE_SHIFT)
13170651Sobrien
13270651Sobrien#define	pgtok(x)		((x) * (PAGE_SIZE / 1024))
13370651Sobrien
13470651Sobrien#endif /* !_MACHINE_PARAM_H_ */
13570651Sobrien#endif /* !_NO_NAMESPACE_POLLUTION */
136