param.h revision 1.10
11.10Sveego/*	$NetBSD: param.h,v 1.10 1997/07/10 08:23:04 veego Exp $	*/
21.1Schuck
31.1Schuck/*
41.1Schuck * Copyright (c) 1988 University of Utah.
51.1Schuck * Copyright (c) 1982, 1986, 1990, 1993
61.1Schuck *	The Regents of the University of California.  All rights reserved.
71.1Schuck *
81.1Schuck * This code is derived from software contributed to Berkeley by
91.1Schuck * the Systems Programming Group of the University of Utah Computer
101.1Schuck * Science Department.
111.1Schuck *
121.1Schuck * Redistribution and use in source and binary forms, with or without
131.1Schuck * modification, are permitted provided that the following conditions
141.1Schuck * are met:
151.1Schuck * 1. Redistributions of source code must retain the above copyright
161.1Schuck *    notice, this list of conditions and the following disclaimer.
171.1Schuck * 2. Redistributions in binary form must reproduce the above copyright
181.1Schuck *    notice, this list of conditions and the following disclaimer in the
191.1Schuck *    documentation and/or other materials provided with the distribution.
201.1Schuck * 3. All advertising materials mentioning features or use of this software
211.1Schuck *    must display the following acknowledgement:
221.1Schuck *	This product includes software developed by the University of
231.1Schuck *	California, Berkeley and its contributors.
241.1Schuck * 4. Neither the name of the University nor the names of its contributors
251.1Schuck *    may be used to endorse or promote products derived from this software
261.1Schuck *    without specific prior written permission.
271.1Schuck *
281.1Schuck * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
291.1Schuck * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
301.1Schuck * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
311.1Schuck * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
321.1Schuck * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
331.1Schuck * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
341.1Schuck * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
351.1Schuck * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
361.1Schuck * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
371.1Schuck * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
381.1Schuck * SUCH DAMAGE.
391.1Schuck *
401.1Schuck * from: Utah $Hdr: machparam.h 1.16 92/12/20$
411.1Schuck *
421.1Schuck *	@(#)param.h	8.1 (Berkeley) 6/10/93
431.1Schuck */
441.1Schuck
451.8Sveego#ifndef	_MACHINE_PARAM_H_
461.8Sveego#define	_MACHINE_PARAM_H_
471.8Sveego
481.1Schuck/*
491.1Schuck * Machine dependent constants for mvme68k, based on HP9000 series 300.
501.1Schuck */
511.5Scgd#define	_MACHINE 	mvme68k
521.4Scgd#define	MACHINE		"mvme68k"
531.1Schuck
541.8Sveego#define	PGSHIFT		12		/* LOG2(NBPG) */
551.8Sveego#define	KERNBASE	0x00000000	/* start of kernel virtual */
561.8Sveego
571.9Sveego#define	SEGSHIFT	22		/* LOG2(NBSEG) */
581.9Sveego#define NBSEG		(1 << SEGSHIFT)	/* bytes/segment */
591.9Sveego#define	SEGOFSET	(NBSEG-1)	/* byte offset into segment */
601.9Sveego
611.8Sveego#define	UPAGES		3		/* pages of u-area */
621.1Schuck
631.8Sveego#include <m68k/param.h>
641.10Sveego
651.10Sveego#define	NPTEPG		(NBPG/(sizeof (pt_entry_t)))
661.1Schuck
671.1Schuck/*
681.8Sveego * Size of kernel malloc arena in CLBYTES-sized logical pages
691.1Schuck */
701.1Schuck#ifndef NKMEMCLUSTERS
711.8Sveego# define	NKMEMCLUSTERS	(2048 * 1024 / CLBYTES)
721.1Schuck#endif
731.1Schuck
741.1Schuck/*
751.1Schuck * spl functions; all but spl0 are done in-line
761.1Schuck */
771.1Schuck#include <machine/psl.h>
781.1Schuck
791.1Schuck#define _spl(s) \
801.1Schuck({ \
811.1Schuck        register int _spl_r; \
821.1Schuck\
831.1Schuck        __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
841.1Schuck                "&=d" (_spl_r) : "di" (s)); \
851.1Schuck        _spl_r; \
861.1Schuck})
871.1Schuck
881.1Schuck/* spl0 requires checking for software interrupts */
891.1Schuck#define spl1()  _spl(PSL_S|PSL_IPL1)
901.1Schuck#define spl2()  _spl(PSL_S|PSL_IPL2)
911.1Schuck#define spl3()  _spl(PSL_S|PSL_IPL3)
921.1Schuck#define spl4()  _spl(PSL_S|PSL_IPL4)
931.1Schuck#define spl5()  _spl(PSL_S|PSL_IPL5)
941.1Schuck#define spl6()  _spl(PSL_S|PSL_IPL6)
951.1Schuck#define spl7()  _spl(PSL_S|PSL_IPL7)
961.1Schuck
971.1Schuck#define splsoftclock()  spl1()
981.2Smycroft#define splsoftnet()    spl1()
991.1Schuck#define splbio()        spl2()
1001.2Smycroft#define splnet()        spl3()
1011.2Smycroft#define spltty()        spl3()
1021.1Schuck#define splimp()        spl3()
1031.1Schuck#define splclock()      spl5()
1041.1Schuck#define splstatclock()	spl5()
1051.1Schuck#define splvm()         spl5()
1061.1Schuck#define splhigh()       spl7()
1071.1Schuck#define splsched()      spl7()
1081.1Schuck
1091.1Schuck/* watch out for side effects */
1101.1Schuck#define splx(s)         (s & PSL_IPL ? _spl(s) : spl0())
1111.1Schuck
1121.6Schuck#if defined(_KERNEL) && !defined(_LOCORE)
1131.6Schuckextern void _delay __P((unsigned));
1141.6Schuck#define delay(us)	_delay((us)<<8)
1151.6Schuck#define DELAY(n)	delay(n)
1161.6Schuck#endif	/* _KERNEL && !_LOCORE */
1171.8Sveego
1181.8Sveego#endif	/* !_MACHINE_PARAM_H_ */
119