device_if.m revision 36973
136973Sdfr#
236973Sdfr# Copyright (c) 1998 Doug Rabson
336973Sdfr# All rights reserved.
436973Sdfr#
536973Sdfr# Redistribution and use in source and binary forms, with or without
636973Sdfr# modification, are permitted provided that the following conditions
736973Sdfr# are met:
836973Sdfr# 1. Redistributions of source code must retain the above copyright
936973Sdfr#    notice, this list of conditions and the following disclaimer.
1036973Sdfr# 2. Redistributions in binary form must reproduce the above copyright
1136973Sdfr#    notice, this list of conditions and the following disclaimer in the
1236973Sdfr#    documentation and/or other materials provided with the distribution.
1336973Sdfr#
1436973Sdfr# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1536973Sdfr# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1636973Sdfr# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1736973Sdfr# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1836973Sdfr# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1936973Sdfr# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2036973Sdfr# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2136973Sdfr# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2236973Sdfr# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2336973Sdfr# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2436973Sdfr# SUCH DAMAGE.
2536973Sdfr#
2636973Sdfr#	$Id$
2736973Sdfr#
2836973Sdfr
2936973SdfrINTERFACE device
3036973Sdfr
3136973Sdfr#
3236973Sdfr# Probe to see if the device is present.  Return 0 if the device exists,
3336973Sdfr# ENXIO if it cannot be found.
3436973Sdfr# 
3536973Sdfr# Devices which implement busses should use this method to probe for
3636973Sdfr# the existence of devices attached to the bus and add them as
3736973Sdfr# children.  If this is combined with the use of bus_generic_attach,
3836973Sdfr# the child devices will be automatically probed and attached.
3936973Sdfr#
4036973SdfrMETHOD int probe {
4136973Sdfr	device_t dev;
4236973Sdfr};
4336973Sdfr
4436973Sdfr#
4536973Sdfr# Attach a device to the system.  The probe method will have been
4636973Sdfr# called and will have indicated that the device exists.  This routine
4736973Sdfr# should initialise the hardware and allocate other system resources
4836973Sdfr# (such as devfs entries).  Returns 0 on success.
4936973Sdfr#
5036973SdfrMETHOD int attach {
5136973Sdfr	device_t dev;
5236973Sdfr};
5336973Sdfr
5436973Sdfr#
5536973Sdfr# Detach a device.  This can be called if the user is replacing the
5636973Sdfr# driver software or if a device is about to be physically removed
5736973Sdfr# from the system (e.g. for pccard devices).  Returns 0 on success.
5836973Sdfr#
5936973SdfrMETHOD int detach {
6036973Sdfr	device_t dev;
6136973Sdfr};
6236973Sdfr
6336973Sdfr#
6436973Sdfr# This is called during system shutdown to allow the driver to put the 
6536973Sdfr# hardware into a consistent state for rebooting the computer.
6636973Sdfr#
6736973SdfrMETHOD int shutdown {
6836973Sdfr	device_t dev;
6936973Sdfr};
70