xref: /freebsd/share/man/man9/config_intrhook.9 (revision fa81ece897e52f42e99db0aed3162f9172931258)
1fa81ece8SWarner Losh.\"
2fa81ece8SWarner Losh.\" Copyright (C) 2006 M. Warner Losh <imp@freebsd.org>. All rights reserved.
3fa81ece8SWarner Losh.\"
4fa81ece8SWarner Losh.\" Redistribution and use in source and binary forms, with or without
5fa81ece8SWarner Losh.\" modification, are permitted provided that the following conditions
6fa81ece8SWarner Losh.\" are met:
7fa81ece8SWarner Losh.\" 1. Redistributions of source code must retain the above copyright
8fa81ece8SWarner Losh.\"    notice(s), this list of conditions and the following disclaimer as
9fa81ece8SWarner Losh.\"    the first lines of this file unmodified other than the possible
10fa81ece8SWarner Losh.\"    addition of one or more copyright notices.
11fa81ece8SWarner Losh.\" 2. Redistributions in binary form must reproduce the above copyright
12fa81ece8SWarner Losh.\"    notice(s), this list of conditions and the following disclaimer in the
13fa81ece8SWarner Losh.\"    documentation and/or other materials provided with the distribution.
14fa81ece8SWarner Losh.\"
15fa81ece8SWarner Losh.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
16fa81ece8SWarner Losh.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17fa81ece8SWarner Losh.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18fa81ece8SWarner Losh.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
19fa81ece8SWarner Losh.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20fa81ece8SWarner Losh.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21fa81ece8SWarner Losh.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22fa81ece8SWarner Losh.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23fa81ece8SWarner Losh.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24fa81ece8SWarner Losh.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
25fa81ece8SWarner Losh.\" DAMAGE.
26fa81ece8SWarner Losh.\"
27fa81ece8SWarner Losh.\" $FreeBSD$
28fa81ece8SWarner Losh.\"
29fa81ece8SWarner Losh.Dd September 24, 2006
30fa81ece8SWarner Losh.Dt CONFIG_INTRHOOK 9
31fa81ece8SWarner Losh.Os
32fa81ece8SWarner Losh.Sh NAME
33fa81ece8SWarner Losh.Nm config_intrhook
34fa81ece8SWarner Losh.Nd schedules a function to be run after interrupts have been enabled,
35fa81ece8SWarner Loshbut before root is mounted.
36fa81ece8SWarner Losh.Sh SYNOPSIS
37fa81ece8SWarner Losh.In sys/kernel.h
38fa81ece8SWarner Losh.Ft "int"
39fa81ece8SWarner Losh.Fn config_intrhook_establish "struct intr_config_hook *hook"
40fa81ece8SWarner Losh.Ft "void"
41fa81ece8SWarner Losh.Fn config_intrhook_disestablish "struct intr_config_hook *hook"
42fa81ece8SWarner Losh.Sh DESCRIPTION
43fa81ece8SWarner LoshThe
44fa81ece8SWarner Losh.Fn config_intrhook_establish
45fa81ece8SWarner Loshfunction schedules a function to be run after interrupts have been
46fa81ece8SWarner Loshenabled, but before root is mounted.
47fa81ece8SWarner LoshIf the system has already passed this point in its initialization,
48fa81ece8SWarner Loshthe function is called immediately.
49fa81ece8SWarner Losh.Pp
50fa81ece8SWarner LoshThe
51fa81ece8SWarner Losh.Fn config_intrhook_disestablish
52fa81ece8SWarner Loshfunction removes the entry from the hook queue.
53fa81ece8SWarner Losh.Pp
54fa81ece8SWarner LoshBefore root is mounted, all the previously established hooks are
55fa81ece8SWarner Loshrun.
56fa81ece8SWarner LoshThe boot process is then stalled until all handlers remove their hook
57fa81ece8SWarner Loshfrom the hook queue with
58fa81ece8SWarner Losh.Fn config_intrhook_disestablish .
59fa81ece8SWarner LoshThe boot process then proceeds to attempt to mount the root file
60fa81ece8SWarner Loshsystem.
61fa81ece8SWarner LoshAny driver that can potentially provide devices they wish to be
62fa81ece8SWarner Loshmounted as root must use either this hook, or probe all these devices
63fa81ece8SWarner Loshin the initial probe.
64fa81ece8SWarner LoshSince interrupts are disabled during the probe process, many drivers
65fa81ece8SWarner Loshneed a method to probe for devices with interrupts enabled.
66fa81ece8SWarner Losh.Pp
67fa81ece8SWarner LoshThe requests are made with the
68fa81ece8SWarner Losh.Vt "intr_config_hook"
69fa81ece8SWarner Loshstructure.
70fa81ece8SWarner LoshThis structure is defined as follows:
71fa81ece8SWarner Losh.Bd -literal
72fa81ece8SWarner Loshstruct intr_config_hook {
73fa81ece8SWarner Losh	TAILQ_ENTRY(intr_config_hook) ich_links;/* Private */
74fa81ece8SWarner Losh	void	(*ich_func)(void *arg);		/* function to call */
75fa81ece8SWarner Losh	void	*ich_arg;			/* Argument to call */
76fa81ece8SWarner Losh};
77fa81ece8SWarner Losh.Ed
78fa81ece8SWarner Losh.Pp
79fa81ece8SWarner LoshStorage for the
80fa81ece8SWarner Losh.Vt intr_config_hook
81fa81ece8SWarner Loshstructure must be provided by the driver.
82fa81ece8SWarner LoshIt must be stable from just before the hook is established until
83fa81ece8SWarner Loshafter the hook is disestablished.
84fa81ece8SWarner Losh.Pp
85fa81ece8SWarner LoshSpecifically, hooks are run at
86fa81ece8SWarner Losh.Fn SI_SUB_INT_CONFIG_HOOKS ,
87fa81ece8SWarner Loshwhich is immeidately after the scheduler is started,
88fa81ece8SWarner Loshand just before the root file system device is discovered.
89fa81ece8SWarner Losh.Sh RETURN VALUES
90fa81ece8SWarner LoshZero return values mean success.
91fa81ece8SWarner LoshNon-zero return values mean failure.
92fa81ece8SWarner Losh.Sh SEE ALSO
93fa81ece8SWarner Losh.Xr DEVICE_ATTACH 9
94fa81ece8SWarner Losh.Sh HISTORY
95fa81ece8SWarner LoshThese functions were introduced in
96fa81ece8SWarner Losh.Fx 3.0
97fa81ece8SWarner Loshwith the CAM subsystem, but are available for any driver to use.
98fa81ece8SWarner Losh.Sh AUTHORS
99fa81ece8SWarner LoshThe functions were written by
100fa81ece8SWarner Losh.An Justin Gibbs Aq gibbs@freebsd.org .
101fa81ece8SWarner LoshThis manual page was written by
102fa81ece8SWarner Losh.An M. Warner Losh Aq imp@freebsd.org .
103