device_if.m (131988) | device_if.m (133588) |
---|---|
1# | 1# |
2# Copyright (c) 1998,2004 Doug Rabson | 2# Copyright (c) 1998-2004 Doug Rabson |
3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright 9# notice, this list of conditions and the following disclaimer. 10# 2. Redistributions in binary form must reproduce the above copyright --- 7 unchanged lines hidden (view full) --- 18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24# SUCH DAMAGE. 25# | 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright 9# notice, this list of conditions and the following disclaimer. 10# 2. Redistributions in binary form must reproduce the above copyright --- 7 unchanged lines hidden (view full) --- 18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24# SUCH DAMAGE. 25# |
26# $FreeBSD: head/sys/kern/device_if.m 131988 2004-07-11 16:17:42Z dfr $ | 26# $FreeBSD: head/sys/kern/device_if.m 133588 2004-08-12 17:26:22Z imp $ |
27# 28 29#include <sys/bus.h> 30 31/** 32 * @defgroup DEVICE device - KObj methods for all device drivers 33 * @brief A basic set of methods required for all device drivers. 34 * --- 95 unchanged lines hidden (view full) --- 130 * be returned to indicate the type of error 131 * @see DEVICE_ATTACH(), pci_get_vendor(), pci_get_device() 132 */ 133METHOD int probe { 134 device_t dev; 135}; 136 137/** | 27# 28 29#include <sys/bus.h> 30 31/** 32 * @defgroup DEVICE device - KObj methods for all device drivers 33 * @brief A basic set of methods required for all device drivers. 34 * --- 95 unchanged lines hidden (view full) --- 130 * be returned to indicate the type of error 131 * @see DEVICE_ATTACH(), pci_get_vendor(), pci_get_device() 132 */ 133METHOD int probe { 134 device_t dev; 135}; 136 137/** |
138 * @brief Called by a parent device to allow drivers to add new devices to the parent. | 138 * @brief Allow a device driver to detect devices not otherwise enumerated. |
139 * | 139 * |
140 * The DEVICE_IDENTIFY() method is used by some drivers (e.g. the ISA bus driver) 141 * to help populate the bus device with a useful set of child devices, normally by 142 * calling the BUS_ADD_CHILD() method of the parent device. For instance, 143 * the ISA bus driver uses several special drivers, including the isahint driver and 144 * the pnp driver to create child devices based on configuration hints and PnP bus | 140 * The DEVICE_IDENTIFY() method is used by some drivers (e.g. the ISA 141 * bus driver) to help populate the bus device with a useful set of 142 * child devices, normally by calling the BUS_ADD_CHILD() method of 143 * the parent device. For instance, the ISA bus driver uses several 144 * special drivers, including the isahint driver and the pnp driver to 145 * create child devices based on configuration hints and PnP bus |
145 * probes respectively. 146 * | 146 * probes respectively. 147 * |
147 * Many bus drivers which support true plug-and-play do not need to use this method 148 * at all since child devices can be discovered automatically without help from 149 * child drivers. | 148 * Many bus drivers which support true plug-and-play do not need to 149 * use this method at all since child devices can be discovered 150 * automatically without help from child drivers. |
150 * 151 * To include this method in a device driver, use a line like this 152 * in the driver's method list: 153 * 154 * @code 155 * KOBJMETHOD(device_identify, foo_identify) 156 * @endcode 157 * --- 72 unchanged lines hidden (view full) --- 230 * KOBJMETHOD(device_shutdown, foo_shutdown) 231 * @endcode 232 */ 233METHOD int shutdown { 234 device_t dev; 235} DEFAULT null_shutdown; 236 237/** | 151 * 152 * To include this method in a device driver, use a line like this 153 * in the driver's method list: 154 * 155 * @code 156 * KOBJMETHOD(device_identify, foo_identify) 157 * @endcode 158 * --- 72 unchanged lines hidden (view full) --- 231 * KOBJMETHOD(device_shutdown, foo_shutdown) 232 * @endcode 233 */ 234METHOD int shutdown { 235 device_t dev; 236} DEFAULT null_shutdown; 237 238/** |
238 * @brief This is called by the power-management subsystem when a suspend has been 239 * requested by the user or by some automatic mechanism. | 239 * @brief This is called by the power-management subsystem when a 240 * suspend has been requested by the user or by some automatic 241 * mechanism. |
240 * | 242 * |
241 * This gives 242 * drivers a chance to veto the suspend or save their configuration before 243 * power is removed. | 243 * This gives drivers a chance to veto the suspend or save their 244 * configuration before power is removed. |
244 * | 245 * |
245 * To include this method in a device driver, use a line like this 246 * in the driver's method list: | 246 * To include this method in a device driver, use a line like this in 247 * the driver's method list: |
247 * 248 * @code 249 * KOBJMETHOD(device_suspend, foo_suspend) 250 * @endcode 251 * 252 * @param dev the device being suspended 253 * 254 * @retval 0 success | 248 * 249 * @code 250 * KOBJMETHOD(device_suspend, foo_suspend) 251 * @endcode 252 * 253 * @param dev the device being suspended 254 * 255 * @retval 0 success |
255 * @retval non-zero an error occurred while attempting to prepare the device 256 * for suspension | 256 * @retval non-zero an error occurred while attempting to prepare the 257 * device for suspension |
257 * 258 * @see DEVICE_RESUME() 259 */ 260METHOD int suspend { 261 device_t dev; 262} DEFAULT null_suspend; 263 264/** --- 4 unchanged lines hidden (view full) --- 269 * 270 * @code 271 * KOBJMETHOD(device_resume, foo_resume) 272 * @endcode 273 * 274 * @param dev the device being resumed 275 * 276 * @retval 0 success | 258 * 259 * @see DEVICE_RESUME() 260 */ 261METHOD int suspend { 262 device_t dev; 263} DEFAULT null_suspend; 264 265/** --- 4 unchanged lines hidden (view full) --- 270 * 271 * @code 272 * KOBJMETHOD(device_resume, foo_resume) 273 * @endcode 274 * 275 * @param dev the device being resumed 276 * 277 * @retval 0 success |
277 * @retval non-zero an error occurred while attempting to restore the device 278 * from suspension | 278 * @retval non-zero an error occurred while attempting to restore the 279 * device from suspension |
279 * 280 * @see DEVICE_SUSPEND() 281 */ 282METHOD int resume { 283 device_t dev; 284} DEFAULT null_resume; | 280 * 281 * @see DEVICE_SUSPEND() 282 */ 283METHOD int resume { 284 device_t dev; 285} DEFAULT null_resume; |