param.h revision 191276
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 191276 2009-04-19 20:19:13Z 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
84191276Srwatson#ifndef CACHE_LINE_SHIFT
85191276Srwatson#define	CACHE_LINE_SHIFT	6
86191276Srwatson#endif
87191276Srwatson#define	CACHE_LINE_SIZE		(1 << CACHE_LINE_SHIFT)
88191276Srwatson
8970651Sobrien#define	PAGE_SHIFT	12
9070651Sobrien#define	PAGE_SIZE	(1 << PAGE_SHIFT)	/* Page size */
9170651Sobrien#define	PAGE_MASK	(PAGE_SIZE - 1)
9270651Sobrien#define	NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
9370651Sobrien
94129198Scognet#define PDR_SHIFT	20 /* log2(NBPDR) */
95129198Scognet#define NBPDR		(1 << PDR_SHIFT)
96129198Scognet#define NPDEPG          (1 << (32 - PDR_SHIFT))
9770651Sobrien
98129198Scognet#ifndef KSTACK_PAGES
99137227Scognet#define KSTACK_PAGES    2
100129198Scognet#endif /* !KSTACK_PAGES */
10170651Sobrien
102129198Scognet#ifndef FPCONTEXTSIZE
103129198Scognet#define FPCONTEXTSIZE	(0x100)
104129198Scognet#endif
105129198Scognet
106129198Scognet#ifndef KSTACK_GUARD_PAGES
107129198Scognet#define KSTACK_GUARD_PAGES	1
108129198Scognet#endif /* !KSTACK_GUARD_PAGES */
109129198Scognet
110137939Scognet#define USPACE_SVC_STACK_TOP		KSTACK_PAGES * PAGE_SIZE
111129198Scognet#define USPACE_SVC_STACK_BOTTOM		(USPACE_SVC_STACK_TOP - 0x1000)
112129198Scognet#define USPACE_UNDEF_STACK_TOP		(USPACE_SVC_STACK_BOTTOM - 0x10)
113129198Scognet#define USPACE_UNDEF_STACK_BOTTOM	(FPCONTEXTSIZE + 10)
11470651Sobrien/*
11570651Sobrien * Mach derived conversion macros
11670651Sobrien */
11770651Sobrien#define	trunc_page(x)		((x) & ~PAGE_MASK)
11870651Sobrien#define	round_page(x)		(((x) + PAGE_MASK) & ~PAGE_MASK)
11970651Sobrien#define	trunc_4mpage(x)		((unsigned)(x) & ~PDRMASK)
12070651Sobrien#define	round_4mpage(x)		((((unsigned)(x)) + PDRMASK) & ~PDRMASK)
12170651Sobrien
12270651Sobrien#define	atop(x)			((unsigned)(x) >> PAGE_SHIFT)
12370651Sobrien#define	ptoa(x)			((unsigned)(x) << PAGE_SHIFT)
12470651Sobrien
12570651Sobrien#define	arm32_btop(x)		((unsigned)(x) >> PAGE_SHIFT)
12670651Sobrien#define	arm32_ptob(x)		((unsigned)(x) << PAGE_SHIFT)
12770651Sobrien
12870651Sobrien#define	pgtok(x)		((x) * (PAGE_SIZE / 1024))
12970651Sobrien
13070651Sobrien#endif /* !_MACHINE_PARAM_H_ */
13170651Sobrien#endif /* !_NO_NAMESPACE_POLLUTION */
132