aboutsummaryrefslogtreecommitdiff
path: root/drivers/char/drm/drm_bufs.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@starflyer.(none)>2005-07-10 15:38:56 +1000
committerDave Airlie <airlied@linux.ie>2005-07-10 15:38:56 +1000
commit9c8da5ebbf6f87293cf8555182da271449889a69 (patch)
treec036835be2ec09249f960518ff2703316257d815 /drivers/char/drm/drm_bufs.c
parentd59431bf96d1e8a3d6d240343f559f5e2ace7f1d (diff)
drm: update support for drm pci buffers
The DRM needs to change the drm_pci interface for FreeBSD compatiblity, this patch introduces the drm_dma_handle_t and uses it in the Linux code. From: Tonnerre Lombard, Eric Anholt, and Sergey Vlasov Signed-off-by: David Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drm_bufs.c')
-rw-r--r--drivers/char/drm/drm_bufs.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index eb3cf550626..be54efbefe8 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -90,6 +90,7 @@ int drm_addmap( struct inode *inode, struct file *filp,
drm_map_t *map;
drm_map_t __user *argp = (void __user *)arg;
drm_map_list_t *list;
+ drm_dma_handle_t *dmah;
if ( !(filp->f_mode & 3) ) return -EACCES; /* Require read/write */
@@ -181,21 +182,19 @@ 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 limit the address to 2^32-1 (or lses),
+ * 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) {
+ dmah = drm_pci_alloc(dev, map->size, map->size, 0xffffffffUL);
+ if (!dmah) {
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
return -ENOMEM;
}
+ map->handle = dmah->vaddr;
+ map->offset = (unsigned long)dmah->busaddr;
+ kfree(dmah);
break;
- }
default:
drm_free( map, sizeof(*map), DRM_MEM_MAPS );
return -EINVAL;
@@ -286,6 +285,8 @@ int drm_rmmap(struct inode *inode, struct file *filp,
}
if(!found_maps) {
+ drm_dma_handle_t dmah;
+
switch (map->type) {
case _DRM_REGISTERS:
case _DRM_FRAME_BUFFER:
@@ -307,7 +308,10 @@ int drm_rmmap(struct inode *inode, struct file *filp,
case _DRM_SCATTER_GATHER:
break;
case _DRM_CONSISTENT:
- drm_pci_free(dev, map->size, map->handle, map->offset);
+ dmah.vaddr = map->handle;
+ dmah.busaddr = map->offset;
+ dmah.size = map->size;
+ __drm_pci_free(dev, &dmah);
break;
}
drm_free(map, sizeof(*map), DRM_MEM_MAPS);