/*-1* SPDX-License-Identifier: BSD-4-Clause2*3* Copyright (c) 2001 David E. O'Brien4* Copyright (c) 1990 The Regents of the University of California.5* All rights reserved.6*7* This code is derived from software contributed to Berkeley by8* William Jolitz.9*10* Redistribution and use in source and binary forms, with or without11* modification, are permitted provided that the following conditions12* are met:13* 1. Redistributions of source code must retain the above copyright14* notice, this list of conditions and the following disclaimer.15* 2. Redistributions in binary form must reproduce the above copyright16* notice, this list of conditions and the following disclaimer in the17* documentation and/or other materials provided with the distribution.18* 3. All advertising materials mentioning features or use of this software19* must display the following acknowledgement:20* This product includes software developed by the University of21* California, Berkeley and its contributors.22* 4. Neither the name of the University nor the names of its contributors23* may be used to endorse or promote products derived from this software24* without specific prior written permission.25*26* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND27* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE28* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE29* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE30* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL31* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS32* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)33* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT34* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY35* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF36* SUCH DAMAGE.37*/3839#ifndef _POWERPC_INCLUDE_PARAM_H_40#define _POWERPC_INCLUDE_PARAM_H_4142/*43* Machine dependent constants for PowerPC44*/4546#include <machine/_align.h>4748#ifndef MACHINE49#define MACHINE "powerpc"50#endif51#ifndef MACHINE_ARCH52#ifdef __powerpc64__53#if defined(__LITTLE_ENDIAN__)54#define MACHINE_ARCH "powerpc64le"55#else56#define MACHINE_ARCH "powerpc64"57#endif58#else59#ifdef __SPE__60#define MACHINE_ARCH "powerpcspe"61#else62#define MACHINE_ARCH "powerpc"63#endif64#endif65#endif66#define MID_MACHINE MID_POWERPC67#ifdef __powerpc64__68#ifndef MACHINE_ARCH3269#define MACHINE_ARCH32 "powerpc"70#endif71#endif7273#ifdef SMP74#ifndef MAXCPU75#define MAXCPU 25676#endif77#else78#define MAXCPU 179#endif8081#ifndef MAXMEMDOM82#define MAXMEMDOM 883#endif8485#define ALIGNBYTES _ALIGNBYTES86#define ALIGN(p) _ALIGN(p)87/*88* ALIGNED_POINTER is a boolean macro that checks whether an address89* is valid to fetch data elements of type t from on this architecture.90* This does not reflect the optimal alignment, just the possibility91* (within reasonable limits).92*/93#define ALIGNED_POINTER(p, t) ((((uintptr_t)(p)) & (sizeof (t) - 1)) == 0)9495/*96* CACHE_LINE_SIZE is the compile-time maximum cache line size for an97* architecture. It should be used with appropriate caution.98*/99#define CACHE_LINE_SHIFT 7100#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)101102#define PAGE_SHIFT 12103#define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */104#define PAGE_MASK (PAGE_SIZE - 1)105#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))106#define NPDEPG (PAGE_SIZE/(sizeof (pt_entry_t)))107108#define L1_PAGE_SIZE_SHIFT 39109#define L1_PAGE_SIZE (1UL<<L1_PAGE_SIZE_SHIFT)110#define L1_PAGE_MASK (L1_PAGE_SIZE-1)111112#define L2_PAGE_SIZE_SHIFT 30113#define L2_PAGE_SIZE (1UL<<L2_PAGE_SIZE_SHIFT)114#define L2_PAGE_MASK (L2_PAGE_SIZE-1)115116#define L3_PAGE_SIZE_SHIFT 21117#define L3_PAGE_SIZE (1UL<<L3_PAGE_SIZE_SHIFT)118#define L3_PAGE_MASK (L3_PAGE_SIZE-1)119120#define MAXPAGESIZES 3 /* maximum number of supported page sizes */121122#define RELOCATABLE_KERNEL 1 /* kernel may relocate during startup */123124#ifndef KSTACK_PAGES125#ifdef __powerpc64__126#define KSTACK_PAGES 12 /* includes pcb */127#else128#define KSTACK_PAGES 4 /* includes pcb */129#endif130#endif131#define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */132#define USPACE (kstack_pages * PAGE_SIZE) /* total size of pcb */133134#define COPYFAULT 0x1135#define FUSUFAULT 0x2136137/*138* Mach derived conversion macros139*/140#define trunc_2mpage(x) ((unsigned long)(x) & ~L3_PAGE_MASK)141#define round_2mpage(x) ((((unsigned long)(x)) + L3_PAGE_MASK) & ~L3_PAGE_MASK)142#define trunc_1gpage(x) ((unsigned long)(x) & ~L2_PAGE_MASK)143144#define powerpc_btop(x) ((x) >> PAGE_SHIFT)145#define powerpc_ptob(x) ((x) << PAGE_SHIFT)146147#define btoc(x) ((vm_offset_t)(((x)+PAGE_MASK)>>PAGE_SHIFT))148149#endif /* !_POWERPC_INCLUDE_PARAM_H_ */150151152