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 5570651Sobrien#ifndef MACHINE 56129198Scognet#define MACHINE "arm" 5770651Sobrien#endif 5870651Sobrien#ifndef MACHINE_ARCH 59129198Scognet#define MACHINE_ARCH "arm" 6070651Sobrien#endif 61129198Scognet#define MID_MACHINE MID_ARM6 6270651Sobrien 63177661Sjb#if defined(SMP) || defined(KLD_MODULE) 64224207Sattilio#ifndef MAXCPU 6570651Sobrien#define MAXCPU 2 66224207Sattilio#endif 6770651Sobrien#else 6870651Sobrien#define MAXCPU 1 69177661Sjb#endif /* SMP || KLD_MODULE */ 7070651Sobrien 7170651Sobrien#define ALIGNBYTES _ALIGNBYTES 7270651Sobrien#define ALIGN(p) _ALIGN(p) 73195376Ssam/* 74195376Ssam * ALIGNED_POINTER is a boolean macro that checks whether an address 75195376Ssam * is valid to fetch data elements of type t from on this architecture. 76195376Ssam * This does not reflect the optimal alignment, just the possibility 77195376Ssam * (within reasonable limits). 78195376Ssam */ 79195376Ssam#define ALIGNED_POINTER(p, t) ((((unsigned)(p)) & (sizeof(t)-1)) == 0) 8070651Sobrien 81191278Srwatson/* 82191278Srwatson * CACHE_LINE_SIZE is the compile-time maximum cache line size for an 83191278Srwatson * architecture. It should be used with appropriate caution. 84191278Srwatson */ 85191276Srwatson#define CACHE_LINE_SHIFT 6 86191276Srwatson#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) 87191276Srwatson 8870651Sobrien#define PAGE_SHIFT 12 8970651Sobrien#define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */ 9070651Sobrien#define PAGE_MASK (PAGE_SIZE - 1) 9170651Sobrien#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) 9270651Sobrien 93129198Scognet#define PDR_SHIFT 20 /* log2(NBPDR) */ 94129198Scognet#define NBPDR (1 << PDR_SHIFT) 95129198Scognet#define NPDEPG (1 << (32 - PDR_SHIFT)) 9670651Sobrien 97197316Salc#define MAXPAGESIZES 1 /* maximum number of supported page sizes */ 98197316Salc 99129198Scognet#ifndef KSTACK_PAGES 100137227Scognet#define KSTACK_PAGES 2 101129198Scognet#endif /* !KSTACK_PAGES */ 10270651Sobrien 103129198Scognet#ifndef FPCONTEXTSIZE 104129198Scognet#define FPCONTEXTSIZE (0x100) 105129198Scognet#endif 106129198Scognet 107129198Scognet#ifndef KSTACK_GUARD_PAGES 108129198Scognet#define KSTACK_GUARD_PAGES 1 109129198Scognet#endif /* !KSTACK_GUARD_PAGES */ 110129198Scognet 111137939Scognet#define USPACE_SVC_STACK_TOP KSTACK_PAGES * PAGE_SIZE 112129198Scognet#define USPACE_SVC_STACK_BOTTOM (USPACE_SVC_STACK_TOP - 0x1000) 113129198Scognet#define USPACE_UNDEF_STACK_TOP (USPACE_SVC_STACK_BOTTOM - 0x10) 114129198Scognet#define USPACE_UNDEF_STACK_BOTTOM (FPCONTEXTSIZE + 10) 11570651Sobrien/* 11670651Sobrien * Mach derived conversion macros 11770651Sobrien */ 11870651Sobrien#define trunc_page(x) ((x) & ~PAGE_MASK) 11970651Sobrien#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) 12070651Sobrien#define trunc_4mpage(x) ((unsigned)(x) & ~PDRMASK) 12170651Sobrien#define round_4mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) 12270651Sobrien 12370651Sobrien#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) 12470651Sobrien#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) 12570651Sobrien 12670651Sobrien#define arm32_btop(x) ((unsigned)(x) >> PAGE_SHIFT) 12770651Sobrien#define arm32_ptob(x) ((unsigned)(x) << PAGE_SHIFT) 12870651Sobrien 12970651Sobrien#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) 13070651Sobrien 131196994Sphk#endif /* !_ARM_INCLUDE_PARAM_H_ */ 132