Page MenuHomeFreeBSD

D44129.diff
No OneTemporary

D44129.diff

diff --git a/share/man/man9/bus_map_resource.9 b/share/man/man9/bus_map_resource.9
--- 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 @@
.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
--- a/sys/arm/arm/nexus.c
+++ b/sys/arm/arm/nexus.c
@@ -331,7 +331,7 @@
}
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 @@
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 @@
}
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
--- a/sys/arm/mv/mv_pci.c
+++ b/sys/arm/mv/mv_pci.c
@@ -353,9 +353,9 @@
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 @@
}
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 @@
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 @@
}
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
--- a/sys/arm64/arm64/nexus.c
+++ b/sys/arm64/arm64/nexus.c
@@ -350,8 +350,7 @@
&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 @@
}
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 @@
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 @@
}
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
--- a/sys/arm64/cavium/thunder_pcie_pem.c
+++ b/sys/arm64/cavium/thunder_pcie_pem.c
@@ -136,10 +136,10 @@
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 @@
}
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 @@
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 @@
}
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
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1551,7 +1551,7 @@
}
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 @@
("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 @@
}
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 @@
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 @@
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
--- a/sys/dev/fdt/simplebus.c
+++ b/sys/dev/fdt/simplebus.c
@@ -52,11 +52,6 @@
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 @@
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),
@@ -524,27 +519,6 @@
return (bus_generic_deactivate_resource(bus, child, type, rid, 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)
-{
-
- 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)
{
diff --git a/sys/dev/ofw/ofw_pcib.c b/sys/dev/ofw/ofw_pcib.c
--- a/sys/dev/ofw/ofw_pcib.c
+++ b/sys/dev/ofw/ofw_pcib.c
@@ -75,9 +75,9 @@
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 @@
}
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 @@
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 @@
space = -1;
}
- if (type == space) {
+ if (rman_get_type(r) == space) {
start += (rp->host - rp->pci);
break;
}
@@ -608,10 +607,10 @@
}
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
--- a/sys/dev/pci/pci_host_generic.c
+++ b/sys/dev/pci/pci_host_generic.c
@@ -639,15 +639,15 @@
}
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 @@
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 @@
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 @@
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
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -2476,7 +2476,7 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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
--- a/sys/dev/vmd/vmd.c
+++ b/sys/dev/vmd/vmd.c
@@ -525,7 +525,7 @@
}
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 @@
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 @@
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
--- a/sys/kern/bus_if.m
+++ b/sys/kern/bus_if.m
@@ -332,7 +332,6 @@
*
* @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 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 @@
*
* @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
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3979,14 +3979,12 @@
* 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_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 @@
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 @@
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 @@
* 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 @@
* 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
--- a/sys/powerpc/mpc85xx/lbc.c
+++ b/sys/powerpc/mpc85xx/lbc.c
@@ -69,9 +69,9 @@
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 @@
}
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 @@
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 @@
}
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
--- a/sys/powerpc/powermac/macio.c
+++ b/sys/powerpc/powermac/macio.c
@@ -92,10 +92,10 @@
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 @@
}
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 @@
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 @@
}
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
--- a/sys/powerpc/powermac/uninorth.c
+++ b/sys/powerpc/powermac/uninorth.c
@@ -82,10 +82,10 @@
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 @@
}
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 @@
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 @@
}
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
--- a/sys/powerpc/powerpc/nexus.c
+++ b/sys/powerpc/powerpc/nexus.c
@@ -242,7 +242,7 @@
}
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 @@
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 @@
/*
* 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 @@
}
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
--- a/sys/powerpc/ps3/ps3bus.c
+++ b/sys/powerpc/ps3/ps3bus.c
@@ -61,10 +61,10 @@
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 @@
}
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 @@
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 @@
}
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
--- a/sys/powerpc/psim/iobus.c
+++ b/sys/powerpc/psim/iobus.c
@@ -80,10 +80,10 @@
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 @@
}
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 @@
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 @@
}
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
--- a/sys/riscv/riscv/nexus.c
+++ b/sys/riscv/riscv/nexus.c
@@ -365,7 +365,7 @@
}
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 @@
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 @@
}
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
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -468,7 +468,7 @@
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 @@
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 @@
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 @@
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 @@
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
--- a/sys/x86/x86/nexus.c
+++ b/sys/x86/x86/nexus.c
@@ -376,18 +376,19 @@
}
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 @@
}
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 */

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 3:50 PM (20 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14681764
Default Alt Text
D44129.diff (37 KB)

Event Timeline