FreeBSD kernel kern code
device_if.m
Go to the documentation of this file.
1 #-
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
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 # $BSDSUniX$
27 #
28 
29 #include <sys/bus.h>
30 
40 INTERFACE device;
41 
42 #
43 # Default implementations of some methods.
44 #
46  static int null_shutdown(device_t dev)
47  {
48  return 0;
49  }
50 
51  static int null_suspend(device_t dev)
52  {
53  return 0;
54  }
55 
56  static int null_resume(device_t dev)
57  {
58  return 0;
59  }
60 
61  static int null_quiesce(device_t dev)
62  {
63  return EOPNOTSUPP;
64  }
65 };
66 
140 METHOD int probe {
141  device_t dev;
142 };
143 
169 STATICMETHOD void identify {
170  driver_t *driver;
171  device_t parent;
172 };
173 
197 METHOD int attach {
198  device_t dev;
199 };
200 
223 METHOD int detach {
224  device_t dev;
225 };
226 
241 METHOD int shutdown {
242  device_t dev;
244 
268 METHOD int suspend {
269  device_t dev;
271 
290 METHOD int resume {
291  device_t dev;
293 
316 METHOD int quiesce {
317  device_t dev;
DEFAULT null_shutdown
Definition: device_if.m:243
METHOD int detach
Detach a driver from a device.
Definition: device_if.m:223
device_t parent
Definition: device_if.m:171
DEFAULT null_resume
Definition: device_if.m:292
CODE
Definition: device_if.m:45
METHOD int resume
This is called when the system resumes after a suspend.
Definition: device_if.m:290
STATICMETHOD void identify
Allow a device driver to detect devices not otherwise enumerated.
Definition: device_if.m:169
DEFAULT null_quiesce
Definition: device_if.m:318
METHOD int suspend
This is called by the power-management subsystem when a suspend has been requested by the user or by ...
Definition: device_if.m:268
METHOD int quiesce
This is called when the driver is asked to quiesce itself.
Definition: device_if.m:316
METHOD int shutdown
Called during system shutdown.
Definition: device_if.m:241
#define DEFAULT(foo, bar)
DEFAULT null_suspend
Definition: device_if.m:270
METHOD int attach
Attach a device to a device driver.
Definition: device_if.m:197
METHOD int probe
Probe to see if a device matches a driver.
Definition: device_if.m:140
INTERFACE device
Definition: device_if.m:40