summaryrefslogtreecommitdiff
path: root/linux/drm_vm.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drm_vm.h')
-rw-r--r--linux/drm_vm.h40
1 files changed, 24 insertions, 16 deletions
diff --git a/linux/drm_vm.h b/linux/drm_vm.h
index 2a5ee146..8119a21b 100644
--- a/linux/drm_vm.h
+++ b/linux/drm_vm.h
@@ -122,7 +122,11 @@ DRM_ERROR("baddr = 0x%lx page = 0x%lx, offset = 0x%lx\n",
baddr, __va(agpmem->memory->memory[offset]), offset);
#endif
get_page(page);
+#if LINUX_VERSION_CODE < 0x020317
+ return page_address(page);
+#else
return page;
+#endif
}
#endif
return NOPAGE_SIGBUS; /* Disallow mremap */
@@ -144,12 +148,12 @@ struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
#else
drm_map_t *map = (drm_map_t *)vma->vm_pte;
#endif
- unsigned long physical;
unsigned long offset;
unsigned long i;
pgd_t *pgd;
pmd_t *pmd;
pte_t *pte;
+ struct page *page;
if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
if (!map) return NOPAGE_OOM; /* Nothing allocated */
@@ -165,14 +169,15 @@ struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
if( !pmd_present( *pmd ) ) return NOPAGE_OOM;
pte = pte_offset( pmd, i );
if( !pte_present( *pte ) ) return NOPAGE_OOM;
- physical = (unsigned long)pte_page( *pte )->virtual;
- atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
- DRM_DEBUG("0x%08lx => 0x%08lx\n", address, physical);
+ page = pte_page( *pte );
+ get_page(page);
+
+ DRM_DEBUG("0x%08lx => 0x%08lx\n", address, page_to_bus(page));
#if LINUX_VERSION_CODE < 0x020317
- return physical;
+ return page_address(page);
#else
- return virt_to_page(physical);
+ return page;
#endif
}
@@ -277,24 +282,27 @@ struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev;
drm_device_dma_t *dma = dev->dma;
- unsigned long physical;
unsigned long offset;
- unsigned long page;
+ unsigned long page_nr;
+ struct page *page;
if (!dma) return NOPAGE_SIGBUS; /* Error */
if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */
offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
- page = offset >> PAGE_SHIFT;
- physical = dma->pagelist[page] + (offset & (~PAGE_MASK));
- atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
+ page_nr = offset >> PAGE_SHIFT;
+ page = virt_to_page((dma->pagelist[page_nr] +
+ (offset & (~PAGE_MASK))));
+
+ get_page(page);
- DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
+ DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page_nr,
+ page_to_bus(page));
#if LINUX_VERSION_CODE < 0x020317
- return physical;
+ return page_address(page);
#else
- return virt_to_page(physical);
+ return page;
#endif
}
@@ -331,10 +339,10 @@ struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
map_offset = map->offset - dev->sg->handle;
page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT);
page = entry->pagelist[page_offset];
- atomic_inc(&page->count); /* Dec. by kernel */
+ get_page(page);
#if LINUX_VERSION_CODE < 0x020317
- return (unsigned long)virt_to_phys(page->virtual);
+ return page_address(page);
#else
return page;
#endif