intr.h revision 1.23
1/*	$NetBSD: intr.h,v 1.23 2023/08/17 14:19:49 andvar Exp $	*/
2
3/*
4 * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#ifndef _SYS_RUMP_INTR_H_
29#define _SYS_RUMP_INTR_H_
30
31#ifndef _LOCORE
32
33typedef uint8_t ipl_t;
34typedef struct {
35        ipl_t _ipl;
36} ipl_cookie_t;
37
38static __inline ipl_cookie_t
39makeiplcookie(ipl_t ipl)
40{
41	ipl_cookie_t c;
42	c._ipl = ipl;
43	return c;
44}
45
46#endif /* !_LOCORE */
47
48#define spllower(x) ((void)x)
49#define splraise(x) 0
50#define splsoftserial() 0
51#define splsoftnet() 0
52#define splsoftclock() 0
53#define splhigh() 0
54#define splsched() 0
55#define splvm() 0
56#define splx(x) ((void)x)
57#define spl0() ((void)0)
58
59/*
60 * IPL_* does not mean anything to a run-to-completion rump kernel,
61 * but we sometimes assert a "not higher than" condition, so we assign
62 * different values (following spl(9)).
63 */
64#define IPL_NONE 0
65#define	IPL_SOFTCLOCK 1
66#define	IPL_SOFTBIO 2
67#define	IPL_SOFTNET 3
68#define IPL_SOFTSERIAL 4
69#define IPL_VM 5
70#define IPL_SCHED 6
71#define IPL_HIGH 7
72
73#define	splraiseipl(COOKIE)	0
74
75#endif /* _SYS_RUMP_INTR_H_ */
76