device_if.m (41153) | device_if.m (46913) |
---|---|
1# 2# Copyright (c) 1998 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 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# | 1# 2# Copyright (c) 1998 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 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# $Id: device_if.m,v 1.2 1998/11/08 18:35:53 nsouch Exp $ | 26# $Id: device_if.m,v 1.3 1998/11/14 21:58:51 wollman Exp $ |
27# 28 29INTERFACE device; 30 31# | 27# 28 29INTERFACE device; 30 31# |
32# Default implementations of some methods. 33# 34CODE { 35 static int null_shutdown(device_t dev) 36 { 37 return 0; 38 } 39 40 static int null_suspend(device_t dev) 41 { 42 return 0; 43 } 44 45 static int null_resume(device_t dev) 46 { 47 return 0; 48 } 49}; 50 51# |
|
32# Probe to see if the device is present. Return 0 if the device exists, | 52# Probe to see if the device is present. Return 0 if the device exists, |
33# ENXIO if it cannot be found. | 53# ENXIO if it cannot be found. For cases where more than one driver 54# matches a device, a priority value can be returned. In this case, 55# success codes are values less than or equal to zero with the highest 56# value representing the best match. Failure codes are represented by 57# positive values and the regular unix error codes should be used for 58# the purpose. 59# 60# If a driver returns a success code which is less than zero, it must 61# not assume that it will be the same driver which is attached to the 62# device. In particular, it must not assume that any values stored in 63# the softc structure will be available for its attach method and any 64# resources allocated during probe must be released and re-allocated 65# if the attach method is called. If a success code of zero is 66# returned, the driver can assume that it will be the one attached. |
34# 35# Devices which implement busses should use this method to probe for 36# the existence of devices attached to the bus and add them as 37# children. If this is combined with the use of bus_generic_attach, 38# the child devices will be automatically probed and attached. 39# 40METHOD int probe { 41 device_t dev; --- 19 unchanged lines hidden (view full) --- 61}; 62 63# 64# This is called during system shutdown to allow the driver to put the 65# hardware into a consistent state for rebooting the computer. 66# 67METHOD int shutdown { 68 device_t dev; | 67# 68# Devices which implement busses should use this method to probe for 69# the existence of devices attached to the bus and add them as 70# children. If this is combined with the use of bus_generic_attach, 71# the child devices will be automatically probed and attached. 72# 73METHOD int probe { 74 device_t dev; --- 19 unchanged lines hidden (view full) --- 94}; 95 96# 97# This is called during system shutdown to allow the driver to put the 98# hardware into a consistent state for rebooting the computer. 99# 100METHOD int shutdown { 101 device_t dev; |
69}; | 102} DEFAULT null_shutdown; |
70 71# 72# This is called by the power-management subsystem when a suspend has been 73# requested by the user or by some automatic mechanism. This gives 74# drivers a chance to veto the suspend or save their configuration before 75# power is removed. 76# 77METHOD int suspend { 78 device_t dev; | 103 104# 105# This is called by the power-management subsystem when a suspend has been 106# requested by the user or by some automatic mechanism. This gives 107# drivers a chance to veto the suspend or save their configuration before 108# power is removed. 109# 110METHOD int suspend { 111 device_t dev; |
79}; | 112} DEFAULT null_suspend; |
80 81METHOD int resume { 82 device_t dev; | 113 114METHOD int resume { 115 device_t dev; |
83}; | 116} DEFAULT null_resume; |