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