psl.h revision 1.19
11.19Smatt/*	$NetBSD: psl.h,v 1.19 2012/07/27 05:36:09 matt Exp $	*/
21.1Sreinoud
31.1Sreinoud/*
41.1Sreinoud * Copyright (c) 1995 Mark Brinicombe.
51.1Sreinoud * All rights reserved.
61.1Sreinoud *
71.1Sreinoud * Redistribution and use in source and binary forms, with or without
81.1Sreinoud * modification, are permitted provided that the following conditions
91.1Sreinoud * are met:
101.1Sreinoud * 1. Redistributions of source code must retain the above copyright
111.1Sreinoud *    notice, this list of conditions and the following disclaimer.
121.1Sreinoud * 2. Redistributions in binary form must reproduce the above copyright
131.1Sreinoud *    notice, this list of conditions and the following disclaimer in the
141.1Sreinoud *    documentation and/or other materials provided with the distribution.
151.1Sreinoud * 3. All advertising materials mentioning features or use of this software
161.1Sreinoud *    must display the following acknowledgement:
171.1Sreinoud *	This product includes software developed by Mark Brinicombe
181.1Sreinoud *	for the NetBSD Project.
191.1Sreinoud * 4. The name of the company nor the name of the author may be used to
201.1Sreinoud *    endorse or promote products derived from this software without specific
211.1Sreinoud *    prior written permission.
221.1Sreinoud *
231.1Sreinoud * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
241.1Sreinoud * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
251.1Sreinoud * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
261.1Sreinoud * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
271.1Sreinoud * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
281.1Sreinoud * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
291.1Sreinoud * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
301.1Sreinoud * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
311.1Sreinoud * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
321.1Sreinoud * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
331.1Sreinoud * SUCH DAMAGE.
341.1Sreinoud *
351.1Sreinoud * RiscBSD kernel project
361.1Sreinoud *
371.1Sreinoud * psl.h
381.1Sreinoud *
391.1Sreinoud * spl prototypes.
401.1Sreinoud * Eventually this will become a set of defines.
411.1Sreinoud *
421.1Sreinoud * Created      : 21/07/95
431.1Sreinoud */
441.1Sreinoud
451.4Sbjh21#ifndef _ARM_PSL_H_
461.4Sbjh21#define _ARM_PSL_H_
471.1Sreinoud#include <machine/intr.h>
481.1Sreinoud
491.1Sreinoud/*
501.1Sreinoud * These are the different SPL states
511.1Sreinoud *
521.1Sreinoud * Each state has an interrupt mask associated with it which
531.1Sreinoud * indicate which interrupts are allowed.
541.1Sreinoud */
551.1Sreinoud
561.16Smatt#define spl0()		splx(IPL_NONE)
571.16Smatt#define splsoftclock()	raisespl(IPL_SOFTCLOCK)
581.16Smatt#define splsoftbio()	raisespl(IPL_SOFTBIO)
591.16Smatt#define splsoftnet()	raisespl(IPL_SOFTNET)
601.16Smatt#define splsoftserial()	raisespl(IPL_SOFTSERIAL)
611.16Smatt#define splvm()		raisespl(IPL_VM)
621.16Smatt#define splsched()	raisespl(IPL_SCHED)
631.16Smatt#define splhigh()	raisespl(IPL_HIGH)
641.1Sreinoud
651.19Smatt#define	IPL_SAFEPRI	IPL_NONE		/* for kern_sleepq.c */
661.19Smatt
671.1Sreinoud#ifdef _KERNEL
681.1Sreinoud#ifndef _LOCORE
691.15Smattint raisespl	(int);
701.15Smattint lowerspl	(int);
711.18Snonakavoid splx	(int);
721.1Sreinoud
731.15Smatt#ifdef __HAVE_FAST_SOFTINTS
741.8Smattvoid _setsoftintr	(int si);
751.15Smatt#endif
761.1Sreinoud
771.10Sthorpejtypedef uint8_t ipl_t;
781.7Syamttypedef struct {
791.16Smatt	uint8_t _ipl;
801.7Syamt} ipl_cookie_t;
811.7Syamt
821.7Syamtstatic inline ipl_cookie_t
831.7Syamtmakeiplcookie(ipl_t ipl)
841.7Syamt{
851.7Syamt
861.16Smatt	return (ipl_cookie_t){._ipl = (uint8_t)ipl};
871.7Syamt}
881.7Syamt
891.7Syamtstatic inline int
901.7Syamtsplraiseipl(ipl_cookie_t icookie)
911.7Syamt{
921.7Syamt
931.16Smatt	return raisespl(icookie._ipl);
941.7Syamt}
951.1Sreinoud#endif /* _LOCORE */
961.1Sreinoud#endif /* _KERNEL */
971.1Sreinoud
981.4Sbjh21#endif /* _ARM_PSL_H_ */
991.1Sreinoud/* End of psl.h */
100