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