FreeBSD/Linux Kernel Cross Reference
sys/sys/intr.h
1 /* $NetBSD: intr.h,v 1.7.10.1 2009/02/02 03:39:18 snj Exp $ */
2
3 /*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #ifndef _SYS_INTR_H_
33 #define _SYS_INTR_H_
34
35 #include <machine/intr.h>
36
37 #ifdef _KERNEL
38
39 struct cpu_info;
40
41 /* Public interface. */
42 void *softint_establish(u_int, void (*)(void *), void *);
43 void softint_disestablish(void *);
44 void softint_schedule(void *);
45
46 /* MI hooks. */
47 void softint_init(struct cpu_info *);
48 lwp_t *softint_picklwp(void);
49 void softint_overlay(void);
50 void softint_block(lwp_t *);
51
52 /* MD-MI interface. */
53 void softint_init_md(lwp_t *, u_int, uintptr_t *);
54 void softint_trigger(uintptr_t);
55 void softint_dispatch(lwp_t *, int);
56
57 /* Flags for softint_establish(). */
58 #define SOFTINT_BIO 0x0000
59 #define SOFTINT_CLOCK 0x0001
60 #define SOFTINT_SERIAL 0x0002
61 #define SOFTINT_NET 0x0003
62 #define SOFTINT_MPSAFE 0x0100
63
64 /* Implementation private flags. */
65 #define SOFTINT_PENDING 0x1000
66 #define SOFTINT_ACTIVE 0x2000
67
68 #define SOFTINT_COUNT 0x0004
69 #define SOFTINT_LVLMASK 0x00ff
70 #define SOFTINT_IMPMASK 0xf000
71
72 extern u_int softint_timing;
73 extern int safepri;
74
75 /*
76 * Historical aliases. XXX Audio devices should run at
77 * IPL_SCHED, but they need to acquire kernel_lock.
78 */
79 #define IPL_BIO IPL_VM
80 #define IPL_NET IPL_VM
81 #define IPL_TTY IPL_VM
82 #define IPL_LPT IPL_VM
83 #define IPL_AUDIO IPL_VM
84 #define IPL_CLOCK IPL_SCHED
85 #define IPL_IPI IPL_HIGH
86 #define IPL_SERIAL IPL_HIGH
87
88 #define splbio() splvm()
89 #define splnet() splvm()
90 #define spltty() splvm()
91 #define spllpt() splvm()
92 #define splaudio() splvm()
93 #define splclock() splsched()
94 #define splipi() splhigh()
95 #define splserial() splhigh()
96
97 #endif /* _KERNEL */
98
99 #endif /* _SYS_INTR_H_ */
Cache object: 513b5f57c8b45a0aba68f1f2ee9f1c05
|