diff options
author | Dave Airlie <airlied@starflyer.(none)> | 2005-07-10 00:34:13 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2005-07-10 00:34:13 -0400 |
commit | 2d0f9eaff8e1d08b9707f5d24fe6b0ac95d231e3 (patch) | |
tree | 6602c6a936254ae1175073fdd3f800ed67730c17 /drivers/char/drm/drm_bufs.c | |
parent | f179bc77d09b9087bfc559d0368bba350342ac76 (diff) |
drm: add _DRM_CONSISTENT map type
Added a new DRM map type _DRM_CONSISTENT for consistent PCI memory. It
uses drm_pci_alloc/free for allocating/freeing the memory.
From: Felix Kuhling <fxkuehl@gmx.de>
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.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c index 4c6191d231b8..89f301ffd97e 100644 --- a/drivers/char/drm/drm_bufs.c +++ b/drivers/char/drm/drm_bufs.c | |||
@@ -180,7 +180,22 @@ int drm_addmap( struct inode *inode, struct file *filp, | |||
180 | } | 180 | } |
181 | map->offset += dev->sg->handle; | 181 | map->offset += dev->sg->handle; |
182 | break; | 182 | break; |
183 | 183 | case _DRM_CONSISTENT: | |
184 | { | ||
185 | /* dma_addr_t is 64bit on i386 with CONFIG_HIGHMEM64G, | ||
186 | * As we're limit the address to 2^32-1 (or lses), | ||
187 | * casting it down to 32 bits is no problem, but we | ||
188 | * need to point to a 64bit variable first. */ | ||
189 | dma_addr_t bus_addr; | ||
190 | map->handle = drm_pci_alloc(dev, map->size, map->size, | ||
191 | 0xffffffffUL, &bus_addr); | ||
192 | map->offset = (unsigned long)bus_addr; | ||
193 | if (!map->handle) { | ||
194 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); | ||
195 | return -ENOMEM; | ||
196 | } | ||
197 | break; | ||
198 | } | ||
184 | default: | 199 | default: |
185 | drm_free( map, sizeof(*map), DRM_MEM_MAPS ); | 200 | drm_free( map, sizeof(*map), DRM_MEM_MAPS ); |
186 | return -EINVAL; | 201 | return -EINVAL; |
@@ -291,6 +306,9 @@ int drm_rmmap(struct inode *inode, struct file *filp, | |||
291 | case _DRM_AGP: | 306 | case _DRM_AGP: |
292 | case _DRM_SCATTER_GATHER: | 307 | case _DRM_SCATTER_GATHER: |
293 | break; | 308 | break; |
309 | case _DRM_CONSISTENT: | ||
310 | drm_pci_free(dev, map->size, map->handle, map->offset); | ||
311 | break; | ||
294 | } | 312 | } |
295 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); | 313 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); |
296 | } | 314 | } |