summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-02-15 19:58:09 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-02-15 19:58:09 +0000
commit31270a9e42f09724e0cc58b02814464d38ff6877 (patch)
tree801baf83c9933b1437080573b01dfc648b91dd59 /sys
parentf477e3d34c194d10aaecaabf8c98c9dc84d71d6f (diff)
Convert CONSISTENT maps over to dmamem api.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/drmP.h8
-rw-r--r--sys/dev/pci/drm/drm_bufs.c24
-rw-r--r--sys/dev/pci/drm/drm_drv.c4
3 files changed, 18 insertions, 18 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h
index bf67a7780e6..a40373e66f1 100644
--- a/sys/dev/pci/drm/drmP.h
+++ b/sys/dev/pci/drm/drmP.h
@@ -405,15 +405,15 @@ typedef TAILQ_HEAD(drm_map_list, drm_local_map) drm_map_list_t;
typedef struct drm_local_map {
TAILQ_ENTRY(drm_local_map) link; /* Link for map list */
- drm_dma_handle_t *dmah; /* Handle to DMA mem */
+ struct drm_dmamem *dmamem;/* Handle to DMA mem */
void *handle;/* KVA, if mapped */
bus_space_tag_t bst; /* Tag for mapped pci mem */
bus_space_handle_t bsh; /* Handle to mapped pci mem */
u_long ext; /* extent for mmap */
- enum drm_map_flags flags; /* Flags */
+ u_long offset;/* Physical address */
+ u_long size; /* Physical size (bytes) */
int mtrr; /* Boolean: MTRR used */
- unsigned long offset;/* Physical address */
- unsigned long size; /* Physical size (bytes) */
+ enum drm_map_flags flags; /* Flags */
enum drm_map_type type; /* Type of memory mapped */
} drm_local_map_t;
diff --git a/sys/dev/pci/drm/drm_bufs.c b/sys/dev/pci/drm/drm_bufs.c
index dcb236b8c20..eb1cd0383e3 100644
--- a/sys/dev/pci/drm/drm_bufs.c
+++ b/sys/dev/pci/drm/drm_bufs.c
@@ -194,29 +194,29 @@ drm_addmap(struct drm_device * dev, unsigned long offset, unsigned long size,
break;
case _DRM_SHM:
case _DRM_CONSISTENT:
- /* Unfortunately, we don't get any alignment specification from
- * the caller, so we have to guess. drm_pci_alloc requires
- * a power-of-two alignment, so try to align the bus address of
- * the map to it size if possible, otherwise just assume
- * PAGE_SIZE alignment.
+ /*
+ * Unfortunately, we don't get any alignment specification from
+ * the caller, so we have to guess. So try to align the bus
+ * address of the map to its size if possible, otherwise just
+ * assume PAGE_SIZE alignment.
*/
align = map->size;
if ((align & (align - 1)) != 0)
align = PAGE_SIZE;
- map->dmah = drm_pci_alloc(dev->dmat, map->size, align,
- 0xfffffffful);
- if (map->dmah == NULL) {
+ map->dmamem = drm_dmamem_alloc(dev->dmat, map->size, align,
+ 1, map->size, 0, 0);
+ if (map->dmamem == NULL) {
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
return (ENOMEM);
}
- map->handle = map->dmah->vaddr;
- map->offset = map->dmah->busaddr;
+ map->handle = map->dmamem->kva;
+ map->offset = map->dmamem->map->dm_segs[0].ds_addr;
if (map->type == _DRM_SHM && map->flags & _DRM_CONTAINS_LOCK) {
DRM_LOCK();
/* Prevent a 2nd X Server from creating a 2nd lock */
if (dev->lock.hw_lock != NULL) {
DRM_UNLOCK();
- drm_pci_free(dev->dmat, map->dmah);
+ drm_dmamem_free(dev->dmat, map->dmamem);
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
return (EBUSY);
}
@@ -303,7 +303,7 @@ drm_rmmap_locked(struct drm_device *dev, drm_local_map_t *map)
case _DRM_SHM:
/* FALLTHROUGH */
case _DRM_CONSISTENT:
- drm_pci_free(dev->dmat, map->dmah);
+ drm_dmamem_free(dev->dmat, map->dmamem);
break;
default:
DRM_ERROR("Bad map type %d\n", map->type);
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c
index 97f9708872a..29602748281 100644
--- a/sys/dev/pci/drm/drm_drv.c
+++ b/sys/dev/pci/drm/drm_drv.c
@@ -786,8 +786,8 @@ drmmmap(dev_t kdev, off_t offset, int prot)
offset, prot, BUS_DMA_NOWAIT));
case _DRM_SHM:
case _DRM_CONSISTENT:
- return (bus_dmamem_mmap(dev->dmat, &map->dmah->seg, 1,
- offset, prot, BUS_DMA_NOWAIT));
+ return (bus_dmamem_mmap(dev->dmat, map->dmamem->segs,
+ map->dmamem->nsegs, offset, prot, BUS_DMA_NOWAIT));
default:
DRM_ERROR("bad map type %d\n", type);
return (-1); /* This should never happen. */