1 # Copyright (c) 2001, 2003 by Thomas Moestl <tmm@FreeBSD.org>
2 # Copyright (c) 2004 by Marius Strobl <marius@FreeBSD.org>
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
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.
14 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 # IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
18 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
23 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #include <machine/bus.h>
30 #include <dev/ofw/openfirm.h>
35 static ofw_bus_get_compat_t ofw_bus_default_get_compat;
36 static ofw_bus_get_model_t ofw_bus_default_get_model;
37 static ofw_bus_get_name_t ofw_bus_default_get_name;
38 static ofw_bus_get_node_t ofw_bus_default_get_node;
39 static ofw_bus_get_type_t ofw_bus_default_get_type;
42 ofw_bus_default_get_compat(device_t bus, device_t dev)
49 ofw_bus_default_get_model(device_t bus, device_t dev)
56 ofw_bus_default_get_name(device_t bus, device_t dev)
63 ofw_bus_default_get_node(device_t bus, device_t dev)
70 ofw_bus_default_get_type(device_t bus, device_t dev)
77 # Get the alternate firmware name for the device dev on the bus. The default
78 # method will return NULL, which means the device doesn't have such a property.
79 METHOD const char * get_compat {
82 } DEFAULT ofw_bus_default_get_compat;
84 # Get the firmware model name for the device dev on the bus. The default method
85 # will return NULL, which means the device doesn't have such a property.
86 METHOD const char * get_model {
89 } DEFAULT ofw_bus_default_get_model;
91 # Get the firmware name for the device dev on the bus. The default method will
92 # return NULL, which means the device doesn't have such a property.
93 METHOD const char * get_name {
96 } DEFAULT ofw_bus_default_get_name;
98 # Get the firmware node for the device dev on the bus. The default method will
99 # return 0, which signals that there is no such node.
100 METHOD phandle_t get_node {
103 } DEFAULT ofw_bus_default_get_node;
105 # Get the firmware device type for the device dev on the bus. The default
106 # method will return NULL, which means the device doesn't have such a property.
107 METHOD const char * get_type {
110 } DEFAULT ofw_bus_default_get_type;