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