diff options
author | Dave Airlie <airlied@redhat.com> | 2008-09-26 15:37:21 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-09-30 14:13:49 +1000 |
commit | 972f6572652bc4a2f6c44c525e5e91f2becdb62a (patch) | |
tree | 60af3dc7e8a7c0f8bef7a3927dae161093b10dbe /bsd-core/drm_pci.c | |
parent | 89126bb58ec82511758bed36a28e698b721fb435 (diff) | |
parent | 2db8e0c8ef8c7a66460fceda129533b364f6418c (diff) |
Merge remote branch 'origin/master' into modesetting-gem
Conflicts:
libdrm/Makefile.am
libdrm/dri_bufmgr.h
linux-core/drm_irq.c
linux-core/drm_sysfs.c
linux-core/drm_ttm.c
shared-core/i915_dma.c
shared-core/i915_irq.c
shared-core/nouveau_drv.h
shared-core/radeon_cp.c
Diffstat (limited to 'bsd-core/drm_pci.c')
-rw-r--r-- | bsd-core/drm_pci.c | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/bsd-core/drm_pci.c b/bsd-core/drm_pci.c index f23b2a5b..e21715b2 100644 --- a/bsd-core/drm_pci.c +++ b/bsd-core/drm_pci.c @@ -34,7 +34,6 @@ /** \name PCI memory */ /*@{*/ -#if defined(__FreeBSD__) static void drm_pci_busdma_callback(void *arg, bus_dma_segment_t *segs, int nsegs, int error) { @@ -46,7 +45,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 @@ -70,8 +68,14 @@ drm_pci_alloc(struct drm_device *dev, size_t size, if (dmah == NULL) return NULL; -#ifdef __FreeBSD__ - DRM_UNLOCK(); + /* 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"); + ret = bus_dma_tag_create(NULL, align, 0, /* tag, align, boundary */ maxaddr, BUS_SPACE_MAXADDR, /* lowaddr, highaddr */ NULL, NULL, /* filtfunc, filtfuncargs */ @@ -80,7 +84,6 @@ drm_pci_alloc(struct drm_device *dev, size_t size, &dmah->tag); if (ret != 0) { free(dmah, M_DRM); - DRM_LOCK(); return NULL; } @@ -89,10 +92,9 @@ drm_pci_alloc(struct drm_device *dev, size_t size, if (ret != 0) { bus_dma_tag_destroy(dmah->tag); free(dmah, M_DRM); - DRM_LOCK(); return NULL; } - DRM_LOCK(); + ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr, size, drm_pci_busdma_callback, dmah, 0); if (ret != 0) { @@ -101,24 +103,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; } @@ -132,12 +116,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); } |