summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2004-08-18 11:14:58 +0000
committerDave Airlie <airlied@linux.ie>2004-08-18 11:14:58 +0000
commit68fd69af05021111070472bd033ba8d1ad70c1de (patch)
tree23bdbedbffb4cbc5db5c927b09598e99d6f8a713
parent5c9ed8309493acb099463d25b32fabb5b7c004af (diff)
Remove HAVE_AGP and HAVE_MTRR
-rw-r--r--linux-core/drmP.h30
-rw-r--r--linux-core/drm_agpsupport.c5
-rw-r--r--linux-core/drm_bufs.c46
-rw-r--r--linux-core/drm_context.c2
-rw-r--r--linux-core/drm_drv.c57
-rw-r--r--linux-core/drm_memory.h18
-rw-r--r--linux-core/drm_memory_debug.h2
-rw-r--r--linux-core/drm_vm.c15
-rw-r--r--linux-core/i810_dma.c1
-rw-r--r--linux-core/i830_dma.c1
-rw-r--r--linux-core/savage.h3
-rw-r--r--linux-core/savage_dma.c1
-rw-r--r--linux-core/tdfx_drv.c1
-rw-r--r--linux/drmP.h30
-rw-r--r--linux/drm_agpsupport.h5
-rw-r--r--linux/drm_bufs.h46
-rw-r--r--linux/drm_context.h2
-rw-r--r--linux/drm_drv.h57
-rw-r--r--linux/drm_memory.h18
-rw-r--r--linux/drm_memory_debug.h2
-rw-r--r--linux/drm_vm.h15
-rw-r--r--linux/gamma.h4
-rw-r--r--linux/gamma_dma.c1
-rw-r--r--linux/i810.h3
-rw-r--r--linux/i810_dma.c1
-rw-r--r--linux/i830.h3
-rw-r--r--linux/i830_dma.c1
-rw-r--r--linux/savage.h3
-rw-r--r--linux/savage_dma.c1
-rw-r--r--linux/tdfx_drv.c1
-rw-r--r--shared-core/i915_dma.c1
-rw-r--r--shared-core/mach64_dma.c1
-rw-r--r--shared-core/mga_dma.c1
-rw-r--r--shared-core/r128_cce.c12
-rw-r--r--shared-core/r128_state.c1
-rw-r--r--shared-core/radeon_cp.c23
-rw-r--r--shared-core/radeon_state.c1
-rw-r--r--shared-core/sis_mm.c1
-rw-r--r--shared-core/tdfx_drv.h1
-rw-r--r--shared-core/via_mm.c5
-rw-r--r--shared/i915.h3
-rw-r--r--shared/i915_dma.c1
-rw-r--r--shared/mach64.h3
-rw-r--r--shared/mach64_dma.c1
-rw-r--r--shared/mga.h3
-rw-r--r--shared/mga_dma.c1
-rw-r--r--shared/r128.h3
-rw-r--r--shared/r128_cce.c12
-rw-r--r--shared/r128_state.c1
-rw-r--r--shared/radeon.h3
-rw-r--r--shared/radeon_cp.c23
-rw-r--r--shared/radeon_state.c1
-rw-r--r--shared/sis.h3
-rw-r--r--shared/sis_mm.c1
-rw-r--r--shared/tdfx.h1
-rw-r--r--shared/via.h3
-rw-r--r--shared/via_mm.c5
57 files changed, 259 insertions, 231 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 75fb999a..8f3b0cb8 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -90,12 +90,16 @@
/** \name DRM template customization defaults */
/*@{*/
-#ifndef __HAVE_AGP
-#define __HAVE_AGP 0
-#endif
-#ifndef __HAVE_MTRR
-#define __HAVE_MTRR 0
-#endif
+/* driver capabilities and requirements mask */
+#define DRIVER_USE_AGP 0x1
+#define DRIVER_REQUIRE_AGP 0x2
+#define DRIVER_USE_MTRR 0x4
+#define DRIVER_CTX_BITMAP 0x8
+#define DRIVER_HAVE_DMA 0x10
+#define DRIVER_HAVE_IRQ 0x20
+#define DRIVER_HAVE_SG 0x40
+#define DRIVER_HAVE_PCI_DMA 0x80
+
#ifndef __HAVE_CTX_BITMAP
#define __HAVE_CTX_BITMAP 0
#endif
@@ -106,11 +110,10 @@
#define __HAVE_IRQ 0
#endif
-#define __REALLY_HAVE_AGP (__HAVE_AGP && (defined(CONFIG_AGP) || \
- defined(CONFIG_AGP_MODULE)))
-#define __REALLY_HAVE_MTRR (__HAVE_MTRR && defined(CONFIG_MTRR))
#define __REALLY_HAVE_SG (__HAVE_SG)
+#define __OS_HAS_AGP (defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE))
+#define __OS_HAS_MTRR (defined(CONFIG_MTRR))
/*@}*/
@@ -438,7 +441,7 @@ typedef struct drm_device_dma {
/*@}*/
} drm_device_dma_t;
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
/**
* AGP memory entry. Stored as a doubly linked list.
*/
@@ -656,7 +659,7 @@ typedef struct drm_device {
wait_queue_head_t buf_readers; /**< Processes waiting to read */
wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
drm_agp_head_t *agp; /**< AGP data */
#endif
@@ -682,6 +685,7 @@ typedef struct drm_device {
struct drm_driver_fn fn_tbl;
drm_local_map_t *agp_buffer_map;
int dev_priv_size;
+ u32 driver_features;
} drm_device_t;
extern void DRM(driver_register_fns)(struct drm_device *dev);
@@ -742,7 +746,7 @@ extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size,
drm_device_t *dev);
extern void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev);
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
extern DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type);
extern int DRM(free_agp)(DRM_AGP_MEM *handle, int pages);
extern int DRM(bind_agp)(DRM_AGP_MEM *handle, unsigned int start);
@@ -874,7 +878,7 @@ extern void DRM(irq_immediate_bh)( void *dev );
#endif
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
/* AGP/GART support (drm_agpsupport.h) */
extern drm_agp_head_t *DRM(agp_init)(void);
extern void DRM(agp_uninit)(void);
diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c
index c4f0e465..12a8ba11 100644
--- a/linux-core/drm_agpsupport.c
+++ b/linux-core/drm_agpsupport.c
@@ -35,8 +35,7 @@
#include "drmP.h"
#include <linux/module.h>
-#if __REALLY_HAVE_AGP
-
+#if __OS_HAS_AGP
#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp")
#define DRM_AGP_PUT inter_module_put("drm_agp")
@@ -471,4 +470,4 @@ int DRM(agp_unbind_memory)(DRM_AGP_MEM *handle)
return drm_agp->unbind_memory(handle);
}
-#endif /* __REALLY_HAVE_AGP */
+#endif /* __OS_HAS_AGP */
diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c
index d3d0b83c..bd455c7e 100644
--- a/linux-core/drm_bufs.c
+++ b/linux-core/drm_bufs.c
@@ -131,11 +131,13 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
#ifdef __alpha__
map->offset += dev->hose->mem_space->start;
#endif
-#if __REALLY_HAVE_MTRR
- if ( map->type == _DRM_FRAME_BUFFER ||
- (map->flags & _DRM_WRITE_COMBINING) ) {
- map->mtrr = mtrr_add( map->offset, map->size,
- MTRR_TYPE_WRCOMB, 1 );
+#if __OS_HAS_MTRR
+ if (dev->driver_features & DRIVER_USE_MTRR) {
+ if ( map->type == _DRM_FRAME_BUFFER ||
+ (map->flags & _DRM_WRITE_COMBINING) ) {
+ map->mtrr = mtrr_add( map->offset, map->size,
+ MTRR_TYPE_WRCOMB, 1 );
+ }
}
#endif
if (map->type == _DRM_REGISTERS)
@@ -163,13 +165,15 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
dev->lock.hw_lock = map->handle; /* Pointer to lock */
}
break;
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
case _DRM_AGP:
+ if (dev->driver_features & DRIVER_USE_AGP) {
#ifdef __alpha__
- map->offset += dev->hose->mem_space->start;
+ map->offset += dev->hose->mem_space->start;
#endif
- map->offset += dev->agp->base;
- map->mtrr = dev->agp->agp_mtrr; /* for getmap */
+ map->offset += dev->agp->base;
+ map->mtrr = dev->agp->agp_mtrr; /* for getmap */
+ }
break;
#endif
case _DRM_SCATTER_GATHER:
@@ -271,13 +275,15 @@ int DRM(rmmap)(struct inode *inode, struct file *filp,
switch (map->type) {
case _DRM_REGISTERS:
case _DRM_FRAME_BUFFER:
-#if __REALLY_HAVE_MTRR
- if (map->mtrr >= 0) {
- int retcode;
- retcode = mtrr_del(map->mtrr,
- map->offset,
- map->size);
- DRM_DEBUG("mtrr_del = %d\n", retcode);
+#if __OS_HAS_MTRR
+ if (dev->driver_features & DRIVER_USE_MTRR) {
+ if (map->mtrr >= 0) {
+ int retcode;
+ retcode = mtrr_del(map->mtrr,
+ map->offset,
+ map->size);
+ DRM_DEBUG("mtrr_del = %d\n", retcode);
+ }
}
#endif
DRM(ioremapfree)(map->handle, map->size, dev);
@@ -344,7 +350,7 @@ static void DRM(cleanup_buf_error)(drm_device_t *dev, drm_buf_entry_t *entry)
}
}
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
/**
* Add AGP buffers for DMA transfers (ioctl).
*
@@ -529,7 +535,7 @@ int DRM(addbufs_agp)( struct inode *inode, struct file *filp,
atomic_dec( &dev->buf_alloc );
return 0;
}
-#endif /* __REALLY_HAVE_AGP */
+#endif /* __OS_HAS_AGP */
#if __HAVE_PCI_DMA
int DRM(addbufs_pci)( struct inode *inode, struct file *filp,
@@ -968,7 +974,7 @@ int DRM(addbufs)( struct inode *inode, struct file *filp,
sizeof(request) ) )
return -EFAULT;
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( request.flags & _DRM_AGP_BUFFER )
return DRM(addbufs_agp)( inode, filp, cmd, arg );
else
@@ -1213,7 +1219,7 @@ int DRM(mapbufs)( struct inode *inode, struct file *filp,
return -EFAULT;
if ( request.count >= dma->buf_count ) {
- if ( (__HAVE_AGP && (dma->flags & _DRM_DMA_USE_AGP)) ||
+ if ( (dev->driver_features & DRIVER_USE_AGP) && (dma->flags & _DRM_DMA_USE_AGP)) ||
(__HAVE_SG && (dma->flags & _DRM_DMA_USE_SG)) ) {
drm_map_t *map = dev->agp_buffer_map;
diff --git a/linux-core/drm_context.c b/linux-core/drm_context.c
index dd280e53..e66068ff 100644
--- a/linux-core/drm_context.c
+++ b/linux-core/drm_context.c
@@ -1,5 +1,5 @@
/**
- * \file drm_context.h
+* \file drm_context.h
* IOCTLs for generic contexts
*
* \author Rickard E. (Rik) Faith <faith@valinux.com>
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index 744fd14c..2aaf625a 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -52,9 +52,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef __MUST_HAVE_AGP
-#define __MUST_HAVE_AGP 0
-#endif
+
#ifndef __HAVE_CTX_BITMAP
#define __HAVE_CTX_BITMAP 0
#endif
@@ -180,7 +178,7 @@ drm_ioctl_desc_t DRM(ioctls)[] = {
[DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 },
#endif
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { DRM(agp_acquire), 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { DRM(agp_release), 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { DRM(agp_enable), 1, 1 },
@@ -380,9 +378,9 @@ static int DRM(takedown)( drm_device_t *dev )
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
}
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
/* Clear AGP information */
- if ( dev->agp ) {
+ if ( (dev->device_features & DRIVER_USE_AGP) && dev->agp ) {
drm_agp_mem_t *entry;
drm_agp_mem_t *nexte;
@@ -420,13 +418,15 @@ static int DRM(takedown)( drm_device_t *dev )
switch ( map->type ) {
case _DRM_REGISTERS:
case _DRM_FRAME_BUFFER:
-#if __REALLY_HAVE_MTRR
- if ( map->mtrr >= 0 ) {
- int retcode;
- retcode = mtrr_del( map->mtrr,
- map->offset,
- map->size );
- DRM_DEBUG( "mtrr_del=%d\n", retcode );
+#if __OS_HAS_MTRR
+ if (dev->driver_features & DRIVER_USE_MTRR) {
+ if ( map->mtrr >= 0 ) {
+ int retcode;
+ retcode = mtrr_del( map->mtrr,
+ map->offset,
+ map->size );
+ DRM_DEBUG( "mtrr_del=%d\n", retcode );
+ }
}
#endif
DRM(ioremapfree)( map->handle, map->size, dev );
@@ -545,21 +545,24 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if ((retcode = dev->fn_tbl.preinit(dev, ent->driver_data)))
goto error_out_unreg;
-#if __REALLY_HAVE_AGP
- dev->agp = DRM(agp_init)();
-#if __MUST_HAVE_AGP
- if ( dev->agp == NULL ) {
+#if __OS_HAS_AGP
+ if (dev->driver_features & DRIVER_USE_AGP)
+ {
+ dev->agp = DRM(agp_init)();
+ if ( dev->driver_features & DRIVER_REQUIRE_AGP) && dev->agp == NULL ) {
DRM_ERROR( "Cannot initialize the agpgart module.\n" );
retcode = -EINVAL;
goto error_out_unreg;
}
#endif
-#if __REALLY_HAVE_MTRR
- if (dev->agp)
- dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base,
- dev->agp->agp_info.aper_size*1024*1024,
- MTRR_TYPE_WRCOMB,
- 1 );
+#if __OS_HAS_MTRR
+ if (dev->driver_features & DRIVER_USE_MTRR) {
+ if (dev->agp)
+ dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base,
+ dev->agp->agp_info.aper_size*1024*1024,
+ MTRR_TYPE_WRCOMB,
+ 1 );
+ }
#endif
#endif
@@ -697,8 +700,9 @@ static void __exit drm_cleanup( drm_device_t *dev )
#if __HAVE_CTX_BITMAP
DRM(ctxbitmap_cleanup)( dev );
#endif
-#if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR
- if ( dev->agp && dev->agp->agp_mtrr >= 0) {
+#if __OS_HAS_AGP
+#if __OS_HAS_MTRR
+ if ( (dev->driver_features & DRIVER_USE_MTRR) && dev->agp && dev->agp->agp_mtrr >= 0 ) {
int retval;
retval = mtrr_del( dev->agp->agp_mtrr,
dev->agp->agp_info.aper_base,
@@ -706,8 +710,7 @@ static void __exit drm_cleanup( drm_device_t *dev )
DRM_DEBUG( "mtrr_del=%d\n", retval );
}
#endif
-#if __REALLY_HAVE_AGP
- if ( dev->agp ) {
+ if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp ) {
DRM(agp_uninit)();
DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS );
dev->agp = NULL;
diff --git a/linux-core/drm_memory.h b/linux-core/drm_memory.h
index d1c4b23a..c407292a 100644
--- a/linux-core/drm_memory.h
+++ b/linux-core/drm_memory.h
@@ -46,7 +46,7 @@
#define DEBUG_MEMORY 0
/* Need the 4-argument version of vmap(). */
-#if __REALLY_HAVE_AGP && defined(VMAP_4_ARGS)
+#if __OS_HAS_AGP && defined(VMAP_4_ARGS)
#include <linux/vmalloc.h>
@@ -142,12 +142,12 @@ drm_follow_page (void *vaddr)
return pte_pfn(*ptep) << PAGE_SHIFT;
}
-#endif /* __REALLY_HAVE_AGP && defined(VMAP_4_ARGS) */
+#endif /* __OS_HAS_AGP && defined(VMAP_4_ARGS) */
static inline void *drm_ioremap(unsigned long offset, unsigned long size, drm_device_t *dev)
{
-#if __REALLY_HAVE_AGP && defined(VMAP_4_ARGS)
- if (dev->agp && dev->agp->cant_use_aperture) {
+#if __OS_HAS_AGP && defined(VMAP_4_ARGS)
+ if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture) {
drm_map_t *map = drm_lookup_map(offset, size, dev);
if (map && map->type == _DRM_AGP)
@@ -161,8 +161,8 @@ static inline void *drm_ioremap(unsigned long offset, unsigned long size, drm_de
static inline void *drm_ioremap_nocache(unsigned long offset, unsigned long size,
drm_device_t *dev)
{
-#if __REALLY_HAVE_AGP && defined(VMAP_4_ARGS)
- if (dev->agp && dev->agp->cant_use_aperture) {
+#if __OS_HAS_AGP&& defined(VMAP_4_ARGS)
+ if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture) {
drm_map_t *map = drm_lookup_map(offset, size, dev);
if (map && map->type == _DRM_AGP)
@@ -175,13 +175,13 @@ static inline void *drm_ioremap_nocache(unsigned long offset, unsigned long size
static inline void drm_ioremapfree(void *pt, unsigned long size, drm_device_t *dev)
{
-#if __REALLY_HAVE_AGP && defined(VMAP_4_ARGS)
+#if __OS_HAS_AGP && defined(VMAP_4_ARGS)
/*
* This is a bit ugly. It would be much cleaner if the DRM API would use separate
* routines for handling mappings in the AGP space. Hopefully this can be done in
* a future revision of the interface...
*/
- if (dev->agp && dev->agp->cant_use_aperture
+ if ((dev->driver_features & DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture
&& ((unsigned long) pt >= VMALLOC_START && (unsigned long) pt < VMALLOC_END))
{
unsigned long offset;
@@ -344,7 +344,7 @@ void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev)
drm_ioremapfree(pt, size, dev);
}
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
/** Wrapper around agp_allocate_memory() */
DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type)
{
diff --git a/linux-core/drm_memory_debug.h b/linux-core/drm_memory_debug.h
index 6723818a..4f23918d 100644
--- a/linux-core/drm_memory_debug.h
+++ b/linux-core/drm_memory_debug.h
@@ -353,7 +353,7 @@ void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev)
}
}
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type)
{
diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c
index 7ab7d5ac..5dc80647 100644
--- a/linux-core/drm_vm.c
+++ b/linux-core/drm_vm.c
@@ -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,
@@ -537,7 +538,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
)
@@ -581,8 +582,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
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c
index d558988f..afc7d696 100644
--- a/linux-core/i810_dma.c
+++ b/linux-core/i810_dma.c
@@ -1413,6 +1413,7 @@ static int i810_driver_dma_quiescent(drm_device_t *dev)
void i810_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR;
dev->dev_priv_size = sizeof(drm_i810_buf_priv_t);
dev->fn_tbl.pretakedown = i810_driver_pretakedown;
dev->fn_tbl.release = i810_driver_release;
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c
index 1a8c6336..52590bf9 100644
--- a/linux-core/i830_dma.c
+++ b/linux-core/i830_dma.c
@@ -1609,6 +1609,7 @@ static int i830_driver_dma_quiescent(drm_device_t *dev)
void i830_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR;
dev->dev_priv_size = sizeof(drm_i830_buf_priv_t);
dev->fn_tbl.pretakedown = i830_driver_pretakedown;
dev->fn_tbl.release = i830_driver_release;
diff --git a/linux-core/savage.h b/linux-core/savage.h
index fb828ce6..fdc73903 100644
--- a/linux-core/savage.h
+++ b/linux-core/savage.h
@@ -31,9 +31,6 @@
/* General customization:
*/
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 1
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
#endif
diff --git a/linux-core/savage_dma.c b/linux-core/savage_dma.c
index 34410116..271d1f23 100644
--- a/linux-core/savage_dma.c
+++ b/linux-core/savage_dma.c
@@ -37,4 +37,5 @@
void DRM(driver_register_fns)(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR;
}
diff --git a/linux-core/tdfx_drv.c b/linux-core/tdfx_drv.c
index f3fcdf84..86e049ab 100644
--- a/linux-core/tdfx_drv.c
+++ b/linux-core/tdfx_drv.c
@@ -52,5 +52,6 @@
void DRM(driver_register_fns)(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_MTRR;
}
diff --git a/linux/drmP.h b/linux/drmP.h
index 75fb999a..8f3b0cb8 100644
--- a/linux/drmP.h
+++ b/linux/drmP.h
@@ -90,12 +90,16 @@
/** \name DRM template customization defaults */
/*@{*/
-#ifndef __HAVE_AGP
-#define __HAVE_AGP 0
-#endif
-#ifndef __HAVE_MTRR
-#define __HAVE_MTRR 0
-#endif
+/* driver capabilities and requirements mask */
+#define DRIVER_USE_AGP 0x1
+#define DRIVER_REQUIRE_AGP 0x2
+#define DRIVER_USE_MTRR 0x4
+#define DRIVER_CTX_BITMAP 0x8
+#define DRIVER_HAVE_DMA 0x10
+#define DRIVER_HAVE_IRQ 0x20
+#define DRIVER_HAVE_SG 0x40
+#define DRIVER_HAVE_PCI_DMA 0x80
+
#ifndef __HAVE_CTX_BITMAP
#define __HAVE_CTX_BITMAP 0
#endif
@@ -106,11 +110,10 @@
#define __HAVE_IRQ 0
#endif
-#define __REALLY_HAVE_AGP (__HAVE_AGP && (defined(CONFIG_AGP) || \
- defined(CONFIG_AGP_MODULE)))
-#define __REALLY_HAVE_MTRR (__HAVE_MTRR && defined(CONFIG_MTRR))
#define __REALLY_HAVE_SG (__HAVE_SG)
+#define __OS_HAS_AGP (defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE))
+#define __OS_HAS_MTRR (defined(CONFIG_MTRR))
/*@}*/
@@ -438,7 +441,7 @@ typedef struct drm_device_dma {
/*@}*/
} drm_device_dma_t;
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
/**
* AGP memory entry. Stored as a doubly linked list.
*/
@@ -656,7 +659,7 @@ typedef struct drm_device {
wait_queue_head_t buf_readers; /**< Processes waiting to read */
wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
drm_agp_head_t *agp; /**< AGP data */
#endif
@@ -682,6 +685,7 @@ typedef struct drm_device {
struct drm_driver_fn fn_tbl;
drm_local_map_t *agp_buffer_map;
int dev_priv_size;
+ u32 driver_features;
} drm_device_t;
extern void DRM(driver_register_fns)(struct drm_device *dev);
@@ -742,7 +746,7 @@ extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size,
drm_device_t *dev);
extern void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev);
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
extern DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type);
extern int DRM(free_agp)(DRM_AGP_MEM *handle, int pages);
extern int DRM(bind_agp)(DRM_AGP_MEM *handle, unsigned int start);
@@ -874,7 +878,7 @@ extern void DRM(irq_immediate_bh)( void *dev );
#endif
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
/* AGP/GART support (drm_agpsupport.h) */
extern drm_agp_head_t *DRM(agp_init)(void);
extern void DRM(agp_uninit)(void);
diff --git a/linux/drm_agpsupport.h b/linux/drm_agpsupport.h
index c4f0e465..12a8ba11 100644
--- a/linux/drm_agpsupport.h
+++ b/linux/drm_agpsupport.h
@@ -35,8 +35,7 @@
#include "drmP.h"
#include <linux/module.h>
-#if __REALLY_HAVE_AGP
-
+#if __OS_HAS_AGP
#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp")
#define DRM_AGP_PUT inter_module_put("drm_agp")
@@ -471,4 +470,4 @@ int DRM(agp_unbind_memory)(DRM_AGP_MEM *handle)
return drm_agp->unbind_memory(handle);
}
-#endif /* __REALLY_HAVE_AGP */
+#endif /* __OS_HAS_AGP */
diff --git a/linux/drm_bufs.h b/linux/drm_bufs.h
index d3d0b83c..bd455c7e 100644
--- a/linux/drm_bufs.h
+++ b/linux/drm_bufs.h
@@ -131,11 +131,13 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
#ifdef __alpha__
map->offset += dev->hose->mem_space->start;
#endif
-#if __REALLY_HAVE_MTRR
- if ( map->type == _DRM_FRAME_BUFFER ||
- (map->flags & _DRM_WRITE_COMBINING) ) {
- map->mtrr = mtrr_add( map->offset, map->size,
- MTRR_TYPE_WRCOMB, 1 );
+#if __OS_HAS_MTRR
+ if (dev->driver_features & DRIVER_USE_MTRR) {
+ if ( map->type == _DRM_FRAME_BUFFER ||
+ (map->flags & _DRM_WRITE_COMBINING) ) {
+ map->mtrr = mtrr_add( map->offset, map->size,
+ MTRR_TYPE_WRCOMB, 1 );
+ }
}
#endif
if (map->type == _DRM_REGISTERS)
@@ -163,13 +165,15 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
dev->lock.hw_lock = map->handle; /* Pointer to lock */
}
break;
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
case _DRM_AGP:
+ if (dev->driver_features & DRIVER_USE_AGP) {
#ifdef __alpha__
- map->offset += dev->hose->mem_space->start;
+ map->offset += dev->hose->mem_space->start;
#endif
- map->offset += dev->agp->base;
- map->mtrr = dev->agp->agp_mtrr; /* for getmap */
+ map->offset += dev->agp->base;
+ map->mtrr = dev->agp->agp_mtrr; /* for getmap */
+ }
break;
#endif
case _DRM_SCATTER_GATHER:
@@ -271,13 +275,15 @@ int DRM(rmmap)(struct inode *inode, struct file *filp,
switch (map->type) {
case _DRM_REGISTERS:
case _DRM_FRAME_BUFFER:
-#if __REALLY_HAVE_MTRR
- if (map->mtrr >= 0) {
- int retcode;
- retcode = mtrr_del(map->mtrr,
- map->offset,
- map->size);
- DRM_DEBUG("mtrr_del = %d\n", retcode);
+#if __OS_HAS_MTRR
+ if (dev->driver_features & DRIVER_USE_MTRR) {
+ if (map->mtrr >= 0) {
+ int retcode;
+ retcode = mtrr_del(map->mtrr,
+ map->offset,
+ map->size);
+ DRM_DEBUG("mtrr_del = %d\n", retcode);
+ }
}
#endif
DRM(ioremapfree)(map->handle, map->size, dev);
@@ -344,7 +350,7 @@ static void DRM(cleanup_buf_error)(drm_device_t *dev, drm_buf_entry_t *entry)
}
}
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
/**
* Add AGP buffers for DMA transfers (ioctl).
*
@@ -529,7 +535,7 @@ int DRM(addbufs_agp)( struct inode *inode, struct file *filp,
atomic_dec( &dev->buf_alloc );
return 0;
}
-#endif /* __REALLY_HAVE_AGP */
+#endif /* __OS_HAS_AGP */
#if __HAVE_PCI_DMA
int DRM(addbufs_pci)( struct inode *inode, struct file *filp,
@@ -968,7 +974,7 @@ int DRM(addbufs)( struct inode *inode, struct file *filp,
sizeof(request) ) )
return -EFAULT;
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( request.flags & _DRM_AGP_BUFFER )
return DRM(addbufs_agp)( inode, filp, cmd, arg );
else
@@ -1213,7 +1219,7 @@ int DRM(mapbufs)( struct inode *inode, struct file *filp,
return -EFAULT;
if ( request.count >= dma->buf_count ) {
- if ( (__HAVE_AGP && (dma->flags & _DRM_DMA_USE_AGP)) ||
+ if ( (dev->driver_features & DRIVER_USE_AGP) && (dma->flags & _DRM_DMA_USE_AGP)) ||
(__HAVE_SG && (dma->flags & _DRM_DMA_USE_SG)) ) {
drm_map_t *map = dev->agp_buffer_map;
diff --git a/linux/drm_context.h b/linux/drm_context.h
index dd280e53..e66068ff 100644
--- a/linux/drm_context.h
+++ b/linux/drm_context.h
@@ -1,5 +1,5 @@
/**
- * \file drm_context.h
+* \file drm_context.h
* IOCTLs for generic contexts
*
* \author Rickard E. (Rik) Faith <faith@valinux.com>
diff --git a/linux/drm_drv.h b/linux/drm_drv.h
index 744fd14c..2aaf625a 100644
--- a/linux/drm_drv.h
+++ b/linux/drm_drv.h
@@ -52,9 +52,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef __MUST_HAVE_AGP
-#define __MUST_HAVE_AGP 0
-#endif
+
#ifndef __HAVE_CTX_BITMAP
#define __HAVE_CTX_BITMAP 0
#endif
@@ -180,7 +178,7 @@ drm_ioctl_desc_t DRM(ioctls)[] = {
[DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 },
#endif
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { DRM(agp_acquire), 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { DRM(agp_release), 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { DRM(agp_enable), 1, 1 },
@@ -380,9 +378,9 @@ static int DRM(takedown)( drm_device_t *dev )
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
}
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
/* Clear AGP information */
- if ( dev->agp ) {
+ if ( (dev->device_features & DRIVER_USE_AGP) && dev->agp ) {
drm_agp_mem_t *entry;
drm_agp_mem_t *nexte;
@@ -420,13 +418,15 @@ static int DRM(takedown)( drm_device_t *dev )
switch ( map->type ) {
case _DRM_REGISTERS:
case _DRM_FRAME_BUFFER:
-#if __REALLY_HAVE_MTRR
- if ( map->mtrr >= 0 ) {
- int retcode;
- retcode = mtrr_del( map->mtrr,
- map->offset,
- map->size );
- DRM_DEBUG( "mtrr_del=%d\n", retcode );
+#if __OS_HAS_MTRR
+ if (dev->driver_features & DRIVER_USE_MTRR) {
+ if ( map->mtrr >= 0 ) {
+ int retcode;
+ retcode = mtrr_del( map->mtrr,
+ map->offset,
+ map->size );
+ DRM_DEBUG( "mtrr_del=%d\n", retcode );
+ }
}
#endif
DRM(ioremapfree)( map->handle, map->size, dev );
@@ -545,21 +545,24 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if ((retcode = dev->fn_tbl.preinit(dev, ent->driver_data)))
goto error_out_unreg;
-#if __REALLY_HAVE_AGP
- dev->agp = DRM(agp_init)();
-#if __MUST_HAVE_AGP
- if ( dev->agp == NULL ) {
+#if __OS_HAS_AGP
+ if (dev->driver_features & DRIVER_USE_AGP)
+ {
+ dev->agp = DRM(agp_init)();
+ if ( dev->driver_features & DRIVER_REQUIRE_AGP) && dev->agp == NULL ) {
DRM_ERROR( "Cannot initialize the agpgart module.\n" );
retcode = -EINVAL;
goto error_out_unreg;
}
#endif
-#if __REALLY_HAVE_MTRR
- if (dev->agp)
- dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base,
- dev->agp->agp_info.aper_size*1024*1024,
- MTRR_TYPE_WRCOMB,
- 1 );
+#if __OS_HAS_MTRR
+ if (dev->driver_features & DRIVER_USE_MTRR) {
+ if (dev->agp)
+ dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base,
+ dev->agp->agp_info.aper_size*1024*1024,
+ MTRR_TYPE_WRCOMB,
+ 1 );
+ }
#endif
#endif
@@ -697,8 +700,9 @@ static void __exit drm_cleanup( drm_device_t *dev )
#if __HAVE_CTX_BITMAP
DRM(ctxbitmap_cleanup)( dev );
#endif
-#if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR
- if ( dev->agp && dev->agp->agp_mtrr >= 0) {
+#if __OS_HAS_AGP
+#if __OS_HAS_MTRR
+ if ( (dev->driver_features & DRIVER_USE_MTRR) && dev->agp && dev->agp->agp_mtrr >= 0 ) {
int retval;
retval = mtrr_del( dev->agp->agp_mtrr,
dev->agp->agp_info.aper_base,
@@ -706,8 +710,7 @@ static void __exit drm_cleanup( drm_device_t *dev )
DRM_DEBUG( "mtrr_del=%d\n", retval );
}
#endif
-#if __REALLY_HAVE_AGP
- if ( dev->agp ) {
+ if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp ) {
DRM(agp_uninit)();
DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS );
dev->agp = NULL;
diff --git a/linux/drm_memory.h b/linux/drm_memory.h
index d1c4b23a..c407292a 100644
--- a/linux/drm_memory.h
+++ b/linux/drm_memory.h
@@ -46,7 +46,7 @@
#define DEBUG_MEMORY 0
/* Need the 4-argument version of vmap(). */
-#if __REALLY_HAVE_AGP && defined(VMAP_4_ARGS)
+#if __OS_HAS_AGP && defined(VMAP_4_ARGS)
#include <linux/vmalloc.h>
@@ -142,12 +142,12 @@ drm_follow_page (void *vaddr)
return pte_pfn(*ptep) << PAGE_SHIFT;
}
-#endif /* __REALLY_HAVE_AGP && defined(VMAP_4_ARGS) */
+#endif /* __OS_HAS_AGP && defined(VMAP_4_ARGS) */
static inline void *drm_ioremap(unsigned long offset, unsigned long size, drm_device_t *dev)
{
-#if __REALLY_HAVE_AGP && defined(VMAP_4_ARGS)
- if (dev->agp && dev->agp->cant_use_aperture) {
+#if __OS_HAS_AGP && defined(VMAP_4_ARGS)
+ if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture) {
drm_map_t *map = drm_lookup_map(offset, size, dev);
if (map && map->type == _DRM_AGP)
@@ -161,8 +161,8 @@ static inline void *drm_ioremap(unsigned long offset, unsigned long size, drm_de
static inline void *drm_ioremap_nocache(unsigned long offset, unsigned long size,
drm_device_t *dev)
{
-#if __REALLY_HAVE_AGP && defined(VMAP_4_ARGS)
- if (dev->agp && dev->agp->cant_use_aperture) {
+#if __OS_HAS_AGP&& defined(VMAP_4_ARGS)
+ if ( (dev->driver_features & DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture) {
drm_map_t *map = drm_lookup_map(offset, size, dev);
if (map && map->type == _DRM_AGP)
@@ -175,13 +175,13 @@ static inline void *drm_ioremap_nocache(unsigned long offset, unsigned long size
static inline void drm_ioremapfree(void *pt, unsigned long size, drm_device_t *dev)
{
-#if __REALLY_HAVE_AGP && defined(VMAP_4_ARGS)
+#if __OS_HAS_AGP && defined(VMAP_4_ARGS)
/*
* This is a bit ugly. It would be much cleaner if the DRM API would use separate
* routines for handling mappings in the AGP space. Hopefully this can be done in
* a future revision of the interface...
*/
- if (dev->agp && dev->agp->cant_use_aperture
+ if ((dev->driver_features & DRIVER_USE_AGP) && dev->agp && dev->agp->cant_use_aperture
&& ((unsigned long) pt >= VMALLOC_START && (unsigned long) pt < VMALLOC_END))
{
unsigned long offset;
@@ -344,7 +344,7 @@ void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev)
drm_ioremapfree(pt, size, dev);
}
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
/** Wrapper around agp_allocate_memory() */
DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type)
{
diff --git a/linux/drm_memory_debug.h b/linux/drm_memory_debug.h
index 6723818a..4f23918d 100644
--- a/linux/drm_memory_debug.h
+++ b/linux/drm_memory_debug.h
@@ -353,7 +353,7 @@ void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev)
}
}
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type)
{
diff --git a/linux/drm_vm.h b/linux/drm_vm.h
index 7ab7d5ac..5dc80647 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,
@@ -537,7 +538,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
)
@@ -581,8 +582,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
diff --git a/linux/gamma.h b/linux/gamma.h
index c30e70ea..09fe6770 100644
--- a/linux/gamma.h
+++ b/linux/gamma.h
@@ -36,8 +36,6 @@
/* General customization:
*/
-#define __HAVE_MTRR 1
-
#define DRIVER_AUTHOR "VA Linux Systems Inc."
#define DRIVER_NAME "gamma"
@@ -66,8 +64,6 @@
/* DMA customization:
*/
#define __HAVE_DMA 1
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 0
#define __HAVE_OLD_DMA 1
#define __HAVE_PCI_DMA 1
diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c
index 2a79f71b..6d1b63ca 100644
--- a/linux/gamma_dma.c
+++ b/linux/gamma_dma.c
@@ -941,6 +941,7 @@ static int gamma_driver_dma_quiescent(drm_device_t *dev)
void gamma_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR;
DRM(fops).read = gamma_fops_read;
DRM(fops).poll = gamma_fops_poll;
dev->fn_tbl.preinit = gamma_driver_preinit;
diff --git a/linux/i810.h b/linux/i810.h
index aea8a63c..1276173d 100644
--- a/linux/i810.h
+++ b/linux/i810.h
@@ -36,9 +36,6 @@
/* General customization:
*/
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 1
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
#define DRIVER_AUTHOR "VA Linux Systems Inc."
diff --git a/linux/i810_dma.c b/linux/i810_dma.c
index d558988f..afc7d696 100644
--- a/linux/i810_dma.c
+++ b/linux/i810_dma.c
@@ -1413,6 +1413,7 @@ static int i810_driver_dma_quiescent(drm_device_t *dev)
void i810_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR;
dev->dev_priv_size = sizeof(drm_i810_buf_priv_t);
dev->fn_tbl.pretakedown = i810_driver_pretakedown;
dev->fn_tbl.release = i810_driver_release;
diff --git a/linux/i830.h b/linux/i830.h
index 7e176f2c..b9cb8047 100644
--- a/linux/i830.h
+++ b/linux/i830.h
@@ -36,9 +36,6 @@
/* General customization:
*/
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 1
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
#define DRIVER_AUTHOR "VA Linux Systems Inc."
diff --git a/linux/i830_dma.c b/linux/i830_dma.c
index 1a8c6336..52590bf9 100644
--- a/linux/i830_dma.c
+++ b/linux/i830_dma.c
@@ -1609,6 +1609,7 @@ static int i830_driver_dma_quiescent(drm_device_t *dev)
void i830_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR;
dev->dev_priv_size = sizeof(drm_i830_buf_priv_t);
dev->fn_tbl.pretakedown = i830_driver_pretakedown;
dev->fn_tbl.release = i830_driver_release;
diff --git a/linux/savage.h b/linux/savage.h
index fb828ce6..fdc73903 100644
--- a/linux/savage.h
+++ b/linux/savage.h
@@ -31,9 +31,6 @@
/* General customization:
*/
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 1
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
#endif
diff --git a/linux/savage_dma.c b/linux/savage_dma.c
index 34410116..271d1f23 100644
--- a/linux/savage_dma.c
+++ b/linux/savage_dma.c
@@ -37,4 +37,5 @@
void DRM(driver_register_fns)(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR;
}
diff --git a/linux/tdfx_drv.c b/linux/tdfx_drv.c
index f3fcdf84..86e049ab 100644
--- a/linux/tdfx_drv.c
+++ b/linux/tdfx_drv.c
@@ -52,5 +52,6 @@
void DRM(driver_register_fns)(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_MTRR;
}
diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c
index 72573cbb..489f24a7 100644
--- a/shared-core/i915_dma.c
+++ b/shared-core/i915_dma.c
@@ -790,6 +790,7 @@ static void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp)
void i915_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR;
dev->fn_tbl.pretakedown = i915_driver_pretakedown;
dev->fn_tbl.prerelease = i915_driver_prerelease;
}
diff --git a/shared-core/mach64_dma.c b/shared-core/mach64_dma.c
index 0acb784d..1ec2e3c6 100644
--- a/shared-core/mach64_dma.c
+++ b/shared-core/mach64_dma.c
@@ -1333,5 +1333,6 @@ static void mach64_driver_pretakedown(drm_device_t *dev)
void mach64_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR;
dev->fn_tbl.pretakedown = mach64_driver_pretakedown;
}
diff --git a/shared-core/mga_dma.c b/shared-core/mga_dma.c
index 4a38b7d9..f1959edf 100644
--- a/shared-core/mga_dma.c
+++ b/shared-core/mga_dma.c
@@ -813,6 +813,7 @@ static int mga_driver_dma_quiescent(drm_device_t *dev)
void mga_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR;
dev->fn_tbl.pretakedown = mga_driver_pretakedown;
dev->fn_tbl.dma_quiescent = mga_driver_dma_quiescent;
}
diff --git a/shared-core/r128_cce.c b/shared-core/r128_cce.c
index 43fa9b51..ac5a461d 100644
--- a/shared-core/r128_cce.c
+++ b/shared-core/r128_cce.c
@@ -322,7 +322,7 @@ static void r128_cce_init_ring_buffer( drm_device_t *dev,
/* The manual (p. 2) says this address is in "VM space". This
* means it's an offset from the start of AGP space.
*/
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( !dev_priv->is_pci )
ring_start = dev_priv->cce_ring->offset - dev->agp->base;
else
@@ -510,7 +510,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
(drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle +
init->sarea_priv_offset);
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( !dev_priv->is_pci ) {
drm_core_ioremap( dev_priv->cce_ring, dev );
drm_core_ioremap( dev_priv->ring_rptr, dev );
@@ -533,7 +533,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
dev->agp_buffer_map->handle = (void *)dev->agp_buffer_map->offset;
}
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( !dev_priv->is_pci )
dev_priv->cce_buffers_offset = dev->agp->base;
else
@@ -558,7 +558,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
R128_WRITE( R128_LAST_DISPATCH_REG,
dev_priv->sarea_priv->last_dispatch );
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( dev_priv->is_pci ) {
#endif
if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart,
@@ -569,7 +569,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
return DRM_ERR(ENOMEM);
}
R128_WRITE( R128_PCI_GART_PAGE, dev_priv->bus_pci_gart );
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
}
#endif
@@ -597,7 +597,7 @@ int r128_do_cleanup_cce( drm_device_t *dev )
if ( dev->dev_private ) {
drm_r128_private_t *dev_priv = dev->dev_private;
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( !dev_priv->is_pci ) {
if ( dev_priv->cce_ring != NULL )
drm_core_ioremapfree( dev_priv->cce_ring, dev );
diff --git a/shared-core/r128_state.c b/shared-core/r128_state.c
index 88d7715a..3649594b 100644
--- a/shared-core/r128_state.c
+++ b/shared-core/r128_state.c
@@ -1712,6 +1712,7 @@ static void r128_driver_pretakedown(drm_device_t *dev)
void r128_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR;
dev->dev_priv_size = sizeof(drm_r128_buf_priv_t);
dev->fn_tbl.prerelease = r128_driver_prerelease;
dev->fn_tbl.pretakedown = r128_driver_pretakedown;
diff --git a/shared-core/radeon_cp.c b/shared-core/radeon_cp.c
index f634a345..1741a3d4 100644
--- a/shared-core/radeon_cp.c
+++ b/shared-core/radeon_cp.c
@@ -858,7 +858,7 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
( ( dev_priv->gart_vm_start - 1 ) & 0xffff0000 )
| ( dev_priv->fb_location >> 16 ) );
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP) {
RADEON_WRITE( RADEON_MC_AGP_LOCATION,
(((dev_priv->gart_vm_start - 1 +
@@ -885,7 +885,7 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
SET_RING_HEAD( dev_priv, cur_read_ptr );
dev_priv->ring.tail = cur_read_ptr;
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP) {
/* set RADEON_AGP_BASE here instead of relying on X from user space */
RADEON_WRITE( RADEON_AGP_BASE, (unsigned int)dev->agp->base );
@@ -1146,7 +1146,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
(drm_radeon_sarea_t *)((u8 *)dev_priv->sarea->handle +
init->sarea_priv_offset);
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( dev_priv->flags & CHIP_IS_AGP ) {
drm_core_ioremap( dev_priv->cp_ring, dev );
drm_core_ioremap( dev_priv->ring_rptr, dev );
@@ -1195,7 +1195,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->gart_vm_start = dev_priv->fb_location
+ RADEON_READ( RADEON_CONFIG_APER_SIZE );
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP)
dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset
- dev->agp->base
@@ -1224,7 +1224,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK;
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP) {
/* Turn off PCI GART */
radeon_set_pcigart( dev_priv, 0 );
@@ -1265,14 +1265,23 @@ int radeon_do_cleanup_cp( drm_device_t *dev )
if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
#endif
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP) {
if ( dev_priv->cp_ring != NULL )
+ {
drm_core_ioremapfree( dev_priv->cp_ring, dev );
+ dev_priv->cp_ring = NULL;
+ }
if ( dev_priv->ring_rptr != NULL )
+ {
drm_core_ioremapfree( dev_priv->ring_rptr, dev );
+ dev_priv->ring_rptr = NULL;
+ }
if ( dev->agp_buffer_map != NULL )
+ {
drm_core_ioremapfree( dev->agp_buffer_map, dev );
+ dev->agp_buffer_map = NULL;
+ }
} else
#endif
{
@@ -1309,7 +1318,7 @@ static int radeon_do_resume_cp( drm_device_t *dev )
DRM_DEBUG("Starting radeon_do_resume_cp()\n");
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP) {
/* Turn off PCI GART */
radeon_set_pcigart( dev_priv, 0 );
diff --git a/shared-core/radeon_state.c b/shared-core/radeon_state.c
index 4a7bfd2d..59e07dd8 100644
--- a/shared-core/radeon_state.c
+++ b/shared-core/radeon_state.c
@@ -2582,6 +2582,7 @@ static void radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv)
void radeon_driver_register_fns(struct drm_device *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR;
dev->dev_priv_size = sizeof(drm_radeon_buf_priv_t);
dev->fn_tbl.preinit = radeon_preinit;
dev->fn_tbl.postinit = radeon_postinit;
diff --git a/shared-core/sis_mm.c b/shared-core/sis_mm.c
index 233843d5..27b904fc 100644
--- a/shared-core/sis_mm.c
+++ b/shared-core/sis_mm.c
@@ -411,6 +411,7 @@ int sis_final_context(struct drm_device *dev, int context)
void DRM(driver_register_fns)(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR;
dev->fn_tbl.context_ctor = sis_init_context;
dev->fn_tbl.context_dtor = sis_final_context;
}
diff --git a/shared-core/tdfx_drv.h b/shared-core/tdfx_drv.h
index 6b067db7..f9c60dbb 100644
--- a/shared-core/tdfx_drv.h
+++ b/shared-core/tdfx_drv.h
@@ -36,7 +36,6 @@
/* General customization:
*/
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
#define DRIVER_AUTHOR "VA Linux Systems Inc."
diff --git a/shared-core/via_mm.c b/shared-core/via_mm.c
index be6184ca..25a91058 100644
--- a/shared-core/via_mm.c
+++ b/shared-core/via_mm.c
@@ -348,6 +348,7 @@ EXPORT_SYMBOL(via_fb_free);
void DRM(driver_register_fns)(drm_device_t *dev)
{
- dev->fn_tbl.context_ctor = via_init_context;
- dev->fn_tbl.context_dtor = via_final_context;
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR;
+ dev->fn_tbl.context_ctor = via_init_context;
+ dev->fn_tbl.context_dtor = via_final_context;
}
diff --git a/shared/i915.h b/shared/i915.h
index a5844e4c..a863042d 100644
--- a/shared/i915.h
+++ b/shared/i915.h
@@ -16,9 +16,6 @@
/* General customization:
*/
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 1
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
#define DRIVER_AUTHOR "Tungsten Graphics, Inc."
diff --git a/shared/i915_dma.c b/shared/i915_dma.c
index 72573cbb..489f24a7 100644
--- a/shared/i915_dma.c
+++ b/shared/i915_dma.c
@@ -790,6 +790,7 @@ static void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp)
void i915_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR;
dev->fn_tbl.pretakedown = i915_driver_pretakedown;
dev->fn_tbl.prerelease = i915_driver_prerelease;
}
diff --git a/shared/mach64.h b/shared/mach64.h
index 6cfb786e..dad4e4dc 100644
--- a/shared/mach64.h
+++ b/shared/mach64.h
@@ -38,9 +38,6 @@
/* General customization:
*/
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 0
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
#define __HAVE_PCI_DMA 1
diff --git a/shared/mach64_dma.c b/shared/mach64_dma.c
index 0acb784d..1ec2e3c6 100644
--- a/shared/mach64_dma.c
+++ b/shared/mach64_dma.c
@@ -1333,5 +1333,6 @@ static void mach64_driver_pretakedown(drm_device_t *dev)
void mach64_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR;
dev->fn_tbl.pretakedown = mach64_driver_pretakedown;
}
diff --git a/shared/mga.h b/shared/mga.h
index f2813846..469366ba 100644
--- a/shared/mga.h
+++ b/shared/mga.h
@@ -36,9 +36,6 @@
/* General customization:
*/
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 1
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc."
diff --git a/shared/mga_dma.c b/shared/mga_dma.c
index 4a38b7d9..f1959edf 100644
--- a/shared/mga_dma.c
+++ b/shared/mga_dma.c
@@ -813,6 +813,7 @@ static int mga_driver_dma_quiescent(drm_device_t *dev)
void mga_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR;
dev->fn_tbl.pretakedown = mga_driver_pretakedown;
dev->fn_tbl.dma_quiescent = mga_driver_dma_quiescent;
}
diff --git a/shared/r128.h b/shared/r128.h
index b9d2f87e..a2bb27dc 100644
--- a/shared/r128.h
+++ b/shared/r128.h
@@ -36,9 +36,6 @@
/* General customization:
*/
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 0
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
#define __HAVE_SG 1
#define __HAVE_PCI_DMA 1
diff --git a/shared/r128_cce.c b/shared/r128_cce.c
index 43fa9b51..ac5a461d 100644
--- a/shared/r128_cce.c
+++ b/shared/r128_cce.c
@@ -322,7 +322,7 @@ static void r128_cce_init_ring_buffer( drm_device_t *dev,
/* The manual (p. 2) says this address is in "VM space". This
* means it's an offset from the start of AGP space.
*/
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( !dev_priv->is_pci )
ring_start = dev_priv->cce_ring->offset - dev->agp->base;
else
@@ -510,7 +510,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
(drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle +
init->sarea_priv_offset);
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( !dev_priv->is_pci ) {
drm_core_ioremap( dev_priv->cce_ring, dev );
drm_core_ioremap( dev_priv->ring_rptr, dev );
@@ -533,7 +533,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
dev->agp_buffer_map->handle = (void *)dev->agp_buffer_map->offset;
}
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( !dev_priv->is_pci )
dev_priv->cce_buffers_offset = dev->agp->base;
else
@@ -558,7 +558,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
R128_WRITE( R128_LAST_DISPATCH_REG,
dev_priv->sarea_priv->last_dispatch );
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( dev_priv->is_pci ) {
#endif
if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart,
@@ -569,7 +569,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
return DRM_ERR(ENOMEM);
}
R128_WRITE( R128_PCI_GART_PAGE, dev_priv->bus_pci_gart );
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
}
#endif
@@ -597,7 +597,7 @@ int r128_do_cleanup_cce( drm_device_t *dev )
if ( dev->dev_private ) {
drm_r128_private_t *dev_priv = dev->dev_private;
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( !dev_priv->is_pci ) {
if ( dev_priv->cce_ring != NULL )
drm_core_ioremapfree( dev_priv->cce_ring, dev );
diff --git a/shared/r128_state.c b/shared/r128_state.c
index 88d7715a..3649594b 100644
--- a/shared/r128_state.c
+++ b/shared/r128_state.c
@@ -1712,6 +1712,7 @@ static void r128_driver_pretakedown(drm_device_t *dev)
void r128_driver_register_fns(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR;
dev->dev_priv_size = sizeof(drm_r128_buf_priv_t);
dev->fn_tbl.prerelease = r128_driver_prerelease;
dev->fn_tbl.pretakedown = r128_driver_pretakedown;
diff --git a/shared/radeon.h b/shared/radeon.h
index 39fb0be9..2bb167a4 100644
--- a/shared/radeon.h
+++ b/shared/radeon.h
@@ -37,9 +37,6 @@
/* General customization:
*/
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 0
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
#define __HAVE_SG 1
#define __HAVE_PCI_DMA 1
diff --git a/shared/radeon_cp.c b/shared/radeon_cp.c
index f634a345..1741a3d4 100644
--- a/shared/radeon_cp.c
+++ b/shared/radeon_cp.c
@@ -858,7 +858,7 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
( ( dev_priv->gart_vm_start - 1 ) & 0xffff0000 )
| ( dev_priv->fb_location >> 16 ) );
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP) {
RADEON_WRITE( RADEON_MC_AGP_LOCATION,
(((dev_priv->gart_vm_start - 1 +
@@ -885,7 +885,7 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
SET_RING_HEAD( dev_priv, cur_read_ptr );
dev_priv->ring.tail = cur_read_ptr;
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP) {
/* set RADEON_AGP_BASE here instead of relying on X from user space */
RADEON_WRITE( RADEON_AGP_BASE, (unsigned int)dev->agp->base );
@@ -1146,7 +1146,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
(drm_radeon_sarea_t *)((u8 *)dev_priv->sarea->handle +
init->sarea_priv_offset);
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if ( dev_priv->flags & CHIP_IS_AGP ) {
drm_core_ioremap( dev_priv->cp_ring, dev );
drm_core_ioremap( dev_priv->ring_rptr, dev );
@@ -1195,7 +1195,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->gart_vm_start = dev_priv->fb_location
+ RADEON_READ( RADEON_CONFIG_APER_SIZE );
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP)
dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset
- dev->agp->base
@@ -1224,7 +1224,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK;
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP) {
/* Turn off PCI GART */
radeon_set_pcigart( dev_priv, 0 );
@@ -1265,14 +1265,23 @@ int radeon_do_cleanup_cp( drm_device_t *dev )
if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
#endif
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP) {
if ( dev_priv->cp_ring != NULL )
+ {
drm_core_ioremapfree( dev_priv->cp_ring, dev );
+ dev_priv->cp_ring = NULL;
+ }
if ( dev_priv->ring_rptr != NULL )
+ {
drm_core_ioremapfree( dev_priv->ring_rptr, dev );
+ dev_priv->ring_rptr = NULL;
+ }
if ( dev->agp_buffer_map != NULL )
+ {
drm_core_ioremapfree( dev->agp_buffer_map, dev );
+ dev->agp_buffer_map = NULL;
+ }
} else
#endif
{
@@ -1309,7 +1318,7 @@ static int radeon_do_resume_cp( drm_device_t *dev )
DRM_DEBUG("Starting radeon_do_resume_cp()\n");
-#if __REALLY_HAVE_AGP
+#if __OS_HAS_AGP
if (dev_priv->flags & CHIP_IS_AGP) {
/* Turn off PCI GART */
radeon_set_pcigart( dev_priv, 0 );
diff --git a/shared/radeon_state.c b/shared/radeon_state.c
index 4a7bfd2d..59e07dd8 100644
--- a/shared/radeon_state.c
+++ b/shared/radeon_state.c
@@ -2582,6 +2582,7 @@ static void radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv)
void radeon_driver_register_fns(struct drm_device *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR;
dev->dev_priv_size = sizeof(drm_radeon_buf_priv_t);
dev->fn_tbl.preinit = radeon_preinit;
dev->fn_tbl.postinit = radeon_postinit;
diff --git a/shared/sis.h b/shared/sis.h
index 8afba1a9..5fc92ef6 100644
--- a/shared/sis.h
+++ b/shared/sis.h
@@ -37,9 +37,6 @@
/* General customization:
*/
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 0
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
#define DRIVER_AUTHOR "SIS"
diff --git a/shared/sis_mm.c b/shared/sis_mm.c
index 233843d5..27b904fc 100644
--- a/shared/sis_mm.c
+++ b/shared/sis_mm.c
@@ -411,6 +411,7 @@ int sis_final_context(struct drm_device *dev, int context)
void DRM(driver_register_fns)(drm_device_t *dev)
{
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR;
dev->fn_tbl.context_ctor = sis_init_context;
dev->fn_tbl.context_dtor = sis_final_context;
}
diff --git a/shared/tdfx.h b/shared/tdfx.h
index 6b067db7..f9c60dbb 100644
--- a/shared/tdfx.h
+++ b/shared/tdfx.h
@@ -36,7 +36,6 @@
/* General customization:
*/
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
#define DRIVER_AUTHOR "VA Linux Systems Inc."
diff --git a/shared/via.h b/shared/via.h
index bf8526fd..0f38f36c 100644
--- a/shared/via.h
+++ b/shared/via.h
@@ -28,9 +28,6 @@
#define DRM(x) viadrv_##x
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 0
-#define __HAVE_MTRR 1
#define __HAVE_CTX_BITMAP 1
/* BEAM: Have enabled DMA,DMA_IRQ and VBL_IRQ needed to do this to get standard
diff --git a/shared/via_mm.c b/shared/via_mm.c
index be6184ca..25a91058 100644
--- a/shared/via_mm.c
+++ b/shared/via_mm.c
@@ -348,6 +348,7 @@ EXPORT_SYMBOL(via_fb_free);
void DRM(driver_register_fns)(drm_device_t *dev)
{
- dev->fn_tbl.context_ctor = via_init_context;
- dev->fn_tbl.context_dtor = via_final_context;
+ dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR;
+ dev->fn_tbl.context_ctor = via_init_context;
+ dev->fn_tbl.context_dtor = via_final_context;
}