Deleted Added
full compact
ofw_bus_if.m (233018) ofw_bus_if.m (256994)
1#-
2# Copyright (c) 2001, 2003 by Thomas Moestl <tmm@FreeBSD.org>
3# Copyright (c) 2004, 2005 by Marius Strobl <marius@FreeBSD.org>
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 9 unchanged lines hidden (view full) ---

18# IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
19# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
24# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25#
1#-
2# Copyright (c) 2001, 2003 by Thomas Moestl <tmm@FreeBSD.org>
3# Copyright (c) 2004, 2005 by Marius Strobl <marius@FreeBSD.org>
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 9 unchanged lines hidden (view full) ---

18# IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
19# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
24# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25#
26# $FreeBSD: head/sys/dev/ofw/ofw_bus_if.m 233018 2012-03-15 22:53:39Z nwhitehorn $
26# $FreeBSD: head/sys/dev/ofw/ofw_bus_if.m 256994 2013-10-23 17:24:21Z nwhitehorn $
27
28# Interface for retrieving the package handle and a subset, namely
29# 'compatible', 'device_type', 'model' and 'name', of the standard
30# properties of a device on an Open Firmware assisted bus for use
31# in device drivers. The rest of the standard properties, 'address',
32# 'interrupts', 'reg' and 'status', are not covered by this interface
33# as they are expected to be only of interest in the respective bus
34# driver.

--- 16 unchanged lines hidden (view full) ---

51
52CODE {
53 static ofw_bus_get_devinfo_t ofw_bus_default_get_devinfo;
54 static ofw_bus_get_compat_t ofw_bus_default_get_compat;
55 static ofw_bus_get_model_t ofw_bus_default_get_model;
56 static ofw_bus_get_name_t ofw_bus_default_get_name;
57 static ofw_bus_get_node_t ofw_bus_default_get_node;
58 static ofw_bus_get_type_t ofw_bus_default_get_type;
27
28# Interface for retrieving the package handle and a subset, namely
29# 'compatible', 'device_type', 'model' and 'name', of the standard
30# properties of a device on an Open Firmware assisted bus for use
31# in device drivers. The rest of the standard properties, 'address',
32# 'interrupts', 'reg' and 'status', are not covered by this interface
33# as they are expected to be only of interest in the respective bus
34# driver.

--- 16 unchanged lines hidden (view full) ---

51
52CODE {
53 static ofw_bus_get_devinfo_t ofw_bus_default_get_devinfo;
54 static ofw_bus_get_compat_t ofw_bus_default_get_compat;
55 static ofw_bus_get_model_t ofw_bus_default_get_model;
56 static ofw_bus_get_name_t ofw_bus_default_get_name;
57 static ofw_bus_get_node_t ofw_bus_default_get_node;
58 static ofw_bus_get_type_t ofw_bus_default_get_type;
59 static ofw_bus_map_intr_t ofw_bus_default_map_intr;
60 static ofw_bus_config_intr_t ofw_bus_default_config_intr;
59
60 static const struct ofw_bus_devinfo *
61 ofw_bus_default_get_devinfo(device_t bus, device_t dev)
62 {
63
64 return (NULL);
65 }
66

--- 26 unchanged lines hidden (view full) ---

93 }
94
95 static const char *
96 ofw_bus_default_get_type(device_t bus, device_t dev)
97 {
98
99 return (NULL);
100 }
61
62 static const struct ofw_bus_devinfo *
63 ofw_bus_default_get_devinfo(device_t bus, device_t dev)
64 {
65
66 return (NULL);
67 }
68

--- 26 unchanged lines hidden (view full) ---

95 }
96
97 static const char *
98 ofw_bus_default_get_type(device_t bus, device_t dev)
99 {
100
101 return (NULL);
102 }
103
104 int
105 ofw_bus_default_map_intr(device_t bus, device_t dev, phandle_t iparent,
106 int irq)
107 {
108 /* Propagate up the bus hierarchy until someone handles it. */
109 if (device_get_parent(bus) != NULL)
110 return OFW_BUS_MAP_INTR(device_get_parent(bus), dev,
111 iparent, irq);
112
113 /* If that fails, then assume a one-domain system */
114 return (irq);
115 }
116
117 int
118 ofw_bus_default_config_intr(device_t bus, device_t dev, int irq,
119 int sense)
120 {
121 /* Propagate up the bus hierarchy until someone handles it. */
122 if (device_get_parent(bus) != NULL)
123 return OFW_BUS_CONFIG_INTR(device_get_parent(bus), dev,
124 irq, sense);
125
126 return (ENXIO);
127 }
101};
102
103# Get the ofw_bus_devinfo struct for the device dev on the bus. Used for bus
104# drivers which use the generic methods in ofw_bus_subr.c to implement the
105# reset of this interface. The default method will return NULL, which means
106# there is no such struct associated with the device.
107METHOD const struct ofw_bus_devinfo * get_devinfo {
108 device_t bus;

--- 29 unchanged lines hidden (view full) ---

138} DEFAULT ofw_bus_default_get_node;
139
140# Get the firmware device type for the device dev on the bus. The default
141# method will return NULL, which means the device doesn't have such a property.
142METHOD const char * get_type {
143 device_t bus;
144 device_t dev;
145} DEFAULT ofw_bus_default_get_type;
128};
129
130# Get the ofw_bus_devinfo struct for the device dev on the bus. Used for bus
131# drivers which use the generic methods in ofw_bus_subr.c to implement the
132# reset of this interface. The default method will return NULL, which means
133# there is no such struct associated with the device.
134METHOD const struct ofw_bus_devinfo * get_devinfo {
135 device_t bus;

--- 29 unchanged lines hidden (view full) ---

165} DEFAULT ofw_bus_default_get_node;
166
167# Get the firmware device type for the device dev on the bus. The default
168# method will return NULL, which means the device doesn't have such a property.
169METHOD const char * get_type {
170 device_t bus;
171 device_t dev;
172} DEFAULT ofw_bus_default_get_type;
173
174# Map an (interrupt parent, IRQ) pair to a unique system-wide interrupt number.
175METHOD int map_intr {
176 device_t bus;
177 device_t dev;
178 phandle_t iparent;
179 int irq;
180} DEFAULT ofw_bus_default_map_intr;
181
182# Configure an interrupt using the device-tree encoded sense key (the second
183# value in the interrupts property if interrupt-cells is 2). IRQ should be
184# encoded as from ofw_bus_map_intr().
185METHOD int config_intr {
186 device_t bus;
187 device_t dev;
188 int irq;
189 int sense;
190} DEFAULT ofw_bus_default_config_intr;
191