config_intrhook (9)
Leading comments
Copyright (C) 2006 M. Warner Losh <imp@FreeBSD.org>. 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 f...
NAME
config_intrhook - schedule a function to be run after interrupts have been enabled, but before root is mountedSYNOPSIS
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 *hookDESCRIPTION
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.The Fn config_intrhook_disestablish function removes the entry from the hook queue.
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.
The requests are made with the Vt intr_config_hook structure. This structure is defined as follows:
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 */ };
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.
Specifically, hooks are run at Fn SI_SUB_INT_CONFIG_HOOKS , which is immediately after the scheduler is started, and just before the root file system device is discovered.