summaryrefslogtreecommitdiff
path: root/linux/drm_vm.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2004-08-24 11:15:53 +0000
committerDave Airlie <airlied@linux.ie>2004-08-24 11:15:53 +0000
commitd4dbf457813e97531ded3bf24f3b6ad421189c69 (patch)
tree8e47c1dd5d7cf9c8c4bce4a7e34531fc9a8eae75 /linux/drm_vm.h
parenteac498baeaf9b57b448065b0fb9f4eeadbb9aa6b (diff)
Merged drmfntbl-0-0-2
Diffstat (limited to 'linux/drm_vm.h')
-rw-r--r--linux/drm_vm.h36
1 files changed, 19 insertions, 17 deletions
diff --git a/linux/drm_vm.h b/linux/drm_vm.h
index 7ab7d5ac..9c444aff 100644
--- a/linux/drm_vm.h
+++ b/linux/drm_vm.h
@@ -50,7 +50,7 @@
static __inline__ struct page *DRM(do_vm_nopage)(struct vm_area_struct *vma,
unsigned long address)
{
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev;
drm_map_t *map = NULL;
@@ -60,6 +60,7 @@ static __inline__ struct page *DRM(do_vm_nopage)(struct vm_area_struct *vma,
/*
* Find the right map
*/
+ if (!(dev->agp && DRIVER_USE_AGP)) goto vm_nopage_error;
if(!dev->agp || !dev->agp->cant_use_aperture) goto vm_nopage_error;
@@ -111,7 +112,7 @@ static __inline__ struct page *DRM(do_vm_nopage)(struct vm_area_struct *vma,
return page;
}
vm_nopage_error:
-#endif /* __REALLY_HAVE_AGP */
+#endif /* __OS_HAS_AGP */
return NOPAGE_SIGBUS; /* Disallow mremap */
}
@@ -205,8 +206,8 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma)
switch (map->type) {
case _DRM_REGISTERS:
case _DRM_FRAME_BUFFER:
-#if __REALLY_HAVE_MTRR
- if (map->mtrr >= 0) {
+#if __OS_HAS_MTRR
+ if ((dev->driver_features & DRIVER_USE_MTRR) && map->mtrr >= 0) {
int retcode;
retcode = mtrr_del(map->mtrr,
map->offset,
@@ -492,18 +493,19 @@ int DRM(mmap_dma)(struct file *filp, struct vm_area_struct *vma)
return 0;
}
-#ifndef DRIVER_GET_MAP_OFS
-#define DRIVER_GET_MAP_OFS() (map->offset)
-#endif
+unsigned long DRM(core_get_map_ofs)(drm_map_t *map)
+{
+ return map->offset;
+}
-#ifndef DRIVER_GET_REG_OFS
+unsigned long DRM(core_get_reg_ofs)(struct drm_device *dev)
+{
#ifdef __alpha__
-#define DRIVER_GET_REG_OFS() (dev->hose->dense_mem_base - \
- dev->hose->mem_space->start)
+ return dev->host->dense_mem_base - dev->hose_mem_space->start;
#else
-#define DRIVER_GET_REG_OFS() 0
-#endif
+ return 0;
#endif
+}
/**
* mmap DMA memory.
@@ -537,7 +539,7 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
* --BenH.
*/
if (!VM_OFFSET(vma)
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
&& (!dev->agp || dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE)
#endif
)
@@ -556,7 +558,7 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
r_list = list_entry(list, drm_map_list_t, head);
map = r_list->map;
if (!map) continue;
- off = DRIVER_GET_MAP_OFS();
+ off = dev->fn_tbl.get_map_ofs(map);
if (off == VM_OFFSET(vma)) break;
}
@@ -581,8 +583,8 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
switch (map->type) {
case _DRM_AGP:
-#if __REALLY_HAVE_AGP
- if (dev->agp->cant_use_aperture) {
+#if __OS_HAS_AGP
+ if ((dev->driver_features & DRIVER_USE_AGP) && dev->agp->cant_use_aperture) {
/*
* On some platforms we can't talk to bus dma address from the CPU, so for
* memory of type DRM_AGP, we'll deal with sorting out the real physical
@@ -613,7 +615,7 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma)
if (map->type != _DRM_AGP)
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
#endif
- offset = DRIVER_GET_REG_OFS();
+ offset = dev->fn_tbl.get_reg_ofs(dev);
#ifdef __sparc__
if (io_remap_page_range(DRM_RPR_ARG(vma) vma->vm_start,
VM_OFFSET(vma) + offset,