aboutsummaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/mpc85xx/lbc.c31
-rw-r--r--sys/powerpc/powermac/macgpio.c18
-rw-r--r--sys/powerpc/powermac/macio.c28
-rw-r--r--sys/powerpc/powermac/uninorth.c25
-rw-r--r--sys/powerpc/psim/iobus.c26
5 files changed, 48 insertions, 80 deletions
diff --git a/sys/powerpc/mpc85xx/lbc.c b/sys/powerpc/mpc85xx/lbc.c
index 20f0baf8c395..6884df611494 100644
--- a/sys/powerpc/mpc85xx/lbc.c
+++ b/sys/powerpc/mpc85xx/lbc.c
@@ -74,9 +74,8 @@ static int lbc_map_resource(device_t, device_t, struct resource *,
static int lbc_unmap_resource(device_t, device_t, struct resource *,
struct resource_map *map);
static int lbc_activate_resource(device_t bus, device_t child,
- int type, int rid, struct resource *r);
-static int lbc_deactivate_resource(device_t bus,
- device_t child, int type __unused, int rid,
+ struct resource *r);
+static int lbc_deactivate_resource(device_t bus, device_t child,
struct resource *r);
static struct rman *lbc_get_rman(device_t, int, u_int);
static struct resource *lbc_alloc_resource(device_t, device_t, int, int *,
@@ -795,36 +794,26 @@ lbc_release_resource(device_t dev, device_t child, int type, int rid,
}
static int
-lbc_activate_resource(device_t bus, device_t child, int type, int rid,
- struct resource *r)
+lbc_activate_resource(device_t bus, device_t child, struct resource *r)
{
- switch (type) {
- case SYS_RES_IOPORT:
- type = SYS_RES_MEMORY;
- /* FALLTHROUGH */
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
- return (bus_generic_rman_activate_resource(bus, child, type,
- rid, r));
+ return (bus_generic_rman_activate_resource(bus, child, r));
case SYS_RES_IRQ:
- return (bus_generic_activate_resource(bus, child, type, rid, r));
+ return (bus_generic_activate_resource(bus, child, r));
default:
return (EINVAL);
}
}
static int
-lbc_deactivate_resource(device_t bus, device_t child, int type, int rid,
- struct resource *r)
+lbc_deactivate_resource(device_t bus, device_t child, struct resource *r)
{
- switch (type) {
- case SYS_RES_IOPORT:
- type = SYS_RES_MEMORY;
- /* FALLTHROUGH */
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
- return (bus_generic_rman_deactivate_resource(bus, child, type,
- rid, r));
+ return (bus_generic_rman_deactivate_resource(bus, child, r));
case SYS_RES_IRQ:
- return (bus_generic_deactivate_resource(bus, child, type, rid, r));
+ return (bus_generic_deactivate_resource(bus, child, r));
default:
return (EINVAL);
}
diff --git a/sys/powerpc/powermac/macgpio.c b/sys/powerpc/powermac/macgpio.c
index d76b5abe79e1..37bd63392449 100644
--- a/sys/powerpc/powermac/macgpio.c
+++ b/sys/powerpc/powermac/macgpio.c
@@ -71,9 +71,9 @@ static int macgpio_print_child(device_t dev, device_t child);
static void macgpio_probe_nomatch(device_t, device_t);
static struct resource *macgpio_alloc_resource(device_t, device_t, int, int *,
rman_res_t, rman_res_t, rman_res_t, u_int);
-static int macgpio_activate_resource(device_t, device_t, int, int,
+static int macgpio_activate_resource(device_t, device_t,
struct resource *);
-static int macgpio_deactivate_resource(device_t, device_t, int, int,
+static int macgpio_deactivate_resource(device_t, device_t,
struct resource *);
static ofw_bus_get_devinfo_t macgpio_get_devinfo;
static int macgpio_suspend(device_t dev);
@@ -275,8 +275,7 @@ macgpio_alloc_resource(device_t bus, device_t child, int type, int *rid,
}
static int
-macgpio_activate_resource(device_t bus, device_t child, int type, int rid,
- struct resource *res)
+macgpio_activate_resource(device_t bus, device_t child, struct resource *res)
{
struct macgpio_softc *sc;
struct macgpio_devinfo *dinfo;
@@ -285,7 +284,7 @@ macgpio_activate_resource(device_t bus, device_t child, int type, int rid,
sc = device_get_softc(bus);
dinfo = device_get_ivars(child);
- if (type != SYS_RES_IRQ)
+ if (rman_get_type(res) != SYS_RES_IRQ)
return ENXIO;
if (dinfo->gpio_num >= 0) {
@@ -294,12 +293,11 @@ macgpio_activate_resource(device_t bus, device_t child, int type, int rid,
bus_write_1(sc->sc_gpios,dinfo->gpio_num,val);
}
- return (bus_activate_resource(bus, type, rid, res));
+ return (bus_generic_activate_resource(bus, child, res));
}
static int
-macgpio_deactivate_resource(device_t bus, device_t child, int type, int rid,
- struct resource *res)
+macgpio_deactivate_resource(device_t bus, device_t child, struct resource *res)
{
struct macgpio_softc *sc;
struct macgpio_devinfo *dinfo;
@@ -308,7 +306,7 @@ macgpio_deactivate_resource(device_t bus, device_t child, int type, int rid,
sc = device_get_softc(bus);
dinfo = device_get_ivars(child);
- if (type != SYS_RES_IRQ)
+ if (rman_get_type(res) != SYS_RES_IRQ)
return ENXIO;
if (dinfo->gpio_num >= 0) {
@@ -317,7 +315,7 @@ macgpio_deactivate_resource(device_t bus, device_t child, int type, int rid,
bus_write_1(sc->sc_gpios,dinfo->gpio_num,val);
}
- return (bus_deactivate_resource(bus, type, rid, res));
+ return (bus_generic_deactivate_resource(bus, child, res));
}
uint8_t
diff --git a/sys/powerpc/powermac/macio.c b/sys/powerpc/powermac/macio.c
index cb4471bbcca1..eb6980005904 100644
--- a/sys/powerpc/powermac/macio.c
+++ b/sys/powerpc/powermac/macio.c
@@ -86,10 +86,8 @@ static struct resource *macio_alloc_resource(device_t, device_t, int, int *,
u_int);
static int macio_adjust_resource(device_t, device_t, struct resource *,
rman_res_t, rman_res_t);
-static int macio_activate_resource(device_t, device_t, int, int,
- struct resource *);
-static int macio_deactivate_resource(device_t, device_t, int, int,
- struct resource *);
+static int macio_activate_resource(device_t, device_t, struct resource *);
+static int macio_deactivate_resource(device_t, device_t, struct resource *);
static int macio_release_resource(device_t, device_t, int, int,
struct resource *);
static int macio_map_resource(device_t, device_t, struct resource *,
@@ -629,34 +627,28 @@ macio_release_resource(device_t bus, device_t child, int type, int rid,
}
static int
-macio_activate_resource(device_t bus, device_t child, int type, int rid,
- struct resource *res)
+macio_activate_resource(device_t bus, device_t child, struct resource *res)
{
- switch (type) {
+ switch (rman_get_type(res)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
- return (bus_generic_rman_activate_resource(bus, child, type,
- rid, res));
+ return (bus_generic_rman_activate_resource(bus, child, res));
case SYS_RES_IRQ:
- return (bus_generic_activate_resource(bus, child, type, rid,
- res));
+ return (bus_generic_activate_resource(bus, child, res));
default:
return (EINVAL);
}
}
static int
-macio_deactivate_resource(device_t bus, device_t child, int type, int rid,
- struct resource *res)
+macio_deactivate_resource(device_t bus, device_t child, struct resource *res)
{
- switch (type) {
+ switch (rman_get_type(res)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
- return (bus_generic_rman_deactivate_resource(bus, child, type,
- rid, res));
+ return (bus_generic_rman_deactivate_resource(bus, child, res));
case SYS_RES_IRQ:
- return (bus_generic_deactivate_resource(bus, child, type, rid,
- res));
+ return (bus_generic_deactivate_resource(bus, child, res));
default:
return (EINVAL);
}
diff --git a/sys/powerpc/powermac/uninorth.c b/sys/powerpc/powermac/uninorth.c
index c7842311d730..96caf4f34530 100644
--- a/sys/powerpc/powermac/uninorth.c
+++ b/sys/powerpc/powermac/uninorth.c
@@ -78,9 +78,9 @@ static struct resource *unin_chip_alloc_resource(device_t, device_t, int, int *,
static int unin_chip_adjust_resource(device_t, device_t,
struct resource *, rman_res_t,
rman_res_t);
-static int unin_chip_activate_resource(device_t, device_t, int, int,
+static int unin_chip_activate_resource(device_t, device_t,
struct resource *);
-static int unin_chip_deactivate_resource(device_t, device_t, int, int,
+static int unin_chip_deactivate_resource(device_t, device_t,
struct resource *);
static int unin_chip_map_resource(device_t, device_t, struct resource *,
struct resource_map_request *,
@@ -587,34 +587,29 @@ unin_chip_release_resource(device_t bus, device_t child, int type, int rid,
}
static int
-unin_chip_activate_resource(device_t bus, device_t child, int type, int rid,
- struct resource *res)
+unin_chip_activate_resource(device_t bus, device_t child, struct resource *res)
{
- switch (type) {
+ switch (rman_get_type(res)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
- return (bus_generic_rman_activate_resource(bus, child, type,
- rid, res));
+ return (bus_generic_rman_activate_resource(bus, child, res));
case SYS_RES_IRQ:
- return (bus_generic_activate_resource(bus, child, type, rid,
- res));
+ return (bus_generic_activate_resource(bus, child, res));
default:
return (EINVAL);
}
}
static int
-unin_chip_deactivate_resource(device_t bus, device_t child, int type, int rid,
+unin_chip_deactivate_resource(device_t bus, device_t child,
struct resource *res)
{
- switch (type) {
+ switch (rman_get_type(res)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
- return (bus_generic_rman_deactivate_resource(bus, child, type,
- rid, res));
+ return (bus_generic_rman_deactivate_resource(bus, child, res));
case SYS_RES_IRQ:
- return (bus_generic_deactivate_resource(bus, child, type, rid,
- res));
+ return (bus_generic_deactivate_resource(bus, child, res));
default:
return (EINVAL);
}
diff --git a/sys/powerpc/psim/iobus.c b/sys/powerpc/psim/iobus.c
index 8f348f0f0614..cea6fc5fb15e 100644
--- a/sys/powerpc/psim/iobus.c
+++ b/sys/powerpc/psim/iobus.c
@@ -76,10 +76,8 @@ static struct resource *iobus_alloc_resource(device_t, device_t, int, int *,
u_int);
static int iobus_adjust_resource(device_t, device_t, struct resource *,
rman_res_t, rman_res_t);
-static int iobus_activate_resource(device_t, device_t, int, int,
- struct resource *);
-static int iobus_deactivate_resource(device_t, device_t, int, int,
- struct resource *);
+static int iobus_activate_resource(device_t, device_t, struct resource *);
+static int iobus_deactivate_resource(device_t, device_t, struct resource *);
static int iobus_map_resource(device_t, device_t, struct resource *,
struct resource_map_request *,
struct resource_map *);
@@ -376,34 +374,30 @@ iobus_release_resource(device_t bus, device_t child, int type, int rid,
}
static int
-iobus_activate_resource(device_t bus, device_t child, int type, int rid,
- struct resource *res)
+iobus_activate_resource(device_t bus, device_t child, struct resource *res)
{
- switch (type) {
+ switch (rman_get_type(res)) {
case SYS_RES_IRQ:
- return (bus_generic_activate_resource(bus, child, type, rid, res));
+ return (bus_generic_activate_resource(bus, child, res));
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
- return (bus_generic_rman_activate_resource(bus, child, type,
- rid, res));
+ return (bus_generic_rman_activate_resource(bus, child, res));
default:
return (EINVAL);
}
}
static int
-iobus_deactivate_resource(device_t bus, device_t child, int type, int rid,
- struct resource *res)
+iobus_deactivate_resource(device_t bus, device_t child, struct resource *res)
{
- switch (type) {
+ switch (rman_get_type(res)) {
case SYS_RES_IRQ:
- return (bus_generic_deactivate_resource(bus, child, type, rid, res));
+ return (bus_generic_deactivate_resource(bus, child, res));
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
- return (bus_generic_rman_deactivate_resource(bus, child, type,
- rid, res));
+ return (bus_generic_rman_deactivate_resource(bus, child, res));
default:
return (EINVAL);
}