diff options
Diffstat (limited to 'linux-core/drm_scatter.c')
-rw-r--r-- | linux-core/drm_scatter.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/linux-core/drm_scatter.c b/linux-core/drm_scatter.c index 342e7572..1647303d 100644 --- a/linux-core/drm_scatter.c +++ b/linux-core/drm_scatter.c @@ -58,6 +58,12 @@ void drm_sg_cleanup(drm_sg_mem_t * entry) drm_free(entry, sizeof(*entry), DRM_MEM_SGLISTS); } +#ifdef _LP64 +# define ScatterHandle(x) (unsigned int)((x >> 32) + (x & ((1L << 32) - 1))) +#else +# define ScatterHandle(x) (unsigned int)(x) +#endif + int drm_sg_alloc(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -125,12 +131,13 @@ int drm_sg_alloc(struct inode *inode, struct file *filp, */ memset(entry->virtual, 0, pages << PAGE_SHIFT); - entry->handle = (unsigned long)entry->virtual; + entry->handle = ScatterHandle((unsigned long)entry->virtual); DRM_DEBUG("sg alloc handle = %08lx\n", entry->handle); DRM_DEBUG("sg alloc virtual = %p\n", entry->virtual); - for (i = entry->handle, j = 0; j < pages; i += PAGE_SIZE, j++) { + for (i = (unsigned long)entry->virtual, j = 0; j < pages; + i += PAGE_SIZE, j++) { entry->pagelist[j] = vmalloc_to_page((void *)i); if (!entry->pagelist[j]) goto failed; |