param.h revision 1.1
11.1Sws/*	$NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $	*/
21.1Sws
31.1Sws/*-
41.1Sws * Copyright (C) 1995, 1996 Wolfgang Solfrank.
51.1Sws * Copyright (C) 1995, 1996 TooLs GmbH.
61.1Sws * All rights reserved.
71.1Sws *
81.1Sws * Redistribution and use in source and binary forms, with or without
91.1Sws * modification, are permitted provided that the following conditions
101.1Sws * are met:
111.1Sws * 1. Redistributions of source code must retain the above copyright
121.1Sws *    notice, this list of conditions and the following disclaimer.
131.1Sws * 2. Redistributions in binary form must reproduce the above copyright
141.1Sws *    notice, this list of conditions and the following disclaimer in the
151.1Sws *    documentation and/or other materials provided with the distribution.
161.1Sws * 3. All advertising materials mentioning features or use of this software
171.1Sws *    must display the following acknowledgement:
181.1Sws *	This product includes software developed by TooLs GmbH.
191.1Sws * 4. The name of TooLs GmbH may not be used to endorse or promote products
201.1Sws *    derived from this software without specific prior written permission.
211.1Sws *
221.1Sws * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
231.1Sws * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
241.1Sws * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
251.1Sws * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
261.1Sws * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
271.1Sws * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
281.1Sws * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
291.1Sws * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
301.1Sws * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
311.1Sws * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
321.1Sws */
331.1Sws
341.1Sws#ifdef	_KERNEL
351.1Sws#ifndef	_LOCORE
361.1Sws#include <machine/cpu.h>
371.1Sws#endif	/* _LOCORE */
381.1Sws#endif
391.1Sws
401.1Sws/*
411.1Sws * Machine dependent constants for PowerPC (32-bit only currently)
421.1Sws */
431.1Sws#define	MACHINE		"powerpc"
441.1Sws#define	MACHINE_ARCH	"powerpc"
451.1Sws#define	MID_MACHINE	MID_POWERPC
461.1Sws
471.1Sws#define	ALIGNBYTES	(sizeof(double) - 1)
481.1Sws#define	ALIGN(p)	(((u_int)(p) + ALIGNBYTES) & ~ALIGNBYTES)
491.1Sws
501.1Sws#define	PGSHIFT		12
511.1Sws#define	NBPG		(1 << PGSHIFT)	/* Page size */
521.1Sws#define	PGOFSET		(NBPG - 1)
531.1Sws
541.1Sws#define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
551.1Sws#define	DEV_BSIZE	(1 << DEV_BSHIFT)
561.1Sws#define	BLKDEV_IOSIZE	NBPG
571.1Sws#define	MAXPHYS		(64 * 1024)	/* max raw I/O transfer size */
581.1Sws
591.1Sws#define	CLSIZELOG2	0
601.1Sws#define	CLSIZE		(1 << CLSIZELOG2)
611.1Sws
621.1Sws#define	UPAGES		4
631.1Sws#define	USPACE		(UPAGES * NBPG)
641.1Sws
651.1Sws#define	KERNBASE	0x100000
661.1Sws
671.1Sws/*
681.1Sws * Constants related to network buffer management.
691.1Sws * MCLBYTES must be no larger than CLBYTES (the software page size), and,
701.1Sws * on machines that exchange pages of input or output buffers with mbuf
711.1Sws * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
721.1Sws * of the hardware page size.
731.1Sws */
741.1Sws#define	MSIZE		128		/* size of an mbuf */
751.1Sws#define	MCLSHIFT	11		/* convert bytes to m_buf clusters */
761.1Sws#define	MCLBYTES	(1 << MCLSHIFT)	/* size of a m_buf cluster */
771.1Sws
781.1Sws#ifndef NMBCLUSTERS
791.1Sws#ifdef GATEWAY
801.1Sws#define	NMBCLUSTERS	512		/* map size, max cluster allocation */
811.1Sws#else
821.1Sws#define	NMBCLUSTERS	256		/* map size, max cluster allocation */
831.1Sws#endif
841.1Sws#endif
851.1Sws
861.1Sws/*
871.1Sws * Size of kernel malloc arena in CLBYTES-sized logical pages.
881.1Sws */
891.1Sws#ifndef	NKMEMCLUSTERS
901.1Sws#define	NKMEMCLUSTERS	(128 * 1024 * 1024 / CLBYTES)
911.1Sws#endif
921.1Sws
931.1Sws/*
941.1Sws * pages ("clicks") to disk blocks
951.1Sws */
961.1Sws#define	ctod(x)		((x) << (PGSHIFT - DEV_BSHIFT))
971.1Sws#define	dtoc(x)		((x) >> (PGSHIFT - DEV_BSHIFT))
981.1Sws/*
991.1Sws * bytes to pages
1001.1Sws */
1011.1Sws#define	ctob(x)		((x) << PGSHIFT)
1021.1Sws#define	btoc(x)		(((x) + PGOFSET) >> PGSHIFT)
1031.1Sws
1041.1Sws/*
1051.1Sws * bytes to disk blocks
1061.1Sws */
1071.1Sws#define	dbtob(x)	((x) << DEV_BSHIFT)
1081.1Sws#define	btodb(x)	((x) >> DEV_BSHIFT)
1091.1Sws
1101.1Sws/*
1111.1Sws * Segment handling stuff
1121.1Sws */
1131.1Sws#define	SEGMENT_LENGTH	0x10000000
1141.1Sws#define	SEGMENT_MASK	0xf0000000
1151.1Sws
1161.1Sws/*
1171.1Sws * Fixed segments
1181.1Sws */
1191.1Sws#define	USER_SR		13
1201.1Sws#define	KERNEL_SR	14
1211.1Sws#define	KERNEL_SEGMENT	(0xfffff0 + KERNEL_SR)
1221.1Sws#define	EMPTY_SEGMENT	0xfffff0
1231.1Sws#define	USER_ADDR	((void *)(USER_SR << ADDR_SR_SHFT))
1241.1Sws
1251.1Sws/*
1261.1Sws * Some system constants
1271.1Sws */
1281.1Sws#ifndef	HTABENTS
1291.1Sws#define	HTABENTS	1024	/* Number of hashslots in HTAB */
1301.1Sws#endif
1311.1Sws#ifndef	NPMAPS
1321.1Sws#define	NPMAPS		32768	/* Number of pmaps in system */
1331.1Sws#endif
1341.1Sws
1351.1Sws/*
1361.1Sws * Temporary kludge till we do (ov)bcopy in assembler
1371.1Sws */
1381.1Sws#define	ovbcopy	bcopy
139