summaryrefslogtreecommitdiffstats
path: root/sys/kern/device_if.m
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1999-05-10 17:06:14 +0000
committerdfr <dfr@FreeBSD.org>1999-05-10 17:06:14 +0000
commit1a3fdb21c5acf7af5eca2961539bd7f56a877ce4 (patch)
treebdc48f1aabde5d55cbfb9dfdcfa5aec92a0e21b3 /sys/kern/device_if.m
parent951dcb68cee2c9e6497dc48f2e3de3440be0b3c9 (diff)
downloadFreeBSD-src-1a3fdb21c5acf7af5eca2961539bd7f56a877ce4.zip
FreeBSD-src-1a3fdb21c5acf7af5eca2961539bd7f56a877ce4.tar.gz
* Augment the interface language to allow arbitrary C code to be 'passed
through' to the C compiler. * Allow the interface to specify a default implementation for methods. * Allow 'static' methods which are not device specific. * Add a simple scheme for probe routines to return a priority value. To make life simple, priority values are negative numbers (positive numbers are standard errno codes) with zero being the highest priority. The driver which returns the highest priority will be chosen for the device.
Diffstat (limited to 'sys/kern/device_if.m')
-rw-r--r--sys/kern/device_if.m43
1 files changed, 38 insertions, 5 deletions
diff --git a/sys/kern/device_if.m b/sys/kern/device_if.m
index f429e67..0d8e8f4 100644
--- a/sys/kern/device_if.m
+++ b/sys/kern/device_if.m
@@ -23,14 +23,47 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $Id: device_if.m,v 1.2 1998/11/08 18:35:53 nsouch Exp $
+# $Id: device_if.m,v 1.3 1998/11/14 21:58:51 wollman Exp $
#
INTERFACE device;
#
+# Default implementations of some methods.
+#
+CODE {
+ static int null_shutdown(device_t dev)
+ {
+ return 0;
+ }
+
+ static int null_suspend(device_t dev)
+ {
+ return 0;
+ }
+
+ static int null_resume(device_t dev)
+ {
+ return 0;
+ }
+};
+
+#
# Probe to see if the device is present. Return 0 if the device exists,
-# ENXIO if it cannot be found.
+# ENXIO if it cannot be found. For cases where more than one driver
+# matches a device, a priority value can be returned. In this case,
+# success codes are values less than or equal to zero with the highest
+# value representing the best match. Failure codes are represented by
+# positive values and the regular unix error codes should be used for
+# the purpose.
+#
+# If a driver returns a success code which is less than zero, it must
+# not assume that it will be the same driver which is attached to the
+# device. In particular, it must not assume that any values stored in
+# the softc structure will be available for its attach method and any
+# resources allocated during probe must be released and re-allocated
+# if the attach method is called. If a success code of zero is
+# returned, the driver can assume that it will be the one attached.
#
# Devices which implement busses should use this method to probe for
# the existence of devices attached to the bus and add them as
@@ -66,7 +99,7 @@ METHOD int detach {
#
METHOD int shutdown {
device_t dev;
-};
+} DEFAULT null_shutdown;
#
# This is called by the power-management subsystem when a suspend has been
@@ -76,8 +109,8 @@ METHOD int shutdown {
#
METHOD int suspend {
device_t dev;
-};
+} DEFAULT null_suspend;
METHOD int resume {
device_t dev;
-};
+} DEFAULT null_resume;
OpenPOWER on IntegriCloud