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: releng/10.2/sys/powerpc/include/param.h 271153 2014-09-05 05:07:38Z jhibbits $ 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 72255419Snwhitehorn#define MAXCPU 32 73224207Sattilio#endif 7470584Sobrien#else 7570584Sobrien#define MAXCPU 1 76177661Sjb#endif /* SMP || KLD_MODULE */ 7770584Sobrien 78250338Sattilio#ifndef MAXMEMDOM 79250338Sattilio#define MAXMEMDOM 1 80250338Sattilio#endif 81250338Sattilio 8270584Sobrien#define ALIGNBYTES _ALIGNBYTES 8370584Sobrien#define ALIGN(p) _ALIGN(p) 84195376Ssam/* 85195376Ssam * ALIGNED_POINTER is a boolean macro that checks whether an address 86195376Ssam * is valid to fetch data elements of type t from on this architecture. 87195376Ssam * This does not reflect the optimal alignment, just the possibility 88195376Ssam * (within reasonable limits). 89195376Ssam */ 90209975Snwhitehorn#define ALIGNED_POINTER(p, t) ((((uintptr_t)(p)) & (sizeof (t) - 1)) == 0) 9170584Sobrien 92191278Srwatson/* 93191278Srwatson * CACHE_LINE_SIZE is the compile-time maximum cache line size for an 94191278Srwatson * architecture. It should be used with appropriate caution. 95191278Srwatson */ 96191276Srwatson#define CACHE_LINE_SHIFT 7 97191276Srwatson#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) 98191276Srwatson 9970584Sobrien#define PAGE_SHIFT 12 100209975Snwhitehorn#define PAGE_SIZE (1L << PAGE_SHIFT) /* Page size */ 101209975Snwhitehorn#define PAGE_MASK (vm_offset_t)(PAGE_SIZE - 1) 10270584Sobrien#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) 10370584Sobrien 104197316Salc#define MAXPAGESIZES 1 /* maximum number of supported page sizes */ 105197316Salc 106118239Speter#ifndef KSTACK_PAGES 107271153Sjhibbits#ifdef __powerpc64__ 108271153Sjhibbits#define KSTACK_PAGES 8 /* includes pcb */ 109271153Sjhibbits#else 11096329Sbenno#define KSTACK_PAGES 4 /* includes pcb */ 111118239Speter#endif 112271153Sjhibbits#endif 113116355Salc#define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ 11483682Smp#define USPACE (KSTACK_PAGES * PAGE_SIZE) /* total size of pcb */ 11570584Sobrien 11670584Sobrien/* 11770584Sobrien * Mach derived conversion macros 11870584Sobrien */ 11978342Sbenno#define trunc_page(x) ((unsigned long)(x) & ~(PAGE_MASK)) 12070584Sobrien#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) 12170584Sobrien 12278342Sbenno#define atop(x) ((unsigned long)(x) >> PAGE_SHIFT) 12378342Sbenno#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) 12470584Sobrien 125209975Snwhitehorn#define powerpc_btop(x) ((unsigned long)(x) >> PAGE_SHIFT) 126209975Snwhitehorn#define powerpc_ptob(x) ((unsigned long)(x) << PAGE_SHIFT) 12770584Sobrien 128209975Snwhitehorn#define pgtok(x) ((x) * (PAGE_SIZE / 1024UL)) 12970584Sobrien 130196994Sphk#endif /* !_POWERPC_INCLUDE_PARAM_H_ */ 131