summaryrefslogtreecommitdiff
path: root/bsd/drm_dma.h
diff options
context:
space:
mode:
Diffstat (limited to 'bsd/drm_dma.h')
-rw-r--r--bsd/drm_dma.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/bsd/drm_dma.h b/bsd/drm_dma.h
index 0f0dd4fd..01b1cdb0 100644
--- a/bsd/drm_dma.h
+++ b/bsd/drm_dma.h
@@ -534,9 +534,13 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
/* Install handler */
dev->irqrid = 0;
+#ifdef __FreeBSD__
dev->irqr = bus_alloc_resource(dev->device, SYS_RES_IRQ, &dev->irqrid,
0, ~0, 1, RF_SHAREABLE);
if (!dev->irqr) {
+#elif defined(__NetBSD__)
+ if (pci_intr_map(&dev->pa, &dev->ih) != 0) {
+#endif
DRM_LOCK;
dev->irq = 0;
dev->irqrid = 0;
@@ -544,11 +548,24 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
return ENOENT;
}
+#ifdef __FreeBSD__
+#if __FreeBSD_version < 500000
retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY,
DRM(dma_service), dev, &dev->irqh);
+#else
+ retcode = bus_setup_intr(dev->device, dev->irqr, INTR_TYPE_TTY | INTR_MPSAFE,
+ DRM(dma_service), dev, &dev->irqh);
+#endif
if ( retcode ) {
+#elif defined(__NetBSD__)
+ dev->irqh = pci_intr_establish(&dev->pa.pa_pc, dev->ih, IPL_TTY,
+ (int (*)(DRM_IRQ_ARGS))DRM(dma_service), dev);
+ if ( !dev->irqh ) {
+#endif
DRM_LOCK;
+#ifdef __FreeBSD__
bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr);
+#endif
dev->irq = 0;
dev->irqrid = 0;
DRM_UNLOCK;
@@ -580,9 +597,13 @@ int DRM(irq_uninstall)( drm_device_t *dev )
DRM(driver_irq_uninstall)( dev );
+#ifdef __FreeBSD__
bus_teardown_intr(dev->device, dev->irqr, dev->irqh);
bus_release_resource(dev->device, SYS_RES_IRQ, irqrid, dev->irqr);
-
+#elif defined(__NetBSD__)
+ pci_intr_disestablish(&dev->pa.pa_pc, dev->irqh);
+#endif
+
return 0;
}