aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/man/man9/bus_map_resource.916
-rw-r--r--sys/arm/arm/nexus.c8
-rw-r--r--sys/arm/mv/mv_pci.c14
-rw-r--r--sys/arm64/arm64/nexus.c11
-rw-r--r--sys/arm64/cavium/thunder_pcie_pem.c19
-rw-r--r--sys/dev/acpica/acpi.c19
-rw-r--r--sys/dev/fdt/simplebus.c30
-rw-r--r--sys/dev/ofw/ofw_pcib.c19
-rw-r--r--sys/dev/pci/pci_host_generic.c22
-rw-r--r--sys/dev/pci/pci_pci.c15
-rw-r--r--sys/dev/vmd/vmd.c8
-rw-r--r--sys/kern/bus_if.m4
-rw-r--r--sys/kern/subr_bus.c35
-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
-rw-r--r--sys/riscv/riscv/nexus.c8
-rw-r--r--sys/sys/bus.h25
-rw-r--r--sys/x86/x86/nexus.c9
22 files changed, 148 insertions, 196 deletions
diff --git a/share/man/man9/bus_map_resource.9 b/share/man/man9/bus_map_resource.9
index bf86e7805964..5cccb815b73b 100644
--- a/share/man/man9/bus_map_resource.9
+++ b/share/man/man9/bus_map_resource.9
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd February 5, 2018
+.Dd March 13, 2024
.Dt BUS_MAP_RESOURCE 9
.Os
.Sh NAME
@@ -38,12 +38,12 @@
.In machine/resource.h
.Ft int
.Fo bus_map_resource
-.Fa "device_t dev" "int type" "struct resource *r"
+.Fa "device_t dev" "struct resource *r"
.Fa "struct resource_map_request *args" "struct resource_map *map"
.Fc
.Ft int
.Fo bus_unmap_resource
-.Fa "device_t dev" "int type" "struct resource *r" "struct resource_map *map"
+.Fa "device_t dev" "struct resource *r" "struct resource_map *map"
.Fc
.Ft void
.Fn resource_init_map_request "struct resource_map_request *args"
@@ -58,16 +58,6 @@ The arguments are as follows:
.Bl -tag -width indent
.It Fa dev
The device that owns the resource.
-.It Fa type
-The type of resource to map.
-It is one of:
-.Pp
-.Bl -tag -width ".Dv SYS_RES_MEMORY" -compact
-.It Dv SYS_RES_IOPORT
-for I/O ports
-.It Dv SYS_RES_MEMORY
-for I/O memory
-.El
.It Fa r
A pointer to the
.Vt "struct resource"
diff --git a/sys/arm/arm/nexus.c b/sys/arm/arm/nexus.c
index eb0d1a5b7ded..0cb896ce346e 100644
--- a/sys/arm/arm/nexus.c
+++ b/sys/arm/arm/nexus.c
@@ -331,7 +331,7 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid,
}
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;
@@ -342,7 +342,7 @@ nexus_map_resource(device_t bus, device_t child, int type, struct resource *r,
if (!(rman_get_flags(r) & RF_ACTIVE))
return (ENXIO);
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
break;
@@ -374,11 +374,11 @@ 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)
{
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
#ifdef FDT
diff --git a/sys/arm/mv/mv_pci.c b/sys/arm/mv/mv_pci.c
index 42ee3180a942..a8a6d1d50002 100644
--- a/sys/arm/mv/mv_pci.c
+++ b/sys/arm/mv/mv_pci.c
@@ -353,9 +353,9 @@ static int mv_pcib_activate_resource(device_t, device_t, int, int,
struct resource *r);
static int mv_pcib_deactivate_resource(device_t, device_t, int, int,
struct resource *r);
-static int mv_pcib_map_resource(device_t, device_t, int, struct resource *,
+static int mv_pcib_map_resource(device_t, device_t, struct resource *,
struct resource_map_request *, struct resource_map *);
-static int mv_pcib_unmap_resource(device_t, device_t, int, struct resource *,
+static int mv_pcib_unmap_resource(device_t, device_t, struct resource *,
struct resource_map *);
static int mv_pcib_read_ivar(device_t, device_t, int, uintptr_t *);
static int mv_pcib_write_ivar(device_t, device_t, int, uintptr_t);
@@ -1034,7 +1034,7 @@ mv_pcib_deactivate_resource(device_t dev, device_t child, int type, int rid,
}
static int
-mv_pcib_map_resource(device_t dev, device_t child, int type, struct resource *r,
+mv_pcib_map_resource(device_t dev, device_t child, struct resource *r,
struct resource_map_request *argsp, struct resource_map *map)
{
struct resource_map_request args;
@@ -1046,7 +1046,7 @@ mv_pcib_map_resource(device_t dev, 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;
@@ -1066,10 +1066,10 @@ mv_pcib_map_resource(device_t dev, device_t child, int type, struct resource *r,
}
static int
-mv_pcib_unmap_resource(device_t dev, device_t child, int type,
- struct resource *r, struct resource_map *map)
+mv_pcib_unmap_resource(device_t dev, 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:
return (0);
diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c
index d2081d40d26a..ed500ba5ea6d 100644
--- a/sys/arm64/arm64/nexus.c
+++ b/sys/arm64/arm64/nexus.c
@@ -350,8 +350,7 @@ nexus_activate_resource_flags(device_t bus, device_t child, int type, int rid,
&use_np);
if (use_np)
args.memattr = VM_MEMATTR_DEVICE_NP;
- err = nexus_map_resource(bus, child, type, r, &args,
- &map);
+ err = nexus_map_resource(bus, child, r, &args, &map);
if (err != 0) {
rman_deactivate_resource(r);
return (err);
@@ -408,7 +407,7 @@ nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
}
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;
@@ -420,7 +419,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;
@@ -445,11 +444,11 @@ 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)
{
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
pmap_unmapdev(map->r_vaddr, map->r_size);
diff --git a/sys/arm64/cavium/thunder_pcie_pem.c b/sys/arm64/cavium/thunder_pcie_pem.c
index 78fcf333d825..b53f70696ff1 100644
--- a/sys/arm64/cavium/thunder_pcie_pem.c
+++ b/sys/arm64/cavium/thunder_pcie_pem.c
@@ -136,10 +136,10 @@ static int thunder_pem_get_id(device_t, device_t, enum pci_id_type,
static int thunder_pem_attach(device_t);
static int thunder_pem_deactivate_resource(device_t, device_t, int, int,
struct resource *);
-static int thunder_pem_map_resource(device_t, device_t, int, struct resource *,
+static int thunder_pem_map_resource(device_t, device_t, struct resource *,
struct resource_map_request *, struct resource_map *);
-static int thunder_pem_unmap_resource(device_t, device_t, int,
- struct resource *, struct resource_map *);
+static int thunder_pem_unmap_resource(device_t, device_t, struct resource *,
+ struct resource_map *);
static bus_dma_tag_t thunder_pem_get_dma_tag(device_t, device_t);
static int thunder_pem_detach(device_t);
static uint64_t thunder_pem_config_reg_read(struct thunder_pem_softc *, int);
@@ -302,9 +302,8 @@ thunder_pem_deactivate_resource(device_t dev, device_t child, int type, int rid,
}
static int
-thunder_pem_map_resource(device_t dev, device_t child, int type,
- struct resource *r, struct resource_map_request *argsp,
- struct resource_map *map)
+thunder_pem_map_resource(device_t dev, device_t child, struct resource *r,
+ struct resource_map_request *argsp, struct resource_map *map)
{
struct resource_map_request args;
struct thunder_pem_softc *sc;
@@ -315,7 +314,7 @@ thunder_pem_map_resource(device_t dev, device_t child, int type,
if (!(rman_get_flags(r) & RF_ACTIVE))
return (ENXIO);
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
break;
@@ -340,11 +339,11 @@ thunder_pem_map_resource(device_t dev, device_t child, int type,
}
static int
-thunder_pem_unmap_resource(device_t dev, device_t child, int type,
- struct resource *r, struct resource_map *map)
+thunder_pem_unmap_resource(device_t dev, device_t child, struct resource *r,
+ struct resource_map *map)
{
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
bus_space_unmap(map->r_bustag, map->r_bushandle, map->r_size);
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 93bce7df70d5..ab34009bf654 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1551,7 +1551,7 @@ acpi_is_resource_managed(device_t bus, struct resource *r)
}
static struct resource *
-acpi_managed_resource(device_t bus, int type, struct resource *r)
+acpi_managed_resource(device_t bus, struct resource *r)
{
struct acpi_softc *sc = device_get_softc(bus);
struct resource_list_entry *rle;
@@ -1560,7 +1560,7 @@ acpi_managed_resource(device_t bus, int type, struct resource *r)
("resource %p is not suballocated", r));
STAILQ_FOREACH(rle, &sc->sysres_rl, link) {
- if (rle->type != type || rle->res == NULL)
+ if (rle->type != rman_get_type(r) || rle->res == NULL)
continue;
if (rman_get_start(r) >= rman_get_start(rle->res) &&
rman_get_end(r) <= rman_get_end(rle->res))
@@ -1630,7 +1630,7 @@ acpi_deactivate_resource(device_t bus, device_t child, int type, int rid,
}
static int
-acpi_map_resource(device_t bus, device_t child, int type, struct resource *r,
+acpi_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;
@@ -1639,8 +1639,7 @@ acpi_map_resource(device_t bus, device_t child, int type, struct resource *r,
int error;
if (!acpi_is_resource_managed(bus, r))
- return (bus_generic_map_resource(bus, child, type, r, argsp,
- map));
+ return (bus_generic_map_resource(bus, child, r, argsp, map));
/* Resources must be active to be mapped. */
if (!(rman_get_flags(r) & RF_ACTIVE))
@@ -1651,25 +1650,25 @@ acpi_map_resource(device_t bus, device_t child, int type, struct resource *r,
if (error)
return (error);
- sysres = acpi_managed_resource(bus, type, r);
+ sysres = acpi_managed_resource(bus, r);
if (sysres == NULL)
return (ENOENT);
args.offset = start - rman_get_start(sysres);
args.length = length;
- return (bus_generic_map_resource(bus, child, type, sysres, &args, map));
+ return (bus_generic_map_resource(bus, child, sysres, &args, map));
}
static int
-acpi_unmap_resource(device_t bus, device_t child, int type, struct resource *r,
+acpi_unmap_resource(device_t bus, device_t child, struct resource *r,
struct resource_map *map)
{
if (acpi_is_resource_managed(bus, r)) {
- r = acpi_managed_resource(bus, type, r);
+ r = acpi_managed_resource(bus, r);
if (r == NULL)
return (ENOENT);
}
- return (bus_generic_unmap_resource(bus, child, type, r, map));
+ return (bus_generic_unmap_resource(bus, child, r, map));
}
/* Allocate an IO port or memory resource, given its GAS. */
diff --git a/sys/dev/fdt/simplebus.c b/sys/dev/fdt/simplebus.c
index 940f93f56274..2bd1a1402797 100644
--- a/sys/dev/fdt/simplebus.c
+++ b/sys/dev/fdt/simplebus.c
@@ -52,11 +52,6 @@ static int simplebus_activate_resource(device_t bus,
device_t child, int type, int rid, struct resource *r);
static int simplebus_deactivate_resource(device_t bus,
device_t child, int type, int rid, struct resource *r);
-static int simplebus_map_resource(device_t bus, device_t child,
- int type, struct resource *r, struct resource_map_request *args,
- struct resource_map *map);
-static int simplebus_unmap_resource(device_t bus, device_t child,
- int type, struct resource *r, struct resource_map *map);
static void simplebus_probe_nomatch(device_t bus, device_t child);
static int simplebus_print_child(device_t bus, device_t child);
static device_t simplebus_add_child(device_t dev, u_int order,
@@ -98,8 +93,8 @@ static device_method_t simplebus_methods[] = {
DEVMETHOD(bus_activate_resource, simplebus_activate_resource),
DEVMETHOD(bus_deactivate_resource, simplebus_deactivate_resource),
DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
- DEVMETHOD(bus_map_resource, simplebus_map_resource),
- DEVMETHOD(bus_unmap_resource, simplebus_unmap_resource),
+ DEVMETHOD(bus_map_resource, bus_generic_map_resource),
+ DEVMETHOD(bus_unmap_resource, bus_generic_unmap_resource),
DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource),
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource),
@@ -525,27 +520,6 @@ simplebus_deactivate_resource(device_t bus, device_t child, int type, int rid,
}
static int
-simplebus_map_resource(device_t bus, device_t child, int type,
- struct resource *r, struct resource_map_request *args,
- struct resource_map *map)
-{
-
- if (type == SYS_RES_IOPORT)
- type = SYS_RES_MEMORY;
- return (bus_generic_map_resource(bus, child, type, r, args, map));
-}
-
-static int
-simplebus_unmap_resource(device_t bus, device_t child, int type,
- struct resource *r, struct resource_map *map)
-{
-
- if (type == SYS_RES_IOPORT)
- type = SYS_RES_MEMORY;
- return (bus_generic_unmap_resource(bus, child, type, r, map));
-}
-
-static int
simplebus_print_res(struct simplebus_devinfo *di)
{
int rv;
diff --git a/sys/dev/ofw/ofw_pcib.c b/sys/dev/ofw/ofw_pcib.c
index e95a5f029140..4f373030dc33 100644
--- a/sys/dev/ofw/ofw_pcib.c
+++ b/sys/dev/ofw/ofw_pcib.c
@@ -75,9 +75,9 @@ static int ofw_pcib_deactivate_resource(device_t, device_t, int, int,
struct resource *);
static int ofw_pcib_adjust_resource(device_t, device_t,
struct resource *, rman_res_t, rman_res_t);
-static int ofw_pcib_map_resource(device_t, device_t, int, struct resource *,
+static int ofw_pcib_map_resource(device_t, device_t, struct resource *,
struct resource_map_request *, struct resource_map *);
-static int ofw_pcib_unmap_resource(device_t, device_t, int, struct resource *,
+static int ofw_pcib_unmap_resource(device_t, device_t, struct resource *,
struct resource_map *);
static int ofw_pcib_translate_resource(device_t bus, int type,
rman_res_t start, rman_res_t *newstart);
@@ -535,9 +535,8 @@ ofw_pcib_activate_resource(device_t bus, device_t child, int type, int rid,
}
static int
-ofw_pcib_map_resource(device_t dev, device_t child, int type,
- struct resource *r, struct resource_map_request *argsp,
- struct resource_map *map)
+ofw_pcib_map_resource(device_t dev, device_t child, struct resource *r,
+ struct resource_map_request *argsp, struct resource_map *map)
{
struct resource_map_request args;
struct ofw_pci_softc *sc;
@@ -549,7 +548,7 @@ ofw_pcib_map_resource(device_t dev, device_t child, int type,
if (!(rman_get_flags(r) & RF_ACTIVE))
return (ENXIO);
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
break;
@@ -583,7 +582,7 @@ ofw_pcib_map_resource(device_t dev, device_t child, int type,
space = -1;
}
- if (type == space) {
+ if (rman_get_type(r) == space) {
start += (rp->host - rp->pci);
break;
}
@@ -608,10 +607,10 @@ ofw_pcib_map_resource(device_t dev, device_t child, int type,
}
static int
-ofw_pcib_unmap_resource(device_t dev, device_t child, int type,
- struct resource *r, struct resource_map *map)
+ofw_pcib_unmap_resource(device_t dev, device_t child, struct resource *r,
+ struct resource_map *map)
{
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
bus_space_unmap(map->r_bustag, map->r_bushandle, map->r_size);
diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c
index f4fccc7b8277..3657be018c99 100644
--- a/sys/dev/pci/pci_host_generic.c
+++ b/sys/dev/pci/pci_host_generic.c
@@ -639,15 +639,15 @@ generic_pcie_adjust_resource(device_t dev, device_t child,
}
static int
-generic_pcie_map_resource(device_t dev, device_t child, int type,
- struct resource *r, struct resource_map_request *argsp,
- struct resource_map *map)
+generic_pcie_map_resource(device_t dev, device_t child, struct resource *r,
+ struct resource_map_request *argsp, struct resource_map *map)
{
struct resource_map_request args;
struct pcie_range *range;
rman_res_t length, start;
- int error;
+ int error, type;
+ type = rman_get_type(r);
switch (type) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
case PCI_RES_BUS:
@@ -657,8 +657,7 @@ generic_pcie_map_resource(device_t dev, device_t child, int type,
case SYS_RES_MEMORY:
break;
default:
- return (bus_generic_map_resource(dev, child, type, r, argsp,
- map));
+ return (bus_generic_map_resource(dev, child, r, argsp, map));
}
/* Resources must be active to be mapped. */
@@ -677,16 +676,17 @@ generic_pcie_map_resource(device_t dev, device_t child, int type,
args.offset = start - range->pci_base;
args.length = length;
- return (bus_generic_map_resource(dev, child, type, range->res, &args,
- map));
+ return (bus_generic_map_resource(dev, child, range->res, &args, map));
}
static int
-generic_pcie_unmap_resource(device_t dev, device_t child, int type,
- struct resource *r, struct resource_map *map)
+generic_pcie_unmap_resource(device_t dev, device_t child, struct resource *r,
+ struct resource_map *map)
{
struct pcie_range *range;
+ int type;
+ type = rman_get_type(r);
switch (type) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
case PCI_RES_BUS:
@@ -703,7 +703,7 @@ generic_pcie_unmap_resource(device_t dev, device_t child, int type,
default:
break;
}
- return (bus_generic_unmap_resource(dev, child, type, r, map));
+ return (bus_generic_unmap_resource(dev, child, r, map));
}
static bus_dma_tag_t
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index b4c02bfeca37..146b67c70801 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -2476,7 +2476,7 @@ pcib_activate_resource(device_t dev, device_t child, int type, int rid,
if ((rman_get_flags(r) & RF_UNMAPPED) == 0 &&
(type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) {
- error = BUS_MAP_RESOURCE(dev, child, type, r, NULL, &map);
+ error = BUS_MAP_RESOURCE(dev, child, r, NULL, &map);
if (error != 0) {
rman_deactivate_resource(r);
return (error);
@@ -2506,7 +2506,7 @@ pcib_deactivate_resource(device_t dev, device_t child, int type, int rid,
if ((rman_get_flags(r) & RF_UNMAPPED) == 0 &&
(type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) {
rman_get_mapping(r, &map);
- BUS_UNMAP_RESOURCE(dev, child, type, r, &map);
+ BUS_UNMAP_RESOURCE(dev, child, r, &map);
}
return (0);
}
@@ -2523,7 +2523,7 @@ pcib_find_parent_resource(struct pcib_window *w, struct resource *r)
}
static int
-pcib_map_resource(device_t dev, device_t child, int type, struct resource *r,
+pcib_map_resource(device_t dev, device_t child, struct resource *r,
struct resource_map_request *argsp, struct resource_map *map)
{
struct pcib_softc *sc = device_get_softc(dev);
@@ -2535,8 +2535,7 @@ pcib_map_resource(device_t dev, device_t child, int type, struct resource *r,
w = pcib_get_resource_window(sc, r);
if (w == NULL)
- return (bus_generic_map_resource(dev, child, type, r, argsp,
- map));
+ return (bus_generic_map_resource(dev, child, r, argsp, map));
/* Resources must be active to be mapped. */
if (!(rman_get_flags(r) & RF_ACTIVE))
@@ -2553,11 +2552,11 @@ pcib_map_resource(device_t dev, device_t child, int type, struct resource *r,
args.offset = start - rman_get_start(pres);
args.length = length;
- return (bus_generic_map_resource(dev, child, type, pres, &args, map));
+ return (bus_generic_map_resource(dev, child, pres, &args, map));
}
static int
-pcib_unmap_resource(device_t dev, device_t child, int type, struct resource *r,
+pcib_unmap_resource(device_t dev, device_t child, struct resource *r,
struct resource_map *map)
{
struct pcib_softc *sc = device_get_softc(dev);
@@ -2569,7 +2568,7 @@ pcib_unmap_resource(device_t dev, device_t child, int type, struct resource *r,
if (r == NULL)
return (ENOENT);
}
- return (bus_generic_unmap_resource(dev, child, type, r, map));
+ return (bus_generic_unmap_resource(dev, child, r, map));
}
#else
/*
diff --git a/sys/dev/vmd/vmd.c b/sys/dev/vmd/vmd.c
index c258ef7a7047..a0a021c7d367 100644
--- a/sys/dev/vmd/vmd.c
+++ b/sys/dev/vmd/vmd.c
@@ -525,7 +525,7 @@ vmd_find_parent_resource(struct vmd_softc *sc, struct resource *r)
}
static int
-vmd_map_resource(device_t dev, device_t child, int type, struct resource *r,
+vmd_map_resource(device_t dev, device_t child, struct resource *r,
struct resource_map_request *argsp, struct resource_map *map)
{
struct vmd_softc *sc = device_get_softc(dev);
@@ -549,11 +549,11 @@ vmd_map_resource(device_t dev, device_t child, int type, struct resource *r,
args.offset = start - rman_get_start(pres);
args.length = length;
- return (bus_generic_map_resource(dev, child, type, pres, &args, map));
+ return (bus_generic_map_resource(dev, child, pres, &args, map));
}
static int
-vmd_unmap_resource(device_t dev, device_t child, int type, struct resource *r,
+vmd_unmap_resource(device_t dev, device_t child, struct resource *r,
struct resource_map *map)
{
struct vmd_softc *sc = device_get_softc(dev);
@@ -561,7 +561,7 @@ vmd_unmap_resource(device_t dev, device_t child, int type, struct resource *r,
r = vmd_find_parent_resource(sc, r);
if (r == NULL)
return (ENOENT);
- return (bus_generic_unmap_resource(dev, child, type, r, map));
+ return (bus_generic_unmap_resource(dev, child, r, map));
}
static int
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m
index 497b98ca4601..375aeebd1835 100644
--- a/sys/kern/bus_if.m
+++ b/sys/kern/bus_if.m
@@ -332,7 +332,6 @@ METHOD int activate_resource {
*
* @param _dev the parent device of @p _child
* @param _child the device which allocated the resource
- * @param _type the type of resource
* @param _r the resource to map
* @param _args optional attributes of the mapping
* @param _map the mapping
@@ -340,7 +339,6 @@ METHOD int activate_resource {
METHOD int map_resource {
device_t _dev;
device_t _child;
- int _type;
struct resource *_r;
struct resource_map_request *_args;
struct resource_map *_map;
@@ -356,14 +354,12 @@ METHOD int map_resource {
*
* @param _dev the parent device of @p _child
* @param _child the device which allocated the resource
- * @param _type the type of resource
* @param _r the resource
* @param _map the mapping to release
*/
METHOD int unmap_resource {
device_t _dev;
device_t _child;
- int _type;
struct resource *_r;
struct resource_map *_map;
} DEFAULT bus_generic_unmap_resource;
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 33d7b1e4af88..34712ae511e5 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3979,14 +3979,12 @@ bus_generic_deactivate_resource(device_t dev, device_t child, int type,
* BUS_MAP_RESOURCE() method of the parent of @p dev.
*/
int
-bus_generic_map_resource(device_t dev, device_t child, int type,
- struct resource *r, struct resource_map_request *args,
- struct resource_map *map)
+bus_generic_map_resource(device_t dev, device_t child, struct resource *r,
+ struct resource_map_request *args, struct resource_map *map)
{
/* Propagate up the bus hierarchy until someone handles it. */
if (dev->parent)
- return (BUS_MAP_RESOURCE(dev->parent, child, type, r, args,
- map));
+ return (BUS_MAP_RESOURCE(dev->parent, child, r, args, map));
return (EINVAL);
}
@@ -3997,12 +3995,12 @@ bus_generic_map_resource(device_t dev, device_t child, int type,
* BUS_UNMAP_RESOURCE() method of the parent of @p dev.
*/
int
-bus_generic_unmap_resource(device_t dev, device_t child, int type,
- struct resource *r, struct resource_map *map)
+bus_generic_unmap_resource(device_t dev, device_t child, struct resource *r,
+ struct resource_map *map)
{
/* Propagate up the bus hierarchy until someone handles it. */
if (dev->parent)
- return (BUS_UNMAP_RESOURCE(dev->parent, child, type, r, map));
+ return (BUS_UNMAP_RESOURCE(dev->parent, child, r, map));
return (EINVAL);
}
@@ -4339,7 +4337,7 @@ bus_generic_rman_activate_resource(device_t dev, device_t child, int type,
if ((rman_get_flags(r) & RF_UNMAPPED) == 0 &&
(type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) {
- error = BUS_MAP_RESOURCE(dev, child, type, r, NULL, &map);
+ error = BUS_MAP_RESOURCE(dev, child, r, NULL, &map);
if (error != 0) {
rman_deactivate_resource(r);
return (error);
@@ -4379,7 +4377,7 @@ bus_generic_rman_deactivate_resource(device_t dev, device_t child, int type,
if ((rman_get_flags(r) & RF_UNMAPPED) == 0 &&
(type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) {
rman_get_mapping(r, &map);
- BUS_UNMAP_RESOURCE(dev, child, type, r, &map);
+ BUS_UNMAP_RESOURCE(dev, child, r, &map);
}
return (0);
}
@@ -4615,19 +4613,19 @@ bus_deactivate_resource_new(device_t dev, struct resource *r)
* parent of @p dev.
*/
int
-bus_map_resource(device_t dev, int type, struct resource *r,
+bus_map_resource(device_t dev, struct resource *r,
struct resource_map_request *args, struct resource_map *map)
{
if (dev->parent == NULL)
return (EINVAL);
- return (BUS_MAP_RESOURCE(dev->parent, dev, type, r, args, map));
+ return (BUS_MAP_RESOURCE(dev->parent, dev, r, args, map));
}
int
-bus_map_resource_new(device_t dev, struct resource *r,
+bus_map_resource_old(device_t dev, int type, struct resource *r,
struct resource_map_request *args, struct resource_map *map)
{
- return (bus_map_resource(dev, rman_get_type(r), r, args, map));
+ return (bus_map_resource(dev, r, args, map));
}
/**
@@ -4637,19 +4635,18 @@ bus_map_resource_new(device_t dev, struct resource *r,
* parent of @p dev.
*/
int
-bus_unmap_resource(device_t dev, int type, struct resource *r,
- struct resource_map *map)
+bus_unmap_resource(device_t dev, struct resource *r, struct resource_map *map)
{
if (dev->parent == NULL)
return (EINVAL);
- return (BUS_UNMAP_RESOURCE(dev->parent, dev, type, r, map));
+ return (BUS_UNMAP_RESOURCE(dev->parent, dev, r, map));
}
int
-bus_unmap_resource_new(device_t dev, struct resource *r,
+bus_unmap_resource_old(device_t dev, int type, struct resource *r,
struct resource_map *map)
{
- return (bus_unmap_resource(dev, rman_get_type(r), r, map));
+ return (bus_unmap_resource(dev, r, map));
}
/**
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);
diff --git a/sys/riscv/riscv/nexus.c b/sys/riscv/riscv/nexus.c
index 31e50d3ca297..eb8126ba1e2f 100644
--- a/sys/riscv/riscv/nexus.c
+++ b/sys/riscv/riscv/nexus.c
@@ -365,7 +365,7 @@ nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
}
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;
@@ -377,7 +377,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;
@@ -402,10 +402,10 @@ 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)
{
- switch (type) {
+ switch (rman_get_type(r)) {
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
pmap_unmapdev(map->r_vaddr, map->r_size);
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index 310b3646f49f..c74553f2ba54 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -468,7 +468,7 @@ ssize_t bus_generic_get_property(device_t dev, device_t child,
size_t size, device_property_type_t type);
struct resource_list *
bus_generic_get_resource_list(device_t, device_t);
-int bus_generic_map_resource(device_t dev, device_t child, int type,
+int bus_generic_map_resource(device_t dev, device_t child,
struct resource *r,
struct resource_map_request *args,
struct resource_map *map);
@@ -526,7 +526,7 @@ int bus_generic_suspend_intr(device_t dev, device_t child,
struct resource *irq);
int bus_generic_resume_intr(device_t dev, device_t child,
struct resource *irq);
-int bus_generic_unmap_resource(device_t dev, device_t child, int type,
+int bus_generic_unmap_resource(device_t dev, device_t child,
struct resource *r,
struct resource_map *map);
int bus_generic_write_ivar(device_t dev, device_t child, int which,
@@ -565,10 +565,10 @@ int bus_activate_resource(device_t dev, int type, int rid,
struct resource *r);
int bus_deactivate_resource(device_t dev, int type, int rid,
struct resource *r);
-int bus_map_resource(device_t dev, int type, struct resource *r,
+int bus_map_resource(device_t dev, struct resource *r,
struct resource_map_request *args,
struct resource_map *map);
-int bus_unmap_resource(device_t dev, int type, struct resource *r,
+int bus_unmap_resource(device_t dev, struct resource *r,
struct resource_map *map);
int bus_get_cpus(device_t dev, enum cpu_sets op, size_t setsize,
struct _cpuset *cpuset);
@@ -618,10 +618,11 @@ int bus_adjust_resource_old(device_t child, int type, struct resource *r,
rman_res_t start, rman_res_t end);
int bus_activate_resource_new(device_t dev, struct resource *r);
int bus_deactivate_resource_new(device_t dev, struct resource *r);
-int bus_map_resource_new(device_t dev, struct resource *r,
- struct resource_map_request *args, struct resource_map *map);
-int bus_unmap_resource_new(device_t dev, struct resource *r,
- struct resource_map *map);
+int bus_map_resource_old(device_t dev, int type, struct resource *r,
+ struct resource_map_request *args,
+ struct resource_map *map);
+int bus_unmap_resource_old(device_t dev, int type, struct resource *r,
+ struct resource_map *map);
int bus_release_resource_new(device_t dev, struct resource *r);
#define _BUS_API_MACRO(_1, _2, _3, _4, _5, NAME, ...) NAME
@@ -639,12 +640,12 @@ int bus_release_resource_new(device_t dev, struct resource *r);
INVALID, bus_deactivate_resource_new)(__VA_ARGS__)
#define bus_map_resource(...) \
- _BUS_API_MACRO(__VA_ARGS__, bus_map_resource, \
- bus_map_resource_new)(__VA_ARGS__)
+ _BUS_API_MACRO(__VA_ARGS__, bus_map_resource_old, \
+ bus_map_resource)(__VA_ARGS__)
#define bus_unmap_resource(...) \
- _BUS_API_MACRO(__VA_ARGS__, INVALID, bus_unmap_resource, \
- bus_unmap_resource_new)(__VA_ARGS__)
+ _BUS_API_MACRO(__VA_ARGS__, INVALID, bus_unmap_resource_old, \
+ bus_unmap_resource)(__VA_ARGS__)
#define bus_release_resource(...) \
_BUS_API_MACRO(__VA_ARGS__, INVALID, bus_release_resource, \
diff --git a/sys/x86/x86/nexus.c b/sys/x86/x86/nexus.c
index 9b05758a6cbf..8f55b543eee2 100644
--- a/sys/x86/x86/nexus.c
+++ b/sys/x86/x86/nexus.c
@@ -376,18 +376,19 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
}
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;
rman_res_t length, start;
- int error;
+ int error, type;
/* Resources must be active to be mapped. */
if (!(rman_get_flags(r) & RF_ACTIVE))
return (ENXIO);
/* Mappings are only supported on I/O and memory resources. */
+ type = rman_get_type(r);
switch (type) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
@@ -426,14 +427,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 */