diff options
author | Dave Airlie <airlied@linux.ie> | 2004-07-29 11:09:22 +0000 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2004-07-29 11:09:22 +0000 |
commit | 0b02bf9d45b70af3b7e236526143c7b78a6fca8b (patch) | |
tree | 8604dc4f8c66e3e471e6991a87288c0ca4567f3e /shared/i915_dma.c | |
parent | 862fcee057a4602a0a9fdc54266f63fe33b0fd8b (diff) |
initial port of i915 to BSD, not finished doesn't work.. no idea why...
Diffstat (limited to 'shared/i915_dma.c')
-rw-r--r-- | shared/i915_dma.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/shared/i915_dma.c b/shared/i915_dma.c index d1a441e7..e7364ffe 100644 --- a/shared/i915_dma.c +++ b/shared/i915_dma.c @@ -81,7 +81,7 @@ void i915_kernel_lost_context(drm_device_t *dev) } -int i915_cleanup(drm_device_t *dev) +static int i915_dma_cleanup(drm_device_t *dev) { /* Make sure interrupts are disabled here because the uninstall ioctl * may not have been called from userspace and after dev_private @@ -98,9 +98,15 @@ int i915_cleanup(drm_device_t *dev) } if (dev_priv->hw_status_page) { +#ifdef __FreeBSD__ +#if __FreeBSD_version > 500000 + contigfree(dev_priv->hw_status_page, PAGE_SIZE, DRM(M_DRM)); +#endif +#else pci_free_consistent(dev->pdev, PAGE_SIZE, dev_priv->hw_status_page, dev_priv->dma_status_page); +#endif /* Need to rewrite hardware status page */ I915_WRITE(0x02080, 0x1ffff000); } @@ -126,14 +132,14 @@ static int i915_initialize(drm_device_t *dev, if(!dev_priv->sarea) { DRM_ERROR("can not find sarea!\n"); dev->dev_private = (void *)dev_priv; - i915_cleanup(dev); + i915_dma_cleanup(dev); return DRM_ERR(EINVAL); } DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset ); if(!dev_priv->mmio_map) { dev->dev_private = (void *)dev_priv; - i915_cleanup(dev); + i915_dma_cleanup(dev); DRM_ERROR("can not find mmio map!\n"); return DRM_ERR(EINVAL); } @@ -157,7 +163,7 @@ static int i915_initialize(drm_device_t *dev, if (dev_priv->ring.map.handle == NULL) { dev->dev_private = (void *) dev_priv; - i915_cleanup(dev); + i915_dma_cleanup(dev); DRM_ERROR("can not ioremap virtual address for" " ring buffer\n"); return DRM_ERR(ENOMEM); @@ -180,13 +186,18 @@ static int i915_initialize(drm_device_t *dev, dev_priv->allow_batchbuffer = 1; /* Program Hardware Status Page */ +#ifdef __FreeBSD__ + dev_priv->hw_status_page = contigmalloc(PAGE_SIZE, DRM(M_DRM), M_NOWAIT, 0ul, 0, 0, 0); + dev_priv->dma_status_page = vtophys(dev_priv->hw_status_page); +#else dev_priv->hw_status_page = pci_alloc_consistent( dev->pdev, PAGE_SIZE, &dev_priv->dma_status_page ); +#endif if (!dev_priv->hw_status_page) { dev->dev_private = (void *)dev_priv; - i915_cleanup(dev); + i915_dma_cleanup(dev); DRM_ERROR("Can not allocate hardware status page\n"); return DRM_ERR(ENOMEM); } @@ -257,7 +268,7 @@ int i915_dma_init( DRM_IOCTL_ARGS ) retcode = i915_initialize(dev, dev_priv, &init); break; case I915_CLEANUP_DMA: - retcode = i915_cleanup(dev); + retcode = i915_dma_cleanup(dev); break; case I915_RESUME_DMA: retcode = i915_resume(dev); |