summaryrefslogtreecommitdiffstats
path: root/sys/dev/drm/drm_pci.c
diff options
context:
space:
mode:
authorrnoland <rnoland@FreeBSD.org>2008-10-03 16:59:11 +0000
committerrnoland <rnoland@FreeBSD.org>2008-10-03 16:59:11 +0000
commitbbc754f502e8dc966e5d05fc4fd4d91d4c136d83 (patch)
tree2d4185c3ec896efd0d1b2735041e6ddeb6a750f1 /sys/dev/drm/drm_pci.c
parentbbe0e181656adf606748968f5803bb8cbc7d83c8 (diff)
downloadFreeBSD-src-bbc754f502e8dc966e5d05fc4fd4d91d4c136d83.zip
FreeBSD-src-bbc754f502e8dc966e5d05fc4fd4d91d4c136d83.tar.gz
resync to git master
This reverts a private patch which is causing issues with many Intel chipsets. I will review that patch and see what we need to do to fix it up later, but for the time being, we will just get these chips working again. This update contains a lot of code cleanup and is post gem merge (no, we don't have gem support). It should prove much easier to read the code now. A lot of thanks goes to vehemens for that work. I have adapted the code to use cdevpriv for tracking per open file data. That alleviates the old ugly hack that we used to try and accomplish the task and helped to clean up the open / close behavior a good bit. This also replaces the hack that was put in place a year or so ago to prevent radeons from locking up with AIGLX enabled. I have had a couple of radeon testers report that it still works as expected, though I no longer have radeon hardware to test with myself. Other various fixes from the linux crew and Intel, many of which are muddled in with the gem merge. Approved by: jhb (mentor) Obtained from: mesa/drm git master MFC after: 2 weeks
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