xref: /minix3/sys/arch/arm/include/arm32/param.h (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc /*	$NetBSD: param.h,v 1.20 2013/05/29 23:29:44 rkujawa Exp $	*/
2b1c4ba4aSLionel Sambuc 
3b1c4ba4aSLionel Sambuc /*
4b1c4ba4aSLionel Sambuc  * Copyright (c) 1994,1995 Mark Brinicombe.
5b1c4ba4aSLionel Sambuc  * All rights reserved.
6b1c4ba4aSLionel Sambuc  *
7b1c4ba4aSLionel Sambuc  * Redistribution and use in source and binary forms, with or without
8b1c4ba4aSLionel Sambuc  * modification, are permitted provided that the following conditions
9b1c4ba4aSLionel Sambuc  * are met:
10b1c4ba4aSLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
11b1c4ba4aSLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
12b1c4ba4aSLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
13b1c4ba4aSLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
14b1c4ba4aSLionel Sambuc  *    documentation and/or other materials provided with the distribution.
15b1c4ba4aSLionel Sambuc  * 3. All advertising materials mentioning features or use of this software
16b1c4ba4aSLionel Sambuc  *    must display the following acknowledgement:
17b1c4ba4aSLionel Sambuc  *	This product includes software developed by the RiscBSD team.
18b1c4ba4aSLionel Sambuc  * 4. The name "RiscBSD" nor the name of the author may be used to
19b1c4ba4aSLionel Sambuc  *    endorse or promote products derived from this software without specific
20b1c4ba4aSLionel Sambuc  *    prior written permission.
21b1c4ba4aSLionel Sambuc  *
22b1c4ba4aSLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
23b1c4ba4aSLionel Sambuc  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24b1c4ba4aSLionel Sambuc  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25b1c4ba4aSLionel Sambuc  * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
26b1c4ba4aSLionel Sambuc  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27b1c4ba4aSLionel Sambuc  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28b1c4ba4aSLionel Sambuc  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29b1c4ba4aSLionel Sambuc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30b1c4ba4aSLionel Sambuc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31b1c4ba4aSLionel Sambuc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32b1c4ba4aSLionel Sambuc  * SUCH DAMAGE.
33b1c4ba4aSLionel Sambuc  */
34b1c4ba4aSLionel Sambuc 
35b1c4ba4aSLionel Sambuc #ifndef	_ARM_ARM32_PARAM_H_
36b1c4ba4aSLionel Sambuc #define	_ARM_ARM32_PARAM_H_
37b1c4ba4aSLionel Sambuc 
38b1c4ba4aSLionel Sambuc #ifdef _KERNEL
39b1c4ba4aSLionel Sambuc #  include <machine/cpu.h>
40b1c4ba4aSLionel Sambuc #endif
41b1c4ba4aSLionel Sambuc 
42b1c4ba4aSLionel Sambuc /*
43b1c4ba4aSLionel Sambuc  * Machine dependent constants for ARM6+ processors
44b1c4ba4aSLionel Sambuc  */
45b1c4ba4aSLionel Sambuc /* These are defined in the Port File before it includes
46b1c4ba4aSLionel Sambuc  * this file. */
47b1c4ba4aSLionel Sambuc 
48b1c4ba4aSLionel Sambuc #define	PGSHIFT		12		/* LOG2(NBPG) */
49b1c4ba4aSLionel Sambuc #define	NBPG		(1 << PGSHIFT)	/* bytes/page */
50b1c4ba4aSLionel Sambuc #define	PGOFSET		(NBPG-1)	/* byte offset into page */
51b1c4ba4aSLionel Sambuc #define	NPTEPG		(NBPG/(sizeof (pt_entry_t)))
52b1c4ba4aSLionel Sambuc 
53b1c4ba4aSLionel Sambuc 
54b1c4ba4aSLionel Sambuc #define SSIZE           1               /* initial stack size/NBPG */
55b1c4ba4aSLionel Sambuc #define SINCR           1               /* increment of stack/NBPG */
56b1c4ba4aSLionel Sambuc #define UPAGES          2               /* pages of u-area */
57b1c4ba4aSLionel Sambuc #define USPACE          (UPAGES * NBPG) /* total size of u-area */
58b1c4ba4aSLionel Sambuc 
59b1c4ba4aSLionel Sambuc #ifndef MSGBUFSIZE
60*84d9c625SLionel Sambuc #define MSGBUFSIZE	16384	 	/* default message buffer size */
61b1c4ba4aSLionel Sambuc #endif
62b1c4ba4aSLionel Sambuc 
63b1c4ba4aSLionel Sambuc /*
64b1c4ba4aSLionel Sambuc  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
65b1c4ba4aSLionel Sambuc  * logical pages.
66b1c4ba4aSLionel Sambuc  */
67b1c4ba4aSLionel Sambuc #define	NKMEMPAGES_MIN_DEFAULT	((8 * 1024 * 1024) >> PAGE_SHIFT)
68b1c4ba4aSLionel Sambuc #define	NKMEMPAGES_MAX_DEFAULT	((128 * 1024 * 1024) >> PAGE_SHIFT)
69b1c4ba4aSLionel Sambuc 
70b1c4ba4aSLionel Sambuc /* Constants used to divide the USPACE area */
71b1c4ba4aSLionel Sambuc 
72b1c4ba4aSLionel Sambuc /*
73b1c4ba4aSLionel Sambuc  * The USPACE area contains :
74b1c4ba4aSLionel Sambuc  * 1. the pcb structure for the process
75*84d9c625SLionel Sambuc  * 2. the kernel (svc) stack
76b1c4ba4aSLionel Sambuc  *
77b1c4ba4aSLionel Sambuc  * The layout of the area looks like this
78b1c4ba4aSLionel Sambuc  *
79*84d9c625SLionel Sambuc  * | uarea | kernel stack |
80b1c4ba4aSLionel Sambuc  *
81b1c4ba4aSLionel Sambuc  * The size of the uarea is known.
82b1c4ba4aSLionel Sambuc  * The kernel stack should be at least 4K is size.
83b1c4ba4aSLionel Sambuc  *
84b1c4ba4aSLionel Sambuc  * The stack top addresses are used to set the stack pointers. The stack bottom
85b1c4ba4aSLionel Sambuc  * addresses at the addresses monitored by the diagnostic code for stack overflows
86b1c4ba4aSLionel Sambuc  *
87b1c4ba4aSLionel Sambuc  */
88b1c4ba4aSLionel Sambuc 
89b1c4ba4aSLionel Sambuc #define USPACE_SVC_STACK_TOP		(USPACE)
90*84d9c625SLionel Sambuc #define USPACE_SVC_STACK_BOTTOM		(sizeof(struct pcb))
91b1c4ba4aSLionel Sambuc 
92*84d9c625SLionel Sambuc #define arm_btop(x)			((unsigned)(x) >> PGSHIFT)
93*84d9c625SLionel Sambuc #define arm_ptob(x)			((unsigned)(x) << PGSHIFT)
94b1c4ba4aSLionel Sambuc #define arm_trunc_page(x)		((unsigned)(x) & ~PGOFSET)
95b1c4ba4aSLionel Sambuc 
96b1c4ba4aSLionel Sambuc #ifdef _KERNEL
97b1c4ba4aSLionel Sambuc #ifndef _LOCORE
98b1c4ba4aSLionel Sambuc void	delay(unsigned);
99b1c4ba4aSLionel Sambuc #define DELAY(x)	delay(x)
100b1c4ba4aSLionel Sambuc #endif
101b1c4ba4aSLionel Sambuc #endif
102b1c4ba4aSLionel Sambuc 
103b1c4ba4aSLionel Sambuc #include <arm/param.h>
104b1c4ba4aSLionel Sambuc 
105b1c4ba4aSLionel Sambuc #endif	/* _ARM_ARM32_PARAM_H_ */
106