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 55269956Simp#if __ARM_ARCH >= 6 56263637Sandrew#define _V6_SUFFIX "v6" 57239268Sgonzo#else 58263637Sandrew#define _V6_SUFFIX "" 59239268Sgonzo#endif 60263637Sandrew 61269956Simp#ifdef __ARM_BIG_ENDIAN 62263637Sandrew#define _EB_SUFFIX "eb" 63235072Simp#else 64263637Sandrew#define _EB_SUFFIX "" 6570651Sobrien#endif 66263637Sandrew 67263637Sandrew#ifndef MACHINE 68263637Sandrew#define MACHINE "arm" 69235072Simp#endif 70263637Sandrew#ifndef MACHINE_ARCH 71300324Simp#define MACHINE_ARCH "arm" _V6_SUFFIX _EB_SUFFIX 72239268Sgonzo#endif 7370651Sobrien 74177661Sjb#if defined(SMP) || defined(KLD_MODULE) 75224207Sattilio#ifndef MAXCPU 76239268Sgonzo#define MAXCPU 4 77224207Sattilio#endif 7870651Sobrien#else 7970651Sobrien#define MAXCPU 1 80177661Sjb#endif /* SMP || KLD_MODULE */ 8170651Sobrien 82250338Sattilio#ifndef MAXMEMDOM 83250338Sattilio#define MAXMEMDOM 1 84250338Sattilio#endif 85250338Sattilio 8670651Sobrien#define ALIGNBYTES _ALIGNBYTES 8770651Sobrien#define ALIGN(p) _ALIGN(p) 88195376Ssam/* 89195376Ssam * ALIGNED_POINTER is a boolean macro that checks whether an address 90195376Ssam * is valid to fetch data elements of type t from on this architecture. 91195376Ssam * This does not reflect the optimal alignment, just the possibility 92236992Simp * (within reasonable limits). 93300701Sian * 94302064Sian * armv4 and v5 require alignment to the type's size. armv6 requires 8-byte 95302064Sian * alignment for the ldrd/strd instructions, but otherwise follows armv7 rules. 96302064Sian * armv7 requires that an 8-byte type be aligned to at least a 4-byte boundary; 97302064Sian * access to smaller types can be unaligned, except that the compiler may 98302064Sian * optimize access to adjacent uint32_t values into a single load/store-multiple 99302064Sian * instruction which requires 4-byte alignment, so we must provide the most- 100302064Sian * pessimistic answer possible even on armv7. 101195376Ssam */ 102195376Ssam#define ALIGNED_POINTER(p, t) ((((unsigned)(p)) & (sizeof(t)-1)) == 0) 10370651Sobrien 104191278Srwatson/* 105191278Srwatson * CACHE_LINE_SIZE is the compile-time maximum cache line size for an 106191278Srwatson * architecture. It should be used with appropriate caution. 107191278Srwatson */ 108191276Srwatson#define CACHE_LINE_SHIFT 6 109191276Srwatson#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) 110191276Srwatson 11170651Sobrien#define PAGE_SHIFT 12 11270651Sobrien#define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */ 11370651Sobrien#define PAGE_MASK (PAGE_SIZE - 1) 11470651Sobrien 115129198Scognet#define PDR_SHIFT 20 /* log2(NBPDR) */ 116129198Scognet#define NBPDR (1 << PDR_SHIFT) 117254918Sraj#define PDRMASK (NBPDR - 1) 118129198Scognet#define NPDEPG (1 << (32 - PDR_SHIFT)) 11970651Sobrien 120254918Sraj#define MAXPAGESIZES 2 /* maximum number of supported page sizes */ 121197316Salc 122129198Scognet#ifndef KSTACK_PAGES 123137227Scognet#define KSTACK_PAGES 2 124129198Scognet#endif /* !KSTACK_PAGES */ 12570651Sobrien 126129198Scognet#ifndef FPCONTEXTSIZE 127129198Scognet#define FPCONTEXTSIZE (0x100) 128129198Scognet#endif 129129198Scognet 130129198Scognet#ifndef KSTACK_GUARD_PAGES 131129198Scognet#define KSTACK_GUARD_PAGES 1 132129198Scognet#endif /* !KSTACK_GUARD_PAGES */ 133129198Scognet 134286584Skib#define USPACE_SVC_STACK_TOP (kstack_pages * PAGE_SIZE) 135262942Sian 13670651Sobrien/* 13770651Sobrien * Mach derived conversion macros 13870651Sobrien */ 13970651Sobrien#define trunc_page(x) ((x) & ~PAGE_MASK) 14070651Sobrien#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) 141254918Sraj#define trunc_1mpage(x) ((unsigned)(x) & ~PDRMASK) 142254918Sraj#define round_1mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) 14370651Sobrien 14470651Sobrien#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) 14570651Sobrien#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) 14670651Sobrien 14770651Sobrien#define arm32_btop(x) ((unsigned)(x) >> PAGE_SHIFT) 14870651Sobrien#define arm32_ptob(x) ((unsigned)(x) << PAGE_SHIFT) 14970651Sobrien 15070651Sobrien#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) 15170651Sobrien 152196994Sphk#endif /* !_ARM_INCLUDE_PARAM_H_ */ 153