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
# $FreeBSD$
27
#
28
29
#include <sys/bus.h>
30
40
INTERFACE
device
;
41
42
# Needed for timestamping device probe/attach calls
43
HEADER
{
44
#include <sys/tslog.h>
45
}
46
47
#
48
# Default implementations of some methods.
49
#
50
CODE
{
51
static
int
null_shutdown
(device_t dev)
52
{
53
return
0;
54
}
55
56
static
int
null_suspend
(device_t dev)
57
{
58
return
0;
59
}
60
61
static
int
null_resume
(device_t dev)
62
{
63
return
0;
64
}
65
66
static
int
null_quiesce
(device_t dev)
67
{
68
return
0;
69
}
70
71
static
void
*
null_register
(device_t dev)
72
{
73
return
NULL;
74
}
75
};
76
150
PROLOG
{
151
TSENTER2(
device_get_name
(dev));
152
}
153
EPILOG
{
154
TSEXIT2(
device_get_name
(dev));
155
}
156
METHOD
int
probe
{
157
device_t dev;
158
};
159
185
STATICMETHOD
void
identify
{
186
driver_t *driver;
187
device_t
parent
;
188
};
189
213
PROLOG
{
214
TSENTER2(
device_get_name
(dev));
215
}
216
EPILOG
{
217
TSEXIT2(
device_get_name
(dev));
218
}
219
METHOD
int
attach
{
220
device_t dev;
221
};
222
245
METHOD
int
detach
{
246
device_t dev;
247
};
248
263
METHOD
int
shutdown
{
264
device_t dev;
265
}
DEFAULT
null_shutdown
;
266
290
METHOD
int
suspend
{
291
device_t dev;
292
}
DEFAULT
null_suspend
;
293
312
METHOD
int
resume
{
313
device_t dev;
314
}
DEFAULT
null_resume
;
315
338
METHOD
int
quiesce
{
339
device_t dev;
340
}
DEFAULT
null_quiesce
;
341
359
METHOD
void
*
register
{
360
device_t dev;
361
}
DEFAULT
null_register
;
CODE
CODE
Definition:
bus_if.m:44
suspend
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:290
resume
METHOD int resume
This is called when the system resumes after a suspend.
Definition:
device_if.m:312
null_resume
DEFAULT null_resume
Definition:
device_if.m:314
parent
device_t parent
Definition:
device_if.m:187
probe
METHOD int probe
Definition:
device_if.m:156
EPILOG
EPILOG
Definition:
device_if.m:153
HEADER
HEADER
Definition:
device_if.m:43
detach
METHOD int detach
Detach a driver from a device.
Definition:
device_if.m:245
quiesce
METHOD int quiesce
This is called when the driver is asked to quiesce itself.
Definition:
device_if.m:338
null_quiesce
DEFAULT null_quiesce
Definition:
device_if.m:340
null_shutdown
DEFAULT null_shutdown
Definition:
device_if.m:265
device
INTERFACE device
Definition:
device_if.m:40
null_suspend
DEFAULT null_suspend
Definition:
device_if.m:292
PROLOG
PROLOG
Probe to see if a device matches a driver.
Definition:
device_if.m:150
identify
STATICMETHOD void identify
Allow a device driver to detect devices not otherwise enumerated.
Definition:
device_if.m:185
shutdown
METHOD int shutdown
Called during system shutdown.
Definition:
device_if.m:263
null_register
DEFAULT null_register
Definition:
device_if.m:361
attach
METHOD int attach
Definition:
device_if.m:219
device_get_name
const char * device_get_name(device_t dev)
Return the name of the device's devclass or NULL if there is none.
Definition:
subr_bus.c:2342
DEFAULT
#define DEFAULT(foo, bar)
kern
device_if.m
Generated by
1.9.3