1*0a6a1f1dSLionel Sambuc /* $NetBSD: param.h,v 1.24 2015/04/02 03:11:01 matt 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 38*0a6a1f1dSLionel Sambuc #ifdef _KERNEL_OPT 39*0a6a1f1dSLionel Sambuc # include "opt_arm32_pmap.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 48*0a6a1f1dSLionel Sambuc #if defined(__minix) 49*0a6a1f1dSLionel Sambuc /* We do not support PAGE_SIZE != 4k */ 50b1c4ba4aSLionel Sambuc #define PGSHIFT 12 /* LOG2(NBPG) */ 51*0a6a1f1dSLionel Sambuc #endif /* defined(__minix) */ 52*0a6a1f1dSLionel Sambuc #ifndef PGSHIFT 53*0a6a1f1dSLionel Sambuc #if defined(_ARM_ARCH_6) 54*0a6a1f1dSLionel Sambuc #define PGSHIFT 13 /* LOG2(NBPG) */ 55*0a6a1f1dSLionel Sambuc #else 56*0a6a1f1dSLionel Sambuc #define PGSHIFT 12 /* LOG2(NBPG) */ 57*0a6a1f1dSLionel Sambuc #endif 58*0a6a1f1dSLionel Sambuc #endif 59b1c4ba4aSLionel Sambuc #define NBPG (1 << PGSHIFT) /* bytes/page */ 60b1c4ba4aSLionel Sambuc #define PGOFSET (NBPG-1) /* byte offset into page */ 61b1c4ba4aSLionel Sambuc #define NPTEPG (NBPG/(sizeof (pt_entry_t))) 62b1c4ba4aSLionel Sambuc 63b1c4ba4aSLionel Sambuc 64b1c4ba4aSLionel Sambuc #define SSIZE 1 /* initial stack size/NBPG */ 65b1c4ba4aSLionel Sambuc #define SINCR 1 /* increment of stack/NBPG */ 66*0a6a1f1dSLionel Sambuc #define USPACE 8192 /* total size of u-area */ 67*0a6a1f1dSLionel Sambuc #define UPAGES (USPACE / NBPG) /* pages of u-area */ 68b1c4ba4aSLionel Sambuc 69b1c4ba4aSLionel Sambuc #ifndef MSGBUFSIZE 7084d9c625SLionel Sambuc #define MSGBUFSIZE 16384 /* default message buffer size */ 71b1c4ba4aSLionel Sambuc #endif 72b1c4ba4aSLionel Sambuc 73b1c4ba4aSLionel Sambuc /* 74b1c4ba4aSLionel Sambuc * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized 75b1c4ba4aSLionel Sambuc * logical pages. 76b1c4ba4aSLionel Sambuc */ 77b1c4ba4aSLionel Sambuc #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) 78b1c4ba4aSLionel Sambuc #define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT) 79b1c4ba4aSLionel Sambuc 80b1c4ba4aSLionel Sambuc /* Constants used to divide the USPACE area */ 81b1c4ba4aSLionel Sambuc 82b1c4ba4aSLionel Sambuc /* 83b1c4ba4aSLionel Sambuc * The USPACE area contains : 84b1c4ba4aSLionel Sambuc * 1. the pcb structure for the process 8584d9c625SLionel Sambuc * 2. the kernel (svc) stack 86b1c4ba4aSLionel Sambuc * 87b1c4ba4aSLionel Sambuc * The layout of the area looks like this 88b1c4ba4aSLionel Sambuc * 8984d9c625SLionel Sambuc * | uarea | kernel stack | 90b1c4ba4aSLionel Sambuc * 91b1c4ba4aSLionel Sambuc * The size of the uarea is known. 92b1c4ba4aSLionel Sambuc * The kernel stack should be at least 4K is size. 93b1c4ba4aSLionel Sambuc * 94b1c4ba4aSLionel Sambuc * The stack top addresses are used to set the stack pointers. The stack bottom 95b1c4ba4aSLionel Sambuc * addresses at the addresses monitored by the diagnostic code for stack overflows 96b1c4ba4aSLionel Sambuc * 97b1c4ba4aSLionel Sambuc */ 98b1c4ba4aSLionel Sambuc 99b1c4ba4aSLionel Sambuc #define USPACE_SVC_STACK_TOP (USPACE) 10084d9c625SLionel Sambuc #define USPACE_SVC_STACK_BOTTOM (sizeof(struct pcb)) 101b1c4ba4aSLionel Sambuc 10284d9c625SLionel Sambuc #define arm_btop(x) ((unsigned)(x) >> PGSHIFT) 10384d9c625SLionel Sambuc #define arm_ptob(x) ((unsigned)(x) << PGSHIFT) 104b1c4ba4aSLionel Sambuc #define arm_trunc_page(x) ((unsigned)(x) & ~PGOFSET) 105b1c4ba4aSLionel Sambuc 106b1c4ba4aSLionel Sambuc #ifdef _KERNEL 107b1c4ba4aSLionel Sambuc #ifndef _LOCORE 108b1c4ba4aSLionel Sambuc void delay(unsigned); 109b1c4ba4aSLionel Sambuc #define DELAY(x) delay(x) 110b1c4ba4aSLionel Sambuc #endif 111b1c4ba4aSLionel Sambuc #endif 112b1c4ba4aSLionel Sambuc 113b1c4ba4aSLionel Sambuc #include <arm/param.h> 114b1c4ba4aSLionel Sambuc 115b1c4ba4aSLionel Sambuc #endif /* _ARM_ARM32_PARAM_H_ */ 116