vmparam.h revision 1.1
11.1Smatt/*-
21.1Smatt * Copyright (c) 2010 The NetBSD Foundation, Inc.
31.1Smatt * All rights reserved.
41.1Smatt *
51.1Smatt * This code is derived from software contributed to The NetBSD Foundation
61.1Smatt * by Matt Thomas of 3am Software Foundry, LLC.
71.1Smatt *
81.1Smatt * Redistribution and use in source and binary forms, with or without
91.1Smatt * modification, are permitted provided that the following conditions
101.1Smatt * are met:
111.1Smatt * 1. Redistributions of source code must retain the above copyright
121.1Smatt *    notice, this list of conditions and the following disclaimer.
131.1Smatt * 2. Redistributions in binary form must reproduce the above copyright
141.1Smatt *    notice, this list of conditions and the following disclaimer in the
151.1Smatt *    documentation and/or other materials provided with the distribution.
161.1Smatt *
171.1Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
181.1Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
191.1Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
201.1Smatt * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
211.1Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
221.1Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
231.1Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
241.1Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
251.1Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
261.1Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
271.1Smatt * POSSIBILITY OF SUCH DAMAGE.
281.1Smatt */
291.1Smatt
301.1Smatt#ifndef _POWERPC_BOOKE_VMPARAM_H_
311.1Smatt#define _POWERPC_BOOKE_VMPARAM_H_
321.1Smatt
331.1Smatt/*
341.1Smatt * Most of the definitions in this can be overriden by a machine-specific
351.1Smatt * vmparam.h if required.  Otherwise a port can just include this file
361.1Smatt * get the right thing to happen.
371.1Smatt */
381.1Smatt
391.1Smatt/*
401.1Smatt * BookE processors have 4K pages.  Override the PAGE_* definitions to be
411.1Smatt * compile-time constants.
421.1Smatt */
431.1Smatt#define	PAGE_SHIFT	12
441.1Smatt#define	PAGE_SIZE	(1 << PAGE_SHIFT)
451.1Smatt#define	PAGE_MASK	(PAGE_SIZE - 1)
461.1Smatt
471.1Smatt#ifndef	USRSTACK
481.1Smatt#define	USRSTACK	VM_MAXUSER_ADDRESS
491.1Smatt#endif
501.1Smatt
511.1Smatt#ifndef	MAXTSIZ
521.1Smatt#define	MAXTSIZ		(2*256*1024*1024)	/* maximum text size */
531.1Smatt#endif
541.1Smatt
551.1Smatt#ifndef	MAXDSIZ
561.1Smatt#define	MAXDSIZ		(13*256*1024*1024)	/* maximum data size */
571.1Smatt#endif
581.1Smatt
591.1Smatt#ifndef	MAXSSIZ
601.1Smatt#define	MAXSSIZ		(1*256*1024*1024-PAGE_SIZE) /* maximum stack size */
611.1Smatt#endif
621.1Smatt
631.1Smatt#ifndef	DFLDSIZ
641.1Smatt#define	DFLDSIZ		(256*1024*1024)		/* default data size */
651.1Smatt#endif
661.1Smatt
671.1Smatt#ifndef	DFLSSIZ
681.1Smatt#define	DFLSSIZ		(2*1024*1024)		/* default stack size */
691.1Smatt#endif
701.1Smatt
711.1Smatt/*
721.1Smatt * Default number of pages in the user raw I/O map.
731.1Smatt */
741.1Smatt#ifndef USRIOSIZE
751.1Smatt#define	USRIOSIZE	1024
761.1Smatt#endif
771.1Smatt
781.1Smatt/*
791.1Smatt * The number of seconds for a process to be blocked before being
801.1Smatt * considered very swappable.
811.1Smatt */
821.1Smatt#ifndef MAXSLP
831.1Smatt#define	MAXSLP		20
841.1Smatt#endif
851.1Smatt
861.1Smatt/*
871.1Smatt * Some system constants
881.1Smatt */
891.1Smatt
901.1Smatt#define	VM_MIN_ADDRESS		((vaddr_t) 0)
911.1Smatt#define	VM_MAXUSER_ADDRESS	((vaddr_t) -PAGE_SIZE)
921.1Smatt#define	VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
931.1Smatt#define	VM_MIN_KERNEL_ADDRESS	((vaddr_t) 0xe4000000)
941.1Smatt#define	VM_MAX_KERNEL_ADDRESS	((vaddr_t) 0xfefff000)
951.1Smatt
961.1Smatt/*
971.1Smatt * The address to which unspecified mapping requests default
981.1Smatt * Put the stack in it's own segment and start mmaping at the
991.1Smatt * top of the next lower segment.
1001.1Smatt */
1011.1Smatt#ifdef _KERNEL_OPT
1021.1Smatt#include "opt_uvm.h"
1031.1Smatt#endif
1041.1Smatt#define	__USE_TOPDOWN_VM
1051.1Smatt#define	VM_DEFAULT_ADDRESS(da, sz) \
1061.1Smatt	(((VM_MAXUSER_ADDRESS - MAXSSIZ) - round_page(sz))
1071.1Smatt
1081.1Smatt#ifndef VM_PHYSSEG_MAX
1091.1Smatt#define	VM_PHYSSEG_MAX		16
1101.1Smatt#endif
1111.1Smatt#define	VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
1121.1Smatt#define	VM_PHYSSEG_NOADD
1131.1Smatt
1141.1Smatt#ifndef VM_PHYS_SIZE
1151.1Smatt#define	VM_PHYS_SIZE		(USRIOSIZE * PAGE_SIZE)
1161.1Smatt#endif
1171.1Smatt
1181.1Smatt#define	VM_NFREELIST		2	/* 16 distinct memory segments */
1191.1Smatt#define	VM_FREELIST_DEFAULT	0
1201.1Smatt#define	VM_FREELIST_FIRST16	1
1211.1Smatt#define	VM_FREELIST_MAX		2
1221.1Smatt
1231.1Smatt#ifndef _LOCORE
1241.1Smatt
1251.1Smatt#define	__HAVE_VM_PAGE_MD
1261.1Smatt
1271.1Smattstruct pv_entry {
1281.1Smatt	struct pv_entry *pv_next;
1291.1Smatt	struct pmap *pv_pmap;
1301.1Smatt	vaddr_t pv_va;
1311.1Smatt};
1321.1Smatt
1331.1Smattstruct vm_page_md {
1341.1Smatt	struct pv_entry mdpg_pvlist;
1351.1Smatt	unsigned int mdpg_attrs;
1361.1Smatt};
1371.1Smatt
1381.1Smatt#define	VM_MDPAGE_INIT(pg) do {				\
1391.1Smatt	(pg)->mdpage.mdpg_pvlist.pv_next = NULL;	\
1401.1Smatt	(pg)->mdpage.mdpg_pvlist.pv_pmap = NULL;	\
1411.1Smatt	(pg)->mdpage.mdpg_pvlist.pv_va = 0;		\
1421.1Smatt	(pg)->mdpage.mdpg_attrs = 0;			\
1431.1Smatt} while (/*CONSTCOND*/0)
1441.1Smatt
1451.1Smatt#endif	/* _LOCORE */
1461.1Smatt
1471.1Smatt#endif /* _POWERPC_BOOKE_VMPARAM_H_ */
148