diff options
author | Eric Anholt <anholt@freebsd.org> | 2003-02-21 23:23:09 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2003-02-21 23:23:09 +0000 |
commit | cfa778af9c70faea8c13e5cb7f80029eee0d074e (patch) | |
tree | 15483e64b6c2b56d3bb0f247df9df2c2602e0404 /bsd-core/drm_dma.c | |
parent | a64472d18493de575a7636704b45babe7b4b4572 (diff) |
Merge from bsd-4-0-0-branch.bsd-4-0-0-20030221-merge
Diffstat (limited to 'bsd-core/drm_dma.c')
-rw-r--r-- | bsd-core/drm_dma.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c index 0f0dd4fd..01b1cdb0 100644 --- a/bsd-core/drm_dma.c +++ b/bsd-core/drm_dma.c @@ -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; } |