Home | History | Annotate | Line # | Download | only in oea
vmparam.h revision 1.4
      1  1.1  matt /*-
      2  1.1  matt  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      3  1.1  matt  * All rights reserved.
      4  1.1  matt  *
      5  1.1  matt  * This code is derived from software contributed to The NetBSD Foundation
      6  1.1  matt  * by Matt Thomas <matt (at) 3am-softwre.com> of Allegro Networks, Inc.
      7  1.1  matt  *
      8  1.1  matt  * Redistribution and use in source and binary forms, with or without
      9  1.1  matt  * modification, are permitted provided that the following conditions
     10  1.1  matt  * are met:
     11  1.1  matt  * 1. Redistributions of source code must retain the above copyright
     12  1.1  matt  *    notice, this list of conditions and the following disclaimer.
     13  1.1  matt  * 2. Redistributions in binary form must reproduce the above copyright
     14  1.1  matt  *    notice, this list of conditions and the following disclaimer in the
     15  1.1  matt  *    documentation and/or other materials provided with the distribution.
     16  1.1  matt  * 3. All advertising materials mentioning features or use of this software
     17  1.1  matt  *    must display the following acknowledgement:
     18  1.1  matt  *        This product includes software developed by the NetBSD
     19  1.1  matt  *        Foundation, Inc. and its contributors.
     20  1.1  matt  * 4. Neither the name of The NetBSD Foundation nor the names of its
     21  1.1  matt  *    contributors may be used to endorse or promote products derived
     22  1.1  matt  *    from this software without specific prior written permission.
     23  1.1  matt  *
     24  1.1  matt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     25  1.1  matt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     26  1.1  matt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     27  1.1  matt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     28  1.1  matt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     29  1.1  matt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     30  1.1  matt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     31  1.1  matt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     32  1.1  matt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     33  1.1  matt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     34  1.1  matt  * POSSIBILITY OF SUCH DAMAGE.
     35  1.1  matt  */
     36  1.1  matt 
     37  1.1  matt #ifndef _POWERPC_OEA_VMPARAM_H_
     38  1.1  matt #define _POWERPC_OEA_VMPARAM_H_
     39  1.1  matt 
     40  1.1  matt #include <sys/queue.h>
     41  1.1  matt 
     42  1.1  matt /*
     43  1.1  matt  * Most of the definitions in this can be overriden by a machine-specific
     44  1.1  matt  * vmparam.h if required.  Otherwise a port can just include this file
     45  1.1  matt  * get the right thing to happen.
     46  1.1  matt  */
     47  1.1  matt 
     48  1.1  matt #ifndef	USRSTACK
     49  1.1  matt #define	USRSTACK		VM_MAXUSER_ADDRESS
     50  1.1  matt #endif
     51  1.1  matt 
     52  1.2  matt #ifndef	USRSTACK32
     53  1.2  matt #define	USRSTACK32		((uint32_t)VM_MAXUSER_ADDRESS)
     54  1.2  matt #endif
     55  1.2  matt 
     56  1.1  matt #ifndef	MAXTSIZ
     57  1.1  matt #define	MAXTSIZ			(64*1024*1024)		/* maximum text size */
     58  1.1  matt #endif
     59  1.1  matt 
     60  1.1  matt #ifndef	MAXDSIZ
     61  1.1  matt #define	MAXDSIZ			(1024*1024*1024)	/* maximum data size */
     62  1.1  matt #endif
     63  1.1  matt 
     64  1.1  matt #ifndef	MAXSSIZ
     65  1.1  matt #define	MAXSSIZ			(32*1024*1024)		/* maximum stack size */
     66  1.1  matt #endif
     67  1.1  matt 
     68  1.1  matt #ifndef	DFLDSIZ
     69  1.1  matt #define	DFLDSIZ			(128*1024*1024)		/* default data size */
     70  1.1  matt #endif
     71  1.1  matt 
     72  1.1  matt #ifndef	DFLSSIZ
     73  1.1  matt #define	DFLSSIZ			(2*1024*1024)		/* default stack size */
     74  1.1  matt #endif
     75  1.1  matt 
     76  1.1  matt /*
     77  1.1  matt  * Default maximum amount of shared memory pages
     78  1.1  matt  */
     79  1.1  matt #ifndef SHMMAXPGS
     80  1.1  matt #define	SHMMAXPGS		1024
     81  1.1  matt #endif
     82  1.1  matt 
     83  1.1  matt /*
     84  1.1  matt  * Default number of pages in the user raw I/O map.
     85  1.1  matt  */
     86  1.1  matt #ifndef USRIOSIZE
     87  1.1  matt #define	USRIOSIZE		1024
     88  1.1  matt #endif
     89  1.1  matt 
     90  1.1  matt /*
     91  1.1  matt  * The number of seconds for a process to be blocked before being
     92  1.1  matt  * considered very swappable.
     93  1.1  matt  */
     94  1.1  matt #ifndef MAXSLP
     95  1.1  matt #define	MAXSLP			20
     96  1.1  matt #endif
     97  1.1  matt 
     98  1.1  matt /*
     99  1.1  matt  * Segment handling stuff
    100  1.1  matt  */
    101  1.2  matt #define	SEGMENT_LENGTH	( 0x10000000L)
    102  1.2  matt #define	SEGMENT_MASK	(~0x0fffffffL)
    103  1.1  matt 
    104  1.1  matt /*
    105  1.1  matt  * Macros to manipulate VSIDs
    106  1.1  matt  */
    107  1.1  matt #if 0
    108  1.1  matt /*
    109  1.1  matt  * Move the SR# to the top 4 bits to make the lower 20 bits entirely random
    110  1.1  matt  * so to give better PTE distribution.
    111  1.1  matt  */
    112  1.1  matt #define	VSID_MAKE(sr, hash)	(((sr) << (ADDR_SR_SHFT-4))|((hash) & 0xfffff))
    113  1.1  matt #define	VSID_TO_SR(vsid)	(((vsid) >> (ADDR_SR_SHFT-4)) & 0xF)
    114  1.1  matt #define	VSID_TO_HASH(vsid)	((vsid) & 0xfffff)
    115  1.1  matt #define	VSID_SR_INCREMENT	0x00100000
    116  1.1  matt #else
    117  1.1  matt #define	VSID_MAKE(sr, hash)	((sr) | (((hash) & 0xfffff) << 4))
    118  1.1  matt #define	VSID_TO_SR(vsid)	((vsid) & 0xF)
    119  1.1  matt #define	VSID_TO_HASH(vsid)	(((vsid) >> 4) & 0xfffff)
    120  1.1  matt #define	VSID_SR_INCREMENT	0x00000001
    121  1.1  matt #endif
    122  1.1  matt 
    123  1.1  matt /*
    124  1.1  matt  * Fixed segments
    125  1.1  matt  */
    126  1.1  matt #ifndef USER_SR
    127  1.1  matt #define	USER_SR			12
    128  1.1  matt #endif
    129  1.3  matt #ifndef KERNEL_SR
    130  1.1  matt #define	KERNEL_SR		13
    131  1.3  matt #endif
    132  1.3  matt #ifndef KERNEL2_SR
    133  1.1  matt #define	KERNEL2_SR		14
    134  1.3  matt #endif
    135  1.1  matt #define	KERNEL2_SEGMENT		VSID_MAKE(KERNEL2_SR, KERNEL_VSIDBITS)
    136  1.1  matt #define	KERNEL_VSIDBITS		0xfffff
    137  1.1  matt #define	KERNEL_SEGMENT		VSID_MAKE(KERNEL_SR, KERNEL_VSIDBITS)
    138  1.1  matt #define	EMPTY_SEGMENT		VSID_MAKE(0, KERNEL_VSIDBITS)
    139  1.1  matt #define	USER_ADDR		((void *)(USER_SR << ADDR_SR_SHFT))
    140  1.1  matt 
    141  1.1  matt /*
    142  1.1  matt  * Some system constants
    143  1.1  matt  */
    144  1.1  matt #ifndef	NPMAPS
    145  1.1  matt #define	NPMAPS		32768	/* Number of pmaps in system */
    146  1.1  matt #endif
    147  1.1  matt 
    148  1.1  matt #define	VM_MIN_ADDRESS		((vaddr_t) 0)
    149  1.2  matt #define	VM_MAXUSER_ADDRESS	((vaddr_t) ~0xfffL)
    150  1.1  matt #define	VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
    151  1.1  matt #define	VM_MIN_KERNEL_ADDRESS	((vaddr_t) (KERNEL_SR << ADDR_SR_SHFT))
    152  1.1  matt #define	VM_MAX_KERNEL_ADDRESS	(VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH)
    153  1.1  matt 
    154  1.4  matt /*
    155  1.4  matt  * The address to which unspecified mapping requests default
    156  1.4  matt  * Put the stack in it's own segment and start mmaping at the
    157  1.4  matt  * top of the next lower segment.
    158  1.4  matt  */
    159  1.4  matt #define	__HAVE_TOPDOWN_VM
    160  1.4  matt #ifdef USE_TOPDOWN_VM
    161  1.4  matt #define	VM_DEFAULT_ADDRESS(da, sz) \
    162  1.4  matt 	(((VM_MAXUSER_ADDRESS - MAXSSIZ) & SEGMENT_MASK) - round_page(sz))
    163  1.4  matt #endif
    164  1.4  matt 
    165  1.1  matt #ifndef VM_PHYSSEG_MAX
    166  1.1  matt #define	VM_PHYSSEG_MAX		16
    167  1.1  matt #endif
    168  1.1  matt #define	VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
    169  1.1  matt #define	VM_PHYSSEG_NOADD
    170  1.1  matt 
    171  1.1  matt #ifndef VM_PHYS_SIZE
    172  1.1  matt #define	VM_PHYS_SIZE		(USRIOSIZE * PAGE_SIZE)
    173  1.1  matt #endif
    174  1.1  matt 
    175  1.1  matt #ifndef VM_MAX_KERNEL_BUF
    176  1.1  matt #define	VM_MAX_KERNEL_BUF	(SEGMENT_LENGTH * 3 / 4)
    177  1.1  matt #endif
    178  1.1  matt 
    179  1.1  matt #define	VM_NFREELIST		16	/* 16 distinct memory segments */
    180  1.1  matt #define	VM_FREELIST_DEFAULT	0
    181  1.1  matt #define	VM_FREELIST_FIRST256	1
    182  1.1  matt #define	VM_FREELIST_FIRST16	2
    183  1.1  matt #define	VM_FREELIST_MAX		3
    184  1.1  matt 
    185  1.1  matt #ifndef _LOCORE
    186  1.1  matt 
    187  1.1  matt LIST_HEAD(pvo_head, pvo_entry);
    188  1.1  matt 
    189  1.1  matt #if __NetBSD_Version__ > 105180000
    190  1.1  matt #define	__HAVE_VM_PAGE_MD
    191  1.1  matt 
    192  1.1  matt struct vm_page_md {
    193  1.1  matt 	struct pvo_head mdpg_pvoh;
    194  1.1  matt 	unsigned int mdpg_attrs;
    195  1.1  matt };
    196  1.1  matt 
    197  1.1  matt #define	VM_MDPAGE_INIT(pg) do {			\
    198  1.1  matt 	LIST_INIT(&(pg)->mdpage.mdpg_pvoh);	\
    199  1.1  matt 	(pg)->mdpage.mdpg_attrs = 0;		\
    200  1.1  matt } while (/*CONSTCOND*/0)
    201  1.1  matt 
    202  1.1  matt #else
    203  1.1  matt 
    204  1.1  matt #define	__HAVE_PMAP_PHYSSEG
    205  1.1  matt 
    206  1.1  matt struct pmap_physseg {
    207  1.1  matt 	struct pvo_head *pvoh;
    208  1.1  matt 	char *attrs;
    209  1.1  matt };
    210  1.1  matt 
    211  1.1  matt #endif
    212  1.1  matt 
    213  1.1  matt #endif	/* _LOCORE */
    214  1.1  matt 
    215  1.1  matt #endif /* _POWERPC_OEA_VMPARAM_H_ */
    216