summaryrefslogtreecommitdiff
path: root/linux-core/drm_scatter.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2005-08-16 12:51:57 +0000
committerDave Airlie <airlied@linux.ie>2005-08-16 12:51:57 +0000
commit7af0186f4ccef285c2158770781ebfc3a26ddd66 (patch)
treee38ae798b605e3c433ba5d1a6c153baf0e9c15ce /linux-core/drm_scatter.c
parent8c21b783c3e38aa2c2d16e11ec01cf695f8e7f8a (diff)
add Egberts 32/64 bit patch (its in kernel already...)
Diffstat (limited to 'linux-core/drm_scatter.c')
-rw-r--r--linux-core/drm_scatter.c11
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;