param.h revision 195376
159765Sjlemon/*- 259765Sjlemon * Copyright (c) 2001 David E. O'Brien 359765Sjlemon * Copyright (c) 1990 The Regents of the University of California. 459765Sjlemon * All rights reserved. 559765Sjlemon * 659765Sjlemon * This code is derived from software contributed to Berkeley by 759765Sjlemon * William Jolitz. 859765Sjlemon * 959765Sjlemon * Redistribution and use in source and binary forms, with or without 1059765Sjlemon * modification, are permitted provided that the following conditions 1159765Sjlemon * are met: 1259765Sjlemon * 1. Redistributions of source code must retain the above copyright 1359765Sjlemon * notice, this list of conditions and the following disclaimer. 1459765Sjlemon * 2. Redistributions in binary form must reproduce the above copyright 1559765Sjlemon * notice, this list of conditions and the following disclaimer in the 1659765Sjlemon * documentation and/or other materials provided with the distribution. 1759765Sjlemon * 3. All advertising materials mentioning features or use of this software 1859765Sjlemon * must display the following acknowledgement: 1959765Sjlemon * This product includes software developed by the University of 2059765Sjlemon * California, Berkeley and its contributors. 2159765Sjlemon * 4. Neither the name of the University nor the names of its contributors 2259765Sjlemon * may be used to endorse or promote products derived from this software 2359765Sjlemon * without specific prior written permission. 2459765Sjlemon * 2559765Sjlemon * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2684221Sdillon * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2784221Sdillon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2884221Sdillon * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2984221Sdillon * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3059765Sjlemon * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3159765Sjlemon * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3259765Sjlemon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3359765Sjlemon * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3459765Sjlemon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3559765Sjlemon * SUCH DAMAGE. 3659765Sjlemon * 3759765Sjlemon * from: @(#)param.h 5.8 (Berkeley) 6/28/91 3859765Sjlemon * $FreeBSD: head/sys/arm/include/param.h 195376 2009-07-05 17:45:48Z sam $ 3959765Sjlemon */ 4059765Sjlemon 4159765Sjlemon/* 4259765Sjlemon * Machine dependent constants for StrongARM 4359765Sjlemon */ 4459765Sjlemon 4559765Sjlemon/* 4659765Sjlemon * Round p (pointer or byte index) up to a correctly-aligned value 4759765Sjlemon * for all data types (int, long, ...). The result is unsigned int 4859765Sjlemon * and must be cast to any desired pointer type. 4959765Sjlemon */ 5059765Sjlemon#ifndef _ALIGNBYTES 5159765Sjlemon#define _ALIGNBYTES (sizeof(int) - 1) 5259765Sjlemon#endif 5359765Sjlemon#ifndef _ALIGN 5459765Sjlemon#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) 5559765Sjlemon#endif 5659765Sjlemon 5759765Sjlemon#define STACKALIGNBYTES (8 - 1) 5859765Sjlemon#define STACKALIGN(p) ((u_int)(p) & ~STACKALIGNBYTES) 5959765Sjlemon 6059765Sjlemon#ifndef _NO_NAMESPACE_POLLUTION 6159765Sjlemon 6259765Sjlemon#define __PCI_REROUTE_INTERRUPT 6359765Sjlemon 6459765Sjlemon#ifndef _MACHINE_PARAM_H_ 6559765Sjlemon#define _MACHINE_PARAM_H_ 6659765Sjlemon 6759765Sjlemon#ifndef MACHINE 6859765Sjlemon#define MACHINE "arm" 6959765Sjlemon#endif 7059765Sjlemon#ifndef MACHINE_ARCH 7159765Sjlemon#define MACHINE_ARCH "arm" 7259765Sjlemon#endif 7359765Sjlemon#define MID_MACHINE MID_ARM6 7459765Sjlemon 7559765Sjlemon#if defined(SMP) || defined(KLD_MODULE) 7659765Sjlemon#define MAXCPU 2 7759765Sjlemon#else 7859765Sjlemon#define MAXCPU 1 7959765Sjlemon#endif /* SMP || KLD_MODULE */ 8059765Sjlemon 8159765Sjlemon#define ALIGNBYTES _ALIGNBYTES 8259765Sjlemon#define ALIGN(p) _ALIGN(p) 8359765Sjlemon/* 8459765Sjlemon * ALIGNED_POINTER is a boolean macro that checks whether an address 8559765Sjlemon * is valid to fetch data elements of type t from on this architecture. 8659765Sjlemon * This does not reflect the optimal alignment, just the possibility 8759765Sjlemon * (within reasonable limits). 8859765Sjlemon */ 8959765Sjlemon#define ALIGNED_POINTER(p, t) ((((unsigned)(p)) & (sizeof(t)-1)) == 0) 9059765Sjlemon 9159765Sjlemon/* 9259765Sjlemon * CACHE_LINE_SIZE is the compile-time maximum cache line size for an 9359765Sjlemon * architecture. It should be used with appropriate caution. 9459765Sjlemon */ 9559765Sjlemon#define CACHE_LINE_SHIFT 6 9659765Sjlemon#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) 9759765Sjlemon 9859765Sjlemon#define PAGE_SHIFT 12 9959765Sjlemon#define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */ 10059765Sjlemon#define PAGE_MASK (PAGE_SIZE - 1) 10159765Sjlemon#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) 10259765Sjlemon 10359765Sjlemon#define PDR_SHIFT 20 /* log2(NBPDR) */ 10459765Sjlemon#define NBPDR (1 << PDR_SHIFT) 10559765Sjlemon#define NPDEPG (1 << (32 - PDR_SHIFT)) 10659765Sjlemon 10759765Sjlemon#ifndef KSTACK_PAGES 10859765Sjlemon#define KSTACK_PAGES 2 10959765Sjlemon#endif /* !KSTACK_PAGES */ 11059765Sjlemon 11159765Sjlemon#ifndef FPCONTEXTSIZE 11259765Sjlemon#define FPCONTEXTSIZE (0x100) 11359765Sjlemon#endif 11459765Sjlemon 11559765Sjlemon#ifndef KSTACK_GUARD_PAGES 11659765Sjlemon#define KSTACK_GUARD_PAGES 1 11759765Sjlemon#endif /* !KSTACK_GUARD_PAGES */ 11859765Sjlemon 11959765Sjlemon#define USPACE_SVC_STACK_TOP KSTACK_PAGES * PAGE_SIZE 12059765Sjlemon#define USPACE_SVC_STACK_BOTTOM (USPACE_SVC_STACK_TOP - 0x1000) 12159765Sjlemon#define USPACE_UNDEF_STACK_TOP (USPACE_SVC_STACK_BOTTOM - 0x10) 12259765Sjlemon#define USPACE_UNDEF_STACK_BOTTOM (FPCONTEXTSIZE + 10) 12359765Sjlemon/* 12459765Sjlemon * Mach derived conversion macros 12559765Sjlemon */ 12659765Sjlemon#define trunc_page(x) ((x) & ~PAGE_MASK) 12759765Sjlemon#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) 12859765Sjlemon#define trunc_4mpage(x) ((unsigned)(x) & ~PDRMASK) 12959765Sjlemon#define round_4mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) 13059765Sjlemon 13159765Sjlemon#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) 13259765Sjlemon#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) 13359765Sjlemon 13459765Sjlemon#define arm32_btop(x) ((unsigned)(x) >> PAGE_SHIFT) 13559765Sjlemon#define arm32_ptob(x) ((unsigned)(x) << PAGE_SHIFT) 13659765Sjlemon 13759765Sjlemon#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) 13859765Sjlemon 13959765Sjlemon#endif /* !_MACHINE_PARAM_H_ */ 14059765Sjlemon#endif /* !_NO_NAMESPACE_POLLUTION */ 14159765Sjlemon