summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/drm_pci.c
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-06-26 16:42:49 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-06-26 16:42:49 +0000
commit7d1d7c470fef5a23347b90f4fa5993391eb7913f (patch)
treedc1f9668ca6b393871ba6af40a2fe702aba9e65e /sys/dev/pci/drm/drm_pci.c
parent4c2a60f6218c77b0e891c84e394cdf5865da47e3 (diff)
Kill the rest of the ifdef maze in drm_*.c
I was going to do this per file, but decided all it would achieve was artificially increasing my commit count. >Kill the ifdef maze. I've been considering doing this for months, it >doesn't make getting changes to and from upstream much easier, and just >makes the code hard to read.
Diffstat (limited to 'sys/dev/pci/drm/drm_pci.c')
-rw-r--r--sys/dev/pci/drm/drm_pci.c56
1 files changed, 1 insertions, 55 deletions
diff --git a/sys/dev/pci/drm/drm_pci.c b/sys/dev/pci/drm/drm_pci.c
index 4adcd27e9c1..c988c7917e8 100644
--- a/sys/dev/pci/drm/drm_pci.c
+++ b/sys/dev/pci/drm/drm_pci.c
@@ -34,20 +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)
-{
- drm_dma_handle_t *dmah = arg;
-
- if (error != 0)
- return;
-
- 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
* memory block.
@@ -56,10 +42,7 @@ drm_dma_handle_t *
drm_pci_alloc(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr)
{
drm_dma_handle_t *dmah;
- int ret;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- int nsegs;
-#endif
+ int ret, nsegs;
/* Need power-of-two alignment, so fail the allocation if it isn't. */
if ((align & (align - 1)) != 0) {
@@ -72,37 +55,6 @@ drm_pci_alloc(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr)
if (dmah == NULL)
return NULL;
-#ifdef __FreeBSD__
- ret = bus_dma_tag_create(NULL, align, 0, /* tag, align, boundary */
- maxaddr, BUS_SPACE_MAXADDR, /* lowaddr, highaddr */
- NULL, NULL, /* filtfunc, filtfuncargs */
- size, 1, size, /* maxsize, nsegs, maxsegsize */
- BUS_DMA_ALLOCNOW, NULL, NULL, /* flags, lockfunc, lockfuncargs */
- &dmah->tag);
- if (ret != 0) {
- free(dmah, M_DRM);
- return NULL;
- }
-
- ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr, BUS_DMA_NOWAIT,
- &dmah->map);
- if (ret != 0) {
- bus_dma_tag_destroy(dmah->tag);
- free(dmah, M_DRM);
- return NULL;
- }
-
- ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr, size,
- drm_pci_busdma_callback, dmah, 0);
- if (ret != 0) {
- bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
- bus_dma_tag_destroy(dmah->tag);
- free(dmah, M_DRM);
- return NULL;
- }
-
- return dmah;
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
if (bus_dmamap_create(dev->pa.pa_dmat, size, 1, size, 0,
BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &dmah->dmamap) != 0)
goto dmahfree;
@@ -145,7 +97,6 @@ dmahfree:
free(dmah, M_DRM);
return (NULL);
-#endif
}
@@ -158,15 +109,10 @@ drm_pci_free(drm_device_t *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__) || defined(__OpenBSD__)
bus_dmamap_unload(dev->pa.pa_dmat, dmah->dmamap);
bus_dmamem_unmap(dev->pa.pa_dmat, dmah->vaddr, dmah->size);
bus_dmamem_free(dev->pa.pa_dmat, &dmah->seg, 1);
bus_dmamap_destroy(dev->pa.pa_dmat, dmah->dmamap);
-#endif
free(dmah, M_DRM);
}