param.h revision 300694
1342619Stsoome/*- 2346476Skevans * Copyright (c) 2001 David E. O'Brien 3346476Skevans * Copyright (c) 1990 The Regents of the University of California. 4342619Stsoome * All rights reserved. 5342619Stsoome * 6342619Stsoome * This code is derived from software contributed to Berkeley by 7342619Stsoome * William Jolitz. 8342619Stsoome * 9342619Stsoome * Redistribution and use in source and binary forms, with or without 10342619Stsoome * modification, are permitted provided that the following conditions 11342619Stsoome * are met: 12342619Stsoome * 1. Redistributions of source code must retain the above copyright 13342619Stsoome * notice, this list of conditions and the following disclaimer. 14342619Stsoome * 2. Redistributions in binary form must reproduce the above copyright 15342619Stsoome * notice, this list of conditions and the following disclaimer in the 16342619Stsoome * documentation and/or other materials provided with the distribution. 17342619Stsoome * 3. All advertising materials mentioning features or use of this software 18342619Stsoome * must display the following acknowledgement: 19342619Stsoome * This product includes software developed by the University of 20342619Stsoome * California, Berkeley and its contributors. 21342619Stsoome * 4. Neither the name of the University nor the names of its contributors 22342619Stsoome * may be used to endorse or promote products derived from this software 23342619Stsoome * without specific prior written permission. 24342619Stsoome * 25342619Stsoome * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26342619Stsoome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27342619Stsoome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28342619Stsoome * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29342619Stsoome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30342619Stsoome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31342619Stsoome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32342619Stsoome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33342619Stsoome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34342619Stsoome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35342619Stsoome * SUCH DAMAGE. 36342619Stsoome * 37342619Stsoome * from: @(#)param.h 5.8 (Berkeley) 6/28/91 38342619Stsoome * $FreeBSD: head/sys/arm/include/param.h 300694 2016-05-25 19:44:26Z ian $ 39342619Stsoome */ 40342619Stsoome 41342619Stsoome#ifndef _ARM_INCLUDE_PARAM_H_ 42342619Stsoome#define _ARM_INCLUDE_PARAM_H_ 43342619Stsoome 44342619Stsoome/* 45342619Stsoome * Machine dependent constants for StrongARM 46342619Stsoome */ 47342619Stsoome 48342619Stsoome#include <machine/_align.h> 49342619Stsoome 50342619Stsoome#define STACKALIGNBYTES (8 - 1) 51342619Stsoome#define STACKALIGN(p) ((u_int)(p) & ~STACKALIGNBYTES) 52342619Stsoome 53342619Stsoome#define __PCI_REROUTE_INTERRUPT 54342619Stsoome 55342619Stsoome#if __ARM_ARCH >= 6 56342619Stsoome#define _V6_SUFFIX "v6" 57342619Stsoome#else 58342619Stsoome#define _V6_SUFFIX "" 59342619Stsoome#endif 60342619Stsoome 61342619Stsoome#ifdef __ARM_BIG_ENDIAN 62342619Stsoome#define _EB_SUFFIX "eb" 63342619Stsoome#else 64342619Stsoome#define _EB_SUFFIX "" 65342619Stsoome#endif 66342619Stsoome 67342619Stsoome#ifndef MACHINE 68#define MACHINE "arm" 69#endif 70#ifndef MACHINE_ARCH 71#define MACHINE_ARCH "arm" _V6_SUFFIX _EB_SUFFIX 72#endif 73 74#if defined(SMP) || defined(KLD_MODULE) 75#ifndef MAXCPU 76#define MAXCPU 4 77#endif 78#else 79#define MAXCPU 1 80#endif /* SMP || KLD_MODULE */ 81 82#ifndef MAXMEMDOM 83#define MAXMEMDOM 1 84#endif 85 86#define ALIGNBYTES _ALIGNBYTES 87#define ALIGN(p) _ALIGN(p) 88/* 89 * ALIGNED_POINTER is a boolean macro that checks whether an address 90 * is valid to fetch data elements of type t from on this architecture. 91 * This does not reflect the optimal alignment, just the possibility 92 * (within reasonable limits). 93 */ 94#define ALIGNED_POINTER(p, t) ((((unsigned)(p)) & (sizeof(t)-1)) == 0) 95 96/* 97 * CACHE_LINE_SIZE is the compile-time maximum cache line size for an 98 * architecture. It should be used with appropriate caution. 99 */ 100#define CACHE_LINE_SHIFT 6 101#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) 102 103#define PAGE_SHIFT 12 104#define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */ 105#define PAGE_MASK (PAGE_SIZE - 1) 106 107#define PDR_SHIFT 20 /* log2(NBPDR) */ 108#define NBPDR (1 << PDR_SHIFT) 109#define PDRMASK (NBPDR - 1) 110#define NPDEPG (1 << (32 - PDR_SHIFT)) 111 112#define MAXPAGESIZES 2 /* maximum number of supported page sizes */ 113 114#ifndef KSTACK_PAGES 115#define KSTACK_PAGES 2 116#endif /* !KSTACK_PAGES */ 117 118#ifndef FPCONTEXTSIZE 119#define FPCONTEXTSIZE (0x100) 120#endif 121 122#ifndef KSTACK_GUARD_PAGES 123#define KSTACK_GUARD_PAGES 1 124#endif /* !KSTACK_GUARD_PAGES */ 125 126#define USPACE_SVC_STACK_TOP (kstack_pages * PAGE_SIZE) 127 128/* 129 * Mach derived conversion macros 130 */ 131#define trunc_page(x) ((x) & ~PAGE_MASK) 132#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) 133#define trunc_1mpage(x) ((unsigned)(x) & ~PDRMASK) 134#define round_1mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) 135 136#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) 137#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) 138 139#define arm32_btop(x) ((unsigned)(x) >> PAGE_SHIFT) 140#define arm32_ptob(x) ((unsigned)(x) << PAGE_SHIFT) 141 142#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) 143 144#endif /* !_ARM_INCLUDE_PARAM_H_ */ 145