170584Sobrien/*- 270584Sobrien * Copyright (c) 2001 David E. O'Brien 370584Sobrien * Copyright (c) 1990 The Regents of the University of California. 470584Sobrien * All rights reserved. 570584Sobrien * 670584Sobrien * This code is derived from software contributed to Berkeley by 770584Sobrien * William Jolitz. 870584Sobrien * 970584Sobrien * Redistribution and use in source and binary forms, with or without 1070584Sobrien * modification, are permitted provided that the following conditions 1170584Sobrien * are met: 1270584Sobrien * 1. Redistributions of source code must retain the above copyright 1370584Sobrien * notice, this list of conditions and the following disclaimer. 1470584Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1570584Sobrien * notice, this list of conditions and the following disclaimer in the 1670584Sobrien * documentation and/or other materials provided with the distribution. 1770584Sobrien * 3. All advertising materials mentioning features or use of this software 1870584Sobrien * must display the following acknowledgement: 1970584Sobrien * This product includes software developed by the University of 2070584Sobrien * California, Berkeley and its contributors. 2170584Sobrien * 4. Neither the name of the University nor the names of its contributors 2270584Sobrien * may be used to endorse or promote products derived from this software 2370584Sobrien * without specific prior written permission. 2470584Sobrien * 2570584Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2670584Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2770584Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2870584Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2970584Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3070584Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3170584Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3270584Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3370584Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3470584Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3570584Sobrien * SUCH DAMAGE. 3670584Sobrien * 3770584Sobrien * from: @(#)param.h 5.8 (Berkeley) 6/28/91 3870584Sobrien * $FreeBSD$ 3970584Sobrien */ 4070584Sobrien 41196994Sphk#ifndef _POWERPC_INCLUDE_PARAM_H_ 42196994Sphk#define _POWERPC_INCLUDE_PARAM_H_ 43196994Sphk 4470584Sobrien/* 45209975Snwhitehorn * Machine dependent constants for PowerPC 4670584Sobrien */ 4770584Sobrien 48196994Sphk#include <machine/_align.h> 4970584Sobrien 50186128Snwhitehorn/* Needed to display interrupts on OFW PCI */ 51186128Snwhitehorn#define __PCI_REROUTE_INTERRUPT 52186128Snwhitehorn 5370584Sobrien#ifndef MACHINE 5470584Sobrien#define MACHINE "powerpc" 5570584Sobrien#endif 5670584Sobrien#ifndef MACHINE_ARCH 57209975Snwhitehorn#ifdef __powerpc64__ 58209975Snwhitehorn#define MACHINE_ARCH "powerpc64" 59209975Snwhitehorn#else 6070584Sobrien#define MACHINE_ARCH "powerpc" 6170584Sobrien#endif 62209975Snwhitehorn#endif 6370584Sobrien#define MID_MACHINE MID_POWERPC 64210369Skib#ifdef __powerpc64__ 65210369Skib#ifndef MACHINE_ARCH32 66210369Skib#define MACHINE_ARCH32 "powerpc" 67210369Skib#endif 68210369Skib#endif 6970584Sobrien 70177661Sjb#if defined(SMP) || defined(KLD_MODULE) 71224207Sattilio#ifndef MAXCPU 72222434Smarcel#define MAXCPU 8 73224207Sattilio#endif 7470584Sobrien#else 7570584Sobrien#define MAXCPU 1 76177661Sjb#endif /* SMP || KLD_MODULE */ 7770584Sobrien 7870584Sobrien#define ALIGNBYTES _ALIGNBYTES 7970584Sobrien#define ALIGN(p) _ALIGN(p) 80195376Ssam/* 81195376Ssam * ALIGNED_POINTER is a boolean macro that checks whether an address 82195376Ssam * is valid to fetch data elements of type t from on this architecture. 83195376Ssam * This does not reflect the optimal alignment, just the possibility 84195376Ssam * (within reasonable limits). 85195376Ssam */ 86209975Snwhitehorn#define ALIGNED_POINTER(p, t) ((((uintptr_t)(p)) & (sizeof (t) - 1)) == 0) 8770584Sobrien 88191278Srwatson/* 89191278Srwatson * CACHE_LINE_SIZE is the compile-time maximum cache line size for an 90191278Srwatson * architecture. It should be used with appropriate caution. 91191278Srwatson */ 92191276Srwatson#define CACHE_LINE_SHIFT 7 93191276Srwatson#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) 94191276Srwatson 9570584Sobrien#define PAGE_SHIFT 12 96209975Snwhitehorn#define PAGE_SIZE (1L << PAGE_SHIFT) /* Page size */ 97209975Snwhitehorn#define PAGE_MASK (vm_offset_t)(PAGE_SIZE - 1) 9870584Sobrien#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) 9970584Sobrien 100197316Salc#define MAXPAGESIZES 1 /* maximum number of supported page sizes */ 101197316Salc 102118239Speter#ifndef KSTACK_PAGES 10396329Sbenno#define KSTACK_PAGES 4 /* includes pcb */ 104118239Speter#endif 105116355Salc#define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ 10683682Smp#define USPACE (KSTACK_PAGES * PAGE_SIZE) /* total size of pcb */ 10770584Sobrien 10870584Sobrien/* 10970584Sobrien * Mach derived conversion macros 11070584Sobrien */ 11178342Sbenno#define trunc_page(x) ((unsigned long)(x) & ~(PAGE_MASK)) 11270584Sobrien#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) 11370584Sobrien 11478342Sbenno#define atop(x) ((unsigned long)(x) >> PAGE_SHIFT) 11578342Sbenno#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) 11670584Sobrien 117209975Snwhitehorn#define powerpc_btop(x) ((unsigned long)(x) >> PAGE_SHIFT) 118209975Snwhitehorn#define powerpc_ptob(x) ((unsigned long)(x) << PAGE_SHIFT) 11970584Sobrien 120209975Snwhitehorn#define pgtok(x) ((x) * (PAGE_SIZE / 1024UL)) 12170584Sobrien 122196994Sphk#endif /* !_POWERPC_INCLUDE_PARAM_H_ */ 123