device_if.m revision 41153
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#    notice, this list of conditions and the following disclaimer.
10# 2. Redistributions in binary form must reproduce the above copyright
11#    notice, this list of conditions and the following disclaimer in the
12#    documentation and/or other materials provided with the distribution.
13#
14# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
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 $
27#
28
29INTERFACE device;
30
31#
32# Probe to see if the device is present.  Return 0 if the device exists,
33# ENXIO if it cannot be found.
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;
42};
43
44#
45# Attach a device to the system.  The probe method will have been
46# called and will have indicated that the device exists.  This routine
47# should initialise the hardware and allocate other system resources
48# (such as devfs entries).  Returns 0 on success.
49#
50METHOD int attach {
51	device_t dev;
52};
53
54#
55# Detach a device.  This can be called if the user is replacing the
56# driver software or if a device is about to be physically removed
57# from the system (e.g. for pccard devices).  Returns 0 on success.
58#
59METHOD int detach {
60	device_t dev;
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;
69};
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;
79};
80
81METHOD int resume {
82	device_t dev;
83};
84