aboutsummaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2024-03-13 15:05:54 -0700
committerJohn Baldwin <jhb@FreeBSD.org>2024-03-13 15:05:54 -0700
commitd77f2092ceebaba115e6be53410428f6f5f6ae83 (patch)
tree7ef42f41d2c2ca7060e9261236ce5ab27adf3d1e /sys/powerpc
parentfef01f0498aa7b256bc37bbf28ee0e8ac9b2536f (diff)
new-bus: Remove the 'type' argument from BUS_MAP/UNMAP_RESOURCE
The public bus_map/unmap_resource() API still accepts both forms, but the internal kobj methods no longer pass the argument. Implementations which need the type now use rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44129
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/mpc85xx/lbc.c12
-rw-r--r--sys/powerpc/powermac/macio.c17
-rw-r--r--sys/powerpc/powermac/uninorth.c17
-rw-r--r--sys/powerpc/powerpc/nexus.c10
-rw-r--r--sys/powerpc/ps3/ps3bus.c14
-rw-r--r--sys/powerpc/psim/iobus.c12
6 files changed, 40 insertions, 42 deletions
diff --git a/sys/powerpc/mpc85xx/lbc.c b/sys/powerpc/mpc85xx/lbc.c
index afac89b7597a..20f0baf8c395 100644
--- a/sys/powerpc/mpc85xx/lbc.c
+++ b/sys/powerpc/mpc85xx/lbc.c
@@ -69,9 +69,9 @@ static MALLOC_DEFINE(M_LBC, "localbus", "localbus devices information");
static int lbc_probe(device_t);
static int lbc_attach(device_t);
static int lbc_shutdown(device_t);
-static int lbc_map_resource(device_t, device_t, int, struct resource *,
+static int lbc_map_resource(device_t, device_t, struct resource *,
struct resource_map_request *, struct resource_map *);
-static int lbc_unmap_resource(device_t, device_t, int, 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);
@@ -831,7 +831,7 @@ lbc_deactivate_resource(device_t bus, device_t child, int type, int rid,
}
static int
-lbc_map_resource(device_t bus, device_t child, int type, struct resource *r,
+lbc_map_resource(device_t bus, device_t child, struct resource *r,
struct resource_map_request *argsp, struct resource_map *map)
{
struct resource_map_request args;
@@ -843,7 +843,7 @@ lbc_map_resource(device_t bus, device_t child, int type, struct resource *r,
return (ENXIO);
/* Mappings are only supported on I/O and memory resources. */
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
break;
@@ -864,12 +864,12 @@ lbc_map_resource(device_t bus, device_t child, int type, struct resource *r,
}
static int
-lbc_unmap_resource(device_t bus, device_t child, int type, struct resource *r,
+lbc_unmap_resource(device_t bus, device_t child, struct resource *r,
struct resource_map *map)
{
/* Mappings are only supported on I/O and memory resources. */
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
break;
diff --git a/sys/powerpc/powermac/macio.c b/sys/powerpc/powermac/macio.c
index b443f277ec89..cb4471bbcca1 100644
--- a/sys/powerpc/powermac/macio.c
+++ b/sys/powerpc/powermac/macio.c
@@ -92,10 +92,10 @@ static int macio_deactivate_resource(device_t, device_t, int, int,
struct resource *);
static int macio_release_resource(device_t, device_t, int, int,
struct resource *);
-static int macio_map_resource(device_t, device_t, int, struct resource *,
+static int macio_map_resource(device_t, device_t, struct resource *,
struct resource_map_request *,
struct resource_map *);
-static int macio_unmap_resource(device_t, device_t, int, struct resource *,
+static int macio_unmap_resource(device_t, device_t, struct resource *,
struct resource_map *);
static struct resource_list *macio_get_resource_list (device_t, device_t);
static ofw_bus_get_devinfo_t macio_get_devinfo;
@@ -663,9 +663,8 @@ macio_deactivate_resource(device_t bus, device_t child, int type, int rid,
}
static int
-macio_map_resource(device_t bus, device_t child, int type,
- struct resource *r, struct resource_map_request *argsp,
- struct resource_map *map)
+macio_map_resource(device_t bus, device_t child, struct resource *r,
+ struct resource_map_request *argsp, struct resource_map *map)
{
struct resource_map_request args;
struct macio_softc *sc;
@@ -677,7 +676,7 @@ macio_map_resource(device_t bus, device_t child, int type,
return (ENXIO);
/* Mappings are only supported on I/O and memory resources. */
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
break;
@@ -705,13 +704,13 @@ macio_map_resource(device_t bus, device_t child, int type,
}
static int
-macio_unmap_resource(device_t bus, device_t child, int type,
- struct resource *r, struct resource_map *map)
+macio_unmap_resource(device_t bus, device_t child, struct resource *r,
+ struct resource_map *map)
{
/*
* If this is a memory resource, unmap it.
*/
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
pmap_unmapdev(map->r_vaddr, map->r_size);
diff --git a/sys/powerpc/powermac/uninorth.c b/sys/powerpc/powermac/uninorth.c
index b9cb4814b986..c7842311d730 100644
--- a/sys/powerpc/powermac/uninorth.c
+++ b/sys/powerpc/powermac/uninorth.c
@@ -82,10 +82,10 @@ static int unin_chip_activate_resource(device_t, device_t, int, int,
struct resource *);
static int unin_chip_deactivate_resource(device_t, device_t, int, int,
struct resource *);
-static int unin_chip_map_resource(device_t, device_t, int, struct resource *,
+static int unin_chip_map_resource(device_t, device_t, struct resource *,
struct resource_map_request *,
struct resource_map *);
-static int unin_chip_unmap_resource(device_t, device_t, int, struct resource *,
+static int unin_chip_unmap_resource(device_t, device_t, struct resource *,
struct resource_map *);
static int unin_chip_release_resource(device_t, device_t, int, int,
struct resource *);
@@ -621,9 +621,8 @@ unin_chip_deactivate_resource(device_t bus, device_t child, int type, int rid,
}
static int
-unin_chip_map_resource(device_t bus, device_t child, int type,
- struct resource *r, struct resource_map_request *argsp,
- struct resource_map *map)
+unin_chip_map_resource(device_t bus, device_t child, struct resource *r,
+ struct resource_map_request *argsp, struct resource_map *map)
{
struct resource_map_request args;
rman_res_t length, start;
@@ -634,7 +633,7 @@ unin_chip_map_resource(device_t bus, device_t child, int type,
return (ENXIO);
/* Mappings are only supported on I/O and memory resources. */
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
break;
@@ -661,13 +660,13 @@ unin_chip_map_resource(device_t bus, device_t child, int type,
}
static int
-unin_chip_unmap_resource(device_t bus, device_t child, int type,
- struct resource *r, struct resource_map *map)
+unin_chip_unmap_resource(device_t bus, device_t child, struct resource *r,
+ struct resource_map *map)
{
/*
* If this is a memory resource, unmap it.
*/
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
pmap_unmapdev(map->r_vaddr, map->r_size);
diff --git a/sys/powerpc/powerpc/nexus.c b/sys/powerpc/powerpc/nexus.c
index 55afadcb4e20..2f7b2ba055ff 100644
--- a/sys/powerpc/powerpc/nexus.c
+++ b/sys/powerpc/powerpc/nexus.c
@@ -242,7 +242,7 @@ nexus_get_rman(device_t bus, int type, u_int flags)
}
static int
-nexus_map_resource(device_t bus, device_t child, int type, struct resource *r,
+nexus_map_resource(device_t bus, device_t child, struct resource *r,
struct resource_map_request *argsp, struct resource_map *map)
{
struct resource_map_request args;
@@ -254,7 +254,7 @@ nexus_map_resource(device_t bus, device_t child, int type, struct resource *r,
return (ENXIO);
/* Mappings are only supported on I/O and memory resources. */
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
break;
@@ -270,7 +270,7 @@ nexus_map_resource(device_t bus, device_t child, int type, struct resource *r,
/*
* If this is a memory resource, map it into the kernel.
*/
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
panic("%s:%d SYS_RES_IOPORT handling not implemented", __func__, __LINE__);
/* XXX: untested
@@ -299,14 +299,14 @@ nexus_map_resource(device_t bus, device_t child, int type, struct resource *r,
}
static int
-nexus_unmap_resource(device_t bus, device_t child, int type, struct resource *r,
+nexus_unmap_resource(device_t bus, device_t child, struct resource *r,
struct resource_map *map)
{
/*
* If this is a memory resource, unmap it.
*/
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
pmap_unmapdev(map->r_vaddr, map->r_size);
/* FALLTHROUGH */
diff --git a/sys/powerpc/ps3/ps3bus.c b/sys/powerpc/ps3/ps3bus.c
index c3f46d4942ad..62687aa5b6ff 100644
--- a/sys/powerpc/ps3/ps3bus.c
+++ b/sys/powerpc/ps3/ps3bus.c
@@ -61,10 +61,10 @@ static struct rman *ps3bus_get_rman(device_t bus, int type, u_int flags);
static struct resource *ps3bus_alloc_resource(device_t bus, device_t child,
int type, int *rid, rman_res_t start, rman_res_t end,
rman_res_t count, u_int flags);
-static int ps3bus_map_resource(device_t bus, device_t child, int type,
+static int ps3bus_map_resource(device_t bus, device_t child,
struct resource *r, struct resource_map_request *argsp,
struct resource_map *map);
-static int ps3bus_unmap_resource(device_t bus, device_t child, int type,
+static int ps3bus_unmap_resource(device_t bus, device_t child,
struct resource *r, struct resource_map *map);
static bus_dma_tag_t ps3bus_get_dma_tag(device_t dev, device_t child);
static int ps3_iommu_map(device_t dev, bus_dma_segment_t *segs, int *nsegs,
@@ -600,7 +600,7 @@ ps3bus_alloc_resource(device_t bus, device_t child, int type, int *rid,
}
static int
-ps3bus_map_resource(device_t bus, device_t child, int type, struct resource *r,
+ps3bus_map_resource(device_t bus, device_t child, struct resource *r,
struct resource_map_request *argsp, struct resource_map *map)
{
struct resource_map_request args;
@@ -612,7 +612,7 @@ ps3bus_map_resource(device_t bus, device_t child, int type, struct resource *r,
return (ENXIO);
/* Mappings are only supported on memory resources. */
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
break;
default:
@@ -637,11 +637,11 @@ ps3bus_map_resource(device_t bus, device_t child, int type, struct resource *r,
}
static int
-ps3bus_unmap_resource(device_t bus, device_t child, int type,
- struct resource *r, struct resource_map *map)
+ps3bus_unmap_resource(device_t bus, device_t child, struct resource *r,
+ struct resource_map *map)
{
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
pmap_unmapdev(map->r_vaddr, map->r_size);
return (0);
diff --git a/sys/powerpc/psim/iobus.c b/sys/powerpc/psim/iobus.c
index 79befbc8bd86..8f348f0f0614 100644
--- a/sys/powerpc/psim/iobus.c
+++ b/sys/powerpc/psim/iobus.c
@@ -80,10 +80,10 @@ 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_map_resource(device_t, device_t, int, struct resource *,
+static int iobus_map_resource(device_t, device_t, struct resource *,
struct resource_map_request *,
struct resource_map *);
-static int iobus_unmap_resource(device_t, device_t, int, struct resource *,
+static int iobus_unmap_resource(device_t, device_t, struct resource *,
struct resource_map *);
static int iobus_release_resource(device_t, device_t, int, int,
struct resource *);
@@ -410,7 +410,7 @@ iobus_deactivate_resource(device_t bus, device_t child, int type, int rid,
}
static int
-iobus_map_resource(device_t bus, device_t child, int type, struct resource *r,
+iobus_map_resource(device_t bus, device_t child, struct resource *r,
struct resource_map_request *argsp, struct resource_map *map)
{
struct resource_map_request args;
@@ -423,7 +423,7 @@ iobus_map_resource(device_t bus, device_t child, int type, struct resource *r,
return (ENXIO);
/* Mappings are only supported on I/O and memory resources. */
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
break;
@@ -448,11 +448,11 @@ iobus_map_resource(device_t bus, device_t child, int type, struct resource *r,
}
static int
-iobus_unmap_resource(device_t bus, device_t child, int type, struct resource *r,
+iobus_unmap_resource(device_t bus, device_t child, struct resource *r,
struct resource_map *map)
{
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
pmap_unmapdev(map->r_vaddr, map->r_size);