summaryrefslogtreecommitdiff
path: root/linux-core/drm_bufs.c
diff options
context:
space:
mode:
authorFelix Kuehling <fxkuehl@gmx.de>2005-01-01 20:03:15 +0000
committerFelix Kuehling <fxkuehl@gmx.de>2005-01-01 20:03:15 +0000
commited165a25292740d5d3ef7e78dc04a6a3402562aa (patch)
tree28545324112665f06e11a8f1ae5d786b1672595e /linux-core/drm_bufs.c
parentfe4ade81bb7a1242b18b84e012c1a293eea0420b (diff)
Added a new DRM map type _DRM_CONSISTENT for consistent PCI memory. It uses
drm_pci_alloc/free for allocating/freeing the memory. Only implemented in the Linux DRM so far.
Diffstat (limited to 'linux-core/drm_bufs.c')
-rw-r--r--linux-core/drm_bufs.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c
index 947042bf..ce51397a 100644
--- a/linux-core/drm_bufs.c
+++ b/linux-core/drm_bufs.c
@@ -244,7 +244,21 @@ int drm_addmap(struct inode *inode, struct file *filp,
}
map->offset += dev->sg->handle;
break;
-
+ case _DRM_CONSISTENT: {
+ /* dma_addr_t is 64bit on i386 with CONFIG_HIGHMEM64G.
+ * As we're limiting the address to 2^32-1 (or less),
+ * casting it down to 32 bits is no problem, but we
+ * need to point to a 64bit variable first. */
+ dma_addr_t bus_addr;
+ map->handle = drm_pci_alloc(dev, map->size, map->size,
+ 0xffffffffUL, &bus_addr);
+ map->offset = (unsigned long)bus_addr;
+ if (!map->handle) {
+ drm_free(map, sizeof(*map), DRM_MEM_MAPS);
+ return -ENOMEM;
+ }
+ break;
+ }
default:
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
return -EINVAL;
@@ -348,6 +362,9 @@ int drm_rmmap(struct inode *inode, struct file *filp,
case _DRM_AGP:
case _DRM_SCATTER_GATHER:
break;
+ case _DRM_CONSISTENT:
+ drm_pci_free(dev, map->size, map->handle, map->offset);
+ break;
}
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
}