mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 02:37:15 +00:00
new-bus: Remove the 'rid' and 'type' arguments from BUS_*ACTIVATE_RESOURCE
The public bus_activate/deactivate_resource() API still accepts both forms, but the internal kobj methods no longer pass the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44130
This commit is contained in:
parent
d77f2092ce
commit
2baed46e85
|
@ -22,7 +22,7 @@
|
||||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd May 20, 2016
|
.Dd March 13, 2024
|
||||||
.Dt BUS_ACTIVATE_RESOURCE 9
|
.Dt BUS_ACTIVATE_RESOURCE 9
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -37,11 +37,11 @@
|
||||||
.In machine/resource.h
|
.In machine/resource.h
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo bus_activate_resource
|
.Fo bus_activate_resource
|
||||||
.Fa "device_t dev" "int type" "int rid" "struct resource *r"
|
.Fa "device_t dev" "struct resource *r"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo bus_deactivate_resource
|
.Fo bus_deactivate_resource
|
||||||
.Fa "device_t dev" "int type" "int rid" "struct resource *r"
|
.Fa "device_t dev" "struct resource *r"
|
||||||
.Fc
|
.Fc
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
These functions activate or deactivate a previously allocated resource.
|
These functions activate or deactivate a previously allocated resource.
|
||||||
|
@ -58,24 +58,6 @@ The arguments are as follows:
|
||||||
.It Fa dev
|
.It Fa dev
|
||||||
The device that requests ownership of the resource.
|
The device that requests ownership of the resource.
|
||||||
Before allocation, the resource is owned by the parent bus.
|
Before allocation, the resource is owned by the parent bus.
|
||||||
.It Fa type
|
|
||||||
The type of resource you want to allocate.
|
|
||||||
It is one of:
|
|
||||||
.Pp
|
|
||||||
.Bl -tag -width ".Dv SYS_RES_MEMORY" -compact
|
|
||||||
.It Dv PCI_RES_BUS
|
|
||||||
for PCI bus numbers
|
|
||||||
.It Dv SYS_RES_IRQ
|
|
||||||
for IRQs
|
|
||||||
.It Dv SYS_RES_DRQ
|
|
||||||
for ISA DMA lines
|
|
||||||
.It Dv SYS_RES_IOPORT
|
|
||||||
for I/O ports
|
|
||||||
.It Dv SYS_RES_MEMORY
|
|
||||||
for I/O memory
|
|
||||||
.El
|
|
||||||
.It Fa rid
|
|
||||||
A pointer to a bus specific handle that identifies the resource being allocated.
|
|
||||||
.It Fa r
|
.It Fa r
|
||||||
A pointer to the
|
A pointer to the
|
||||||
.Vt "struct resource"
|
.Vt "struct resource"
|
||||||
|
|
|
@ -305,16 +305,14 @@ nexus_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
|
nexus_activate_resource(device_t bus, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
return (bus_generic_rman_activate_resource(bus, child, type,
|
return (bus_generic_rman_activate_resource(bus, child, r));
|
||||||
rid, r));
|
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
err = rman_activate_resource(r);
|
err = rman_activate_resource(r);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
|
@ -393,16 +391,14 @@ nexus_unmap_resource(device_t bus, device_t child, struct resource *r,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
nexus_deactivate_resource(device_t bus, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
return (bus_generic_rman_deactivate_resource(bus, child, type,
|
return (bus_generic_rman_deactivate_resource(bus, child, r));
|
||||||
rid, r));
|
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
error = rman_deactivate_resource(r);
|
error = rman_deactivate_resource(r);
|
||||||
if (error)
|
if (error)
|
||||||
|
|
|
@ -349,10 +349,8 @@ static int mv_pcib_adjust_resource(device_t, device_t, struct resource *,
|
||||||
rman_res_t, rman_res_t);
|
rman_res_t, rman_res_t);
|
||||||
static int mv_pcib_release_resource(device_t, device_t, int, int,
|
static int mv_pcib_release_resource(device_t, device_t, int, int,
|
||||||
struct resource *);
|
struct resource *);
|
||||||
static int mv_pcib_activate_resource(device_t, device_t, int, int,
|
static int mv_pcib_activate_resource(device_t, device_t, struct resource *);
|
||||||
struct resource *r);
|
static int mv_pcib_deactivate_resource(device_t, device_t, struct resource *);
|
||||||
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, struct resource *,
|
static int mv_pcib_map_resource(device_t, device_t, struct resource *,
|
||||||
struct resource_map_request *, struct resource_map *);
|
struct resource_map_request *, struct resource_map *);
|
||||||
static int mv_pcib_unmap_resource(device_t, device_t, struct resource *,
|
static int mv_pcib_unmap_resource(device_t, device_t, struct resource *,
|
||||||
|
@ -987,49 +985,42 @@ mv_pcib_release_resource(device_t dev, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mv_pcib_activate_resource(device_t dev, device_t child, int type, int rid,
|
mv_pcib_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
#ifdef PCI_RES_BUS
|
#ifdef PCI_RES_BUS
|
||||||
struct mv_pcib_softc *sc = device_get_softc(dev);
|
struct mv_pcib_softc *sc = device_get_softc(dev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
return (bus_generic_rman_activate_resource(dev, child, type,
|
return (bus_generic_rman_activate_resource(dev, child, r));
|
||||||
rid, r));
|
|
||||||
#ifdef PCI_RES_BUS
|
#ifdef PCI_RES_BUS
|
||||||
case PCI_RES_BUS:
|
case PCI_RES_BUS:
|
||||||
return (pci_domain_activate_bus(sc->ap_segment, child, rid, r));
|
return (pci_domain_activate_bus(sc->ap_segment, child, r));
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
return (bus_generic_activate_resource(dev, child, type, rid,
|
return (bus_generic_activate_resource(dev, child, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mv_pcib_deactivate_resource(device_t dev, device_t child, int type, int rid,
|
mv_pcib_deactivate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
#ifdef PCI_RES_BUS
|
#ifdef PCI_RES_BUS
|
||||||
struct mv_pcib_softc *sc = device_get_softc(dev);
|
struct mv_pcib_softc *sc = device_get_softc(dev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
return (bus_generic_rman_deactivate_resource(dev, child, type,
|
return (bus_generic_rman_deactivate_resource(dev, child, r));
|
||||||
rid, r));
|
|
||||||
#ifdef PCI_RES_BUS
|
#ifdef PCI_RES_BUS
|
||||||
case PCI_RES_BUS:
|
case PCI_RES_BUS:
|
||||||
return (pci_domain_deactivate_bus(sc->ap_segment, child, rid,
|
return (pci_domain_deactivate_bus(sc->ap_segment, child, r));
|
||||||
r));
|
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
return (bus_generic_deactivate_resource(dev, child, type, rid,
|
return (bus_generic_deactivate_resource(dev, child, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,8 +324,8 @@ nexus_get_bus_tag(device_t bus __unused, device_t child __unused)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nexus_activate_resource_flags(device_t bus, device_t child, int type, int rid,
|
nexus_activate_resource_flags(device_t bus, device_t child, struct resource *r,
|
||||||
struct resource *r, int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
struct resource_map_request args;
|
struct resource_map_request args;
|
||||||
struct resource_map map;
|
struct resource_map map;
|
||||||
|
@ -337,7 +337,7 @@ nexus_activate_resource_flags(device_t bus, device_t child, int type, int rid,
|
||||||
/*
|
/*
|
||||||
* If this is a memory resource, map it into the kernel.
|
* If this is a memory resource, map it into the kernel.
|
||||||
*/
|
*/
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
if ((rman_get_flags(r) & RF_UNMAPPED) == 0) {
|
if ((rman_get_flags(r) & RF_UNMAPPED) == 0) {
|
||||||
|
@ -370,10 +370,9 @@ nexus_activate_resource_flags(device_t bus, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nexus_activate_resource(device_t dev, device_t child, int type, int rid,
|
nexus_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
return (nexus_activate_resource_flags(dev, child, type, rid, r, 0));
|
return (nexus_activate_resource_flags(dev, child, r, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct resource_list *
|
static struct resource_list *
|
||||||
|
@ -385,16 +384,14 @@ nexus_get_reslist(device_t dev, device_t child)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
nexus_deactivate_resource(device_t bus, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
return (bus_generic_rman_deactivate_resource(bus, child, type,
|
return (bus_generic_rman_deactivate_resource(bus, child, r));
|
||||||
rid, r));
|
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
error = rman_deactivate_resource(r);
|
error = rman_deactivate_resource(r);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -500,14 +497,13 @@ nexus_fdt_attach(device_t dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nexus_fdt_activate_resource(device_t bus, device_t child, int type, int rid,
|
nexus_fdt_activate_resource(device_t bus, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
phandle_t node, parent;
|
phandle_t node, parent;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
/*
|
/*
|
||||||
|
@ -529,7 +525,7 @@ nexus_fdt_activate_resource(device_t bus, device_t child, int type, int rid,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (nexus_activate_resource_flags(bus, child, type, rid, r, flags));
|
return (nexus_activate_resource_flags(bus, child, r, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -120,8 +120,7 @@
|
||||||
|
|
||||||
#define RID_PEM_SPACE 1
|
#define RID_PEM_SPACE 1
|
||||||
|
|
||||||
static int thunder_pem_activate_resource(device_t, device_t, int, int,
|
static int thunder_pem_activate_resource(device_t, device_t, struct resource *);
|
||||||
struct resource *);
|
|
||||||
static int thunder_pem_adjust_resource(device_t, device_t,
|
static int thunder_pem_adjust_resource(device_t, device_t,
|
||||||
struct resource *, rman_res_t, rman_res_t);
|
struct resource *, rman_res_t, rman_res_t);
|
||||||
static struct resource * thunder_pem_alloc_resource(device_t, device_t, int,
|
static struct resource * thunder_pem_alloc_resource(device_t, device_t, int,
|
||||||
|
@ -134,7 +133,7 @@ static int thunder_pem_map_msi(device_t, device_t, int, uint64_t *, uint32_t *);
|
||||||
static int thunder_pem_get_id(device_t, device_t, enum pci_id_type,
|
static int thunder_pem_get_id(device_t, device_t, enum pci_id_type,
|
||||||
uintptr_t *);
|
uintptr_t *);
|
||||||
static int thunder_pem_attach(device_t);
|
static int thunder_pem_attach(device_t);
|
||||||
static int thunder_pem_deactivate_resource(device_t, device_t, int, int,
|
static int thunder_pem_deactivate_resource(device_t, device_t,
|
||||||
struct resource *);
|
struct resource *);
|
||||||
static int thunder_pem_map_resource(device_t, device_t, struct resource *,
|
static int thunder_pem_map_resource(device_t, device_t, struct resource *,
|
||||||
struct resource_map_request *, struct resource_map *);
|
struct resource_map_request *, struct resource_map *);
|
||||||
|
@ -254,31 +253,28 @@ thunder_pem_write_ivar(device_t dev, device_t child, int index,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
thunder_pem_activate_resource(device_t dev, device_t child, int type, int rid,
|
thunder_pem_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
||||||
struct thunder_pem_softc *sc;
|
struct thunder_pem_softc *sc;
|
||||||
|
|
||||||
sc = device_get_softc(dev);
|
sc = device_get_softc(dev);
|
||||||
#endif
|
#endif
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
||||||
case PCI_RES_BUS:
|
case PCI_RES_BUS:
|
||||||
return (pci_domain_activate_bus(sc->id, child, rid, r));
|
return (pci_domain_activate_bus(sc->id, child, r));
|
||||||
#endif
|
#endif
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
return (bus_generic_rman_activate_resource(dev, child, type,
|
return (bus_generic_rman_activate_resource(dev, child, r));
|
||||||
rid, r));
|
|
||||||
default:
|
default:
|
||||||
return (bus_generic_activate_resource(dev, child, type, rid,
|
return (bus_generic_activate_resource(dev, child, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
thunder_pem_deactivate_resource(device_t dev, device_t child, int type, int rid,
|
thunder_pem_deactivate_resource(device_t dev, device_t child,
|
||||||
struct resource *r)
|
struct resource *r)
|
||||||
{
|
{
|
||||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
||||||
|
@ -286,18 +282,16 @@ thunder_pem_deactivate_resource(device_t dev, device_t child, int type, int rid,
|
||||||
|
|
||||||
sc = device_get_softc(dev);
|
sc = device_get_softc(dev);
|
||||||
#endif
|
#endif
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
||||||
case PCI_RES_BUS:
|
case PCI_RES_BUS:
|
||||||
return (pci_domain_deactivate_bus(sc->id, child, rid, r));
|
return (pci_domain_deactivate_bus(sc->id, child, r));
|
||||||
#endif
|
#endif
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
return (bus_generic_rman_deactivate_resource(dev, child, type,
|
return (bus_generic_rman_deactivate_resource(dev, child, r));
|
||||||
rid, r));
|
|
||||||
default:
|
default:
|
||||||
return (bus_generic_deactivate_resource(dev, child, type, rid,
|
return (bus_generic_deactivate_resource(dev, child, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1610,23 +1610,19 @@ acpi_delete_resource(device_t bus, device_t child, int type, int rid)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_activate_resource(device_t bus, device_t child, int type, int rid,
|
acpi_activate_resource(device_t bus, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
if (acpi_is_resource_managed(bus, r))
|
if (acpi_is_resource_managed(bus, r))
|
||||||
return (bus_generic_rman_activate_resource(bus, child, type,
|
return (bus_generic_rman_activate_resource(bus, child, r));
|
||||||
rid, r));
|
return (bus_generic_activate_resource(bus, child, r));
|
||||||
return (bus_generic_activate_resource(bus, child, type, rid, r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
acpi_deactivate_resource(device_t bus, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
if (acpi_is_resource_managed(bus, r))
|
if (acpi_is_resource_managed(bus, r))
|
||||||
return (bus_generic_rman_deactivate_resource(bus, child, type,
|
return (bus_generic_rman_deactivate_resource(bus, child, r));
|
||||||
rid, r));
|
return (bus_generic_deactivate_resource(bus, child, r));
|
||||||
return (bus_generic_deactivate_resource(bus, child, type, rid, r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -104,11 +104,9 @@ static int acpi_pcib_acpi_release_resource(device_t dev,
|
||||||
device_t child, int type, int rid,
|
device_t child, int type, int rid,
|
||||||
struct resource *r);
|
struct resource *r);
|
||||||
static int acpi_pcib_acpi_activate_resource(device_t dev,
|
static int acpi_pcib_acpi_activate_resource(device_t dev,
|
||||||
device_t child, int type, int rid,
|
device_t child, struct resource *r);
|
||||||
struct resource *r);
|
|
||||||
static int acpi_pcib_acpi_deactivate_resource(device_t dev,
|
static int acpi_pcib_acpi_deactivate_resource(device_t dev,
|
||||||
device_t child, int type, int rid,
|
device_t child, struct resource *r);
|
||||||
struct resource *r);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
static int acpi_pcib_request_feature(device_t pcib, device_t dev,
|
static int acpi_pcib_request_feature(device_t pcib, device_t dev,
|
||||||
|
@ -773,28 +771,27 @@ acpi_pcib_acpi_release_resource(device_t dev, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
acpi_pcib_acpi_activate_resource(device_t dev, device_t child, int type, int rid,
|
acpi_pcib_acpi_activate_resource(device_t dev, device_t child,
|
||||||
struct resource *r)
|
struct resource *r)
|
||||||
{
|
{
|
||||||
struct acpi_hpcib_softc *sc;
|
struct acpi_hpcib_softc *sc;
|
||||||
|
|
||||||
sc = device_get_softc(dev);
|
sc = device_get_softc(dev);
|
||||||
if (type == PCI_RES_BUS)
|
if (rman_get_type(r) == PCI_RES_BUS)
|
||||||
return (pci_domain_activate_bus(sc->ap_segment, child, rid, r));
|
return (pci_domain_activate_bus(sc->ap_segment, child, r));
|
||||||
return (bus_generic_activate_resource(dev, child, type, rid, r));
|
return (bus_generic_activate_resource(dev, child, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
acpi_pcib_acpi_deactivate_resource(device_t dev, device_t child, int type,
|
acpi_pcib_acpi_deactivate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r)
|
struct resource *r)
|
||||||
{
|
{
|
||||||
struct acpi_hpcib_softc *sc;
|
struct acpi_hpcib_softc *sc;
|
||||||
|
|
||||||
sc = device_get_softc(dev);
|
sc = device_get_softc(dev);
|
||||||
if (type == PCI_RES_BUS)
|
if (rman_get_type(r) == PCI_RES_BUS)
|
||||||
return (pci_domain_deactivate_bus(sc->ap_segment, child, rid,
|
return (pci_domain_deactivate_bus(sc->ap_segment, child, r));
|
||||||
r));
|
return (bus_generic_deactivate_resource(dev, child, r));
|
||||||
return (bus_generic_deactivate_resource(dev, child, type, rid, r));
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2051,8 +2051,8 @@ agp_i915_chipset_flush_free_page(device_t dev)
|
||||||
vga = device_get_parent(dev);
|
vga = device_get_parent(dev);
|
||||||
if (sc->sc_flush_page_res == NULL)
|
if (sc->sc_flush_page_res == NULL)
|
||||||
return;
|
return;
|
||||||
BUS_DEACTIVATE_RESOURCE(device_get_parent(vga), dev, SYS_RES_MEMORY,
|
BUS_DEACTIVATE_RESOURCE(device_get_parent(vga), dev,
|
||||||
sc->sc_flush_page_rid, sc->sc_flush_page_res);
|
sc->sc_flush_page_res);
|
||||||
BUS_RELEASE_RESOURCE(device_get_parent(vga), dev, SYS_RES_MEMORY,
|
BUS_RELEASE_RESOURCE(device_get_parent(vga), dev, SYS_RES_MEMORY,
|
||||||
sc->sc_flush_page_rid, sc->sc_flush_page_res);
|
sc->sc_flush_page_rid, sc->sc_flush_page_res);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,13 +104,11 @@ static int bhndb_init_child_resource(struct resource *r,
|
||||||
static int bhndb_activate_static_region(
|
static int bhndb_activate_static_region(
|
||||||
struct bhndb_softc *sc,
|
struct bhndb_softc *sc,
|
||||||
struct bhndb_region *region,
|
struct bhndb_region *region,
|
||||||
device_t child, int type, int rid,
|
device_t child, struct resource *r);
|
||||||
struct resource *r);
|
|
||||||
|
|
||||||
static int bhndb_try_activate_resource(
|
static int bhndb_try_activate_resource(
|
||||||
struct bhndb_softc *sc, device_t child,
|
struct bhndb_softc *sc, device_t child,
|
||||||
int type, int rid, struct resource *r,
|
struct resource *r, bool *indirect);
|
||||||
bool *indirect);
|
|
||||||
|
|
||||||
static inline struct bhndb_dw_alloc *bhndb_io_resource(struct bhndb_softc *sc,
|
static inline struct bhndb_dw_alloc *bhndb_io_resource(struct bhndb_softc *sc,
|
||||||
bus_addr_t addr, bus_size_t size,
|
bus_addr_t addr, bus_size_t size,
|
||||||
|
@ -755,8 +753,7 @@ bhndb_resume_resource(device_t dev, device_t child, int type,
|
||||||
device_printf(child, "resume resource type=%d 0x%jx+0x%jx\n",
|
device_printf(child, "resume resource type=%d 0x%jx+0x%jx\n",
|
||||||
type, rman_get_start(r), rman_get_size(r));
|
type, rman_get_start(r), rman_get_size(r));
|
||||||
|
|
||||||
return (bhndb_try_activate_resource(sc, rman_get_device(r), type,
|
return (bhndb_try_activate_resource(sc, rman_get_device(r), r, NULL));
|
||||||
rman_get_rid(r), r, NULL));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1057,7 +1054,7 @@ bhndb_release_resource(device_t dev, device_t child, int type, int rid,
|
||||||
|
|
||||||
/* Deactivate resources */
|
/* Deactivate resources */
|
||||||
if (rman_get_flags(r) & RF_ACTIVE) {
|
if (rman_get_flags(r) & RF_ACTIVE) {
|
||||||
error = BUS_DEACTIVATE_RESOURCE(dev, child, type, rid, r);
|
error = BUS_DEACTIVATE_RESOURCE(dev, child, r);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
@ -1186,8 +1183,7 @@ bhndb_init_child_resource(struct resource *r,
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
bhndb_activate_static_region(struct bhndb_softc *sc,
|
bhndb_activate_static_region(struct bhndb_softc *sc,
|
||||||
struct bhndb_region *region, device_t child, int type, int rid,
|
struct bhndb_region *region, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct resource *bridge_res;
|
struct resource *bridge_res;
|
||||||
const struct bhndb_regwin *win;
|
const struct bhndb_regwin *win;
|
||||||
|
@ -1287,8 +1283,6 @@ bhndb_retain_dynamic_window(struct bhndb_softc *sc, struct resource *r)
|
||||||
*
|
*
|
||||||
* @param sc The bhndb driver state.
|
* @param sc The bhndb driver state.
|
||||||
* @param child The child holding ownership of @p r.
|
* @param child The child holding ownership of @p r.
|
||||||
* @param type The type of the resource to be activated.
|
|
||||||
* @param rid The resource ID of @p r.
|
|
||||||
* @param r The resource to be activated
|
* @param r The resource to be activated
|
||||||
* @param[out] indirect On error and if not NULL, will be set to 'true' if
|
* @param[out] indirect On error and if not NULL, will be set to 'true' if
|
||||||
* the caller should instead use an indirect resource mapping.
|
* the caller should instead use an indirect resource mapping.
|
||||||
|
@ -1297,21 +1291,22 @@ bhndb_retain_dynamic_window(struct bhndb_softc *sc, struct resource *r)
|
||||||
* @retval non-zero activation failed.
|
* @retval non-zero activation failed.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
bhndb_try_activate_resource(struct bhndb_softc *sc, device_t child, int type,
|
bhndb_try_activate_resource(struct bhndb_softc *sc, device_t child,
|
||||||
int rid, struct resource *r, bool *indirect)
|
struct resource *r, bool *indirect)
|
||||||
{
|
{
|
||||||
struct bhndb_region *region;
|
struct bhndb_region *region;
|
||||||
struct bhndb_dw_alloc *dwa;
|
struct bhndb_dw_alloc *dwa;
|
||||||
bhndb_priority_t dw_priority;
|
bhndb_priority_t dw_priority;
|
||||||
rman_res_t r_start, r_size;
|
rman_res_t r_start, r_size;
|
||||||
rman_res_t parent_offset;
|
rman_res_t parent_offset;
|
||||||
int error;
|
int error, type;
|
||||||
|
|
||||||
BHNDB_LOCK_ASSERT(sc, MA_NOTOWNED);
|
BHNDB_LOCK_ASSERT(sc, MA_NOTOWNED);
|
||||||
|
|
||||||
if (indirect != NULL)
|
if (indirect != NULL)
|
||||||
*indirect = false;
|
*indirect = false;
|
||||||
|
|
||||||
|
type = rman_get_type(r);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
/* IRQ resources are always directly mapped */
|
/* IRQ resources are always directly mapped */
|
||||||
|
@ -1367,8 +1362,7 @@ bhndb_try_activate_resource(struct bhndb_softc *sc, device_t child, int type,
|
||||||
|
|
||||||
/* Prefer static mappings over consuming a dynamic windows. */
|
/* Prefer static mappings over consuming a dynamic windows. */
|
||||||
if (region && region->static_regwin) {
|
if (region && region->static_regwin) {
|
||||||
error = bhndb_activate_static_region(sc, region, child, type,
|
error = bhndb_activate_static_region(sc, region, child, r);
|
||||||
rid, r);
|
|
||||||
if (error)
|
if (error)
|
||||||
device_printf(sc->dev, "static window allocation "
|
device_printf(sc->dev, "static window allocation "
|
||||||
"for 0x%llx-0x%llx failed\n",
|
"for 0x%llx-0x%llx failed\n",
|
||||||
|
@ -1425,41 +1419,40 @@ bhndb_try_activate_resource(struct bhndb_softc *sc, device_t child, int type,
|
||||||
* Default bhndb(4) implementation of BUS_ACTIVATE_RESOURCE().
|
* Default bhndb(4) implementation of BUS_ACTIVATE_RESOURCE().
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
bhndb_activate_resource(device_t dev, device_t child, int type, int rid,
|
bhndb_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct bhndb_softc *sc = device_get_softc(dev);
|
struct bhndb_softc *sc = device_get_softc(dev);
|
||||||
|
|
||||||
/* Delegate directly to our parent device's bus if the requested
|
/* Delegate directly to our parent device's bus if the requested
|
||||||
* resource type isn't handled locally. */
|
* resource type isn't handled locally. */
|
||||||
if (bhndb_get_rman(sc, child, type) == NULL) {
|
if (bhndb_get_rman(sc, child, rman_get_type(r)) == NULL) {
|
||||||
return (BUS_ACTIVATE_RESOURCE(device_get_parent(sc->parent_dev),
|
return (BUS_ACTIVATE_RESOURCE(device_get_parent(sc->parent_dev),
|
||||||
child, type, rid, r));
|
child, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (bhndb_try_activate_resource(sc, child, type, rid, r, NULL));
|
return (bhndb_try_activate_resource(sc, child, r, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default bhndb(4) implementation of BUS_DEACTIVATE_RESOURCE().
|
* Default bhndb(4) implementation of BUS_DEACTIVATE_RESOURCE().
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
bhndb_deactivate_resource(device_t dev, device_t child, int type,
|
bhndb_deactivate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
int rid, struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct bhndb_dw_alloc *dwa;
|
struct bhndb_dw_alloc *dwa;
|
||||||
struct bhndb_softc *sc;
|
struct bhndb_softc *sc;
|
||||||
struct rman *rm;
|
struct rman *rm;
|
||||||
int error;
|
int error, type;
|
||||||
|
|
||||||
sc = device_get_softc(dev);
|
sc = device_get_softc(dev);
|
||||||
|
type = rman_get_type(r);
|
||||||
|
|
||||||
/* Delegate directly to our parent device's bus if the requested
|
/* Delegate directly to our parent device's bus if the requested
|
||||||
* resource type isn't handled locally. */
|
* resource type isn't handled locally. */
|
||||||
rm = bhndb_get_rman(sc, child, type);
|
rm = bhndb_get_rman(sc, child, type);
|
||||||
if (rm == NULL) {
|
if (rm == NULL) {
|
||||||
return (BUS_DEACTIVATE_RESOURCE(
|
return (BUS_DEACTIVATE_RESOURCE(
|
||||||
device_get_parent(sc->parent_dev), child, type, rid, r));
|
device_get_parent(sc->parent_dev), child, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark inactive */
|
/* Mark inactive */
|
||||||
|
@ -1534,7 +1527,7 @@ bhndb_activate_bhnd_resource(device_t dev, device_t child,
|
||||||
/* Delegate directly to BUS_ACTIVATE_RESOURCE() if the requested
|
/* Delegate directly to BUS_ACTIVATE_RESOURCE() if the requested
|
||||||
* resource type isn't handled locally. */
|
* resource type isn't handled locally. */
|
||||||
if (bhndb_get_rman(sc, child, type) == NULL) {
|
if (bhndb_get_rman(sc, child, type) == NULL) {
|
||||||
error = BUS_ACTIVATE_RESOURCE(dev, child, type, rid, r->res);
|
error = BUS_ACTIVATE_RESOURCE(dev, child, r->res);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
r->direct = true;
|
r->direct = true;
|
||||||
return (error);
|
return (error);
|
||||||
|
@ -1574,8 +1567,7 @@ bhndb_activate_bhnd_resource(device_t dev, device_t child,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attempt direct activation */
|
/* Attempt direct activation */
|
||||||
error = bhndb_try_activate_resource(sc, child, type, rid, r->res,
|
error = bhndb_try_activate_resource(sc, child, r->res, &indirect);
|
||||||
&indirect);
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
r->direct = true;
|
r->direct = true;
|
||||||
} else if (indirect) {
|
} else if (indirect) {
|
||||||
|
@ -1615,7 +1607,7 @@ bhndb_deactivate_bhnd_resource(device_t dev, device_t child,
|
||||||
("RF_ACTIVE not set on direct resource"));
|
("RF_ACTIVE not set on direct resource"));
|
||||||
|
|
||||||
/* Perform deactivation */
|
/* Perform deactivation */
|
||||||
error = BUS_DEACTIVATE_RESOURCE(dev, child, type, rid, r->res);
|
error = BUS_DEACTIVATE_RESOURCE(dev, child, r->res);
|
||||||
if (!error)
|
if (!error)
|
||||||
r->direct = false;
|
r->direct = false;
|
||||||
|
|
||||||
|
|
|
@ -124,8 +124,8 @@ static int chipc_enable_sprom_pins(struct chipc_softc *sc);
|
||||||
static void chipc_disable_sprom_pins(struct chipc_softc *sc);
|
static void chipc_disable_sprom_pins(struct chipc_softc *sc);
|
||||||
|
|
||||||
static int chipc_try_activate_resource(device_t dev,
|
static int chipc_try_activate_resource(device_t dev,
|
||||||
device_t child, int type, int rid,
|
device_t child, struct resource *r,
|
||||||
struct resource *r, bool req_direct);
|
bool req_direct);
|
||||||
|
|
||||||
static int chipc_init_rman(struct chipc_softc *sc);
|
static int chipc_init_rman(struct chipc_softc *sc);
|
||||||
static void chipc_free_rman(struct chipc_softc *sc);
|
static void chipc_free_rman(struct chipc_softc *sc);
|
||||||
|
@ -949,16 +949,14 @@ chipc_adjust_resource(device_t dev, device_t child,
|
||||||
*
|
*
|
||||||
* @param sc Driver instance state.
|
* @param sc Driver instance state.
|
||||||
* @param child Requesting child device.
|
* @param child Requesting child device.
|
||||||
* @param type resource type of @p r.
|
|
||||||
* @param rid resource id of @p r
|
|
||||||
* @param r resource to be activated.
|
* @param r resource to be activated.
|
||||||
* @param req_direct If true, failure to allocate a direct bhnd resource
|
* @param req_direct If true, failure to allocate a direct bhnd resource
|
||||||
* will be treated as an error. If false, the resource will not be marked
|
* will be treated as an error. If false, the resource will not be marked
|
||||||
* as RF_ACTIVE if bhnd direct resource allocation fails.
|
* as RF_ACTIVE if bhnd direct resource allocation fails.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
chipc_try_activate_resource(device_t dev, device_t child, int type,
|
chipc_try_activate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r, bool req_direct)
|
struct resource *r, bool req_direct)
|
||||||
{
|
{
|
||||||
struct chipc_softc *sc = device_get_softc(dev);
|
struct chipc_softc *sc = device_get_softc(dev);
|
||||||
struct rman *rm;
|
struct rman *rm;
|
||||||
|
@ -967,7 +965,7 @@ chipc_try_activate_resource(device_t dev, device_t child, int type,
|
||||||
rman_res_t r_start, r_end, r_size;
|
rman_res_t r_start, r_end, r_size;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
rm = chipc_get_rman(dev, type, rman_get_flags(r));
|
rm = chipc_get_rman(dev, rman_get_type(r), rman_get_flags(r));
|
||||||
if (rm == NULL || !rman_is_region_manager(r, rm))
|
if (rm == NULL || !rman_is_region_manager(r, rm))
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
|
@ -1024,8 +1022,7 @@ chipc_activate_bhnd_resource(device_t dev, device_t child, int type,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try activating the chipc region resource */
|
/* Try activating the chipc region resource */
|
||||||
error = chipc_try_activate_resource(dev, child, type, rid, r->res,
|
error = chipc_try_activate_resource(dev, child, r->res, false);
|
||||||
false);
|
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
@ -1038,28 +1035,26 @@ chipc_activate_bhnd_resource(device_t dev, device_t child, int type,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
chipc_activate_resource(device_t dev, device_t child, int type, int rid,
|
chipc_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct rman *rm;
|
struct rman *rm;
|
||||||
|
|
||||||
/* Delegate non-locally managed resources to parent */
|
/* Delegate non-locally managed resources to parent */
|
||||||
rm = chipc_get_rman(dev, type, rman_get_flags(r));
|
rm = chipc_get_rman(dev, rman_get_type(r), rman_get_flags(r));
|
||||||
if (rm == NULL || !rman_is_region_manager(r, rm)) {
|
if (rm == NULL || !rman_is_region_manager(r, rm)) {
|
||||||
return (bus_generic_activate_resource(dev, child, type, rid,
|
return (bus_generic_activate_resource(dev, child, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try activating the chipc region-based resource */
|
/* Try activating the chipc region-based resource */
|
||||||
return (chipc_try_activate_resource(dev, child, type, rid, r, true));
|
return (chipc_try_activate_resource(dev, child, r, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default bhndb(4) implementation of BUS_DEACTIVATE_RESOURCE().
|
* Default bhndb(4) implementation of BUS_DEACTIVATE_RESOURCE().
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
chipc_deactivate_resource(device_t dev, device_t child, int type,
|
chipc_deactivate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r)
|
struct resource *r)
|
||||||
{
|
{
|
||||||
struct chipc_softc *sc;
|
struct chipc_softc *sc;
|
||||||
struct chipc_region *cr;
|
struct chipc_region *cr;
|
||||||
|
@ -1069,10 +1064,9 @@ chipc_deactivate_resource(device_t dev, device_t child, int type,
|
||||||
sc = device_get_softc(dev);
|
sc = device_get_softc(dev);
|
||||||
|
|
||||||
/* Handled by parent bus? */
|
/* Handled by parent bus? */
|
||||||
rm = chipc_get_rman(dev, type, rman_get_flags(r));
|
rm = chipc_get_rman(dev, rman_get_type(r), rman_get_flags(r));
|
||||||
if (rm == NULL || !rman_is_region_manager(r, rm)) {
|
if (rm == NULL || !rman_is_region_manager(r, rm)) {
|
||||||
return (bus_generic_deactivate_resource(dev, child, type, rid,
|
return (bus_generic_deactivate_resource(dev, child, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the corresponding chipc region */
|
/* Find the corresponding chipc region */
|
||||||
|
|
|
@ -345,23 +345,19 @@ bhnd_usb_release_resource(device_t dev, device_t child, int type,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bhnd_usb_activate_resource(device_t dev, device_t child, int type, int rid,
|
bhnd_usb_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
if (type != SYS_RES_MEMORY)
|
if (type != SYS_RES_MEMORY)
|
||||||
return (bus_generic_activate_resource(dev, child, type, rid,
|
return (bus_generic_activate_resource(dev, child, r));
|
||||||
r));
|
return (bus_generic_rman_activate_resource(dev, child, r));
|
||||||
return (bus_generic_rman_activate_resource(dev, child, type, rid, r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bhnd_usb_deactivate_resource(device_t dev, device_t child, int type, int rid,
|
bhnd_usb_deactivate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
if (type != SYS_RES_MEMORY)
|
if (type != SYS_RES_MEMORY)
|
||||||
return (bus_generic_deactivate_resource(dev, child, type, rid,
|
return (bus_generic_deactivate_resource(dev, child, r));
|
||||||
r));
|
return (bus_generic_rman_deactivate_resource(dev, child, r));
|
||||||
return (bus_generic_rman_deactivate_resource(dev, child, type, rid, r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -86,8 +86,7 @@ const uint32_t fman_firmware[] = FMAN_UC_IMG;
|
||||||
const uint32_t fman_firmware_size = sizeof(fman_firmware);
|
const uint32_t fman_firmware_size = sizeof(fman_firmware);
|
||||||
|
|
||||||
int
|
int
|
||||||
fman_activate_resource(device_t bus, device_t child, int type, int rid,
|
fman_activate_resource(device_t bus, device_t child, struct resource *res)
|
||||||
struct resource *res)
|
|
||||||
{
|
{
|
||||||
struct fman_softc *sc;
|
struct fman_softc *sc;
|
||||||
bus_space_tag_t bt;
|
bus_space_tag_t bt;
|
||||||
|
@ -95,7 +94,7 @@ fman_activate_resource(device_t bus, device_t child, int type, int rid,
|
||||||
int i, rv;
|
int i, rv;
|
||||||
|
|
||||||
sc = device_get_softc(bus);
|
sc = device_get_softc(bus);
|
||||||
if (type != SYS_RES_IRQ) {
|
if (rman_get_type(res) != SYS_RES_IRQ) {
|
||||||
for (i = 0; i < sc->sc_base.nranges; i++) {
|
for (i = 0; i < sc->sc_base.nranges; i++) {
|
||||||
if (rman_is_region_manager(res, &sc->rman) != 0) {
|
if (rman_is_region_manager(res, &sc->rman) != 0) {
|
||||||
bt = rman_get_bustag(sc->mem_res);
|
bt = rman_get_bustag(sc->mem_res);
|
||||||
|
@ -113,7 +112,7 @@ fman_activate_resource(device_t bus, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
return (bus_generic_activate_resource(bus, child, type, rid, res));
|
return (bus_generic_activate_resource(bus, child, res));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct fman_softc {
|
||||||
struct resource * fman_alloc_resource(device_t bus, device_t child, int type,
|
struct resource * fman_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);
|
int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags);
|
||||||
int fman_activate_resource(device_t bus, device_t child,
|
int fman_activate_resource(device_t bus, device_t child,
|
||||||
int type, int rid, struct resource *res);
|
struct resource *res);
|
||||||
int fman_release_resource(device_t bus, device_t child, int type, int rid,
|
int fman_release_resource(device_t bus, device_t child, int type, int rid,
|
||||||
struct resource *res);
|
struct resource *res);
|
||||||
int fman_attach(device_t dev);
|
int fman_attach(device_t dev);
|
||||||
|
|
|
@ -369,29 +369,25 @@ dpaa2_mc_release_resource(device_t mcdev, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dpaa2_mc_activate_resource(device_t mcdev, device_t child, int type, int rid,
|
dpaa2_mc_activate_resource(device_t mcdev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct rman *rm;
|
struct rman *rm;
|
||||||
|
|
||||||
rm = dpaa2_mc_rman(mcdev, type, rman_get_flags(r));
|
rm = dpaa2_mc_rman(mcdev, rman_get_type(r), rman_get_flags(r));
|
||||||
if (rm)
|
if (rm)
|
||||||
return (bus_generic_rman_activate_resource(mcdev, child, type,
|
return (bus_generic_rman_activate_resource(mcdev, child, r));
|
||||||
rid, r));
|
return (bus_generic_activate_resource(mcdev, child, r));
|
||||||
return (bus_generic_activate_resource(mcdev, child, type, rid, r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
dpaa2_mc_deactivate_resource(device_t mcdev, device_t child, int type, int rid,
|
dpaa2_mc_deactivate_resource(device_t mcdev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct rman *rm;
|
struct rman *rm;
|
||||||
|
|
||||||
rm = dpaa2_mc_rman(mcdev, type, rman_get_flags(r));
|
rm = dpaa2_mc_rman(mcdev, rman_get_type(r), rman_get_flags(r));
|
||||||
if (rm)
|
if (rm)
|
||||||
return (bus_generic_rman_deactivate_resource(mcdev, child, type,
|
return (bus_generic_rman_deactivate_resource(mcdev, child, r));
|
||||||
rid, r));
|
return (bus_generic_deactivate_resource(mcdev, child, r));
|
||||||
return (bus_generic_deactivate_resource(mcdev, child, type, rid, r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -187,10 +187,10 @@ int dpaa2_mc_adjust_resource(device_t mcdev, device_t child,
|
||||||
struct resource *r, rman_res_t start, rman_res_t end);
|
struct resource *r, rman_res_t start, rman_res_t end);
|
||||||
int dpaa2_mc_release_resource(device_t mcdev, device_t child, int type,
|
int dpaa2_mc_release_resource(device_t mcdev, device_t child, int type,
|
||||||
int rid, struct resource *r);
|
int rid, struct resource *r);
|
||||||
int dpaa2_mc_activate_resource(device_t mcdev, device_t child, int type,
|
int dpaa2_mc_activate_resource(device_t mcdev, device_t child,
|
||||||
int rid, struct resource *r);
|
struct resource *r);
|
||||||
int dpaa2_mc_deactivate_resource(device_t mcdev, device_t child, int type,
|
int dpaa2_mc_deactivate_resource(device_t mcdev, device_t child,
|
||||||
int rid, struct resource *r);
|
struct resource *r);
|
||||||
|
|
||||||
/* For pseudo-pcib interface. */
|
/* For pseudo-pcib interface. */
|
||||||
|
|
||||||
|
|
|
@ -811,18 +811,18 @@ exca_removal(struct exca_softc *exca)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
exca_activate_resource(struct exca_softc *exca, device_t child, int type,
|
exca_activate_resource(struct exca_softc *exca, device_t child,
|
||||||
int rid, struct resource *res)
|
struct resource *res)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (rman_get_flags(res) & RF_ACTIVE)
|
if (rman_get_flags(res) & RF_ACTIVE)
|
||||||
return (0);
|
return (0);
|
||||||
err = BUS_ACTIVATE_RESOURCE(device_get_parent(exca->dev), child,
|
err = BUS_ACTIVATE_RESOURCE(device_get_parent(exca->dev), child,
|
||||||
type, rid, res);
|
res);
|
||||||
if (err)
|
if (err)
|
||||||
return (err);
|
return (err);
|
||||||
switch (type) {
|
switch (rman_get_type(res)) {
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
err = exca_io_map(exca, PCCARD_WIDTH_AUTO, res);
|
err = exca_io_map(exca, PCCARD_WIDTH_AUTO, res);
|
||||||
break;
|
break;
|
||||||
|
@ -832,16 +832,16 @@ exca_activate_resource(struct exca_softc *exca, device_t child, int type,
|
||||||
}
|
}
|
||||||
if (err)
|
if (err)
|
||||||
BUS_DEACTIVATE_RESOURCE(device_get_parent(exca->dev), child,
|
BUS_DEACTIVATE_RESOURCE(device_get_parent(exca->dev), child,
|
||||||
type, rid, res);
|
res);
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
exca_deactivate_resource(struct exca_softc *exca, device_t child, int type,
|
exca_deactivate_resource(struct exca_softc *exca, device_t child,
|
||||||
int rid, struct resource *res)
|
struct resource *res)
|
||||||
{
|
{
|
||||||
if (rman_get_flags(res) & RF_ACTIVE) { /* if activated */
|
if (rman_get_flags(res) & RF_ACTIVE) { /* if activated */
|
||||||
switch (type) {
|
switch (rman_get_type(res)) {
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
if (exca_io_unmap_res(exca, res))
|
if (exca_io_unmap_res(exca, res))
|
||||||
return (ENOENT);
|
return (ENOENT);
|
||||||
|
@ -853,7 +853,7 @@ exca_deactivate_resource(struct exca_softc *exca, device_t child, int type,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (BUS_DEACTIVATE_RESOURCE(device_get_parent(exca->dev), child,
|
return (BUS_DEACTIVATE_RESOURCE(device_get_parent(exca->dev), child,
|
||||||
type, rid, res));
|
res));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -121,10 +121,10 @@ void exca_removal(struct exca_softc *);
|
||||||
void exca_reset(struct exca_softc *, device_t child);
|
void exca_reset(struct exca_softc *, device_t child);
|
||||||
|
|
||||||
/* bus/device interfaces */
|
/* bus/device interfaces */
|
||||||
int exca_activate_resource(struct exca_softc *exca, device_t child, int type,
|
int exca_activate_resource(struct exca_softc *exca, device_t child,
|
||||||
int rid, struct resource *res);
|
struct resource *res);
|
||||||
int exca_deactivate_resource(struct exca_softc *exca, device_t child, int type,
|
int exca_deactivate_resource(struct exca_softc *exca, device_t child,
|
||||||
int rid, struct resource *res);
|
struct resource *res);
|
||||||
|
|
||||||
static __inline uint8_t
|
static __inline uint8_t
|
||||||
exca_getb(struct exca_softc *sc, int reg)
|
exca_getb(struct exca_softc *sc, int reg)
|
||||||
|
|
|
@ -48,10 +48,6 @@ static struct resource *simplebus_alloc_resource(device_t, device_t, int,
|
||||||
int *, rman_res_t, rman_res_t, rman_res_t, u_int);
|
int *, rman_res_t, rman_res_t, rman_res_t, u_int);
|
||||||
static int simplebus_release_resource(device_t bus, device_t child,
|
static int simplebus_release_resource(device_t bus, device_t child,
|
||||||
int type, int rid, struct resource *r);
|
int type, int rid, struct resource *r);
|
||||||
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 void simplebus_probe_nomatch(device_t bus, device_t child);
|
static void simplebus_probe_nomatch(device_t bus, device_t child);
|
||||||
static int simplebus_print_child(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,
|
static device_t simplebus_add_child(device_t dev, u_int order,
|
||||||
|
@ -90,8 +86,8 @@ static device_method_t simplebus_methods[] = {
|
||||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||||
DEVMETHOD(bus_alloc_resource, simplebus_alloc_resource),
|
DEVMETHOD(bus_alloc_resource, simplebus_alloc_resource),
|
||||||
DEVMETHOD(bus_release_resource, simplebus_release_resource),
|
DEVMETHOD(bus_release_resource, simplebus_release_resource),
|
||||||
DEVMETHOD(bus_activate_resource, simplebus_activate_resource),
|
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||||
DEVMETHOD(bus_deactivate_resource, simplebus_deactivate_resource),
|
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||||
DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
|
DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
|
||||||
DEVMETHOD(bus_map_resource, bus_generic_map_resource),
|
DEVMETHOD(bus_map_resource, bus_generic_map_resource),
|
||||||
DEVMETHOD(bus_unmap_resource, bus_generic_unmap_resource),
|
DEVMETHOD(bus_unmap_resource, bus_generic_unmap_resource),
|
||||||
|
@ -499,26 +495,6 @@ simplebus_release_resource(device_t bus, device_t child, int type, int rid,
|
||||||
return (bus_generic_release_resource(bus, child, type, rid, r));
|
return (bus_generic_release_resource(bus, child, type, rid, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
simplebus_activate_resource(device_t bus, device_t child, int type, int rid,
|
|
||||||
struct resource *r)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (type == SYS_RES_IOPORT)
|
|
||||||
type = SYS_RES_MEMORY;
|
|
||||||
return (bus_generic_activate_resource(bus, child, type, rid, r));
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
simplebus_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
|
||||||
struct resource *r)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (type == SYS_RES_IOPORT)
|
|
||||||
type = SYS_RES_MEMORY;
|
|
||||||
return (bus_generic_deactivate_resource(bus, child, type, rid, r));
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
simplebus_print_res(struct simplebus_devinfo *di)
|
simplebus_print_res(struct simplebus_devinfo *di)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1741,27 +1741,25 @@ vmbus_pcib_release_resource(device_t dev, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vmbus_pcib_activate_resource(device_t dev, device_t child, int type, int rid,
|
vmbus_pcib_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct vmbus_pcib_softc *sc = device_get_softc(dev);
|
struct vmbus_pcib_softc *sc = device_get_softc(dev);
|
||||||
|
|
||||||
if (type == PCI_RES_BUS)
|
if (rman_get_type(r) == PCI_RES_BUS)
|
||||||
return (pci_domain_activate_bus(sc->hbus->pci_domain, child,
|
return (pci_domain_activate_bus(sc->hbus->pci_domain, child,
|
||||||
rid, r));
|
r));
|
||||||
return (bus_generic_activate_resource(dev, child, type, rid, r));
|
return (bus_generic_activate_resource(dev, child, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vmbus_pcib_deactivate_resource(device_t dev, device_t child, int type, int rid,
|
vmbus_pcib_deactivate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct vmbus_pcib_softc *sc = device_get_softc(dev);
|
struct vmbus_pcib_softc *sc = device_get_softc(dev);
|
||||||
|
|
||||||
if (type == PCI_RES_BUS)
|
if (rman_get_type(r) == PCI_RES_BUS)
|
||||||
return (pci_domain_deactivate_bus(sc->hbus->pci_domain, child,
|
return (pci_domain_deactivate_bus(sc->hbus->pci_domain, child,
|
||||||
rid, r));
|
r));
|
||||||
return (bus_generic_deactivate_resource(dev, child, type, rid, r));
|
return (bus_generic_deactivate_resource(dev, child, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -69,10 +69,8 @@ static struct resource * ofw_pcib_alloc_resource(device_t, device_t,
|
||||||
int, int *, rman_res_t, rman_res_t, rman_res_t, u_int);
|
int, int *, rman_res_t, rman_res_t, rman_res_t, u_int);
|
||||||
static int ofw_pcib_release_resource(device_t, device_t, int, int,
|
static int ofw_pcib_release_resource(device_t, device_t, int, int,
|
||||||
struct resource *);
|
struct resource *);
|
||||||
static int ofw_pcib_activate_resource(device_t, device_t, int, int,
|
static int ofw_pcib_activate_resource(device_t, device_t, struct resource *);
|
||||||
struct resource *);
|
static int ofw_pcib_deactivate_resource(device_t, device_t, struct resource *);
|
||||||
static int ofw_pcib_deactivate_resource(device_t, device_t, int, int,
|
|
||||||
struct resource *);
|
|
||||||
static int ofw_pcib_adjust_resource(device_t, device_t,
|
static int ofw_pcib_adjust_resource(device_t, device_t,
|
||||||
struct resource *, rman_res_t, rman_res_t);
|
struct resource *, rman_res_t, rman_res_t);
|
||||||
static int ofw_pcib_map_resource(device_t, device_t, struct resource *,
|
static int ofw_pcib_map_resource(device_t, device_t, struct resource *,
|
||||||
|
@ -510,27 +508,23 @@ ofw_pcib_translate_resource(device_t bus, int type, rman_res_t start,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ofw_pcib_activate_resource(device_t bus, device_t child, int type, int rid,
|
ofw_pcib_activate_resource(device_t bus, device_t child, struct resource *res)
|
||||||
struct resource *res)
|
|
||||||
{
|
{
|
||||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
||||||
struct ofw_pci_softc *sc;
|
struct ofw_pci_softc *sc;
|
||||||
|
|
||||||
sc = device_get_softc(bus);
|
sc = device_get_softc(bus);
|
||||||
#endif
|
#endif
|
||||||
switch (type) {
|
switch (rman_get_type(res)) {
|
||||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
||||||
case PCI_RES_BUS:
|
case PCI_RES_BUS:
|
||||||
return (pci_domain_activate_bus(sc->sc_pci_domain, child, rid,
|
return (pci_domain_activate_bus(sc->sc_pci_domain, child, res));
|
||||||
res));
|
|
||||||
#endif
|
#endif
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
return (bus_generic_rman_activate_resource(bus, child, type, rid,
|
return (bus_generic_rman_activate_resource(bus, child, res));
|
||||||
res));
|
|
||||||
default:
|
default:
|
||||||
return (bus_generic_activate_resource(bus, child, type, rid,
|
return (bus_generic_activate_resource(bus, child, res));
|
||||||
res));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,27 +624,24 @@ ofw_pcib_bus_get_bus_tag(device_t bus, device_t child)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ofw_pcib_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
ofw_pcib_deactivate_resource(device_t bus, device_t child, struct resource *res)
|
||||||
struct resource *res)
|
|
||||||
{
|
{
|
||||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
||||||
struct ofw_pci_softc *sc;
|
struct ofw_pci_softc *sc;
|
||||||
|
|
||||||
sc = device_get_softc(bus);
|
sc = device_get_softc(bus);
|
||||||
#endif
|
#endif
|
||||||
switch (type) {
|
switch (rman_get_type(res)) {
|
||||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
||||||
case PCI_RES_BUS:
|
case PCI_RES_BUS:
|
||||||
return (pci_domain_deactivate_bus(sc->sc_pci_domain, child, rid,
|
return (pci_domain_deactivate_bus(sc->sc_pci_domain, child,
|
||||||
res));
|
res));
|
||||||
#endif
|
#endif
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
return (bus_generic_rman_deactivate_resource(bus, child, type,
|
return (bus_generic_rman_deactivate_resource(bus, child, res));
|
||||||
rid, res));
|
|
||||||
default:
|
default:
|
||||||
return (bus_generic_deactivate_resource(bus, child, type, rid,
|
return (bus_generic_deactivate_resource(bus, child, res));
|
||||||
res));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,9 +155,9 @@ static int cbb_cardbus_mem_open(device_t brdev, int win,
|
||||||
uint32_t start, uint32_t end);
|
uint32_t start, uint32_t end);
|
||||||
static void cbb_cardbus_auto_open(struct cbb_softc *sc, int type);
|
static void cbb_cardbus_auto_open(struct cbb_softc *sc, int type);
|
||||||
static int cbb_cardbus_activate_resource(device_t brdev, device_t child,
|
static int cbb_cardbus_activate_resource(device_t brdev, device_t child,
|
||||||
int type, int rid, struct resource *res);
|
struct resource *res);
|
||||||
static int cbb_cardbus_deactivate_resource(device_t brdev,
|
static int cbb_cardbus_deactivate_resource(device_t brdev,
|
||||||
device_t child, int type, int rid, struct resource *res);
|
device_t child, struct resource *res);
|
||||||
static struct resource *cbb_cardbus_alloc_resource(device_t brdev,
|
static struct resource *cbb_cardbus_alloc_resource(device_t brdev,
|
||||||
device_t child, int type, int *rid, rman_res_t start,
|
device_t child, int type, int *rid, rman_res_t start,
|
||||||
rman_res_t end, rman_res_t count, u_int flags);
|
rman_res_t end, rman_res_t count, u_int flags);
|
||||||
|
@ -1175,30 +1175,30 @@ cbb_cardbus_auto_open(struct cbb_softc *sc, int type)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cbb_cardbus_activate_resource(device_t brdev, device_t child, int type,
|
cbb_cardbus_activate_resource(device_t brdev, device_t child,
|
||||||
int rid, struct resource *res)
|
struct resource *res)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = BUS_ACTIVATE_RESOURCE(device_get_parent(brdev), child,
|
ret = BUS_ACTIVATE_RESOURCE(device_get_parent(brdev), child,
|
||||||
type, rid, res);
|
res);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return (ret);
|
return (ret);
|
||||||
cbb_cardbus_auto_open(device_get_softc(brdev), type);
|
cbb_cardbus_auto_open(device_get_softc(brdev), rman_get_type(res));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cbb_cardbus_deactivate_resource(device_t brdev, device_t child, int type,
|
cbb_cardbus_deactivate_resource(device_t brdev, device_t child,
|
||||||
int rid, struct resource *res)
|
struct resource *res)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = BUS_DEACTIVATE_RESOURCE(device_get_parent(brdev), child,
|
ret = BUS_DEACTIVATE_RESOURCE(device_get_parent(brdev), child,
|
||||||
type, rid, res);
|
res);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return (ret);
|
return (ret);
|
||||||
cbb_cardbus_auto_open(device_get_softc(brdev), type);
|
cbb_cardbus_auto_open(device_get_softc(brdev), rman_get_type(res));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1347,24 +1347,24 @@ cbb_power_disable_socket(device_t brdev, device_t child)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cbb_pcic_activate_resource(device_t brdev, device_t child, int type, int rid,
|
cbb_pcic_activate_resource(device_t brdev, device_t child,
|
||||||
struct resource *res)
|
struct resource *res)
|
||||||
{
|
{
|
||||||
struct cbb_softc *sc = device_get_softc(brdev);
|
struct cbb_softc *sc = device_get_softc(brdev);
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = exca_activate_resource(&sc->exca, child, type, rid, res);
|
error = exca_activate_resource(&sc->exca, child, res);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
cbb_activate_window(brdev, type);
|
cbb_activate_window(brdev, rman_get_type(res));
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cbb_pcic_deactivate_resource(device_t brdev, device_t child, int type,
|
cbb_pcic_deactivate_resource(device_t brdev, device_t child,
|
||||||
int rid, struct resource *res)
|
struct resource *res)
|
||||||
{
|
{
|
||||||
struct cbb_softc *sc = device_get_softc(brdev);
|
struct cbb_softc *sc = device_get_softc(brdev);
|
||||||
return (exca_deactivate_resource(&sc->exca, child, type, rid, res));
|
return (exca_deactivate_resource(&sc->exca, child, res));
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct resource *
|
static struct resource *
|
||||||
|
@ -1483,30 +1483,25 @@ cbb_pcic_set_memory_offset(device_t brdev, device_t child, int rid,
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
cbb_activate_resource(device_t brdev, device_t child, int type, int rid,
|
cbb_activate_resource(device_t brdev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct cbb_softc *sc = device_get_softc(brdev);
|
struct cbb_softc *sc = device_get_softc(brdev);
|
||||||
|
|
||||||
if (sc->flags & CBB_16BIT_CARD)
|
if (sc->flags & CBB_16BIT_CARD)
|
||||||
return (cbb_pcic_activate_resource(brdev, child, type, rid, r));
|
return (cbb_pcic_activate_resource(brdev, child, r));
|
||||||
else
|
else
|
||||||
return (cbb_cardbus_activate_resource(brdev, child, type, rid,
|
return (cbb_cardbus_activate_resource(brdev, child, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
cbb_deactivate_resource(device_t brdev, device_t child, int type,
|
cbb_deactivate_resource(device_t brdev, device_t child, struct resource *r)
|
||||||
int rid, struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct cbb_softc *sc = device_get_softc(brdev);
|
struct cbb_softc *sc = device_get_softc(brdev);
|
||||||
|
|
||||||
if (sc->flags & CBB_16BIT_CARD)
|
if (sc->flags & CBB_16BIT_CARD)
|
||||||
return (cbb_pcic_deactivate_resource(brdev, child, type,
|
return (cbb_pcic_deactivate_resource(brdev, child, r));
|
||||||
rid, r));
|
|
||||||
else
|
else
|
||||||
return (cbb_cardbus_deactivate_resource(brdev, child, type,
|
return (cbb_cardbus_deactivate_resource(brdev, child, r));
|
||||||
rid, r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct resource *
|
struct resource *
|
||||||
|
|
|
@ -108,14 +108,14 @@ struct cbb_softc {
|
||||||
extern int cbb_debug;
|
extern int cbb_debug;
|
||||||
|
|
||||||
int cbb_activate_resource(device_t brdev, device_t child,
|
int cbb_activate_resource(device_t brdev, device_t child,
|
||||||
int type, int rid, struct resource *r);
|
struct resource *r);
|
||||||
struct resource *cbb_alloc_resource(device_t brdev, device_t child,
|
struct resource *cbb_alloc_resource(device_t brdev, device_t child,
|
||||||
int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count,
|
int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count,
|
||||||
u_int flags);
|
u_int flags);
|
||||||
void cbb_child_detached(device_t brdev, device_t child);
|
void cbb_child_detached(device_t brdev, device_t child);
|
||||||
int cbb_child_present(device_t parent, device_t child);
|
int cbb_child_present(device_t parent, device_t child);
|
||||||
int cbb_deactivate_resource(device_t brdev, device_t child,
|
int cbb_deactivate_resource(device_t brdev, device_t child,
|
||||||
int type, int rid, struct resource *r);
|
struct resource *r);
|
||||||
int cbb_detach(device_t brdev);
|
int cbb_detach(device_t brdev);
|
||||||
void cbb_disable_func_intr(struct cbb_softc *sc);
|
void cbb_disable_func_intr(struct cbb_softc *sc);
|
||||||
void cbb_driver_added(device_t brdev, driver_t *driver);
|
void cbb_driver_added(device_t brdev, driver_t *driver);
|
||||||
|
|
|
@ -5687,13 +5687,12 @@ pci_release_resource(device_t dev, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pci_activate_resource(device_t dev, device_t child, int type, int rid,
|
pci_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct pci_devinfo *dinfo;
|
struct pci_devinfo *dinfo;
|
||||||
int error;
|
int error, rid, type;
|
||||||
|
|
||||||
error = bus_generic_activate_resource(dev, child, type, rid, r);
|
error = bus_generic_activate_resource(dev, child, r);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
@ -5701,6 +5700,8 @@ pci_activate_resource(device_t dev, device_t child, int type, int rid,
|
||||||
if (device_get_parent(child) == dev) {
|
if (device_get_parent(child) == dev) {
|
||||||
/* Device ROMs need their decoding explicitly enabled. */
|
/* Device ROMs need their decoding explicitly enabled. */
|
||||||
dinfo = device_get_ivars(child);
|
dinfo = device_get_ivars(child);
|
||||||
|
rid = rman_get_rid(r);
|
||||||
|
type = rman_get_type(r);
|
||||||
if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
|
if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
|
||||||
pci_write_bar(child, pci_find_bar(child, rid),
|
pci_write_bar(child, pci_find_bar(child, rid),
|
||||||
rman_get_start(r) | PCIM_BIOS_ENABLE);
|
rman_get_start(r) | PCIM_BIOS_ENABLE);
|
||||||
|
@ -5715,19 +5716,20 @@ pci_activate_resource(device_t dev, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pci_deactivate_resource(device_t dev, device_t child, int type,
|
pci_deactivate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
int rid, struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct pci_devinfo *dinfo;
|
struct pci_devinfo *dinfo;
|
||||||
int error;
|
int error, rid, type;
|
||||||
|
|
||||||
error = bus_generic_deactivate_resource(dev, child, type, rid, r);
|
error = bus_generic_deactivate_resource(dev, child, r);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
/* Disable decoding for device ROMs. */
|
/* Disable decoding for device ROMs. */
|
||||||
if (device_get_parent(child) == dev) {
|
if (device_get_parent(child) == dev) {
|
||||||
dinfo = device_get_ivars(child);
|
dinfo = device_get_ivars(child);
|
||||||
|
rid = rman_get_rid(r);
|
||||||
|
type = rman_get_type(r);
|
||||||
if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
|
if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
|
||||||
pci_write_bar(child, pci_find_bar(child, rid),
|
pci_write_bar(child, pci_find_bar(child, rid),
|
||||||
rman_get_start(r));
|
rman_get_start(r));
|
||||||
|
|
|
@ -566,50 +566,45 @@ pci_host_generic_core_alloc_resource(device_t dev, device_t child, int type,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
generic_pcie_activate_resource(device_t dev, device_t child, int type,
|
generic_pcie_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
int rid, struct resource *r)
|
|
||||||
{
|
{
|
||||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
||||||
struct generic_pcie_core_softc *sc;
|
struct generic_pcie_core_softc *sc;
|
||||||
|
|
||||||
sc = device_get_softc(dev);
|
sc = device_get_softc(dev);
|
||||||
#endif
|
#endif
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
||||||
case PCI_RES_BUS:
|
case PCI_RES_BUS:
|
||||||
return (pci_domain_activate_bus(sc->ecam, child, rid, r));
|
return (pci_domain_activate_bus(sc->ecam, child, r));
|
||||||
#endif
|
#endif
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
return (bus_generic_rman_activate_resource(dev, child, type,
|
return (bus_generic_rman_activate_resource(dev, child, r));
|
||||||
rid, r));
|
|
||||||
default:
|
default:
|
||||||
return (bus_generic_activate_resource(dev, child, type, rid,
|
return (bus_generic_activate_resource(dev, child, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
generic_pcie_deactivate_resource(device_t dev, device_t child, int type,
|
generic_pcie_deactivate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r)
|
struct resource *r)
|
||||||
{
|
{
|
||||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
||||||
struct generic_pcie_core_softc *sc;
|
struct generic_pcie_core_softc *sc;
|
||||||
|
|
||||||
sc = device_get_softc(dev);
|
sc = device_get_softc(dev);
|
||||||
#endif
|
#endif
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
|
||||||
case PCI_RES_BUS:
|
case PCI_RES_BUS:
|
||||||
return (pci_domain_deactivate_bus(sc->ecam, child, rid, r));
|
return (pci_domain_deactivate_bus(sc->ecam, child, r));
|
||||||
#endif
|
#endif
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
return (bus_generic_rman_deactivate_resource(dev, child, type,
|
return (bus_generic_rman_deactivate_resource(dev, child, r));
|
||||||
rid, r));
|
|
||||||
default:
|
default:
|
||||||
return (bus_generic_deactivate_resource(dev, child, type, rid,
|
return (bus_generic_deactivate_resource(dev, child, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2459,21 +2459,20 @@ pcib_release_resource(device_t dev, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pcib_activate_resource(device_t dev, device_t child, int type, int rid,
|
pcib_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct pcib_softc *sc = device_get_softc(dev);
|
struct pcib_softc *sc = device_get_softc(dev);
|
||||||
struct resource_map map;
|
struct resource_map map;
|
||||||
int error;
|
int error, type;
|
||||||
|
|
||||||
if (!pcib_is_resource_managed(sc, r))
|
if (!pcib_is_resource_managed(sc, r))
|
||||||
return (bus_generic_activate_resource(dev, child, type, rid,
|
return (bus_generic_activate_resource(dev, child, r));
|
||||||
r));
|
|
||||||
|
|
||||||
error = rman_activate_resource(r);
|
error = rman_activate_resource(r);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
type = rman_get_type(r);
|
||||||
if ((rman_get_flags(r) & RF_UNMAPPED) == 0 &&
|
if ((rman_get_flags(r) & RF_UNMAPPED) == 0 &&
|
||||||
(type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) {
|
(type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) {
|
||||||
error = BUS_MAP_RESOURCE(dev, child, r, NULL, &map);
|
error = BUS_MAP_RESOURCE(dev, child, r, NULL, &map);
|
||||||
|
@ -2488,21 +2487,20 @@ pcib_activate_resource(device_t dev, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pcib_deactivate_resource(device_t dev, device_t child, int type, int rid,
|
pcib_deactivate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
struct pcib_softc *sc = device_get_softc(dev);
|
struct pcib_softc *sc = device_get_softc(dev);
|
||||||
struct resource_map map;
|
struct resource_map map;
|
||||||
int error;
|
int error, type;
|
||||||
|
|
||||||
if (!pcib_is_resource_managed(sc, r))
|
if (!pcib_is_resource_managed(sc, r))
|
||||||
return (bus_generic_deactivate_resource(dev, child, type, rid,
|
return (bus_generic_deactivate_resource(dev, child, r));
|
||||||
r));
|
|
||||||
|
|
||||||
error = rman_deactivate_resource(r);
|
error = rman_deactivate_resource(r);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
type = rman_get_type(r);
|
||||||
if ((rman_get_flags(r) & RF_UNMAPPED) == 0 &&
|
if ((rman_get_flags(r) & RF_UNMAPPED) == 0 &&
|
||||||
(type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) {
|
(type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) {
|
||||||
rman_get_mapping(r, &map);
|
rman_get_mapping(r, &map);
|
||||||
|
|
|
@ -119,10 +119,10 @@ struct resource *pci_alloc_resource(device_t dev, device_t child,
|
||||||
rman_res_t count, u_int flags);
|
rman_res_t count, u_int flags);
|
||||||
int pci_release_resource(device_t dev, device_t child, int type,
|
int pci_release_resource(device_t dev, device_t child, int type,
|
||||||
int rid, struct resource *r);
|
int rid, struct resource *r);
|
||||||
int pci_activate_resource(device_t dev, device_t child, int type,
|
int pci_activate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r);
|
struct resource *r);
|
||||||
int pci_deactivate_resource(device_t dev, device_t child, int type,
|
int pci_deactivate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r);
|
struct resource *r);
|
||||||
void pci_delete_resource(device_t dev, device_t child,
|
void pci_delete_resource(device_t dev, device_t child,
|
||||||
int type, int rid);
|
int type, int rid);
|
||||||
struct resource_list *pci_get_resource_list (device_t dev, device_t child);
|
struct resource_list *pci_get_resource_list (device_t dev, device_t child);
|
||||||
|
|
|
@ -382,7 +382,7 @@ pci_domain_release_bus(int domain, device_t dev, int rid, struct resource *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pci_domain_activate_bus(int domain, device_t dev, int rid, struct resource *r)
|
pci_domain_activate_bus(int domain, device_t dev, struct resource *r)
|
||||||
{
|
{
|
||||||
#ifdef INVARIANTS
|
#ifdef INVARIANTS
|
||||||
struct pci_domain *d;
|
struct pci_domain *d;
|
||||||
|
@ -398,7 +398,7 @@ pci_domain_activate_bus(int domain, device_t dev, int rid, struct resource *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pci_domain_deactivate_bus(int domain, device_t dev, int rid, struct resource *r)
|
pci_domain_deactivate_bus(int domain, device_t dev, struct resource *r)
|
||||||
{
|
{
|
||||||
#ifdef INVARIANTS
|
#ifdef INVARIANTS
|
||||||
struct pci_domain *d;
|
struct pci_domain *d;
|
||||||
|
|
|
@ -160,9 +160,9 @@ int pci_domain_adjust_bus(int domain, device_t dev,
|
||||||
struct resource *r, rman_res_t start, rman_res_t end);
|
struct resource *r, rman_res_t start, rman_res_t end);
|
||||||
int pci_domain_release_bus(int domain, device_t dev, int rid,
|
int pci_domain_release_bus(int domain, device_t dev, int rid,
|
||||||
struct resource *r);
|
struct resource *r);
|
||||||
int pci_domain_activate_bus(int domain, device_t dev, int rid,
|
int pci_domain_activate_bus(int domain, device_t dev,
|
||||||
struct resource *r);
|
struct resource *r);
|
||||||
int pci_domain_deactivate_bus(int domain, device_t dev, int rid,
|
int pci_domain_deactivate_bus(int domain, device_t dev,
|
||||||
struct resource *r);
|
struct resource *r);
|
||||||
struct resource *pcib_alloc_subbus(struct pcib_secbus *bus, device_t child,
|
struct resource *pcib_alloc_subbus(struct pcib_secbus *bus, device_t child,
|
||||||
int *rid, rman_res_t start, rman_res_t end, rman_res_t count,
|
int *rid, rman_res_t start, rman_res_t end, rman_res_t count,
|
||||||
|
|
|
@ -492,25 +492,21 @@ vmd_release_resource(device_t dev, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vmd_activate_resource(device_t dev, device_t child, int type, int rid,
|
vmd_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
if (type == SYS_RES_IRQ) {
|
if (rman_get_type(r) == SYS_RES_IRQ) {
|
||||||
return (bus_generic_activate_resource(dev, child, type, rid,
|
return (bus_generic_activate_resource(dev, child, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
return (bus_generic_rman_activate_resource(dev, child, type, rid, r));
|
return (bus_generic_rman_activate_resource(dev, child, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vmd_deactivate_resource(device_t dev, device_t child, int type, int rid,
|
vmd_deactivate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
if (type == SYS_RES_IRQ) {
|
if (rman_get_type(r) == SYS_RES_IRQ) {
|
||||||
return (bus_generic_deactivate_resource(dev, child, type, rid,
|
return (bus_generic_deactivate_resource(dev, child, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
return (bus_generic_rman_deactivate_resource(dev, child, type, rid, r));
|
return (bus_generic_rman_deactivate_resource(dev, child, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct resource *
|
static struct resource *
|
||||||
|
|
|
@ -310,15 +310,11 @@ METHOD struct resource * alloc_resource {
|
||||||
*
|
*
|
||||||
* @param _dev the parent device of @p _child
|
* @param _dev the parent device of @p _child
|
||||||
* @param _child the device which allocated the resource
|
* @param _child the device which allocated the resource
|
||||||
* @param _type the type of resource
|
|
||||||
* @param _rid the resource identifier
|
|
||||||
* @param _r the resource to activate
|
* @param _r the resource to activate
|
||||||
*/
|
*/
|
||||||
METHOD int activate_resource {
|
METHOD int activate_resource {
|
||||||
device_t _dev;
|
device_t _dev;
|
||||||
device_t _child;
|
device_t _child;
|
||||||
int _type;
|
|
||||||
int _rid;
|
|
||||||
struct resource *_r;
|
struct resource *_r;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -373,15 +369,11 @@ METHOD int unmap_resource {
|
||||||
*
|
*
|
||||||
* @param _dev the parent device of @p _child
|
* @param _dev the parent device of @p _child
|
||||||
* @param _child the device which allocated the resource
|
* @param _child the device which allocated the resource
|
||||||
* @param _type the type of resource
|
|
||||||
* @param _rid the resource identifier
|
|
||||||
* @param _r the resource to deactivate
|
* @param _r the resource to deactivate
|
||||||
*/
|
*/
|
||||||
METHOD int deactivate_resource {
|
METHOD int deactivate_resource {
|
||||||
device_t _dev;
|
device_t _dev;
|
||||||
device_t _child;
|
device_t _child;
|
||||||
int _type;
|
|
||||||
int _rid;
|
|
||||||
struct resource *_r;
|
struct resource *_r;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3945,13 +3945,11 @@ bus_generic_release_resource(device_t dev, device_t child, int type, int rid,
|
||||||
* BUS_ACTIVATE_RESOURCE() method of the parent of @p dev.
|
* BUS_ACTIVATE_RESOURCE() method of the parent of @p dev.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
bus_generic_activate_resource(device_t dev, device_t child, int type, int rid,
|
bus_generic_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
/* Propagate up the bus hierarchy until someone handles it. */
|
/* Propagate up the bus hierarchy until someone handles it. */
|
||||||
if (dev->parent)
|
if (dev->parent)
|
||||||
return (BUS_ACTIVATE_RESOURCE(dev->parent, child, type, rid,
|
return (BUS_ACTIVATE_RESOURCE(dev->parent, child, r));
|
||||||
r));
|
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3962,13 +3960,12 @@ bus_generic_activate_resource(device_t dev, device_t child, int type, int rid,
|
||||||
* BUS_DEACTIVATE_RESOURCE() method of the parent of @p dev.
|
* BUS_DEACTIVATE_RESOURCE() method of the parent of @p dev.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
bus_generic_deactivate_resource(device_t dev, device_t child, int type,
|
bus_generic_deactivate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r)
|
struct resource *r)
|
||||||
{
|
{
|
||||||
/* Propagate up the bus hierarchy until someone handles it. */
|
/* Propagate up the bus hierarchy until someone handles it. */
|
||||||
if (dev->parent)
|
if (dev->parent)
|
||||||
return (BUS_DEACTIVATE_RESOURCE(dev->parent, child, type, rid,
|
return (BUS_DEACTIVATE_RESOURCE(dev->parent, child, r));
|
||||||
r));
|
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4316,15 +4313,16 @@ bus_generic_rman_release_resource(device_t dev, device_t child, int type,
|
||||||
* allocated by bus_generic_rman_alloc_resource.
|
* allocated by bus_generic_rman_alloc_resource.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
bus_generic_rman_activate_resource(device_t dev, device_t child, int type,
|
bus_generic_rman_activate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r)
|
struct resource *r)
|
||||||
{
|
{
|
||||||
struct resource_map map;
|
struct resource_map map;
|
||||||
#ifdef INVARIANTS
|
#ifdef INVARIANTS
|
||||||
struct rman *rm;
|
struct rman *rm;
|
||||||
#endif
|
#endif
|
||||||
int error;
|
int error, type;
|
||||||
|
|
||||||
|
type = rman_get_type(r);
|
||||||
#ifdef INVARIANTS
|
#ifdef INVARIANTS
|
||||||
rm = BUS_GET_RMAN(dev, type, rman_get_flags(r));
|
rm = BUS_GET_RMAN(dev, type, rman_get_flags(r));
|
||||||
KASSERT(rman_is_region_manager(r, rm),
|
KASSERT(rman_is_region_manager(r, rm),
|
||||||
|
@ -4355,15 +4353,16 @@ bus_generic_rman_activate_resource(device_t dev, device_t child, int type,
|
||||||
* resources allocated by bus_generic_rman_alloc_resource.
|
* resources allocated by bus_generic_rman_alloc_resource.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
bus_generic_rman_deactivate_resource(device_t dev, device_t child, int type,
|
bus_generic_rman_deactivate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r)
|
struct resource *r)
|
||||||
{
|
{
|
||||||
struct resource_map map;
|
struct resource_map map;
|
||||||
#ifdef INVARIANTS
|
#ifdef INVARIANTS
|
||||||
struct rman *rm;
|
struct rman *rm;
|
||||||
#endif
|
#endif
|
||||||
int error;
|
int error, type;
|
||||||
|
|
||||||
|
type = rman_get_type(r);
|
||||||
#ifdef INVARIANTS
|
#ifdef INVARIANTS
|
||||||
rm = BUS_GET_RMAN(dev, type, rman_get_flags(r));
|
rm = BUS_GET_RMAN(dev, type, rman_get_flags(r));
|
||||||
KASSERT(rman_is_region_manager(r, rm),
|
KASSERT(rman_is_region_manager(r, rm),
|
||||||
|
@ -4571,18 +4570,17 @@ bus_translate_resource(device_t dev, int type, rman_res_t start,
|
||||||
* parent of @p dev.
|
* parent of @p dev.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
bus_activate_resource(device_t dev, int type, int rid, struct resource *r)
|
bus_activate_resource(device_t dev, struct resource *r)
|
||||||
{
|
{
|
||||||
if (dev->parent == NULL)
|
if (dev->parent == NULL)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
return (BUS_ACTIVATE_RESOURCE(dev->parent, dev, type, rid, r));
|
return (BUS_ACTIVATE_RESOURCE(dev->parent, dev, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bus_activate_resource_new(device_t dev, struct resource *r)
|
bus_activate_resource_old(device_t dev, int type, int rid, struct resource *r)
|
||||||
{
|
{
|
||||||
return (bus_activate_resource(dev, rman_get_type(r), rman_get_rid(r),
|
return (bus_activate_resource(dev, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4592,18 +4590,17 @@ bus_activate_resource_new(device_t dev, struct resource *r)
|
||||||
* parent of @p dev.
|
* parent of @p dev.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
bus_deactivate_resource(device_t dev, int type, int rid, struct resource *r)
|
bus_deactivate_resource(device_t dev, struct resource *r)
|
||||||
{
|
{
|
||||||
if (dev->parent == NULL)
|
if (dev->parent == NULL)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
return (BUS_DEACTIVATE_RESOURCE(dev->parent, dev, type, rid, r));
|
return (BUS_DEACTIVATE_RESOURCE(dev->parent, dev, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bus_deactivate_resource_new(device_t dev, struct resource *r)
|
bus_deactivate_resource_old(device_t dev, int type, int rid, struct resource *r)
|
||||||
{
|
{
|
||||||
return (bus_deactivate_resource(dev, rman_get_type(r), rman_get_rid(r),
|
return (bus_deactivate_resource(dev, r));
|
||||||
r));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -74,9 +74,8 @@ static int lbc_map_resource(device_t, device_t, struct resource *,
|
||||||
static int lbc_unmap_resource(device_t, device_t, struct resource *,
|
static int lbc_unmap_resource(device_t, device_t, struct resource *,
|
||||||
struct resource_map *map);
|
struct resource_map *map);
|
||||||
static int lbc_activate_resource(device_t bus, device_t child,
|
static int lbc_activate_resource(device_t bus, device_t child,
|
||||||
int type, int rid, struct resource *r);
|
struct resource *r);
|
||||||
static int lbc_deactivate_resource(device_t bus,
|
static int lbc_deactivate_resource(device_t bus, device_t child,
|
||||||
device_t child, int type __unused, int rid,
|
|
||||||
struct resource *r);
|
struct resource *r);
|
||||||
static struct rman *lbc_get_rman(device_t, int, u_int);
|
static struct rman *lbc_get_rman(device_t, int, u_int);
|
||||||
static struct resource *lbc_alloc_resource(device_t, device_t, int, int *,
|
static struct resource *lbc_alloc_resource(device_t, device_t, int, int *,
|
||||||
|
@ -795,36 +794,26 @@ lbc_release_resource(device_t dev, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
lbc_activate_resource(device_t bus, device_t child, int type, int rid,
|
lbc_activate_resource(device_t bus, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
case SYS_RES_IOPORT:
|
|
||||||
type = SYS_RES_MEMORY;
|
|
||||||
/* FALLTHROUGH */
|
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
return (bus_generic_rman_activate_resource(bus, child, type,
|
return (bus_generic_rman_activate_resource(bus, child, r));
|
||||||
rid, r));
|
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
return (bus_generic_activate_resource(bus, child, type, rid, r));
|
return (bus_generic_activate_resource(bus, child, r));
|
||||||
default:
|
default:
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
lbc_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
lbc_deactivate_resource(device_t bus, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
case SYS_RES_IOPORT:
|
|
||||||
type = SYS_RES_MEMORY;
|
|
||||||
/* FALLTHROUGH */
|
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
return (bus_generic_rman_deactivate_resource(bus, child, type,
|
return (bus_generic_rman_deactivate_resource(bus, child, r));
|
||||||
rid, r));
|
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
return (bus_generic_deactivate_resource(bus, child, type, rid, r));
|
return (bus_generic_deactivate_resource(bus, child, r));
|
||||||
default:
|
default:
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,9 +71,9 @@ static int macgpio_print_child(device_t dev, device_t child);
|
||||||
static void macgpio_probe_nomatch(device_t, device_t);
|
static void macgpio_probe_nomatch(device_t, device_t);
|
||||||
static struct resource *macgpio_alloc_resource(device_t, device_t, int, int *,
|
static struct resource *macgpio_alloc_resource(device_t, device_t, int, int *,
|
||||||
rman_res_t, rman_res_t, rman_res_t, u_int);
|
rman_res_t, rman_res_t, rman_res_t, u_int);
|
||||||
static int macgpio_activate_resource(device_t, device_t, int, int,
|
static int macgpio_activate_resource(device_t, device_t,
|
||||||
struct resource *);
|
struct resource *);
|
||||||
static int macgpio_deactivate_resource(device_t, device_t, int, int,
|
static int macgpio_deactivate_resource(device_t, device_t,
|
||||||
struct resource *);
|
struct resource *);
|
||||||
static ofw_bus_get_devinfo_t macgpio_get_devinfo;
|
static ofw_bus_get_devinfo_t macgpio_get_devinfo;
|
||||||
static int macgpio_suspend(device_t dev);
|
static int macgpio_suspend(device_t dev);
|
||||||
|
@ -275,8 +275,7 @@ macgpio_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
macgpio_activate_resource(device_t bus, device_t child, int type, int rid,
|
macgpio_activate_resource(device_t bus, device_t child, struct resource *res)
|
||||||
struct resource *res)
|
|
||||||
{
|
{
|
||||||
struct macgpio_softc *sc;
|
struct macgpio_softc *sc;
|
||||||
struct macgpio_devinfo *dinfo;
|
struct macgpio_devinfo *dinfo;
|
||||||
|
@ -285,7 +284,7 @@ macgpio_activate_resource(device_t bus, device_t child, int type, int rid,
|
||||||
sc = device_get_softc(bus);
|
sc = device_get_softc(bus);
|
||||||
dinfo = device_get_ivars(child);
|
dinfo = device_get_ivars(child);
|
||||||
|
|
||||||
if (type != SYS_RES_IRQ)
|
if (rman_get_type(res) != SYS_RES_IRQ)
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
|
||||||
if (dinfo->gpio_num >= 0) {
|
if (dinfo->gpio_num >= 0) {
|
||||||
|
@ -294,12 +293,11 @@ macgpio_activate_resource(device_t bus, device_t child, int type, int rid,
|
||||||
bus_write_1(sc->sc_gpios,dinfo->gpio_num,val);
|
bus_write_1(sc->sc_gpios,dinfo->gpio_num,val);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (bus_activate_resource(bus, type, rid, res));
|
return (bus_generic_activate_resource(bus, child, res));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
macgpio_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
macgpio_deactivate_resource(device_t bus, device_t child, struct resource *res)
|
||||||
struct resource *res)
|
|
||||||
{
|
{
|
||||||
struct macgpio_softc *sc;
|
struct macgpio_softc *sc;
|
||||||
struct macgpio_devinfo *dinfo;
|
struct macgpio_devinfo *dinfo;
|
||||||
|
@ -308,7 +306,7 @@ macgpio_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
||||||
sc = device_get_softc(bus);
|
sc = device_get_softc(bus);
|
||||||
dinfo = device_get_ivars(child);
|
dinfo = device_get_ivars(child);
|
||||||
|
|
||||||
if (type != SYS_RES_IRQ)
|
if (rman_get_type(res) != SYS_RES_IRQ)
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
|
||||||
if (dinfo->gpio_num >= 0) {
|
if (dinfo->gpio_num >= 0) {
|
||||||
|
@ -317,7 +315,7 @@ macgpio_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
||||||
bus_write_1(sc->sc_gpios,dinfo->gpio_num,val);
|
bus_write_1(sc->sc_gpios,dinfo->gpio_num,val);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (bus_deactivate_resource(bus, type, rid, res));
|
return (bus_generic_deactivate_resource(bus, child, res));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t
|
uint8_t
|
||||||
|
|
|
@ -86,10 +86,8 @@ static struct resource *macio_alloc_resource(device_t, device_t, int, int *,
|
||||||
u_int);
|
u_int);
|
||||||
static int macio_adjust_resource(device_t, device_t, struct resource *,
|
static int macio_adjust_resource(device_t, device_t, struct resource *,
|
||||||
rman_res_t, rman_res_t);
|
rman_res_t, rman_res_t);
|
||||||
static int macio_activate_resource(device_t, device_t, int, int,
|
static int macio_activate_resource(device_t, device_t, struct resource *);
|
||||||
struct resource *);
|
static int macio_deactivate_resource(device_t, device_t, struct resource *);
|
||||||
static int macio_deactivate_resource(device_t, device_t, int, int,
|
|
||||||
struct resource *);
|
|
||||||
static int macio_release_resource(device_t, device_t, int, int,
|
static int macio_release_resource(device_t, device_t, int, int,
|
||||||
struct resource *);
|
struct resource *);
|
||||||
static int macio_map_resource(device_t, device_t, struct resource *,
|
static int macio_map_resource(device_t, device_t, struct resource *,
|
||||||
|
@ -629,34 +627,28 @@ macio_release_resource(device_t bus, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
macio_activate_resource(device_t bus, device_t child, int type, int rid,
|
macio_activate_resource(device_t bus, device_t child, struct resource *res)
|
||||||
struct resource *res)
|
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (rman_get_type(res)) {
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
return (bus_generic_rman_activate_resource(bus, child, type,
|
return (bus_generic_rman_activate_resource(bus, child, res));
|
||||||
rid, res));
|
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
return (bus_generic_activate_resource(bus, child, type, rid,
|
return (bus_generic_activate_resource(bus, child, res));
|
||||||
res));
|
|
||||||
default:
|
default:
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
macio_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
macio_deactivate_resource(device_t bus, device_t child, struct resource *res)
|
||||||
struct resource *res)
|
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (rman_get_type(res)) {
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
return (bus_generic_rman_deactivate_resource(bus, child, type,
|
return (bus_generic_rman_deactivate_resource(bus, child, res));
|
||||||
rid, res));
|
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
return (bus_generic_deactivate_resource(bus, child, type, rid,
|
return (bus_generic_deactivate_resource(bus, child, res));
|
||||||
res));
|
|
||||||
default:
|
default:
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,9 +78,9 @@ static struct resource *unin_chip_alloc_resource(device_t, device_t, int, int *,
|
||||||
static int unin_chip_adjust_resource(device_t, device_t,
|
static int unin_chip_adjust_resource(device_t, device_t,
|
||||||
struct resource *, rman_res_t,
|
struct resource *, rman_res_t,
|
||||||
rman_res_t);
|
rman_res_t);
|
||||||
static int unin_chip_activate_resource(device_t, device_t, int, int,
|
static int unin_chip_activate_resource(device_t, device_t,
|
||||||
struct resource *);
|
struct resource *);
|
||||||
static int unin_chip_deactivate_resource(device_t, device_t, int, int,
|
static int unin_chip_deactivate_resource(device_t, device_t,
|
||||||
struct resource *);
|
struct resource *);
|
||||||
static int unin_chip_map_resource(device_t, device_t, struct resource *,
|
static int unin_chip_map_resource(device_t, device_t, struct resource *,
|
||||||
struct resource_map_request *,
|
struct resource_map_request *,
|
||||||
|
@ -587,34 +587,29 @@ unin_chip_release_resource(device_t bus, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
unin_chip_activate_resource(device_t bus, device_t child, int type, int rid,
|
unin_chip_activate_resource(device_t bus, device_t child, struct resource *res)
|
||||||
struct resource *res)
|
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (rman_get_type(res)) {
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
return (bus_generic_rman_activate_resource(bus, child, type,
|
return (bus_generic_rman_activate_resource(bus, child, res));
|
||||||
rid, res));
|
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
return (bus_generic_activate_resource(bus, child, type, rid,
|
return (bus_generic_activate_resource(bus, child, res));
|
||||||
res));
|
|
||||||
default:
|
default:
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
unin_chip_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
unin_chip_deactivate_resource(device_t bus, device_t child,
|
||||||
struct resource *res)
|
struct resource *res)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (rman_get_type(res)) {
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
return (bus_generic_rman_deactivate_resource(bus, child, type,
|
return (bus_generic_rman_deactivate_resource(bus, child, res));
|
||||||
rid, res));
|
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
return (bus_generic_deactivate_resource(bus, child, type, rid,
|
return (bus_generic_deactivate_resource(bus, child, res));
|
||||||
res));
|
|
||||||
default:
|
default:
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,10 +76,8 @@ static struct resource *iobus_alloc_resource(device_t, device_t, int, int *,
|
||||||
u_int);
|
u_int);
|
||||||
static int iobus_adjust_resource(device_t, device_t, struct resource *,
|
static int iobus_adjust_resource(device_t, device_t, struct resource *,
|
||||||
rman_res_t, rman_res_t);
|
rman_res_t, rman_res_t);
|
||||||
static int iobus_activate_resource(device_t, device_t, int, int,
|
static int iobus_activate_resource(device_t, device_t, struct resource *);
|
||||||
struct resource *);
|
static int iobus_deactivate_resource(device_t, device_t, struct resource *);
|
||||||
static int iobus_deactivate_resource(device_t, device_t, int, int,
|
|
||||||
struct resource *);
|
|
||||||
static int iobus_map_resource(device_t, device_t, struct resource *,
|
static int iobus_map_resource(device_t, device_t, struct resource *,
|
||||||
struct resource_map_request *,
|
struct resource_map_request *,
|
||||||
struct resource_map *);
|
struct resource_map *);
|
||||||
|
@ -376,34 +374,30 @@ iobus_release_resource(device_t bus, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
iobus_activate_resource(device_t bus, device_t child, int type, int rid,
|
iobus_activate_resource(device_t bus, device_t child, struct resource *res)
|
||||||
struct resource *res)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (type) {
|
switch (rman_get_type(res)) {
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
return (bus_generic_activate_resource(bus, child, type, rid, res));
|
return (bus_generic_activate_resource(bus, child, res));
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
return (bus_generic_rman_activate_resource(bus, child, type,
|
return (bus_generic_rman_activate_resource(bus, child, res));
|
||||||
rid, res));
|
|
||||||
default:
|
default:
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
iobus_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
iobus_deactivate_resource(device_t bus, device_t child, struct resource *res)
|
||||||
struct resource *res)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (type) {
|
switch (rman_get_type(res)) {
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
return (bus_generic_deactivate_resource(bus, child, type, rid, res));
|
return (bus_generic_deactivate_resource(bus, child, res));
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
return (bus_generic_rman_deactivate_resource(bus, child, type,
|
return (bus_generic_rman_deactivate_resource(bus, child, res));
|
||||||
rid, res));
|
|
||||||
default:
|
default:
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,16 +303,14 @@ nexus_get_bus_tag(device_t bus __unused, device_t child __unused)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
|
nexus_activate_resource(device_t bus, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
error = bus_generic_rman_activate_resource(bus, child, type,
|
error = bus_generic_rman_activate_resource(bus, child, r);
|
||||||
rid, r);
|
|
||||||
break;
|
break;
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
error = rman_activate_resource(r);
|
error = rman_activate_resource(r);
|
||||||
|
@ -340,16 +338,14 @@ nexus_get_reslist(device_t dev, device_t child)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
nexus_deactivate_resource(device_t bus, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
switch (type) {
|
switch (rman_get_type(r)) {
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
error = bus_generic_rman_deactivate_resource(bus, child, type,
|
error = bus_generic_rman_deactivate_resource(bus, child, r);
|
||||||
rid, r);
|
|
||||||
break;
|
break;
|
||||||
case SYS_RES_IRQ:
|
case SYS_RES_IRQ:
|
||||||
error = rman_deactivate_resource(r);
|
error = rman_deactivate_resource(r);
|
||||||
|
|
|
@ -427,8 +427,8 @@ void root_bus_configure(void);
|
||||||
|
|
||||||
struct _cpuset;
|
struct _cpuset;
|
||||||
|
|
||||||
int bus_generic_activate_resource(device_t dev, device_t child, int type,
|
int bus_generic_activate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r);
|
struct resource *r);
|
||||||
device_t
|
device_t
|
||||||
bus_generic_add_child(device_t dev, u_int order, const char *name,
|
bus_generic_add_child(device_t dev, u_int order, const char *name,
|
||||||
int unit);
|
int unit);
|
||||||
|
@ -452,8 +452,8 @@ int bus_generic_config_intr(device_t, int, enum intr_trigger,
|
||||||
int bus_generic_describe_intr(device_t dev, device_t child,
|
int bus_generic_describe_intr(device_t dev, device_t child,
|
||||||
struct resource *irq, void *cookie,
|
struct resource *irq, void *cookie,
|
||||||
const char *descr);
|
const char *descr);
|
||||||
int bus_generic_deactivate_resource(device_t dev, device_t child, int type,
|
int bus_generic_deactivate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r);
|
struct resource *r);
|
||||||
int bus_generic_detach(device_t dev);
|
int bus_generic_detach(device_t dev);
|
||||||
void bus_generic_driver_added(device_t dev, driver_t *driver);
|
void bus_generic_driver_added(device_t dev, driver_t *driver);
|
||||||
int bus_generic_get_cpus(device_t dev, device_t child, enum cpu_sets op,
|
int bus_generic_get_cpus(device_t dev, device_t child, enum cpu_sets op,
|
||||||
|
@ -511,10 +511,8 @@ int bus_generic_rman_release_resource(device_t dev, device_t child,
|
||||||
int type, int rid,
|
int type, int rid,
|
||||||
struct resource *r);
|
struct resource *r);
|
||||||
int bus_generic_rman_activate_resource(device_t dev, device_t child,
|
int bus_generic_rman_activate_resource(device_t dev, device_t child,
|
||||||
int type, int rid,
|
|
||||||
struct resource *r);
|
struct resource *r);
|
||||||
int bus_generic_rman_deactivate_resource(device_t dev, device_t child,
|
int bus_generic_rman_deactivate_resource(device_t dev, device_t child,
|
||||||
int type, int rid,
|
|
||||||
struct resource *r);
|
struct resource *r);
|
||||||
|
|
||||||
int bus_generic_shutdown(device_t dev);
|
int bus_generic_shutdown(device_t dev);
|
||||||
|
@ -561,10 +559,8 @@ int bus_translate_resource(device_t child, int type, rman_res_t start,
|
||||||
struct resource *bus_alloc_resource(device_t dev, int type, int *rid,
|
struct resource *bus_alloc_resource(device_t dev, int type, int *rid,
|
||||||
rman_res_t start, rman_res_t end,
|
rman_res_t start, rman_res_t end,
|
||||||
rman_res_t count, u_int flags);
|
rman_res_t count, u_int flags);
|
||||||
int bus_activate_resource(device_t dev, int type, int rid,
|
int bus_activate_resource(device_t dev, struct resource *r);
|
||||||
struct resource *r);
|
int bus_deactivate_resource(device_t dev, struct resource *r);
|
||||||
int bus_deactivate_resource(device_t dev, int type, int rid,
|
|
||||||
struct resource *r);
|
|
||||||
int bus_map_resource(device_t dev, struct resource *r,
|
int bus_map_resource(device_t dev, struct resource *r,
|
||||||
struct resource_map_request *args,
|
struct resource_map_request *args,
|
||||||
struct resource_map *map);
|
struct resource_map *map);
|
||||||
|
@ -616,8 +612,10 @@ bus_alloc_resource_anywhere(device_t dev, int type, int *rid,
|
||||||
/* Compat shims for simpler bus resource API. */
|
/* Compat shims for simpler bus resource API. */
|
||||||
int bus_adjust_resource_old(device_t child, int type, struct resource *r,
|
int bus_adjust_resource_old(device_t child, int type, struct resource *r,
|
||||||
rman_res_t start, rman_res_t end);
|
rman_res_t start, rman_res_t end);
|
||||||
int bus_activate_resource_new(device_t dev, struct resource *r);
|
int bus_activate_resource_old(device_t dev, int type, int rid,
|
||||||
int bus_deactivate_resource_new(device_t dev, struct resource *r);
|
struct resource *r);
|
||||||
|
int bus_deactivate_resource_old(device_t dev, int type, int rid,
|
||||||
|
struct resource *r);
|
||||||
int bus_map_resource_old(device_t dev, int type, struct resource *r,
|
int bus_map_resource_old(device_t dev, int type, struct resource *r,
|
||||||
struct resource_map_request *args,
|
struct resource_map_request *args,
|
||||||
struct resource_map *map);
|
struct resource_map *map);
|
||||||
|
@ -632,12 +630,12 @@ int bus_release_resource_new(device_t dev, struct resource *r);
|
||||||
bus_adjust_resource)(__VA_ARGS__)
|
bus_adjust_resource)(__VA_ARGS__)
|
||||||
|
|
||||||
#define bus_activate_resource(...) \
|
#define bus_activate_resource(...) \
|
||||||
_BUS_API_MACRO(__VA_ARGS__, INVALID, bus_activate_resource, \
|
_BUS_API_MACRO(__VA_ARGS__, INVALID, bus_activate_resource_old, \
|
||||||
INVALID, bus_activate_resource_new)(__VA_ARGS__)
|
INVALID, bus_activate_resource)(__VA_ARGS__)
|
||||||
|
|
||||||
#define bus_deactivate_resource(...) \
|
#define bus_deactivate_resource(...) \
|
||||||
_BUS_API_MACRO(__VA_ARGS__, INVALID, bus_deactivate_resource, \
|
_BUS_API_MACRO(__VA_ARGS__, INVALID, bus_deactivate_resource_old, \
|
||||||
INVALID, bus_deactivate_resource_new)(__VA_ARGS__)
|
INVALID, bus_deactivate_resource)(__VA_ARGS__)
|
||||||
|
|
||||||
#define bus_map_resource(...) \
|
#define bus_map_resource(...) \
|
||||||
_BUS_API_MACRO(__VA_ARGS__, bus_map_resource_old, \
|
_BUS_API_MACRO(__VA_ARGS__, bus_map_resource_old, \
|
||||||
|
|
|
@ -62,10 +62,10 @@ int legacy_pcib_adjust_resource(device_t dev, device_t child,
|
||||||
struct resource *r, rman_res_t start, rman_res_t end);
|
struct resource *r, rman_res_t start, rman_res_t end);
|
||||||
int legacy_pcib_release_resource(device_t dev, device_t child, int type,
|
int legacy_pcib_release_resource(device_t dev, device_t child, int type,
|
||||||
int rid, struct resource *r);
|
int rid, struct resource *r);
|
||||||
int legacy_pcib_activate_resource(device_t dev, device_t child, int type,
|
int legacy_pcib_activate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r);
|
struct resource *r);
|
||||||
int legacy_pcib_deactivate_resource(device_t dev, device_t child, int type,
|
int legacy_pcib_deactivate_resource(device_t dev, device_t child,
|
||||||
int rid, struct resource *r);
|
struct resource *r);
|
||||||
int legacy_pcib_alloc_msi(device_t pcib, device_t dev, int count,
|
int legacy_pcib_alloc_msi(device_t pcib, device_t dev, int count,
|
||||||
int maxcount, int *irqs);
|
int maxcount, int *irqs);
|
||||||
int legacy_pcib_alloc_msix(device_t pcib, device_t dev, int *irq);
|
int legacy_pcib_alloc_msix(device_t pcib, device_t dev, int *irq);
|
||||||
|
|
|
@ -627,21 +627,20 @@ legacy_pcib_release_resource(device_t dev, device_t child, int type, int rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
legacy_pcib_activate_resource(device_t dev, device_t child, int type, int rid,
|
legacy_pcib_activate_resource(device_t dev, device_t child, struct resource *r)
|
||||||
struct resource *r)
|
|
||||||
{
|
{
|
||||||
if (type == PCI_RES_BUS)
|
if (rman_get_type(r) == PCI_RES_BUS)
|
||||||
return (pci_domain_activate_bus(0, child, rid, r));
|
return (pci_domain_activate_bus(0, child, r));
|
||||||
return (bus_generic_activate_resource(dev, child, type, rid, r));
|
return (bus_generic_activate_resource(dev, child, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
legacy_pcib_deactivate_resource(device_t dev, device_t child, int type, int rid,
|
legacy_pcib_deactivate_resource(device_t dev, device_t child,
|
||||||
struct resource *r)
|
struct resource *r)
|
||||||
{
|
{
|
||||||
if (type == PCI_RES_BUS)
|
if (rman_get_type(r) == PCI_RES_BUS)
|
||||||
return (pci_domain_deactivate_bus(0, child, rid, r));
|
return (pci_domain_deactivate_bus(0, child, r));
|
||||||
return (bus_generic_deactivate_resource(dev, child, type, rid, r));
|
return (bus_generic_deactivate_resource(dev, child, r));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue