From 7af0186f4ccef285c2158770781ebfc3a26ddd66 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 16 Aug 2005 12:51:57 +0000 Subject: add Egberts 32/64 bit patch (its in kernel already...) --- linux-core/drm_scatter.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'linux-core/drm_scatter.c') 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; -- cgit v1.2.3