2001-03-09 03:30:20 +00:00
|
|
|
.\" Copyright (c) 2001 John H. Baldwin <jhb@FreeBSD.org>
|
2022-10-15 18:41:45 +00:00
|
|
|
.\" Copyright (c) 2006 Tom Rhodes <trhodes@FreeBSD.org>
|
|
|
|
.\" Copyright (c) 2021 Mitchell Horne <mhorne@FreeBSD.org>
|
|
|
|
.\" Copyright (c) 2022 The FreeBSD Foundation
|
|
|
|
.\"
|
|
|
|
.\" Portions of this documentation were written by Mitchell Horne
|
|
|
|
.\" under sponsorship from the FreeBSD Foundation.
|
2001-03-09 03:30:20 +00:00
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
2022-10-30 14:02:20 +00:00
|
|
|
.Dd October 30, 2022
|
2022-10-15 18:32:09 +00:00
|
|
|
.Dt INTR_EVENT 9
|
2001-03-09 03:30:20 +00:00
|
|
|
.Os
|
|
|
|
.Sh NAME
|
2022-10-15 18:32:09 +00:00
|
|
|
.Nm intr_event_add_handler ,
|
|
|
|
.Nm intr_event_create ,
|
|
|
|
.Nm intr_event_destroy ,
|
2023-02-12 18:58:25 +00:00
|
|
|
.Nm intr_event_handle ,
|
2022-10-15 18:32:09 +00:00
|
|
|
.Nm intr_event_remove_handler ,
|
|
|
|
.Nm intr_priority
|
|
|
|
.Nd "kernel interrupt handler and thread API"
|
2001-03-09 03:30:20 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-10-04 08:59:53 +00:00
|
|
|
.In sys/param.h
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/bus.h
|
|
|
|
.In sys/interrupt.h
|
2001-03-09 03:30:20 +00:00
|
|
|
.Ft int
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fo intr_event_add_handler
|
|
|
|
.Fa "struct intr_event *ie"
|
2001-03-09 03:30:20 +00:00
|
|
|
.Fa "const char *name"
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fa "driver_filter_t filter"
|
2001-03-09 03:30:20 +00:00
|
|
|
.Fa "driver_intr_t handler"
|
|
|
|
.Fa "void *arg"
|
|
|
|
.Fa "u_char pri"
|
|
|
|
.Fa "enum intr_type flags"
|
|
|
|
.Fa "void **cookiep"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fo intr_event_create
|
|
|
|
.Fa "struct intr_event **event"
|
|
|
|
.Fa "void *source"
|
2001-03-09 03:30:20 +00:00
|
|
|
.Fa "int flags"
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fa "int irq"
|
|
|
|
.Fa "void (*pre_ithread)(void *)"
|
|
|
|
.Fa "void (*post_ithread)(void *)"
|
|
|
|
.Fa "void (*post_filter)(void *)"
|
|
|
|
.Fa "int (*assign_cpu)(void *, int)"
|
2001-03-09 03:30:20 +00:00
|
|
|
.Fa "const char *fmt"
|
|
|
|
.Fa "..."
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_destroy "struct intr_event *ie"
|
2001-03-09 03:30:20 +00:00
|
|
|
.Ft int
|
2022-10-30 14:02:20 +00:00
|
|
|
.Fn intr_event_handle "struct intr_event *ie" "struct trapframe *frame"
|
|
|
|
.Ft int
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_remove_handler "void *cookie"
|
|
|
|
.Ft u_char
|
|
|
|
.Fn intr_priority "enum intr_type flags"
|
2001-03-09 03:30:20 +00:00
|
|
|
.Sh DESCRIPTION
|
2022-10-15 18:38:02 +00:00
|
|
|
The interrupt event API provides methods to manage the registration and
|
|
|
|
execution of interrupt handlers and their associated thread contexts.
|
|
|
|
.Pp
|
|
|
|
Each interrupt event in the system corresponds to a single hardware or software
|
|
|
|
interrupt source.
|
|
|
|
Each interrupt event maintains a list of interrupt handlers, sorted by
|
|
|
|
priority, which will be invoked when handling the event.
|
|
|
|
An interrupt event will typically, but not always, have an associated
|
|
|
|
.Xr kthread 9 ,
|
|
|
|
known as the interrupt thread.
|
|
|
|
Finally, each event contains optional callback functions which will be
|
|
|
|
invoked before and after the handler functions themselves.
|
|
|
|
.Pp
|
|
|
|
An interrupt handler contains two distinct handler functions:
|
|
|
|
the
|
|
|
|
.Em filter
|
|
|
|
and the thread
|
|
|
|
.Em handler .
|
|
|
|
The
|
|
|
|
.Em filter
|
|
|
|
function is run from interrupt context and is intended to perform quick
|
|
|
|
handling such as acknowledging or masking a hardware interrupt,
|
|
|
|
and queueing work for the ensuing thread
|
|
|
|
.Em handler .
|
|
|
|
Both functions are optional; each interrupt handler may choose to register a
|
|
|
|
filter, a thread handler, or both.
|
|
|
|
Each interrupt handler also consists of a name,
|
|
|
|
a set of flags,
|
|
|
|
and an opaque argument which will be passed to both the
|
|
|
|
.Em filter
|
|
|
|
and
|
|
|
|
.Em handler
|
|
|
|
functions.
|
|
|
|
.Ss Handler Constraints
|
|
|
|
The
|
|
|
|
.Em filter
|
|
|
|
function is executed inside a
|
|
|
|
.Xr critical 9
|
|
|
|
section.
|
|
|
|
Therefore, filters may not yield the CPU for any reason, and may only use spin
|
|
|
|
locks to access shared data.
|
|
|
|
Allocating memory within a filter is not permitted.
|
2001-03-09 03:30:20 +00:00
|
|
|
.Pp
|
|
|
|
The
|
2022-10-15 18:38:02 +00:00
|
|
|
.Em handler
|
|
|
|
function executes from the context of the associated interrupt kernel thread.
|
|
|
|
Sleeping is not permitted, but the interrupt thread may be preempted by higher
|
|
|
|
priority threads.
|
|
|
|
Thus, threaded handler functions may obtain non-sleepable locks, as described
|
|
|
|
in
|
|
|
|
.Xr locking 9 .
|
|
|
|
Any memory or zone allocations in an interrupt thread must specify the
|
|
|
|
.Dv M_NOWAIT
|
|
|
|
flag, and any allocation errors must be handled.
|
|
|
|
.Pp
|
|
|
|
The exception to these constraints is software interrupt threads, which are
|
|
|
|
allowed to sleep but should be allocated and scheduled using the
|
|
|
|
.Xr swi 9
|
|
|
|
interface.
|
|
|
|
.Ss Function Descriptions
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_create
|
2022-10-15 18:39:27 +00:00
|
|
|
function creates a new interrupt event.
|
2001-03-09 03:30:20 +00:00
|
|
|
The
|
2022-10-15 18:39:27 +00:00
|
|
|
.Fa event
|
2022-10-15 18:32:09 +00:00
|
|
|
argument points to a
|
2022-10-15 18:39:27 +00:00
|
|
|
.Vt struct intr_event
|
|
|
|
pointer that will reference the newly created event upon success.
|
|
|
|
The
|
|
|
|
.Fa source
|
|
|
|
argument is an opaque pointer which will be passed to the
|
|
|
|
.Fa pre_ithread ,
|
|
|
|
.Fa post_ithread ,
|
|
|
|
and
|
|
|
|
.Fa post_filter
|
|
|
|
callbacks.
|
2001-03-09 03:30:20 +00:00
|
|
|
The
|
|
|
|
.Fa flags
|
2002-02-18 00:21:05 +00:00
|
|
|
argument is a mask of properties of this thread.
|
2001-03-09 03:30:20 +00:00
|
|
|
The only valid flag currently for
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_create
|
2001-03-09 03:30:20 +00:00
|
|
|
is
|
2022-10-15 18:32:09 +00:00
|
|
|
.Dv IE_SOFT
|
2001-03-09 03:30:20 +00:00
|
|
|
to specify that this interrupt thread is a software interrupt.
|
|
|
|
The
|
|
|
|
.Fa enable
|
|
|
|
and
|
|
|
|
.Fa disable
|
|
|
|
arguments specify optional functions used to enable and disable this
|
|
|
|
interrupt thread's interrupt source.
|
2022-10-15 18:39:27 +00:00
|
|
|
The
|
|
|
|
.Fa irq
|
|
|
|
argument is the unique interrupt vector number corresponding to the event.
|
|
|
|
The
|
|
|
|
.Fa pre_ithread ,
|
|
|
|
.Fa post_ithread ,
|
|
|
|
and
|
|
|
|
.Fa post_filter
|
|
|
|
arguments are callback functions that are invoked at different
|
|
|
|
points while handling an interrupt.
|
|
|
|
This is described in more detail in the
|
|
|
|
.Sx Handler Callbacks
|
|
|
|
section, below.
|
|
|
|
They may be
|
|
|
|
.Va NULL
|
|
|
|
to specify no callback.
|
|
|
|
The
|
|
|
|
.Fa assign_cpu
|
|
|
|
argument points to a callback function that will be invoked when binding
|
|
|
|
an interrupt to a particular CPU.
|
|
|
|
It may be
|
|
|
|
.Va NULL
|
|
|
|
if binding is unsupported.
|
|
|
|
The
|
|
|
|
remaining arguments form a
|
2001-03-09 03:30:20 +00:00
|
|
|
.Xr printf 9
|
2022-10-15 18:32:09 +00:00
|
|
|
argument list that is used to build the base name of the new interrupt thread.
|
2001-03-09 03:30:20 +00:00
|
|
|
The full name of an interrupt thread is formed by concatenating the base
|
2022-10-15 18:32:09 +00:00
|
|
|
name of the interrupt thread with the names of all of its interrupt handlers.
|
2001-03-09 03:30:20 +00:00
|
|
|
.Pp
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_destroy
|
2022-10-15 18:39:27 +00:00
|
|
|
function destroys a previously created interrupt event by releasing its
|
|
|
|
resources.
|
|
|
|
.\" The following is not true (yet):
|
|
|
|
.\"and arranging for the backing kernel thread to terminate.
|
|
|
|
An interrupt event can only be destroyed if it has no handlers remaining.
|
2001-03-09 03:30:20 +00:00
|
|
|
.Pp
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_add_handler
|
2022-10-15 18:39:27 +00:00
|
|
|
function adds a new handler to an existing interrupt event specified by
|
|
|
|
.Fa ie .
|
2001-03-09 03:30:20 +00:00
|
|
|
The
|
|
|
|
.Fa name
|
|
|
|
argument specifies a name for this handler.
|
|
|
|
The
|
2022-10-15 18:39:27 +00:00
|
|
|
.Fa filter
|
|
|
|
argument provide the filter function to execute.
|
|
|
|
The
|
2001-03-09 03:30:20 +00:00
|
|
|
.Fa handler
|
2022-10-15 18:39:27 +00:00
|
|
|
argument provides the handler function to be executed from the
|
|
|
|
event's interrupt thread.
|
|
|
|
The
|
2001-03-09 03:30:20 +00:00
|
|
|
.Fa arg
|
2022-10-15 18:39:27 +00:00
|
|
|
argument will be passed to the
|
|
|
|
.Fa filter
|
|
|
|
and
|
|
|
|
.Fa handler
|
|
|
|
functions when they are invoked.
|
2001-03-09 03:30:20 +00:00
|
|
|
The
|
|
|
|
.Fa pri
|
2022-10-15 18:39:27 +00:00
|
|
|
argument specifies the priority of this handler,
|
|
|
|
corresponding to the values defined in
|
|
|
|
.In sys/priority.h .
|
|
|
|
It determines the order this handler is called relative to the other handlers
|
2024-03-23 16:57:37 +00:00
|
|
|
for this event, as well as the scheduling priority of the backing kernel
|
2022-10-15 18:39:27 +00:00
|
|
|
thread.
|
2001-03-09 03:30:20 +00:00
|
|
|
.Fa flags
|
|
|
|
argument can be used to specify properties of this handler as defined in
|
2003-09-08 19:57:22 +00:00
|
|
|
.In sys/bus.h .
|
2001-03-09 03:30:20 +00:00
|
|
|
If
|
|
|
|
.Fa cookiep
|
|
|
|
is not
|
|
|
|
.Dv NULL ,
|
|
|
|
then it will be assigned a cookie that can be used later to remove this
|
|
|
|
handler.
|
|
|
|
.Pp
|
|
|
|
The
|
2022-10-30 14:02:20 +00:00
|
|
|
.Fn intr_event_handle
|
|
|
|
function is the main entry point into the interrupt handling code.
|
|
|
|
It must be called from an interrupt context.
|
|
|
|
The function will execute all filter handlers associated with the interrupt
|
|
|
|
event
|
|
|
|
.Fa ie ,
|
|
|
|
and schedule the associated interrupt thread to run, if applicable.
|
|
|
|
The
|
|
|
|
.Fa frame
|
|
|
|
argument is used to pass a pointer to the
|
|
|
|
.Vt struct trapframe
|
|
|
|
containing the machine state at the time of the interrupt.
|
|
|
|
The main body of this function runs within a
|
|
|
|
.Xr critical 9
|
|
|
|
section.
|
|
|
|
.Pp
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_remove_handler
|
2022-10-15 18:39:27 +00:00
|
|
|
function removes an interrupt handler from the interrupt event specified by
|
|
|
|
.Fa ie .
|
2001-03-09 03:30:20 +00:00
|
|
|
The
|
|
|
|
.Fa cookie
|
2022-10-15 18:39:27 +00:00
|
|
|
argument, obtained from
|
|
|
|
.Fn intr_event_add_handler ,
|
|
|
|
identifies the handler to remove.
|
2001-03-09 03:30:20 +00:00
|
|
|
.Pp
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_priority
|
2001-03-09 03:30:20 +00:00
|
|
|
function translates the
|
|
|
|
.Dv INTR_TYPE_*
|
2022-10-15 18:32:09 +00:00
|
|
|
interrupt flags into interrupt thread scheduling priorities.
|
2001-03-09 03:30:20 +00:00
|
|
|
.Pp
|
|
|
|
The interrupt flags not related to the type of a particular interrupt
|
2001-03-12 08:54:49 +00:00
|
|
|
.Pq Dv INTR_TYPE_*
|
2001-03-09 03:30:20 +00:00
|
|
|
can be used to specify additional properties of both hardware and software
|
|
|
|
interrupt handlers.
|
|
|
|
The
|
|
|
|
.Dv INTR_EXCL
|
2001-08-08 18:32:06 +00:00
|
|
|
flag specifies that this handler cannot share an interrupt thread with
|
2001-03-09 03:30:20 +00:00
|
|
|
another handler.
|
|
|
|
The
|
|
|
|
.Dv INTR_MPSAFE
|
|
|
|
flag specifies that this handler is MP safe in that it does not need the
|
|
|
|
Giant mutex to be held while it is executed.
|
|
|
|
The
|
|
|
|
.Dv INTR_ENTROPY
|
|
|
|
flag specifies that the interrupt source this handler is tied to is a good
|
|
|
|
source of entropy, and thus that entropy should be gathered when an interrupt
|
|
|
|
from the handler's source triggers.
|
|
|
|
Presently, the
|
|
|
|
.Dv INTR_ENTROPY
|
2011-01-06 21:14:34 +00:00
|
|
|
flag is not valid for software interrupt handlers.
|
2022-10-15 18:39:27 +00:00
|
|
|
.Ss Handler Callbacks
|
|
|
|
Each
|
|
|
|
.Vt struct intr_event
|
|
|
|
is assigned three optional callback functions when it is created:
|
|
|
|
.Fa pre_ithread ,
|
|
|
|
.Fa post_ithread ,
|
|
|
|
and
|
|
|
|
.Fa post_filter .
|
|
|
|
These callbacks are intended to be defined by the interrupt controller driver,
|
|
|
|
to allow for actions such as masking and unmasking hardware interrupt signals.
|
|
|
|
.Pp
|
|
|
|
When an interrupt is triggered, all filters are run to determine if any
|
|
|
|
threaded interrupt handlers should be scheduled for execution by the associated
|
|
|
|
interrupt thread. If no threaded handlers are scheduled, the
|
|
|
|
.Fa post_filter
|
|
|
|
callback is invoked which should acknowledge the interrupt and permit it to
|
|
|
|
trigger in the future.
|
|
|
|
If any threaded handlers are scheduled, the
|
|
|
|
.Fa pre_ithread
|
|
|
|
callback is invoked instead.
|
|
|
|
This handler should acknowledge the interrupt, but it should also ensure that
|
|
|
|
the interrupt will not fire continuously until after the threaded handlers have
|
|
|
|
executed.
|
|
|
|
Typically this callback masks level-triggered interrupts in an interrupt
|
|
|
|
controller while leaving edge-triggered interrupts alone.
|
|
|
|
Once all threaded handlers have executed,
|
|
|
|
the
|
|
|
|
.Fa post_ithread
|
|
|
|
callback is invoked from the interrupt thread to enable future interrupts.
|
|
|
|
Typically this callback unmasks level-triggered interrupts in an interrupt
|
|
|
|
controller.
|
2001-03-09 03:30:20 +00:00
|
|
|
.Sh RETURN VALUES
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_add_handler ,
|
|
|
|
.Fn intr_event_create ,
|
|
|
|
.Fn intr_event_destroy ,
|
2022-10-30 14:02:20 +00:00
|
|
|
.Fn intr_event_handle ,
|
2001-03-09 03:30:20 +00:00
|
|
|
and
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_remove_handler
|
2001-03-09 03:30:20 +00:00
|
|
|
functions return zero on success and non-zero on failure.
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_priority
|
2001-03-09 03:30:20 +00:00
|
|
|
function returns a process priority corresponding to the passed in interrupt
|
|
|
|
flags.
|
|
|
|
.Sh EXAMPLES
|
|
|
|
The
|
2022-10-15 18:34:44 +00:00
|
|
|
.Xr swi_add 9
|
2001-03-09 03:30:20 +00:00
|
|
|
function demonstrates the use of
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_create
|
2001-03-09 03:30:20 +00:00
|
|
|
and
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_add_handler .
|
2001-03-09 03:30:20 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
int
|
2022-10-15 18:34:44 +00:00
|
|
|
swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler,
|
|
|
|
void *arg, int pri, enum intr_type flags, void **cookiep)
|
2001-03-09 03:30:20 +00:00
|
|
|
{
|
2022-10-15 18:34:44 +00:00
|
|
|
struct intr_event *ie;
|
|
|
|
int error = 0;
|
2001-03-09 03:30:20 +00:00
|
|
|
|
2011-01-06 21:14:34 +00:00
|
|
|
if (flags & INTR_ENTROPY)
|
2001-03-09 03:30:20 +00:00
|
|
|
return (EINVAL);
|
|
|
|
|
2022-10-15 18:34:44 +00:00
|
|
|
ie = (eventp != NULL) ? *eventp : NULL;
|
2001-03-09 03:30:20 +00:00
|
|
|
|
2022-10-15 18:34:44 +00:00
|
|
|
if (ie != NULL) {
|
|
|
|
if (!(ie->ie_flags & IE_SOFT))
|
|
|
|
return (EINVAL);
|
2001-03-09 03:30:20 +00:00
|
|
|
} else {
|
2022-10-15 18:34:44 +00:00
|
|
|
error = intr_event_create(&ie, NULL, IE_SOFT, 0,
|
|
|
|
NULL, NULL, NULL, swi_assign_cpu, "swi%d:", pri);
|
2001-03-09 03:30:20 +00:00
|
|
|
if (error)
|
|
|
|
return (error);
|
2022-10-15 18:34:44 +00:00
|
|
|
if (eventp != NULL)
|
|
|
|
*eventp = ie;
|
|
|
|
}
|
|
|
|
if (handler != NULL) {
|
|
|
|
error = intr_event_add_handler(ie, name, NULL, handler, arg,
|
|
|
|
PI_SWI(pri), flags, cookiep);
|
2001-03-09 03:30:20 +00:00
|
|
|
}
|
2022-10-15 18:34:44 +00:00
|
|
|
return (error);
|
2001-03-09 03:30:20 +00:00
|
|
|
}
|
|
|
|
.Ed
|
|
|
|
.Sh ERRORS
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_add_handler
|
2001-03-09 03:30:20 +00:00
|
|
|
function will fail if:
|
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er EINVAL
|
2022-10-15 18:32:09 +00:00
|
|
|
The
|
|
|
|
.Fa ie
|
2001-03-09 03:30:20 +00:00
|
|
|
or
|
|
|
|
.Fa name
|
|
|
|
arguments are
|
|
|
|
.Dv NULL .
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fa handler
|
|
|
|
and
|
|
|
|
.Fa filter
|
|
|
|
arguments are both
|
|
|
|
.Dv NULL .
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
The
|
|
|
|
.Dv IH_EXCLUSIVE
|
2001-03-09 03:30:20 +00:00
|
|
|
flag is specified and the interrupt thread
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fa ie
|
2001-03-09 03:30:20 +00:00
|
|
|
already has at least one handler, or the interrupt thread
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fa ie
|
2001-03-09 03:30:20 +00:00
|
|
|
already has an exclusive handler.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_create
|
2001-03-09 03:30:20 +00:00
|
|
|
function will fail if:
|
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
A flag other than
|
2022-10-15 18:32:09 +00:00
|
|
|
.Dv IE_SOFT
|
2001-03-09 03:30:20 +00:00
|
|
|
was specified in the
|
|
|
|
.Fa flags
|
|
|
|
parameter.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_destroy
|
2001-03-09 03:30:20 +00:00
|
|
|
function will fail if:
|
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fa ie
|
2001-03-09 03:30:20 +00:00
|
|
|
argument is
|
|
|
|
.Dv NULL .
|
2022-10-15 18:32:09 +00:00
|
|
|
.It Bq Er EBUSY
|
|
|
|
The interrupt event pointed to by
|
|
|
|
.Fa ie
|
|
|
|
has at least one handler which has not been removed with
|
|
|
|
.Fn intr_event_remove_handler .
|
2001-03-09 03:30:20 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The
|
2022-10-30 14:02:20 +00:00
|
|
|
.Fn intr_event_handle
|
|
|
|
function will fail if:
|
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
The
|
|
|
|
.Fa ie
|
|
|
|
argument is
|
|
|
|
.Dv NULL .
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
There are no interrupt handlers assigned to
|
|
|
|
.Fa ie .
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
The interrupt was not acknowledged by any filter and has no associated thread
|
|
|
|
handler.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The
|
2022-10-15 18:32:09 +00:00
|
|
|
.Fn intr_event_remove_handler
|
2001-03-09 03:30:20 +00:00
|
|
|
function will fail if:
|
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
The
|
|
|
|
.Fa cookie
|
|
|
|
argument is
|
|
|
|
.Dv NULL .
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
2022-10-30 14:02:20 +00:00
|
|
|
.Xr critical 9 ,
|
2001-03-09 03:30:20 +00:00
|
|
|
.Xr kthread 9 ,
|
2022-10-15 18:38:02 +00:00
|
|
|
.Xr locking 9 ,
|
2006-08-25 19:04:42 +00:00
|
|
|
.Xr malloc 9 ,
|
|
|
|
.Xr swi 9 ,
|
|
|
|
.Xr uma 9
|
2001-03-09 03:30:20 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
Interrupt threads and their corresponding API first appeared in
|
|
|
|
.Fx 5.0 .
|