1/* $NetBSD: vmparam.h,v 1.27 2023/12/15 09:42:33 rin Exp $ */ 2 3#ifndef _POWERPC_VMPARAM_H_ 4#define _POWERPC_VMPARAM_H_ 5 6#ifdef _KERNEL_OPT 7#include "opt_modular.h" 8#include "opt_ppcarch.h" 9#endif 10 11/* 12 * These are common for BOOKE, IBM4XX, and OEA 13 */ 14#define VM_FREELIST_DEFAULT 0 15#define VM_FREELIST_DIRECT_MAPPED 1 16#define VM_FREELIST_FIRST16 2 17#define VM_NFREELIST 3 18 19#define VM_PHYSSEG_MAX 16 20 21/* 22 * The address to which unspecified mapping requests default 23 * Put the stack in its own segment and start mmaping at the 24 * top of the next lower segment. 25 */ 26#define __USE_TOPDOWN_VM 27#define VM_DEFAULT_ADDRESS_BOTTOMUP(da, sz) \ 28 round_page((vaddr_t)(da) + (vsize_t)maxdmap) 29 30#if defined(MODULAR) || defined(_MODULE) || !defined(_KERNEL) 31/* 32 * If we are a module or a modular kernel, then we need to defined the range 33 * of our variable page sizes since BOOKE and OEA use 4KB pages while IBM4XX 34 * use 16KB pages. 35 * This is also required for userland by jemalloc. 36 */ 37#define MIN_PAGE_SHIFT 12 /* BOOKE/OEA */ 38#define MAX_PAGE_SHIFT 14 /* IBM4XX */ 39#define MIN_PAGE_SIZE (1 << MIN_PAGE_SHIFT) 40#define MAX_PAGE_SIZE (1 << MAX_PAGE_SHIFT) 41#endif /* MODULAR || _MODULE || !_KERNEL */ 42 43#if defined(_MODULE) 44#if defined(_RUMPKERNEL) 45/* 46 * Safe definitions for RUMP kernels 47 */ 48#define VM_MAXUSER_ADDRESS 0x7fff8000 49#define VM_MIN_ADDRESS 0x00000000 50#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS 51#define MAXDSIZ (1024*1024*1024) 52#define MAXSSIZ (32*1024*1024) 53#define MAXTSIZ (256*1024*1024) 54#else /* !_RUMPKERNEL */ 55/* 56 * Some modules need some of the constants but those vary between the variants 57 * so those constants are exported as linker symbols so they don't take up any 58 * space but also avoid an extra load to put into a register. 59 */ 60extern const char __USRSTACK; /* let the linker resolve it */ 61 62#define USRSTACK ((vaddr_t)(uintptr_t)&__USRSTACK) 63#endif /* !_RUMPKERNEL */ 64 65#else /* !_MODULE */ 66 67#if defined(PPC_BOOKE) 68#include <powerpc/booke/vmparam.h> 69#elif defined(PPC_IBM4XX) 70#include <powerpc/ibm4xx/vmparam.h> 71#elif defined(PPC_OEA) || defined (PPC_OEA64) || defined (PPC_OEA64_BRIDGE) 72#include <powerpc/oea/vmparam.h> 73#elif defined(_KERNEL) 74#error unknown PPC variant 75#endif 76 77#endif /* !_MODULE */ 78 79#if defined(MODULAR) || defined(_MODULE) 80/* 81 * If we are a module or support modules, we need to define a compatible 82 * pmap_physseg since IBM4XX uses one. This will waste a tiny of space 83 * but is needed for compatibility. 84 */ 85#ifndef __HAVE_PMAP_PHYSSEG 86#define __HAVE_PMAP_PHYSSEG 87struct pmap_physseg { 88 uintptr_t pmseg_dummy[2]; 89}; 90#endif 91 92__CTASSERT(sizeof(struct pmap_physseg) == sizeof(uintptr_t) * 2); 93#endif /* MODULAR || _MODULE */ 94 95#endif /* !_POWERPC_VMPARAM_H_ */ 96