2 # Copyright (c) 2001, 2003 by Thomas Moestl <tmm@FreeBSD.org>
3 # Copyright (c) 2004, 2005 by Marius Strobl <marius@FreeBSD.org>
4 # Copyright (c) 2006 by Kip Macy <kmacy@FreeBSD.org>
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 # IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
20 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 # Interface for retrieving the package handle and a subset, namely
30 # 'compatible', 'device_type', 'model' and 'name', of the standard
31 # properties of a device on an Open Firmware assisted bus for use
32 # in device drivers. The rest of the standard properties, 'address',
33 # 'interrupts', 'reg' and 'status', are not covered by this interface
34 # as they are expected to be only of interest in the respective bus
39 #include <machine/cddl/mdesc.h>
44 struct mdesc_bus_devinfo {
53 static mdesc_bus_get_devinfo_t mdesc_bus_default_get_devinfo;
54 static mdesc_bus_get_compat_t mdesc_bus_default_get_compat;
55 static mdesc_bus_get_name_t mdesc_bus_default_get_name;
56 static mdesc_bus_get_type_t mdesc_bus_default_get_type;
58 static const struct mdesc_bus_devinfo *
59 mdesc_bus_default_get_devinfo(device_t bus, device_t dev)
66 mdesc_bus_default_get_compat(device_t bus, device_t dev)
73 mdesc_bus_default_get_name(device_t bus, device_t dev)
80 mdesc_bus_default_get_type(device_t bus, device_t dev)
87 mdesc_bus_default_get_handle(device_t bus, device_t dev)
94 # Get the mdesc_bus_devinfo struct for the device dev on the bus. Used for bus
95 # drivers which use the generic methods in mdesc_bus_subr.c to implement the
96 # reset of this interface. The default method will return NULL, which means
97 # there is no such struct associated with the device.
98 METHOD const struct mdesc_bus_devinfo * get_devinfo {
101 } DEFAULT mdesc_bus_default_get_devinfo;
103 # Get the alternate firmware name for the device dev on the bus. The default
104 # method will return NULL, which means the device doesn't have such a property.
105 METHOD const char * get_compat {
108 } DEFAULT mdesc_bus_default_get_compat;
110 # Get the firmware name for the device dev on the bus. The default method will
111 # return NULL, which means the device doesn't have such a property.
112 METHOD const char * get_name {
115 } DEFAULT mdesc_bus_default_get_name;
117 # Get the firmware device type for the device dev on the bus. The default
118 # method will return NULL, which means the device doesn't have such a property.
119 METHOD const char * get_type {
122 } DEFAULT mdesc_bus_default_get_type;
124 METHOD uint64_t get_handle {
127 } DEFAULT mdesc_bus_default_get_handle;