Home | History | Annotate | Line # | Download | only in oea
vmparam.h revision 1.20.18.1
      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  *
     17        1.1     matt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     18        1.1     matt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     19        1.1     matt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     20        1.1     matt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     21        1.1     matt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     22        1.1     matt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     23        1.1     matt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     24        1.1     matt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     25        1.1     matt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     26        1.1     matt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     27        1.1     matt  * POSSIBILITY OF SUCH DAMAGE.
     28        1.1     matt  */
     29        1.1     matt 
     30        1.1     matt #ifndef _POWERPC_OEA_VMPARAM_H_
     31        1.1     matt #define _POWERPC_OEA_VMPARAM_H_
     32        1.1     matt 
     33        1.1     matt #include <sys/queue.h>
     34        1.1     matt 
     35        1.1     matt /*
     36        1.1     matt  * Most of the definitions in this can be overriden by a machine-specific
     37        1.1     matt  * vmparam.h if required.  Otherwise a port can just include this file
     38        1.1     matt  * get the right thing to happen.
     39        1.1     matt  */
     40        1.1     matt 
     41        1.6  thorpej /*
     42        1.6  thorpej  * OEA processors have 4K pages.  Override the PAGE_* definitions
     43        1.6  thorpej  * to be compile-time constants.
     44        1.6  thorpej  */
     45        1.6  thorpej #define	PAGE_SHIFT	12
     46        1.6  thorpej #define	PAGE_SIZE	(1 << PAGE_SHIFT)
     47        1.6  thorpej #define	PAGE_MASK	(PAGE_SIZE - 1)
     48        1.6  thorpej 
     49        1.1     matt #ifndef	USRSTACK
     50  1.20.18.1  thorpej #define	USRSTACK	VM_MAXUSER_ADDRESS
     51        1.1     matt #endif
     52        1.1     matt 
     53        1.2     matt #ifndef	USRSTACK32
     54  1.20.18.1  thorpej #define	USRSTACK32	VM_MAXUSER_ADDRESS32
     55        1.2     matt #endif
     56        1.2     matt 
     57        1.1     matt #ifndef	MAXTSIZ
     58  1.20.18.1  thorpej #define	MAXTSIZ		(128*1024*1024)		/* maximum text size */
     59        1.1     matt #endif
     60        1.1     matt 
     61        1.1     matt #ifndef	MAXDSIZ
     62  1.20.18.1  thorpej #define	MAXDSIZ		(1024*1024*1024)	/* maximum data size */
     63        1.1     matt #endif
     64        1.1     matt 
     65       1.18     matt #ifndef	MAXDSIZ32
     66  1.20.18.1  thorpej #define	MAXDSIZ32	(1024*1024*1024)	/* maximum data size */
     67       1.18     matt #endif
     68       1.18     matt 
     69        1.1     matt #ifndef	MAXSSIZ
     70  1.20.18.1  thorpej #define	MAXSSIZ		(32*1024*1024)		/* maximum stack size */
     71        1.1     matt #endif
     72        1.1     matt 
     73       1.18     matt #ifndef	MAXSSIZ32
     74  1.20.18.1  thorpej #define	MAXSSIZ32	(32*1024*1024)		/* maximum stack size */
     75       1.18     matt #endif
     76       1.18     matt 
     77        1.1     matt #ifndef	DFLDSIZ
     78  1.20.18.1  thorpej #define	DFLDSIZ		(256*1024*1024)		/* default data size */
     79        1.1     matt #endif
     80        1.1     matt 
     81       1.18     matt #ifndef	DFLDSIZ32
     82  1.20.18.1  thorpej #define	DFLSSIZ32	(256*1024*1024)
     83       1.18     matt #endif
     84       1.18     matt 
     85        1.1     matt #ifndef	DFLSSIZ
     86  1.20.18.1  thorpej #define	DFLSSIZ		(2*1024*1024)		/* default stack size */
     87        1.1     matt #endif
     88        1.1     matt 
     89       1.18     matt #ifndef	DFLSSIZ32
     90  1.20.18.1  thorpej #define	DFLSSIZ32	(2*1024*1024)		/* default stack size */
     91       1.18     matt #endif
     92       1.18     matt 
     93        1.1     matt /*
     94        1.1     matt  * Default number of pages in the user raw I/O map.
     95        1.1     matt  */
     96        1.1     matt #ifndef USRIOSIZE
     97  1.20.18.1  thorpej #define	USRIOSIZE	1024
     98        1.1     matt #endif
     99        1.1     matt 
    100        1.1     matt /*
    101        1.1     matt  * The number of seconds for a process to be blocked before being
    102        1.1     matt  * considered very swappable.
    103        1.1     matt  */
    104        1.1     matt #ifndef MAXSLP
    105  1.20.18.1  thorpej #define	MAXSLP		20
    106        1.1     matt #endif
    107        1.1     matt 
    108        1.1     matt /*
    109        1.1     matt  * Segment handling stuff
    110        1.1     matt  */
    111        1.2     matt #define	SEGMENT_LENGTH	( 0x10000000L)
    112        1.2     matt #define	SEGMENT_MASK	(~0x0fffffffL)
    113        1.1     matt 
    114        1.1     matt /*
    115        1.1     matt  * Macros to manipulate VSIDs
    116        1.1     matt  */
    117        1.1     matt #if 0
    118        1.1     matt /*
    119        1.7     matt  * Move the SR# to the top bits to make the lower bits entirely random
    120        1.1     matt  * so to give better PTE distribution.
    121        1.1     matt  */
    122        1.7     matt #define	VSID__KEYSHFT		(SR_VSID_WIDTH - SR_KEY_LEN)
    123        1.7     matt #define	VSID_SR_INCREMENT	((1L << VSID__KEYSHFT) - 1)
    124        1.7     matt #define VSID__HASHMASK		(VSID_SR_INCREMENT - 1)
    125        1.7     matt #define	VSID_MAKE(sr, hash) \
    126        1.7     matt 	(( \
    127        1.7     matt 	    (((sr) << VSID__KEYSHFT) | ((hash) & VSID__HASMASK))
    128        1.7     matt 	    << SR_VSID_SHFT) & SR_VSID)
    129        1.7     matt #define	VSID_TO_SR(vsid) \
    130        1.7     matt 	(((vsid) & SR_VSID) >> (SR_VSID_SHFT + VSID__KEYSHFT))
    131        1.7     matt #define	VSID_TO_HASH(vsid) \
    132        1.7     matt 	(((vsid) & SR_VSID) >> SR_VSID_SHFT) & VSID__HASHMASK)
    133        1.1     matt #else
    134        1.7     matt #define	VSID__HASHSHFT		(SR_KEY_LEN)
    135        1.7     matt #define	VSID_SR_INCREMENT	(1L << 0)
    136        1.7     matt #define	VSID__KEYMASK		((1L << VSID__HASHSHFT) - 1)
    137        1.7     matt #define	VSID_MAKE(sr, hash) \
    138        1.7     matt 	(( \
    139        1.7     matt 	    (((hash) << VSID__HASHSHFT) | ((sr) & VSID__KEYMASK)) \
    140        1.7     matt 	     << SR_VSID_SHFT) & SR_VSID)
    141        1.7     matt #define	VSID_TO_SR(vsid) \
    142        1.7     matt 	(((vsid) >> SR_VSID_SHFT) & VSID__KEYMASK)
    143        1.7     matt #define	VSID_TO_HASH(vsid) \
    144        1.7     matt 	(((vsid) & SR_VSID) >> (SR_VSID_SHFT + VSID__HASHSHFT))
    145       1.12  garbled #endif /*0*/
    146        1.1     matt 
    147       1.18     matt #ifndef _LP64
    148        1.1     matt /*
    149        1.1     matt  * Fixed segments
    150        1.1     matt  */
    151        1.1     matt #ifndef USER_SR
    152        1.1     matt #define	USER_SR			12
    153        1.1     matt #endif
    154        1.3     matt #ifndef KERNEL_SR
    155        1.1     matt #define	KERNEL_SR		13
    156        1.3     matt #endif
    157        1.3     matt #ifndef KERNEL2_SR
    158        1.1     matt #define	KERNEL2_SR		14
    159        1.3     matt #endif
    160        1.1     matt #define	KERNEL2_SEGMENT		VSID_MAKE(KERNEL2_SR, KERNEL_VSIDBITS)
    161       1.18     matt #endif
    162        1.1     matt #define	KERNEL_VSIDBITS		0xfffff
    163       1.10     matt #define	PHYSMAP_VSIDBITS	0xffffe
    164       1.10     matt #define	PHYSMAPN_SEGMENT(s)	VSID_MAKE(s, PHYSMAP_VSIDBITS)
    165        1.1     matt #define	KERNEL_SEGMENT		VSID_MAKE(KERNEL_SR, KERNEL_VSIDBITS)
    166        1.9  sanjayl #define	KERNELN_SEGMENT(s)	VSID_MAKE(s, KERNEL_VSIDBITS)
    167        1.9  sanjayl /* XXXSL: need something here that will never be mapped */
    168        1.9  sanjayl #define	EMPTY_SEGMENT		VSID_MAKE(0, 0xffffe)
    169        1.1     matt #define	USER_ADDR		((void *)(USER_SR << ADDR_SR_SHFT))
    170        1.1     matt 
    171        1.1     matt /*
    172        1.1     matt  * Some system constants
    173        1.1     matt  */
    174        1.1     matt #ifndef	NPMAPS
    175        1.1     matt #define	NPMAPS		32768	/* Number of pmaps in system */
    176        1.1     matt #endif
    177        1.1     matt 
    178        1.1     matt #define	VM_MIN_ADDRESS		((vaddr_t) 0)
    179       1.18     matt #define	VM_MAXUSER_ADDRESS32	((vaddr_t) (uint32_t) ~0xfffL)
    180       1.18     matt #ifdef _LP64
    181       1.18     matt #define	VM_MAXUSER_ADDRESS	((vaddr_t) 1UL << 48) /* 256TB */
    182       1.18     matt #else
    183       1.18     matt #define	VM_MAXUSER_ADDRESS	VM_MAXUSER_ADDRESS32
    184       1.18     matt #endif
    185        1.1     matt #define	VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
    186       1.18     matt #ifdef _LP64
    187       1.18     matt #define	VM_MIN_KERNEL_ADDRESS	((vaddr_t) 0xffffffUL << 40) /* top 1TB */
    188       1.18     matt #define	VM_MAX_KERNEL_ADDRESS	((vaddr_t) -32768)
    189       1.18     matt #else
    190        1.1     matt #define	VM_MIN_KERNEL_ADDRESS	((vaddr_t) (KERNEL_SR << ADDR_SR_SHFT))
    191        1.1     matt #define	VM_MAX_KERNEL_ADDRESS	(VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH)
    192       1.18     matt #endif
    193        1.1     matt 
    194        1.1     matt #define	VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
    195        1.1     matt 
    196        1.1     matt #ifndef VM_PHYS_SIZE
    197        1.1     matt #define	VM_PHYS_SIZE		(USRIOSIZE * PAGE_SIZE)
    198        1.1     matt #endif
    199        1.1     matt 
    200        1.1     matt #endif /* _POWERPC_OEA_VMPARAM_H_ */
    201