xref: /dflybsd-src/share/man/man9/config_intrhook.9 (revision c616d3786462c4bbb32602d276dfb62c4d97ef77)
10fde4452SSascha Wildner.\"
20fde4452SSascha Wildner.\" Copyright (C) 2006 M. Warner Losh <imp@FreeBSD.org>. All rights reserved.
30fde4452SSascha Wildner.\"
40fde4452SSascha Wildner.\" Redistribution and use in source and binary forms, with or without
50fde4452SSascha Wildner.\" modification, are permitted provided that the following conditions
60fde4452SSascha Wildner.\" are met:
70fde4452SSascha Wildner.\" 1. Redistributions of source code must retain the above copyright
80fde4452SSascha Wildner.\"    notice(s), this list of conditions and the following disclaimer as
90fde4452SSascha Wildner.\"    the first lines of this file unmodified other than the possible
100fde4452SSascha Wildner.\"    addition of one or more copyright notices.
110fde4452SSascha Wildner.\" 2. Redistributions in binary form must reproduce the above copyright
120fde4452SSascha Wildner.\"    notice(s), this list of conditions and the following disclaimer in the
130fde4452SSascha Wildner.\"    documentation and/or other materials provided with the distribution.
140fde4452SSascha Wildner.\"
150fde4452SSascha Wildner.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
160fde4452SSascha Wildner.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
170fde4452SSascha Wildner.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
180fde4452SSascha Wildner.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
190fde4452SSascha Wildner.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
200fde4452SSascha Wildner.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
210fde4452SSascha Wildner.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
220fde4452SSascha Wildner.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
230fde4452SSascha Wildner.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
240fde4452SSascha Wildner.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
250fde4452SSascha Wildner.\" DAMAGE.
260fde4452SSascha Wildner.\"
270fde4452SSascha Wildner.\" $FreeBSD: src/share/man/man9/config_intrhook.9,v 1.4 2006/12/14 14:33:13 mpp Exp $
280fde4452SSascha Wildner.\"
29657d4485SSascha Wildner.Dd July 10, 2012
300fde4452SSascha Wildner.Dt CONFIG_INTRHOOK 9
310fde4452SSascha Wildner.Os
320fde4452SSascha Wildner.Sh NAME
330fde4452SSascha Wildner.Nm config_intrhook
340fde4452SSascha Wildner.Nd schedule a function to be run after interrupts have been enabled,
350fde4452SSascha Wildnerbut before root is mounted
360fde4452SSascha Wildner.Sh SYNOPSIS
370fde4452SSascha Wildner.In sys/kernel.h
380fde4452SSascha Wildner.Ft int
390fde4452SSascha Wildner.Fn config_intrhook_establish "struct intr_config_hook *hook"
400fde4452SSascha Wildner.Ft void
410fde4452SSascha Wildner.Fn config_intrhook_disestablish "struct intr_config_hook *hook"
420fde4452SSascha Wildner.Sh DESCRIPTION
430fde4452SSascha WildnerThe
440fde4452SSascha Wildner.Fn config_intrhook_establish
450fde4452SSascha Wildnerfunction schedules a function to be run after interrupts have been
460fde4452SSascha Wildnerenabled, but before root is mounted.
470fde4452SSascha WildnerIf the system has already passed this point in its initialization,
480fde4452SSascha Wildnerthe function is called immediately.
490fde4452SSascha Wildner.Pp
500fde4452SSascha WildnerThe
510fde4452SSascha Wildner.Fn config_intrhook_disestablish
520fde4452SSascha Wildnerfunction removes the entry from the hook queue.
530fde4452SSascha Wildner.Pp
540fde4452SSascha WildnerBefore root is mounted, all the previously established hooks are
550fde4452SSascha Wildnerrun.
560fde4452SSascha WildnerThe boot process is then stalled until all handlers remove their hook
570fde4452SSascha Wildnerfrom the hook queue with
580fde4452SSascha Wildner.Fn config_intrhook_disestablish .
590fde4452SSascha WildnerThe boot process then proceeds to attempt to mount the root file
600fde4452SSascha Wildnersystem.
610fde4452SSascha WildnerAny driver that can potentially provide devices they wish to be
620fde4452SSascha Wildnermounted as root must use either this hook, or probe all these devices
630fde4452SSascha Wildnerin the initial probe.
640fde4452SSascha WildnerSince interrupts are disabled during the probe process, many drivers
650fde4452SSascha Wildnerneed a method to probe for devices with interrupts enabled.
660fde4452SSascha Wildner.Pp
670fde4452SSascha WildnerThe requests are made with the
680fde4452SSascha Wildner.Vt intr_config_hook
690fde4452SSascha Wildnerstructure.
700fde4452SSascha WildnerThis structure is defined as follows:
710fde4452SSascha Wildner.Bd -literal
720fde4452SSascha Wildnerstruct intr_config_hook {
730fde4452SSascha Wildner	TAILQ_ENTRY(intr_config_hook) ich_links;/* Private */
740fde4452SSascha Wildner	void	(*ich_func)(void *arg);		/* function to call */
750fde4452SSascha Wildner	void	*ich_arg;			/* Argument to call */
76657d4485SSascha Wildner	const char *ich_desc;			/* Hook description */
77657d4485SSascha Wildner	int	ich_order;			/* Ordering field */
78657d4485SSascha Wildner	int	ich_ran;			/* Private */
790fde4452SSascha Wildner};
800fde4452SSascha Wildner.Ed
810fde4452SSascha Wildner.Pp
820fde4452SSascha WildnerStorage for the
830fde4452SSascha Wildner.Vt intr_config_hook
840fde4452SSascha Wildnerstructure must be provided by the driver.
850fde4452SSascha WildnerIt must be stable from just before the hook is established until
860fde4452SSascha Wildnerafter the hook is disestablished.
870fde4452SSascha Wildner.Pp
880fde4452SSascha WildnerSpecifically, hooks are run at
8928e9bc39SSascha Wildner.Dv SI_SUB_INT_CONFIG_HOOKS ,
900fde4452SSascha Wildnerwhich is immediately after the scheduler is started,
910fde4452SSascha Wildnerand just before the root file system device is discovered.
920fde4452SSascha Wildner.Sh RETURN VALUES
930fde4452SSascha WildnerA zero return value means the hook was successfully added to the queue
940fde4452SSascha Wildner(with either deferred or immediate execution).
950fde4452SSascha WildnerA non-zero return value means the hook could not be added to the queue
960fde4452SSascha Wildnerbecause it was already on the queue.
970fde4452SSascha Wildner.Sh SEE ALSO
980fde4452SSascha Wildner.Xr DEVICE_ATTACH 9
990fde4452SSascha Wildner.Sh HISTORY
1000fde4452SSascha WildnerThese functions were introduced in
1010fde4452SSascha Wildner.Fx 3.0
1020fde4452SSascha Wildnerwith the CAM subsystem, but are available for any driver to use.
1030fde4452SSascha Wildner.Sh AUTHORS
1040fde4452SSascha Wildner.An -nosplit
1050fde4452SSascha WildnerThe functions were written by
106*c616d378SFranco Fichtner.An Justin Gibbs Aq Mt gibbs@FreeBSD.org .
1070fde4452SSascha WildnerThis manual page was written by
108*c616d378SFranco Fichtner.An M. Warner Losh Aq Mt imp@FreeBSD.org .
109