summaryrefslogtreecommitdiffstats
path: root/sys/dev/drm/drm_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/drm/drm_pci.c')
-rw-r--r--sys/dev/drm/drm_pci.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/sys/dev/drm/drm_pci.c b/sys/dev/drm/drm_pci.c
index 4aa6d03..7f8bc9f 100644
--- a/sys/dev/drm/drm_pci.c
+++ b/sys/dev/drm/drm_pci.c
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
/** \name PCI memory */
/*@{*/
-#if defined(__FreeBSD__)
static void
drm_pci_busdma_callback(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
{
@@ -49,7 +48,6 @@ drm_pci_busdma_callback(void *arg, bus_dma_segment_t *segs, int nsegs, int error
KASSERT(nsegs == 1, ("drm_pci_busdma_callback: bad dma segment count"));
dmah->busaddr = segs[0].ds_addr;
}
-#endif
/**
* \brief Allocate a physically contiguous DMA-accessible consistent
@@ -73,10 +71,11 @@ drm_pci_alloc(struct drm_device *dev, size_t size,
if (dmah == NULL)
return NULL;
-#ifdef __FreeBSD__
/* Make sure we aren't holding locks here */
+ mtx_assert(&dev->dev_lock, MA_NOTOWNED);
if (mtx_owned(&dev->dev_lock))
DRM_ERROR("called while holding dev_lock\n");
+ mtx_assert(&dev->dma_lock, MA_NOTOWNED);
if (mtx_owned(&dev->dma_lock))
DRM_ERROR("called while holding dma_lock\n");
@@ -107,24 +106,6 @@ drm_pci_alloc(struct drm_device *dev, size_t size,
free(dmah, M_DRM);
return NULL;
}
-#elif defined(__NetBSD__)
- ret = bus_dmamem_alloc(dev->dma_tag, size, align, PAGE_SIZE,
- &dmah->seg, 1, &nsegs, BUS_DMA_NOWAIT);
- if ((ret != 0) || (nsegs != 1)) {
- free(dmah, M_DRM);
- return NULL;
- }
-
- ret = bus_dmamem_map(dev->dma_tag, &dmah->seg, 1, size, &dmah->addr,
- BUS_DMA_NOWAIT);
- if (ret != 0) {
- bus_dmamem_free(dev->dma_tag, &dmah->seg, 1);
- free(dmah, M_DRM);
- return NULL;
- }
-
- dmah->dmaaddr = h->seg.ds_addr;
-#endif
return dmah;
}
@@ -138,12 +119,8 @@ drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah)
if (dmah == NULL)
return;
-#if defined(__FreeBSD__)
bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
bus_dma_tag_destroy(dmah->tag);
-#elif defined(__NetBSD__)
- bus_dmamem_free(dev->dma_tag, &dmah->seg, 1);
-#endif
free(dmah, M_DRM);
}
OpenPOWER on IntegriCloud