diff options
author | dfr <dfr@FreeBSD.org> | 1999-05-30 10:50:57 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1999-05-30 10:50:57 +0000 |
commit | 8a8d1b8c17a111d9a5ee314eccf2305075acac48 (patch) | |
tree | 95ef06d4bd8eb87756a72f769a3c49f86d27385a /sys | |
parent | 024249e17e67f5b4252a5386341b5bb6feb46a43 (diff) | |
download | FreeBSD-src-8a8d1b8c17a111d9a5ee314eccf2305075acac48.zip FreeBSD-src-8a8d1b8c17a111d9a5ee314eccf2305075acac48.tar.gz |
Activate/deactivate resources by calling the method, not through the
resource manager automatic handling of RF_ACTIVE.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/legacy.c | 18 | ||||
-rw-r--r-- | sys/amd64/amd64/nexus.c | 18 | ||||
-rw-r--r-- | sys/i386/i386/legacy.c | 18 | ||||
-rw-r--r-- | sys/i386/i386/nexus.c | 18 |
4 files changed, 68 insertions, 4 deletions
diff --git a/sys/amd64/amd64/legacy.c b/sys/amd64/amd64/legacy.c index 8551f36..8b16d43 100644 --- a/sys/amd64/amd64/legacy.c +++ b/sys/amd64/amd64/legacy.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: nexus.c,v 1.9 1999/05/10 17:56:20 dfr Exp $ + * $Id: nexus.c,v 1.10 1999/05/18 20:48:41 peter Exp $ */ /* @@ -224,6 +224,9 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, { struct resource *rv; struct rman *rm; + int needactivate = flags & RF_ACTIVE; + + flags &= ~RF_ACTIVE; switch (type) { case SYS_RES_IRQ: @@ -276,6 +279,14 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_set_bustag(rv, I386_BUS_SPACE_IO); rman_set_bushandle(rv, rv->r_start); } + + if (needactivate) { + if (bus_activate_resource(child, type, *rid, rv)) { + rman_release_resource(rv); + return 0; + } + } + return rv; } @@ -297,6 +308,11 @@ static int nexus_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { + if (r->r_flags & RF_ACTIVE) { + int error = bus_deactivate_resource(child, type, rid, r); + if (error) + return error; + } return (rman_release_resource(r)); } diff --git a/sys/amd64/amd64/nexus.c b/sys/amd64/amd64/nexus.c index 8551f36..8b16d43 100644 --- a/sys/amd64/amd64/nexus.c +++ b/sys/amd64/amd64/nexus.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: nexus.c,v 1.9 1999/05/10 17:56:20 dfr Exp $ + * $Id: nexus.c,v 1.10 1999/05/18 20:48:41 peter Exp $ */ /* @@ -224,6 +224,9 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, { struct resource *rv; struct rman *rm; + int needactivate = flags & RF_ACTIVE; + + flags &= ~RF_ACTIVE; switch (type) { case SYS_RES_IRQ: @@ -276,6 +279,14 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_set_bustag(rv, I386_BUS_SPACE_IO); rman_set_bushandle(rv, rv->r_start); } + + if (needactivate) { + if (bus_activate_resource(child, type, *rid, rv)) { + rman_release_resource(rv); + return 0; + } + } + return rv; } @@ -297,6 +308,11 @@ static int nexus_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { + if (r->r_flags & RF_ACTIVE) { + int error = bus_deactivate_resource(child, type, rid, r); + if (error) + return error; + } return (rman_release_resource(r)); } diff --git a/sys/i386/i386/legacy.c b/sys/i386/i386/legacy.c index 8551f36..8b16d43 100644 --- a/sys/i386/i386/legacy.c +++ b/sys/i386/i386/legacy.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: nexus.c,v 1.9 1999/05/10 17:56:20 dfr Exp $ + * $Id: nexus.c,v 1.10 1999/05/18 20:48:41 peter Exp $ */ /* @@ -224,6 +224,9 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, { struct resource *rv; struct rman *rm; + int needactivate = flags & RF_ACTIVE; + + flags &= ~RF_ACTIVE; switch (type) { case SYS_RES_IRQ: @@ -276,6 +279,14 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_set_bustag(rv, I386_BUS_SPACE_IO); rman_set_bushandle(rv, rv->r_start); } + + if (needactivate) { + if (bus_activate_resource(child, type, *rid, rv)) { + rman_release_resource(rv); + return 0; + } + } + return rv; } @@ -297,6 +308,11 @@ static int nexus_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { + if (r->r_flags & RF_ACTIVE) { + int error = bus_deactivate_resource(child, type, rid, r); + if (error) + return error; + } return (rman_release_resource(r)); } diff --git a/sys/i386/i386/nexus.c b/sys/i386/i386/nexus.c index 8551f36..8b16d43 100644 --- a/sys/i386/i386/nexus.c +++ b/sys/i386/i386/nexus.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: nexus.c,v 1.9 1999/05/10 17:56:20 dfr Exp $ + * $Id: nexus.c,v 1.10 1999/05/18 20:48:41 peter Exp $ */ /* @@ -224,6 +224,9 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, { struct resource *rv; struct rman *rm; + int needactivate = flags & RF_ACTIVE; + + flags &= ~RF_ACTIVE; switch (type) { case SYS_RES_IRQ: @@ -276,6 +279,14 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_set_bustag(rv, I386_BUS_SPACE_IO); rman_set_bushandle(rv, rv->r_start); } + + if (needactivate) { + if (bus_activate_resource(child, type, *rid, rv)) { + rman_release_resource(rv); + return 0; + } + } + return rv; } @@ -297,6 +308,11 @@ static int nexus_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { + if (r->r_flags & RF_ACTIVE) { + int error = bus_deactivate_resource(child, type, rid, r); + if (error) + return error; + } return (rman_release_resource(r)); } |