summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-02-15 20:10:25 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-02-15 20:10:25 +0000
commitf1c8696d1a7698c0df74722c31470c1de0cb7551 (patch)
treec202871cdfe0104fc3bf71d333d52d07cc591fa8
parente28310e8efce1b91a4279cf487097f160a8e3a8d (diff)
Remove drm_pci_alloc and associated definitions.
-rw-r--r--sys/dev/pci/drm/drmP.h14
-rw-r--r--sys/dev/pci/drm/drm_pci.c108
-rw-r--r--sys/dev/pci/drm/files.drm3
3 files changed, 1 insertions, 124 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h
index a455d26bb78..2a2f83047ce 100644
--- a/sys/dev/pci/drm/drmP.h
+++ b/sys/dev/pci/drm/drmP.h
@@ -295,15 +295,6 @@ typedef struct drm_buf {
void *dev_private; /* Per-buffer private storage */
} drm_buf_t;
-typedef struct drm_dma_handle {
- void *vaddr;
- bus_addr_t busaddr;
- bus_dmamap_t dmamap;
- bus_dma_segment_t seg;
- void *addr;
- size_t size;
-} drm_dma_handle_t;
-
struct drm_dmamem {
bus_dmamap_t map;
caddr_t kva;
@@ -718,11 +709,6 @@ int drm_agp_bind_ioctl(struct drm_device *, void *, struct drm_file *);
int drm_sg_alloc_ioctl(struct drm_device *, void *, struct drm_file *);
int drm_sg_free(struct drm_device *, void *, struct drm_file *);
-/* consistent PCI memory functions (drm_pci.c) */
-drm_dma_handle_t *drm_pci_alloc(bus_dma_tag_t, size_t, size_t,
- dma_addr_t);
-void drm_pci_free(bus_dma_tag_t, drm_dma_handle_t *);
-
/* Inline replacements for DRM_IOREMAP macros */
#define drm_core_ioremap_wc drm_core_ioremap
static __inline__ void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
diff --git a/sys/dev/pci/drm/drm_pci.c b/sys/dev/pci/drm/drm_pci.c
deleted file mode 100644
index 760b504dbac..00000000000
--- a/sys/dev/pci/drm/drm_pci.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * Copyright 2003 Eric Anholt.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "drmP.h"
-
-/*
- * Allocate a physically contiguous DMA-accessible consistent
- * memory block.
- */
-drm_dma_handle_t *
-drm_pci_alloc(bus_dma_tag_t dmat, size_t size, size_t align,
- dma_addr_t maxaddr)
-{
- drm_dma_handle_t *dmah;
- int ret, nsegs;
-
- /* Need power-of-two alignment, so fail the allocation if it isn't. */
- if ((align & (align - 1)) != 0) {
- DRM_ERROR("drm_pci_alloc with non-power-of-two alignment %d\n",
- (int)align);
- return NULL;
- }
-
- dmah = drm_alloc(sizeof(*dmah), DRM_MEM_DMA);
- if (dmah == NULL)
- return NULL;
-
- if (bus_dmamap_create(dmat, size, 1, size, 0,
- BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &dmah->dmamap) != 0)
- goto dmahfree;
-
- if ((ret = bus_dmamem_alloc(dmat, size, align, 0,
- &dmah->seg, 1, &nsegs, BUS_DMA_NOWAIT)) != 0) {
- DRM_ERROR("bus_dmamem_alloc(%zd, %zd) returned %d\n",
- size, align, ret);
- goto destroy;
- }
- if (nsegs != 1) {
- DRM_ERROR("bus_dmamem_alloc(%zd) returned %d segments\n",
- size, nsegs);
- goto free;
- }
-
- if ((ret = bus_dmamem_map(dmat, &dmah->seg, 1, size,
- (caddr_t*)&dmah->addr, BUS_DMA_NOWAIT)) != 0) {
- DRM_ERROR("bus_dmamem_map() failed %d\n", ret);
- goto free;
- }
-
- if (bus_dmamap_load(dmat, dmah->dmamap, dmah->addr, size,
- NULL, BUS_DMA_NOWAIT) != 0)
- goto unmap;
-
- dmah->busaddr = dmah->dmamap->dm_segs[0].ds_addr;
- dmah->vaddr = dmah->addr;
- dmah->size = size;
-
- return dmah;
-
-unmap:
- bus_dmamem_unmap(dmat, dmah->addr, size);
-free:
- bus_dmamem_free(dmat, &dmah->seg, 1);
-destroy:
- bus_dmamap_destroy(dmat, dmah->dmamap);
-dmahfree:
- drm_free(dmah, sizeof(*dmah), DRM_MEM_DMA);
-
- return (NULL);
-
-}
-
-/*
- * Free a DMA-accessible consistent memory block.
- */
-void
-drm_pci_free(bus_dma_tag_t dmat, drm_dma_handle_t *dmah)
-{
- if (dmah == NULL)
- return;
-
- bus_dmamap_unload(dmat, dmah->dmamap);
- bus_dmamem_unmap(dmat, dmah->vaddr, dmah->size);
- bus_dmamem_free(dmat, &dmah->seg, 1);
- bus_dmamap_destroy(dmat, dmah->dmamap);
-
- drm_free(dmah, sizeof(*dmah), DRM_MEM_DMA);
-}
diff --git a/sys/dev/pci/drm/files.drm b/sys/dev/pci/drm/files.drm
index 8a0df35cdf8..fc522edbbd8 100644
--- a/sys/dev/pci/drm/files.drm
+++ b/sys/dev/pci/drm/files.drm
@@ -1,5 +1,5 @@
# $NetBSD: files.drm,v 1.2 2007/03/28 11:29:37 jmcneill Exp $
-# $OpenBSD: files.drm,v 1.11 2009/02/05 00:25:51 oga Exp $
+# $OpenBSD: files.drm,v 1.12 2009/02/15 20:10:24 oga Exp $
# direct rendering modules
define drmbase {}
@@ -15,7 +15,6 @@ file dev/pci/drm/drm_heap.c inteldrm | radeondrm
file dev/pci/drm/drm_irq.c drm
file dev/pci/drm/drm_lock.c drm
file dev/pci/drm/drm_memory.c drm
-file dev/pci/drm/drm_pci.c drm
file dev/pci/drm/drm_scatter.c drm
device inteldrm: drmbase