summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bsd-core/drmP.h1
-rw-r--r--bsd-core/drm_dma.c28
-rw-r--r--bsd/drmP.h1
-rw-r--r--bsd/drm_dma.h28
4 files changed, 32 insertions, 26 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 1adaa0e5..b7b21da4 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -448,6 +448,7 @@ struct drm_device {
/* Context support */
#ifdef __FreeBSD__
int irq; /* Interrupt used by board */
+ int irqrid; /* Interrupt used by board */
struct resource *irqr; /* Resource for interrupt used by board */
#elif defined(__NetBSD__)
struct pci_attach_args pa;
diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c
index 4593a712..5632b5a2 100644
--- a/bsd-core/drm_dma.c
+++ b/bsd-core/drm_dma.c
@@ -41,12 +41,6 @@
#define __HAVE_SHARED_IRQ 0
#endif
-#if __HAVE_SHARED_IRQ
-#define DRM_IRQ_TYPE SA_SHIRQ
-#else
-#define DRM_IRQ_TYPE 0
-#endif
-
#if __HAVE_DMA
int DRM(dma_setup)( drm_device_t *dev )
@@ -503,7 +497,6 @@ int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma)
int DRM(irq_install)( drm_device_t *dev, int irq )
{
- int rid;
int retcode;
if ( !irq )
@@ -535,18 +528,24 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
DRM(driver_irq_preinstall)( dev );
/* Install handler */
- rid = 0;
- dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &rid,
+ dev->irqrid = 0;
+ dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &dev->irqrid,
0, ~0, 1, RF_SHAREABLE);
- if (!dev->irqr)
+ if (!dev->irqr) {
+ DRM_LOCK;
+ dev->irq = 0;
+ dev->irqrid = 0;
+ DRM_UNLOCK;
return ENOENT;
+ }
retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY,
DRM(dma_service), dev, &dev->irqh);
if ( retcode ) {
DRM_LOCK;
- bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irqr);
+ bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr);
dev->irq = 0;
+ dev->irqrid = 0;
DRM_UNLOCK;
return retcode;
}
@@ -560,10 +559,13 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
int DRM(irq_uninstall)( drm_device_t *dev )
{
int irq;
-
+ int irqrid;
+
DRM_LOCK;
irq = dev->irq;
+ irqrid = dev->irqrid;
dev->irq = 0;
+ dev->irqrid = 0;
DRM_UNLOCK;
if ( !irq )
@@ -574,7 +576,7 @@ int DRM(irq_uninstall)( drm_device_t *dev )
DRM(driver_irq_uninstall)( dev );
bus_teardown_intr(dev->device, dev->irqr, dev->irqh);
- bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irqr);
+ bus_release_resource(dev->device, SYS_RES_IRQ, irqrid, dev->irqr);
return 0;
}
diff --git a/bsd/drmP.h b/bsd/drmP.h
index 1adaa0e5..b7b21da4 100644
--- a/bsd/drmP.h
+++ b/bsd/drmP.h
@@ -448,6 +448,7 @@ struct drm_device {
/* Context support */
#ifdef __FreeBSD__
int irq; /* Interrupt used by board */
+ int irqrid; /* Interrupt used by board */
struct resource *irqr; /* Resource for interrupt used by board */
#elif defined(__NetBSD__)
struct pci_attach_args pa;
diff --git a/bsd/drm_dma.h b/bsd/drm_dma.h
index 4593a712..5632b5a2 100644
--- a/bsd/drm_dma.h
+++ b/bsd/drm_dma.h
@@ -41,12 +41,6 @@
#define __HAVE_SHARED_IRQ 0
#endif
-#if __HAVE_SHARED_IRQ
-#define DRM_IRQ_TYPE SA_SHIRQ
-#else
-#define DRM_IRQ_TYPE 0
-#endif
-
#if __HAVE_DMA
int DRM(dma_setup)( drm_device_t *dev )
@@ -503,7 +497,6 @@ int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma)
int DRM(irq_install)( drm_device_t *dev, int irq )
{
- int rid;
int retcode;
if ( !irq )
@@ -535,18 +528,24 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
DRM(driver_irq_preinstall)( dev );
/* Install handler */
- rid = 0;
- dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &rid,
+ dev->irqrid = 0;
+ dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &dev->irqrid,
0, ~0, 1, RF_SHAREABLE);
- if (!dev->irqr)
+ if (!dev->irqr) {
+ DRM_LOCK;
+ dev->irq = 0;
+ dev->irqrid = 0;
+ DRM_UNLOCK;
return ENOENT;
+ }
retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY,
DRM(dma_service), dev, &dev->irqh);
if ( retcode ) {
DRM_LOCK;
- bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irqr);
+ bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr);
dev->irq = 0;
+ dev->irqrid = 0;
DRM_UNLOCK;
return retcode;
}
@@ -560,10 +559,13 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
int DRM(irq_uninstall)( drm_device_t *dev )
{
int irq;
-
+ int irqrid;
+
DRM_LOCK;
irq = dev->irq;
+ irqrid = dev->irqrid;
dev->irq = 0;
+ dev->irqrid = 0;
DRM_UNLOCK;
if ( !irq )
@@ -574,7 +576,7 @@ int DRM(irq_uninstall)( drm_device_t *dev )
DRM(driver_irq_uninstall)( dev );
bus_teardown_intr(dev->device, dev->irqr, dev->irqh);
- bus_release_resource(dev->device, SYS_RES_IRQ, 0, dev->irqr);
+ bus_release_resource(dev->device, SYS_RES_IRQ, irqrid, dev->irqr);
return 0;
}