param.h revision 1.1
11.1Sdrochner/*	$NetBSD: param.h,v 1.1 2001/05/14 18:23:13 drochner Exp $	*/
21.1Sdrochner
31.1Sdrochner/*
41.1Sdrochner * Copyright (c) 1988 University of Utah.
51.1Sdrochner * Copyright (c) 1982, 1986, 1990, 1993
61.1Sdrochner *	The Regents of the University of California.  All rights reserved.
71.1Sdrochner *
81.1Sdrochner * This code is derived from software contributed to Berkeley by
91.1Sdrochner * the Systems Programming Group of the University of Utah Computer
101.1Sdrochner * Science Department.
111.1Sdrochner *
121.1Sdrochner * Redistribution and use in source and binary forms, with or without
131.1Sdrochner * modification, are permitted provided that the following conditions
141.1Sdrochner * are met:
151.1Sdrochner * 1. Redistributions of source code must retain the above copyright
161.1Sdrochner *    notice, this list of conditions and the following disclaimer.
171.1Sdrochner * 2. Redistributions in binary form must reproduce the above copyright
181.1Sdrochner *    notice, this list of conditions and the following disclaimer in the
191.1Sdrochner *    documentation and/or other materials provided with the distribution.
201.1Sdrochner * 3. All advertising materials mentioning features or use of this software
211.1Sdrochner *    must display the following acknowledgement:
221.1Sdrochner *	This product includes software developed by the University of
231.1Sdrochner *	California, Berkeley and its contributors.
241.1Sdrochner * 4. Neither the name of the University nor the names of its contributors
251.1Sdrochner *    may be used to endorse or promote products derived from this software
261.1Sdrochner *    without specific prior written permission.
271.1Sdrochner *
281.1Sdrochner * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
291.1Sdrochner * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
301.1Sdrochner * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
311.1Sdrochner * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
321.1Sdrochner * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
331.1Sdrochner * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
341.1Sdrochner * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
351.1Sdrochner * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
361.1Sdrochner * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
371.1Sdrochner * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
381.1Sdrochner * SUCH DAMAGE.
391.1Sdrochner *
401.1Sdrochner * from: Utah $Hdr: machparam.h 1.16 92/12/20$
411.1Sdrochner *
421.1Sdrochner *	@(#)param.h	8.1 (Berkeley) 6/10/93
431.1Sdrochner */
441.1Sdrochner
451.1Sdrochner/*
461.1Sdrochner * Machine dependent constants for CES FIC8234.
471.1Sdrochner */
481.1Sdrochner#define	_MACHINE	cesfic
491.1Sdrochner#define	MACHINE		"cesfic"
501.1Sdrochner
511.1Sdrochner/*
521.1Sdrochner * Round p (pointer or byte index) up to a correctly-aligned value for all
531.1Sdrochner * data types (int, long, ...).   The result is u_int and must be cast to
541.1Sdrochner * any desired pointer type.
551.1Sdrochner *
561.1Sdrochner * ALIGNED_POINTER is a boolean macro that checks whether an address
571.1Sdrochner * is valid to fetch data elements of type t from on this architecture.
581.1Sdrochner * This does not reflect the optimal alignment, just the possibility
591.1Sdrochner * (within reasonable limits).
601.1Sdrochner *
611.1Sdrochner */
621.1Sdrochner
631.1Sdrochner#define	PGSHIFT		12		/* LOG2(NBPG) */
641.1Sdrochner#define	NPTEPG		(NBPG/(sizeof (pt_entry_t)))
651.1Sdrochner
661.1Sdrochner#define	SEGSHIFT	22		/* LOG2(NBSEG) */
671.1Sdrochner#define NBSEG		(1 << SEGSHIFT)	/* bytes/segment */
681.1Sdrochner#define	SEGOFSET	(NBSEG-1)	/* byte offset into segment */
691.1Sdrochner
701.1Sdrochner#define	KERNBASE	0x00002000	/* start of kernel virtual */
711.1Sdrochner
721.1Sdrochner/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
731.1Sdrochner#define	UPAGES		2		/* pages of u-area */
741.1Sdrochner
751.1Sdrochner#include <m68k/param.h>
761.1Sdrochner
771.1Sdrochner/*
781.1Sdrochner * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
791.1Sdrochner * logical pages.
801.1Sdrochner */
811.1Sdrochner#define	NKMEMPAGES_MIN_DEFAULT	((3 * 1024 * 1024) >> PAGE_SHIFT)
821.1Sdrochner#define	NKMEMPAGES_MAX_DEFAULT	((3 * 1024 * 1024) >> PAGE_SHIFT)
831.1Sdrochner
841.1Sdrochner/*
851.1Sdrochner * spl functions; all but spl0 are done in-line
861.1Sdrochner */
871.1Sdrochner#include <machine/psl.h>
881.1Sdrochner
891.1Sdrochner/* spl0 requires checking for software interrupts */
901.1Sdrochner#define spl1()  _spl(PSL_S|PSL_IPL1)
911.1Sdrochner#define spl2()  _spl(PSL_S|PSL_IPL2)
921.1Sdrochner#define spl3()  _spl(PSL_S|PSL_IPL3)
931.1Sdrochner#define spl4()  _spl(PSL_S|PSL_IPL4)
941.1Sdrochner#define spl5()  _spl(PSL_S|PSL_IPL5)
951.1Sdrochner#define spl6()  _spl(PSL_S|PSL_IPL6)
961.1Sdrochner#define spl7()  _spl(PSL_S|PSL_IPL7)
971.1Sdrochner
981.1Sdrochner#if defined(_KERNEL) && !defined(_LOCORE)
991.1Sdrochner/*
1001.1Sdrochner * These four globals contain the appropriate PSL_S|PSL_IPL? values
1011.1Sdrochner * to raise interrupt priority to the requested level.
1021.1Sdrochner */
1031.1Sdrochnerextern	unsigned short cesfic_bioipl;
1041.1Sdrochnerextern	unsigned short cesfic_netipl;
1051.1Sdrochnerextern	unsigned short cesfic_ttyipl;
1061.1Sdrochnerextern	unsigned short cesfic_impipl;
1071.1Sdrochner#endif /* _KERNEL && !_LOCORE */
1081.1Sdrochner
1091.1Sdrochner/* These spl calls are _not_ to be used by machine-independent code. */
1101.1Sdrochner#define splhil()	_splraise(PSL_S|PSL_IPL1)
1111.1Sdrochner#define splkbd()	splhil()
1121.1Sdrochner
1131.1Sdrochner/* These spl calls are used by machine-independent code. */
1141.1Sdrochner#define	spllowersoftclock() spl1()
1151.1Sdrochner#define	splsoft()	splraise1()
1161.1Sdrochner#define splsoftclock()	splsoft()
1171.1Sdrochner#define splsoftnet()	splsoft()
1181.1Sdrochner#define splbio()	_splraise(cesfic_bioipl)
1191.1Sdrochner#define splnet()	_splraise(cesfic_netipl)
1201.1Sdrochner#define spltty()	_splraise(cesfic_ttyipl)
1211.1Sdrochner#define splimp()	_splraise(cesfic_impipl)
1221.1Sdrochner#define splclock()	spl6()
1231.1Sdrochner#define splstatclock()	spl6()
1241.1Sdrochner#define splvm()		spl6()
1251.1Sdrochner#define splhigh()	spl7()
1261.1Sdrochner#define splsched()	spl7()
1271.1Sdrochner#define spllock()	spl7()
1281.1Sdrochner
1291.1Sdrochner/* watch out for side effects */
1301.1Sdrochner#define splx(s)         (s & PSL_IPL ? _spl(s) : spl0())
1311.1Sdrochner
1321.1Sdrochner#if defined(_KERNEL) && !defined(_LOCORE)
1331.1Sdrochner#define	delay(us)	_delay((us) << 8)
1341.1Sdrochner#define DELAY(us)	delay(us)
1351.1Sdrochner
1361.1Sdrochnerint	spl0 __P((void));
1371.1Sdrochnervoid	_delay __P((u_int));
1381.1Sdrochner#endif /* _KERNEL && !_LOCORE */
1391.1Sdrochner
140