1 .\" Copyright (c) 2000-2001 John H. Baldwin <jhb@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .Nd register and schedule software interrupt handlers
39 .Vt "extern struct intr_event *tty_intr_event" ;
40 .Vt "extern struct intr_event *clk_intr_event" ;
41 .Vt "extern void *vm_ih" ;
44 .Fa "struct intr_event **eventp"
45 .Fa "const char *name"
46 .Fa "driver_intr_t handler"
49 .Fa "enum intr_type flags"
53 .Fn swi_remove "void *cookie"
55 .Fn swi_sched "void *cookie" "int flags"
57 These functions are used to register and schedule software interrupt handlers.
58 Software interrupt handlers are attached to a software interrupt thread, just
59 as hardware interrupt handlers are attached to a hardware interrupt thread.
60 Multiple handlers can be attached to the same thread.
61 Software interrupt handlers can be used to queue up less critical processing
62 inside of hardware interrupt handlers so that the work can be done at a later
64 Software interrupt threads are different from other kernel threads in that they
65 are treated as an interrupt thread.
66 This means that time spent executing these threads is counted as interrupt
67 time, and that they can be run via a lightweight context switch.
71 function is used to add a new software interrupt handler to a specified
75 argument is an optional pointer to a
78 If this argument points to an existing event that holds a list of
79 interrupt handlers, then this handler will be attached to that event.
80 Otherwise a new event will be created, and if
84 then the pointer at that address to will be modified to point to the
88 argument is used to associate a name with a specific handler.
89 This name is appended to the name of the software interrupt thread that this
90 handler is attached to.
93 argument is the function that will be executed when the handler is scheduled
97 parameter will be passed in as the only parameter to
99 when the function is executed.
102 value specifies the priority of this interrupt handler relative to other
103 software interrupt handlers.
104 If an interrupt event is created, then this value is used as the vector,
107 argument is used to specify the attributes of a handler such as
114 This cookie will be set to a value that uniquely identifies this handler,
115 and is used to schedule the handler for execution later on.
119 function is used to teardown an interrupt handler pointed to by the
122 It detaches the interrupt handler from the associated interrupt event
123 and frees its memory.
127 function is used to schedule an interrupt handler and its associated thread to
131 argument specifies which software interrupt handler should be scheduled to run.
134 argument specifies how and when the handler should be run and is a mask of one
135 or more of the following flags:
136 .Bl -tag -width SWI_DELAY
138 Specifies that the kernel should mark the specified handler as needing to run,
139 but the kernel should not schedule the software interrupt thread to run.
142 will be executed the next time that the software interrupt thread runs after
143 being scheduled by another event.
144 Attaching a handler to the clock software interrupt thread and using this flag
145 when scheduling a software interrupt handler can be used to implement the
146 functionality performed by
148 in earlier versions of
156 variables contain pointers to the software interrupt handlers for the tty and
157 clock software interrupts, respectively.
159 is used to hang tty software interrupt handlers off of the same thread.
161 is used to hang delayed handlers off of the clock software interrupt thread so
162 that the functionality of
164 can be obtained in conjunction with
168 handler cookie is used to schedule software interrupt threads to run for the
175 functions return zero on success and non-zero on failure.
179 function will fail if:
182 The system-imposed limit on the total
183 number of processes under execution would be exceeded.
184 The limit is given by the
196 argument points to a hardware interrupt thread.
207 flag is specified and the interrupt event pointed to by
209 already has at least one handler, or the interrupt event already has an
215 function will fail if:
218 A software interrupt handler pointed to by
231 functions first appeared in
235 function which appeared in
241 functions which date back to at least
245 function first appeared in
248 Most of the global variables described in this manual page should not be
249 global, or at the very least should not be declared in
250 .In sys/interrupt.h .