param.h revision 1.8
11.8Sveego/*	$NetBSD: param.h,v 1.8 1997/06/10 07:54:42 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.8Sveego#define	UPAGES		3		/* pages of u-area */
581.1Schuck
591.8Sveego#include <m68k/param.h>
601.1Schuck
611.1Schuck#define	SEGSHIFT	22		/* LOG2(NBSEG) */
621.1Schuck#define NBSEG		(1 << SEGSHIFT)	/* bytes/segment */
631.1Schuck#define	SEGOFSET	(NBSEG-1)	/* byte offset into segment */
641.1Schuck
651.1Schuck/*
661.8Sveego * Size of kernel malloc arena in CLBYTES-sized logical pages
671.1Schuck */
681.1Schuck#ifndef NKMEMCLUSTERS
691.8Sveego# define	NKMEMCLUSTERS	(2048 * 1024 / CLBYTES)
701.1Schuck#endif
711.1Schuck
721.1Schuck/*
731.1Schuck * Mach derived conversion macros
741.1Schuck */
751.1Schuck#define m68k_round_page(x)	((((unsigned)(x)) + PGOFSET) & ~PGOFSET)
761.1Schuck#define m68k_trunc_page(x)	((unsigned)(x) & ~PGOFSET)
771.1Schuck#define m68k_btop(x)		((unsigned)(x) >> PGSHIFT)
781.1Schuck#define m68k_ptob(x)		((unsigned)(x) << PGSHIFT)
791.1Schuck
801.1Schuck/*
811.1Schuck * spl functions; all but spl0 are done in-line
821.1Schuck */
831.1Schuck#include <machine/psl.h>
841.1Schuck
851.1Schuck#define _spl(s) \
861.1Schuck({ \
871.1Schuck        register int _spl_r; \
881.1Schuck\
891.1Schuck        __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
901.1Schuck                "&=d" (_spl_r) : "di" (s)); \
911.1Schuck        _spl_r; \
921.1Schuck})
931.1Schuck
941.1Schuck/* spl0 requires checking for software interrupts */
951.1Schuck#define spl1()  _spl(PSL_S|PSL_IPL1)
961.1Schuck#define spl2()  _spl(PSL_S|PSL_IPL2)
971.1Schuck#define spl3()  _spl(PSL_S|PSL_IPL3)
981.1Schuck#define spl4()  _spl(PSL_S|PSL_IPL4)
991.1Schuck#define spl5()  _spl(PSL_S|PSL_IPL5)
1001.1Schuck#define spl6()  _spl(PSL_S|PSL_IPL6)
1011.1Schuck#define spl7()  _spl(PSL_S|PSL_IPL7)
1021.1Schuck
1031.1Schuck#define splsoftclock()  spl1()
1041.2Smycroft#define splsoftnet()    spl1()
1051.1Schuck#define splbio()        spl2()
1061.2Smycroft#define splnet()        spl3()
1071.2Smycroft#define spltty()        spl3()
1081.1Schuck#define splimp()        spl3()
1091.1Schuck#define splclock()      spl5()
1101.1Schuck#define splstatclock()	spl5()
1111.1Schuck#define splvm()         spl5()
1121.1Schuck#define splhigh()       spl7()
1131.1Schuck#define splsched()      spl7()
1141.1Schuck
1151.1Schuck/* watch out for side effects */
1161.1Schuck#define splx(s)         (s & PSL_IPL ? _spl(s) : spl0())
1171.1Schuck
1181.6Schuck#if defined(_KERNEL) && !defined(_LOCORE)
1191.6Schuckextern void _delay __P((unsigned));
1201.6Schuck#define delay(us)	_delay((us)<<8)
1211.6Schuck#define DELAY(n)	delay(n)
1221.6Schuck#endif	/* _KERNEL && !_LOCORE */
1231.8Sveego
1241.8Sveego#endif	/* !_MACHINE_PARAM_H_ */
125