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