2 .\" Copyright (C) 2006 M. Warner Losh <imp@FreeBSD.org>. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
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
27 .\" $FreeBSD: src/share/man/man9/config_intrhook.9,v 1.4 2006/12/14 14:33:13 mpp Exp $
34 .Nd schedule a function to be run after interrupts have been enabled,
35 but before root is mounted
39 .Fn config_intrhook_establish "struct intr_config_hook *hook"
41 .Fn config_intrhook_disestablish "struct intr_config_hook *hook"
44 .Fn config_intrhook_establish
45 function schedules a function to be run after interrupts have been
46 enabled, but before root is mounted.
47 If the system has already passed this point in its initialization,
48 the function is called immediately.
51 .Fn config_intrhook_disestablish
52 function removes the entry from the hook queue.
54 Before root is mounted, all the previously established hooks are
56 The boot process is then stalled until all handlers remove their hook
57 from the hook queue with
58 .Fn config_intrhook_disestablish .
59 The boot process then proceeds to attempt to mount the root file
61 Any driver that can potentially provide devices they wish to be
62 mounted as root must use either this hook, or probe all these devices
64 Since interrupts are disabled during the probe process, many drivers
65 need a method to probe for devices with interrupts enabled.
67 The requests are made with the
70 This structure is defined as follows:
72 struct 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 const char *ich_desc; /* Hook description */
77 int ich_order; /* Ordering field */
78 int ich_ran; /* Private */
84 structure must be provided by the driver.
85 It must be stable from just before the hook is established until
86 after the hook is disestablished.
88 Specifically, hooks are run at
89 .Dv SI_SUB_INT_CONFIG_HOOKS ,
90 which is immediately after the scheduler is started,
91 and just before the root file system device is discovered.
93 A zero return value means the hook was successfully added to the queue
94 (with either deferred or immediate execution).
95 A non-zero return value means the hook could not be added to the queue
96 because it was already on the queue.
100 These functions were introduced in
102 with the CAM subsystem, but are available for any driver to use.
105 The functions were written by
106 .An Justin Gibbs Aq Mt gibbs@FreeBSD.org .
107 This manual page was written by
108 .An M. Warner Losh Aq Mt imp@FreeBSD.org .