Deleted Added
full compact
pcf_ebus.c (133589) pcf_ebus.c (146966)
1/*-
2 * Copyright (c) 2004 Marius Strobl, Joerg Wunsch
3 *
4 * derived from sys/i386/isa/pcf.c which is:
5 *
6 * Copyright (c) 1998 Nicolas Souchu, Marc Bouget
7 * All rights reserved.
8 *

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

23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004 Marius Strobl, Joerg Wunsch
3 *
4 * derived from sys/i386/isa/pcf.c which is:
5 *
6 * Copyright (c) 1998 Nicolas Souchu, Marc Bouget
7 * All rights reserved.
8 *

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

23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/pcf/pcf_ebus.c 133589 2004-08-12 17:41:33Z marius $");
31__FBSDID("$FreeBSD: head/sys/dev/pcf/pcf_ebus.c 146966 2005-06-04 20:29:28Z marius $");
32
33/*
34 * Device specific driver for the EBus i2c devices found on some sun4u
35 * systems. On systems not having a boot-bus controller the i2c devices
36 * are PCF8584.
37 *
38 * Known onboard slave devices on the primary bus are:
39 *

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

146
147 /* get OFW node of the pcf */
148 if ((node = ofw_bus_get_node(dev)) <= 0) {
149 device_printf(dev, "cannot get OFW node\n");
150 goto error;
151 }
152
153 /* IO port is mandatory */
32
33/*
34 * Device specific driver for the EBus i2c devices found on some sun4u
35 * systems. On systems not having a boot-bus controller the i2c devices
36 * are PCF8584.
37 *
38 * Known onboard slave devices on the primary bus are:
39 *

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

146
147 /* get OFW node of the pcf */
148 if ((node = ofw_bus_get_node(dev)) <= 0) {
149 device_printf(dev, "cannot get OFW node\n");
150 goto error;
151 }
152
153 /* IO port is mandatory */
154 sc->res_ioport = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
154 sc->res_ioport = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
155 &sc->rid_ioport, RF_ACTIVE);
156 if (sc->res_ioport == 0) {
157 device_printf(dev, "cannot reserve I/O port range\n");
158 goto error;
159 }
160 sc->bt_ioport = rman_get_bustag(sc->res_ioport);
161 sc->bh_ioport = rman_get_bushandle(sc->res_ioport);
162

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

213error:
214 if (sc->res_irq != 0) {
215 bus_deactivate_resource(dev, SYS_RES_IRQ, sc->rid_irq,
216 sc->res_irq);
217 bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq,
218 sc->res_irq);
219 }
220 if (sc->res_ioport != 0) {
155 &sc->rid_ioport, RF_ACTIVE);
156 if (sc->res_ioport == 0) {
157 device_printf(dev, "cannot reserve I/O port range\n");
158 goto error;
159 }
160 sc->bt_ioport = rman_get_bustag(sc->res_ioport);
161 sc->bh_ioport = rman_get_bushandle(sc->res_ioport);
162

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

213error:
214 if (sc->res_irq != 0) {
215 bus_deactivate_resource(dev, SYS_RES_IRQ, sc->rid_irq,
216 sc->res_irq);
217 bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq,
218 sc->res_irq);
219 }
220 if (sc->res_ioport != 0) {
221 bus_deactivate_resource(dev, SYS_RES_IOPORT, sc->rid_ioport,
221 bus_deactivate_resource(dev, SYS_RES_MEMORY, sc->rid_ioport,
222 sc->res_ioport);
222 sc->res_ioport);
223 bus_release_resource(dev, SYS_RES_IOPORT, sc->rid_ioport,
223 bus_release_resource(dev, SYS_RES_MEMORY, sc->rid_ioport,
224 sc->res_ioport);
225 }
226 return (rv);
227}
228
229static int
230pcf_ebus_detach(device_t dev)
231{

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

244 BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->res_irq,
245 sc->intr_cookie);
246 bus_deactivate_resource(dev, SYS_RES_IRQ, sc->rid_irq,
247 sc->res_irq);
248 bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq,
249 sc->res_irq);
250 }
251
224 sc->res_ioport);
225 }
226 return (rv);
227}
228
229static int
230pcf_ebus_detach(device_t dev)
231{

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

244 BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->res_irq,
245 sc->intr_cookie);
246 bus_deactivate_resource(dev, SYS_RES_IRQ, sc->rid_irq,
247 sc->res_irq);
248 bus_release_resource(dev, SYS_RES_IRQ, sc->rid_irq,
249 sc->res_irq);
250 }
251
252 bus_deactivate_resource(dev, SYS_RES_IOPORT, sc->rid_ioport,
252 bus_deactivate_resource(dev, SYS_RES_MEMORY, sc->rid_ioport,
253 sc->res_ioport);
253 sc->res_ioport);
254 bus_release_resource(dev, SYS_RES_IOPORT, sc->rid_ioport,
254 bus_release_resource(dev, SYS_RES_MEMORY, sc->rid_ioport,
255 sc->res_ioport);
256
257 return (0);
258}
259
260DRIVER_MODULE(pcf_ebus, ebus, pcf_ebus_driver, pcf_ebus_devclass, 0, 0);
261MODULE_DEPEND(pcf_ebus, iicbus, PCF_MINVER, PCF_PREFVER, PCF_MAXVER);
262MODULE_VERSION(pcf_ebus, PCF_MODVER);
255 sc->res_ioport);
256
257 return (0);
258}
259
260DRIVER_MODULE(pcf_ebus, ebus, pcf_ebus_driver, pcf_ebus_devclass, 0, 0);
261MODULE_DEPEND(pcf_ebus, iicbus, PCF_MINVER, PCF_PREFVER, PCF_MAXVER);
262MODULE_VERSION(pcf_ebus, PCF_MODVER);