vmparam.h revision 1.2
1/*-
2 * Copyright (c) 2010 The NetBSD Foundation, Inc.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Matt Thomas of 3am Software Foundry, LLC.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#ifndef _POWERPC_BOOKE_VMPARAM_H_
31#define _POWERPC_BOOKE_VMPARAM_H_
32
33/*
34 * Most of the definitions in this can be overriden by a machine-specific
35 * vmparam.h if required.  Otherwise a port can just include this file
36 * get the right thing to happen.
37 */
38
39/*
40 * BookE processors have 4K pages.  Override the PAGE_* definitions to be
41 * compile-time constants.
42 */
43#define	PAGE_SHIFT	12
44#define	PAGE_SIZE	(1 << PAGE_SHIFT)
45#define	PAGE_MASK	(PAGE_SIZE - 1)
46
47#ifndef	USRSTACK
48#define	USRSTACK	VM_MAXUSER_ADDRESS
49#endif
50
51#ifndef	MAXTSIZ
52#define	MAXTSIZ		(2*256*1024*1024)	/* maximum text size */
53#endif
54
55#ifndef	MAXDSIZ
56#define	MAXDSIZ		(13*256*1024*1024)	/* maximum data size */
57#endif
58
59#ifndef	MAXSSIZ
60#define	MAXSSIZ		(1*256*1024*1024-PAGE_SIZE) /* maximum stack size */
61#endif
62
63#ifndef	DFLDSIZ
64#define	DFLDSIZ		(256*1024*1024)		/* default data size */
65#endif
66
67#ifndef	DFLSSIZ
68#define	DFLSSIZ		(2*1024*1024)		/* default stack size */
69#endif
70
71/*
72 * Default number of pages in the user raw I/O map.
73 */
74#ifndef USRIOSIZE
75#define	USRIOSIZE	1024
76#endif
77
78/*
79 * The number of seconds for a process to be blocked before being
80 * considered very swappable.
81 */
82#ifndef MAXSLP
83#define	MAXSLP		20
84#endif
85
86/*
87 * Some system constants
88 */
89
90#define	VM_MIN_ADDRESS		((vaddr_t) 0)
91#define	VM_MAXUSER_ADDRESS	((vaddr_t) -PAGE_SIZE)
92#define	VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
93#define	VM_MIN_KERNEL_ADDRESS	((vaddr_t) 0xe4000000)
94#define	VM_MAX_KERNEL_ADDRESS	((vaddr_t) 0xfefff000)
95
96/*
97 * The address to which unspecified mapping requests default
98 * Put the stack in it's own segment and start mmaping at the
99 * top of the next lower segment.
100 */
101#ifdef _KERNEL_OPT
102#include "opt_uvm.h"
103#endif
104#define	__USE_TOPDOWN_VM
105#define	VM_DEFAULT_ADDRESS(da, sz) \
106	(((VM_MAXUSER_ADDRESS - MAXSSIZ) - round_page(sz))
107
108#ifndef VM_PHYSSEG_MAX
109#define	VM_PHYSSEG_MAX		16
110#endif
111#define	VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
112
113#ifndef VM_PHYS_SIZE
114#define	VM_PHYS_SIZE		(USRIOSIZE * PAGE_SIZE)
115#endif
116
117#define	VM_NFREELIST		2	/* 16 distinct memory segments */
118#define	VM_FREELIST_DEFAULT	0
119#define	VM_FREELIST_FIRST16	1
120#define	VM_FREELIST_MAX		2
121
122#ifndef _LOCORE
123
124#define	__HAVE_VM_PAGE_MD
125
126struct pv_entry {
127	struct pv_entry *pv_next;
128	struct pmap *pv_pmap;
129	vaddr_t pv_va;
130};
131
132struct vm_page_md {
133	struct pv_entry mdpg_pvlist;
134	unsigned int mdpg_attrs;
135};
136
137#define	VM_MDPAGE_INIT(pg) do {				\
138	(pg)->mdpage.mdpg_pvlist.pv_next = NULL;	\
139	(pg)->mdpage.mdpg_pvlist.pv_pmap = NULL;	\
140	(pg)->mdpage.mdpg_pvlist.pv_va = 0;		\
141	(pg)->mdpage.mdpg_attrs = 0;			\
142} while (/*CONSTCOND*/0)
143
144#endif	/* _LOCORE */
145
146#endif /* _POWERPC_BOOKE_VMPARAM_H_ */
147