diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1321,6 +1321,7 @@ MLINKS+=intr_event.9 intr_event_add_handler.9 \ intr_event.9 intr_event_create.9 \ intr_event.9 intr_event_destroy.9 \ + intr_event.9 intr_event_handle.9 \ intr_event.9 intr_event_remove_handler.9 MLINKS+=kernacc.9 useracc.9 MLINKS+=kernel_mount.9 free_mntarg.9 \ 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 @@ -30,6 +30,7 @@ .Nm intr_event_add_handler , .Nm intr_event_create , .Nm intr_event_destroy , +.Nm intr_event handle , .Nm intr_event_remove_handler , .Nm intr_priority .Nd "kernel interrupt handler and thread API" @@ -64,6 +65,8 @@ .Ft int .Fn intr_event_destroy "struct intr_event *ie" .Ft int +.Fn intr_event_handle "struct intr_event *ie" "struct trapframe *frame" +.Ft int .Fn intr_event_remove_handler "void *cookie" .Ft u_char .Fn intr_priority "enum intr_type flags" @@ -236,6 +239,23 @@ handler. .Pp The +.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 .Fn intr_event_remove_handler removes a handler from an interrupt thread. The @@ -300,6 +320,7 @@ .Fn intr_event_add_handler , .Fn intr_event_create , .Fn intr_event_destroy , +.Fn intr_event_handle , and .Fn intr_event_remove_handler functions return zero on success and non-zero on failure. @@ -403,6 +424,23 @@ .El .Pp The +.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 .Fn intr_event_remove_handler function will fail if: .Bl -tag -width Er @@ -413,6 +451,7 @@ .Dv NULL . .El .Sh SEE ALSO +.Xr critical 9 , .Xr kthread 9 , .Xr locking 9 , .Xr malloc 9 ,