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