<commit_before>.\"
.\" Copyright (C) 2006 <NAME> <<EMAIL>>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice(s), this list of conditions and the following disclaimer as
.\"    the first lines of this file unmodified other than the possible
.\"    addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice(s), this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd September 24, 2006
.Dt CONFIG_INTRHOOK 9
.Os
.Sh NAME
.Nm config_intrhook
.Nd schedule a function to be run after interrupts have been enabled,
but before root is mounted
.Sh SYNOPSIS
.In sys/kernel.h
.Ft int
.Fn config_intrhook_establish "struct intr_config_hook *hook"
.Ft void
.Fn config_intrhook_disestablish "struct intr_config_hook *hook"
.Sh DESCRIPTION
The
.Fn config_intrhook_establish
function schedules a function to be run after interrupts have been
enabled, but before root is mounted.
If the system has already passed this point in its initialization,
the function is called immediately.
.Pp
The
.Fn config_intrhook_disestablish
function removes the entry from the hook queue.
.Pp
Before root is mounted, all the previously established hooks are
run.
The boot process is then stalled until all handlers remove their hook
from the hook queue with
.Fn config_intrhook_disestablish .
The boot process then proceeds to attempt to mount the root file
system.
Any driver that can potentially provide devices they wish to be
mounted as root must use either this hook, or probe all these devices
in the initial probe.
Since interrupts are disabled during the probe process, many drivers
need a method to probe for devices with interrupts enabled.
.Pp
The requests are made with the
.Vt intr_config_hook
structure.
This structure is defined as follows:
.Bd -literal
struct intr_config_hook {
	TAILQ_ENTRY(intr_config_hook) ich_links;/* Private */
	void	(*ich_func)(void *arg);		/* function to call */
	void	*ich_arg;			/* Argument to call */
};
.Ed
.Pp
Storage for the
.Vt intr_config_hook
structure must be provided by the driver.
It must be stable from just before the hook is established until
after the hook is disestablished.
.Pp
Specifically, hooks are run at
.Fn SI_SUB_INT_CONFIG_HOOKS ,
which is immeidately after the scheduler is started,
and just before the root file system device is discovered.
.Sh RETURN VALUES
Zero return values mean success.
Non-zero return values mean failure.
.Sh SEE ALSO
.Xr DEVICE_ATTACH 9
.Sh HISTORY
These functions were introduced in
.Fx 3.0
with the CAM subsystem, but are available for any driver to use.
.Sh AUTHORS
.An -nosplit
The functions were written by
.An <NAME> Aq <EMAIL> .
This manual page was written by<commit_msg>Clarify what non-zero return values mean.<commit_after>.\"
.\" Copyright (C) 2006 <NAME> <<EMAIL>>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice(s), this list of conditions and the following disclaimer as
.\"    the first lines of this file unmodified other than the possible
.\"    addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice(s), this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd September 24, 2006
.Dt CONFIG_INTRHOOK 9
.Os
.Sh NAME
.Nm config_intrhook
.Nd schedule a function to be run after interrupts have been enabled,
but before root is mounted
.Sh SYNOPSIS
.In sys/kernel.h
.Ft int
.Fn config_intrhook_establish "struct intr_config_hook *hook"
.Ft void
.Fn config_intrhook_disestablish "struct intr_config_hook *hook"
.Sh DESCRIPTION
The
.Fn config_intrhook_establish
function schedules a function to be run after interrupts have been
enabled, but before root is mounted.
If the system has already passed this point in its initialization,
the function is called immediately.
.Pp
The
.Fn config_intrhook_disestablish
function removes the entry from the hook queue.
.Pp
Before root is mounted, all the previously established hooks are
run.
The boot process is then stalled until all handlers remove their hook
from the hook queue with
.Fn config_intrhook_disestablish .
The boot process then proceeds to attempt to mount the root file
system.
Any driver that can potentially provide devices they wish to be
mounted as root must use either this hook, or probe all these devices
in the initial probe.
Since interrupts are disabled during the probe process, many drivers
need a method to probe for devices with interrupts enabled.
.Pp
The requests are made with the
.Vt intr_config_hook
structure.
This structure is defined as follows:
.Bd -literal
struct intr_config_hook {
	TAILQ_ENTRY(intr_config_hook) ich_links;/* Private */
	void	(*ich_func)(void *arg);		/* function to call */
	void	*ich_arg;			/* Argument to call */
};
.Ed
.Pp
Storage for the
.Vt intr_config_hook
structure must be provided by the driver.
It must be stable from just before the hook is established until
after the hook is disestablished.
.Pp
Specifically, hooks are run at
.Fn SI_SUB_INT_CONFIG_HOOKS ,
which is immeidately after the scheduler is started,
and just before the root file system device is discovered.
.Sh RETURN VALUES
A zero return value means the hook was successfully added to the queue
(with either deferred or immediate execution).
A non-zero return value means the hook could not be added to the queue
because it was already on the queue.
.Sh SEE ALSO
.Xr DEVICE_ATTACH 9
.Sh HISTORY
These functions were introduced in
.Fx 3.0
with the CAM subsystem, but are available for any driver to use.
.Sh AUTHORS
.An -nosplit
The functions were written by
.An <NAME> Aq <EMAIL> .
This manual page was written by
{'fraction_non_alphanumeric': 0.06453265044814341, 'fraction_numerical': 0.00409731113956466, 'mean_word_length': 4.1865869853917665, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2741507', 'n_tokens_mistral': 2258, 'n_tokens_neox': 2050, 'n_words': 1132}