xref: /netbsd-src/sys/arch/or1k/include/vmparam.h (revision 27620987b8618edefe3919667fcfb2a0eb02578b)
1 /* $NetBSD: vmparam.h,v 1.1 2014/09/03 19:34:26 matt Exp $ */
2 
3 /*-
4  * Copyright (c) 2014 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Matt Thomas of 3am Software Foundry.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef _OR1K_VMPARAM_H_
33 #define _OR1K_VMPARAM_H_
34 
35 /*
36  * OR1K supports 1 page size: 8KB.
37  */
38 
39 #define PAGE_SHIFT	13
40 #define PAGE_SIZE	(1 << PAGE_SHIFT)
41 #define PAGE_MASK	(PAGE_SIZE - 1)
42 
43 #define USPACE		16384
44 #define	UPAGES		(USPACE >> PAGE_SHIFT)
45 
46 /*
47  * USRSTACK is the top (end) of the user stack.  The user VA space is a
48  * 32-bit address space starting at 0.  Place the stack at its top end.
49  */
50 #define USRSTACK	((vaddr_t) 0x80000000U - PAGE_SIZE)
51 
52 #ifndef MAXTSIZ
53 #define	MAXTSIZ		(1UL << 26)	/* 32bit max text size (64MB) */
54 #endif
55 
56 #ifndef MAXDSIZ
57 #define	MAXDSIZ		(1UL << 30)	/* max data size (1024MB) */
58 #endif
59 
60 #ifndef MAXSSIZ
61 #define	MAXSSIZ		(1UL << 26)	/* max stack size (64MB) */
62 #endif
63 
64 #ifndef DFLDSIZ
65 #define	DFLDSIZ		(1UL << 27)	/* 32bit default data size (128MB) */
66 #endif
67 
68 #ifndef DFLSSIZ
69 #define	DFLSSIZ		(1UL << 21)	/* 32bit default stack size (2MB) */
70 #endif
71 
72 #define	VM_MIN_ADDRESS		((vaddr_t) 0x0)
73 #define	VM_MAXUSER_ADDRESS	((vaddr_t) 0x80000000 - PAGE_SIZE)
74 #define	VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
75 
76 /*
77  * Give ourselves 64GB of mappable kernel space.  That leaves the rest
78  * to be user for directly mapped (block addressable) addresses.
79  */
80 #define VM_MIN_KERNEL_ADDRESS	((vaddr_t) 0x80000000L)
81 #define VM_MAX_KERNEL_ADDRESS	((vaddr_t) -PAGE_SIZE)
82 
83 /* virtual sizes (bytes) for various kernel submaps */
84 #define USRIOSIZE		(PAGE_SIZE / 8)
85 #define VM_PHYS_SIZE		(USRIOSIZE * PAGE_SIZE)
86 
87 /* */
88 #define VM_PHYSSEG_MAX		16              /* XXX */
89 #define VM_PHYSSEG_STRAT	VM_PSTRAT_BSEARCH
90 
91 #define VM_NFREELIST		1
92 #define	VM_FREELIST_DEFAULT	0
93 
94 #endif /* _OR1K_VMPARAM_H_ */
95