diff --git a/share/man/man9/intr_event.9 b/share/man/man9/intr_event.9 --- a/share/man/man9/intr_event.9 +++ b/share/man/man9/intr_event.9 @@ -133,12 +133,20 @@ .Pp The .Fn intr_event_create -function creates a new interrupt thread. +function creates a new interrupt event. The -.Fa source +.Fa event argument points to a -.Vt struct intr_event event -pointer that will point to the newly created thread upon success. +.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. The .Fa flags argument is a mask of properties of this thread. @@ -153,9 +161,31 @@ .Fa disable arguments specify optional functions used to enable and disable this interrupt thread's interrupt source. -The functions receive the vector corresponding to the thread's interrupt -source as their only argument. -The remaining arguments form a +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 .Xr printf 9 argument list that is used to build the base name of the new interrupt thread. The full name of an interrupt thread is formed by concatenating the base @@ -163,29 +193,41 @@ .Pp The .Fn intr_event_destroy -function destroys a previously created interrupt thread by releasing its -resources and arranging for the backing kernel thread to terminate. -An interrupt thread can only be destroyed if it has no handlers remaining. +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. .Pp The .Fn intr_event_add_handler -function adds a new handler to an existing interrupt thread specified by -.Fa ithread . +function adds a new handler to an existing interrupt event specified by +.Fa ie . The .Fa name argument specifies a name for this handler. The +.Fa filter +argument provide the filter function to execute. +The .Fa handler -and +argument provides the handler function to be executed from the +event's interrupt thread. +The .Fa arg -arguments provide the function to execute for this handler and an argument -to pass to it. +argument will be passed to the +.Fa filter +and +.Fa handler +functions when they are invoked. The .Fa pri -argument specifies the priority of this handler and is used both in sorting -it in relation to the other handlers for this thread and to specify the -priority of the backing kernel thread. -The +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 +for this event, as well as the scheduling priority of of the backing kernel +thread. .Fa flags argument can be used to specify properties of this handler as defined in .In sys/bus.h . @@ -229,6 +271,33 @@ Presently, the .Dv INTR_ENTROPY flag is not valid for software interrupt handlers. +.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 +The +.Fa post_filter +callback function is invoked once per interrupt, after the execution of all +filter handlers has completed, but only when there is no threaded handler +assigned to the interrupt. +If the interrupt does have one or more threaded handlers, the +.Fa pre_ithread +callback is invoked instead. +The +.Fa post_ithread +callback function is invoked once per interrupt, after the execution of all +threaded handlers has completed. +It is run from the associated interrupt thread context. +If an interrupt has no threaded handler, then +.Fa post_ithread +is not executed. .Sh RETURN VALUES The .Fn intr_event_add_handler ,