param.h revision 1.11
11.11Ssoda/*	$NetBSD: param.h,v 1.11 2000/01/23 21:01:57 soda Exp $	*/
21.11Ssoda/*      $OpenBSD: param.h,v 1.9 1997/04/30 09:54:15 niklas Exp $ */
31.2Sthorpej
41.1Sjonathan/*
51.1Sjonathan * Copyright (c) 1988 University of Utah.
61.1Sjonathan * Copyright (c) 1992, 1993
71.1Sjonathan *	The Regents of the University of California.  All rights reserved.
81.1Sjonathan *
91.1Sjonathan * This code is derived from software contributed to Berkeley by
101.1Sjonathan * the Systems Programming Group of the University of Utah Computer
111.1Sjonathan * Science Department and Ralph Campbell.
121.1Sjonathan *
131.1Sjonathan * Redistribution and use in source and binary forms, with or without
141.1Sjonathan * modification, are permitted provided that the following conditions
151.1Sjonathan * are met:
161.1Sjonathan * 1. Redistributions of source code must retain the above copyright
171.1Sjonathan *    notice, this list of conditions and the following disclaimer.
181.1Sjonathan * 2. Redistributions in binary form must reproduce the above copyright
191.1Sjonathan *    notice, this list of conditions and the following disclaimer in the
201.1Sjonathan *    documentation and/or other materials provided with the distribution.
211.1Sjonathan * 3. All advertising materials mentioning features or use of this software
221.1Sjonathan *    must display the following acknowledgement:
231.1Sjonathan *	This product includes software developed by the University of
241.1Sjonathan *	California, Berkeley and its contributors.
251.1Sjonathan * 4. Neither the name of the University nor the names of its contributors
261.1Sjonathan *    may be used to endorse or promote products derived from this software
271.1Sjonathan *    without specific prior written permission.
281.1Sjonathan *
291.1Sjonathan * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
301.1Sjonathan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
311.1Sjonathan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
321.1Sjonathan * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
331.1Sjonathan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
341.1Sjonathan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
351.1Sjonathan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
361.1Sjonathan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
371.1Sjonathan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
381.1Sjonathan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
391.1Sjonathan * SUCH DAMAGE.
401.1Sjonathan *
411.11Ssoda *	from: Utah Hdr: machparam.h 1.11 89/08/14
421.1Sjonathan *	from: @(#)param.h	8.1 (Berkeley) 6/10/93
431.1Sjonathan */
441.1Sjonathan
451.11Ssoda#ifndef _ARC_PARAM_H_
461.11Ssoda#define _ARC_PARAM_H_
471.11Ssoda
481.1Sjonathan/*
491.3Sjonathan * Machine-dependent constants (VM, etc) common across MIPS cpus
501.3Sjonathan */
511.3Sjonathan#include <mips/mips_param.h>
521.3Sjonathan
531.3Sjonathan/*
541.11Ssoda * Machine dependent constants for ARC BIOS MIPS machines:
551.11Ssoda *	Acer Labs PICA_61
561.11Ssoda *	Deskstation rPC44
571.11Ssoda *	Deskstation Tyne
581.11Ssoda *	Etc
591.11Ssoda */
601.11Ssoda#define	_MACHINE	arc
611.11Ssoda#define	MACHINE		"arc"
621.11Ssoda#define MACHINE_ARCH	"mips"
631.11Ssoda#define MID_MACHINE	MID_PMAX	/* XXX Bogus, but needed for now... */
641.1Sjonathan
651.1Sjonathan#define	KERNBASE	0x80000000	/* start of kernel virtual */
661.1Sjonathan#define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
671.1Sjonathan
681.1Sjonathan#define	DEV_BSIZE	512
691.1Sjonathan#define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
701.1Sjonathan#define BLKDEV_IOSIZE	2048
711.11Ssoda/* XXX Maxphys temporary changed to 32K while SCSI driver is fixed. */
721.11Ssoda#define	MAXPHYS		(32 * 1024)	/* max raw I/O transfer size */
731.1Sjonathan
741.1Sjonathan#define	SSIZE		1		/* initial stack size/NBPG */
751.1Sjonathan#define	SINCR		1		/* increment of stack/NBPG */
761.1Sjonathan
771.1Sjonathan#define	UPAGES		2		/* pages of u-area */
781.11Ssoda#if defined(_LOCORE) && defined(notyet)
791.11Ssoda#define	UADDR		0xffffffffffffc000	/* address of u */
801.11Ssoda#else
811.1Sjonathan#define	UADDR		0xffffc000	/* address of u */
821.11Ssoda#endif
831.1Sjonathan#define USPACE		(UPAGES*NBPG)	/* size of u-area in bytes */
841.1Sjonathan#define	UVPN		(UADDR>>PGSHIFT)/* virtual page number of u */
851.1Sjonathan#define	KERNELSTACK	(UADDR+UPAGES*NBPG)	/* top of kernel stack */
861.1Sjonathan
871.1Sjonathan/*
881.1Sjonathan * Constants related to network buffer management.
891.1Sjonathan * MCLBYTES must be no larger than CLBYTES (the software page size), and,
901.1Sjonathan * on machines that exchange pages of input or output buffers with mbuf
911.1Sjonathan * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
921.1Sjonathan * of the hardware page size.
931.1Sjonathan */
941.1Sjonathan#define	MSIZE		128		/* size of an mbuf */
951.11Ssoda#define	MCLSHIFT	11
961.11Ssoda#define	MCLBYTES	(1 << MCLSHIFT)	/* enough for whole Ethernet packet */
971.1Sjonathan#define	MCLOFSET	(MCLBYTES - 1)
981.1Sjonathan#ifndef NMBCLUSTERS
991.8Sthorpej
1001.8Sthorpej#if defined(_KERNEL) && !defined(_LKM)
1011.8Sthorpej#include "opt_gateway.h"
1021.8Sthorpej#endif /* _KERNEL && ! _LKM */
1031.8Sthorpej
1041.1Sjonathan#ifdef GATEWAY
1051.1Sjonathan#define	NMBCLUSTERS	2048		/* map size, max cluster allocation */
1061.1Sjonathan#else
1071.1Sjonathan#define	NMBCLUSTERS	1024		/* map size, max cluster allocation */
1081.1Sjonathan#endif
1091.1Sjonathan#endif
1101.1Sjonathan
1111.1Sjonathan/*
1121.9Sragge * Size of kernel malloc arena in NBPG-sized logical pages
1131.11Ssoda *	XXX - different from <mips/include/mips_param.h>
1141.11Ssoda */
1151.1Sjonathan#ifndef NKMEMCLUSTERS
1161.11Ssoda#define	NKMEMCLUSTERS	(4096*1024/NBPG)
1171.1Sjonathan#endif
1181.1Sjonathan
1191.1Sjonathan/* bytes to disk blocks */
1201.1Sjonathan#define	btodb(x)	((x) >> DEV_BSHIFT)
1211.1Sjonathan#define dbtob(x)	((x) << DEV_BSHIFT)
1221.1Sjonathan
1231.11Ssoda#include <machine/intr.h>
1241.1Sjonathan
1251.1Sjonathan#ifdef _KERNEL
1261.3Sjonathan#ifndef _LOCORE
1271.11Ssoda
1281.11Ssodaextern int cpuspeed;
1291.11Ssodaextern void delay __P((int n));
1301.11Ssoda
1311.11Ssoda#if 0 /* XXX: should use mips_mcclock.c */
1321.11Ssoda#define	DELAY(n)	{ register int N = cpuspeed * (n); while (--N > 0); }
1331.11Ssoda#else
1341.1Sjonathan/*
1351.1Sjonathan *   Delay is based on an assumtion that each time in the loop
1361.1Sjonathan *   takes 3 clocks. Three is for branch and subtract in the delay slot.
1371.1Sjonathan */
1381.1Sjonathan#define	DELAY(n)	{ register int N = cpuspeed * (n); while ((N -= 3) > 0); }
1391.11Ssoda#endif
1401.11Ssoda
1411.11Ssoda#endif /* _LOCORE */
1421.11Ssoda#endif /* _KERNEL */
1431.1Sjonathan
1441.11Ssoda#endif /* _ARC_PARAM_H_ */
145