summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/legacy.c18
-rw-r--r--sys/amd64/amd64/nexus.c18
-rw-r--r--sys/i386/i386/legacy.c18
-rw-r--r--sys/i386/i386/nexus.c18
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));
}
OpenPOWER on IntegriCloud