xref: /netbsd-src/sys/arch/powerpc/include/vmparam.h (revision 1b9578b8c2c1f848eeb16dabbfd7d1f0d9fdefbd)
1 /*	$NetBSD: vmparam.h,v 1.16 2011/06/20 21:45:16 matt 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 it's 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(da, sz) \
29 	((VM_MAXUSER_ADDRESS - MAXSSIZ) - round_page(sz))
30 
31 #if defined(_MODULE)
32 /*
33  * If we are a module, then we need with varible page sizes since BOOKE and OEA
34  * use 4KB pages while IBM4XX use 16KB pages.
35  */
36 #define	MIN_PAGE_SIZE	4096		/* BOOKE/OEA */
37 #define	MAX_PAGE_SIZE	16384		/* IBM4XX */
38 
39 #if defined(_RUMPKERNEL)
40 /*
41  * Safe definitions for RUMP kernels
42  */
43 #define	VM_MAXUSER_ADDRESS	0x7fff8000
44 #define	VM_MIN_ADDRESS		0x00000000
45 #define	VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
46 #define	MAXDSIZ			(1024*1024*1024)
47 #define	MAXSSIZ			(32*1024*1024)
48 #define	MAXTSIZ			(256*1024*1024)
49 #else /* !_RUMPKERNEL */
50 /*
51  * Some modules need some of the constants but those vary between the variants
52  * so those constants are exported as linker symbols so they don't take up any
53  * space but also avoid an extra load to put into a register.
54  */
55 extern const char __USRSTACK;		/* let the linker resolve it */
56 
57 #define USRSTACK	((vaddr_t)(uintptr_t)&__USRSTACK)
58 #endif /* !_RUMPKERNEL */
59 
60 #else /* !_MODULE */
61 
62 #if defined(PPC_BOOKE)
63 #include <powerpc/booke/vmparam.h>
64 #elif defined(PPC_IBM4XX)
65 #include <powerpc/ibm4xx/vmparam.h>
66 #elif defined(PPC_OEA) || defined (PPC_OEA64) || defined (PPC_OEA64_BRIDGE)
67 #include <powerpc/oea/vmparam.h>
68 #elif defined(_KERNEL)
69 #error unknown PPC variant
70 #endif
71 
72 #endif /* !_MODULE */
73 
74 #if defined(MODULAR) || defined(_MODULAR)
75 /*
76  * If we are a module or support modules, we need to define a compatible
77  * pmap_physseg since IBM4XX uses one.  This will waste a tiny of space
78  * but is needed for compatibility.
79  */
80 #ifndef __HAVE_PMAP_PHYSSEG
81 #define	__HAVE_PMAP_PHYSSEG
82 struct pmap_physseg {
83 	uintptr_t pmseg_dummy[2];
84 };
85 #endif
86 
87 __CTASSERT(sizeof(struct pmap_physseg) == sizeof(uintptr_t) * 2);
88 #endif /* MODULAR || _MODULE */
89 
90 #endif /* !_POWERPC_VMPARAM_H_ */
91