summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bsd-core/drmP.h2
-rw-r--r--bsd-core/drm_dma.c2
-rw-r--r--bsd-core/drm_os_freebsd.h3
-rw-r--r--bsd-core/drm_os_netbsd.h3
-rw-r--r--bsd/drmP.h2
-rw-r--r--bsd/drm_dma.h2
-rw-r--r--bsd/drm_os_freebsd.h3
-rw-r--r--bsd/drm_os_netbsd.h3
-rw-r--r--linux-core/drmP.h23
-rw-r--r--linux-core/drm_agpsupport.c12
-rw-r--r--linux-core/drm_memory.h8
-rw-r--r--linux-core/drm_memory_debug.h10
-rw-r--r--linux-core/drm_os_linux.h24
-rw-r--r--linux-core/i830_irq.c14
-rw-r--r--linux/drmP.h23
-rw-r--r--linux/drm_agpsupport.h12
-rw-r--r--linux/drm_memory.h8
-rw-r--r--linux/drm_memory_debug.h10
-rw-r--r--linux/drm_os_linux.h24
-rw-r--r--linux/gamma_dma.c8
-rw-r--r--linux/i830_irq.c14
-rw-r--r--shared-core/mga_irq.c4
-rw-r--r--shared-core/r128_irq.c4
-rw-r--r--shared-core/radeon_irq.c5
-rw-r--r--shared/mga_irq.c4
-rw-r--r--shared/r128_irq.c4
-rw-r--r--shared/radeon_irq.c5
27 files changed, 149 insertions, 87 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 94a5710c..8b38d232 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -446,7 +446,7 @@ extern void DRM(reclaim_buffers)(drm_device_t *dev, DRMFILE filp);
#if __HAVE_DMA_IRQ
extern int DRM(irq_install)( drm_device_t *dev, int irq );
extern int DRM(irq_uninstall)( drm_device_t *dev );
-extern void DRM(dma_service)( DRM_IRQ_ARGS );
+extern DRM_IRQ_RET DRM(dma_service)( DRM_IRQ_ARGS );
extern void DRM(driver_irq_preinstall)( drm_device_t *dev );
extern void DRM(driver_irq_postinstall)( drm_device_t *dev );
extern void DRM(driver_irq_uninstall)( drm_device_t *dev );
diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c
index 10c26e37..88ca2e39 100644
--- a/bsd-core/drm_dma.c
+++ b/bsd-core/drm_dma.c
@@ -217,7 +217,7 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
if ( retcode ) {
#elif defined(__NetBSD__)
dev->irqh = pci_intr_establish(&dev->pa.pa_pc, dev->ih, IPL_TTY,
- (int (*)(DRM_IRQ_ARGS))DRM(dma_service), dev);
+ (DRM_IRQ_RET (*)(DRM_IRQ_ARGS))DRM(dma_service), dev);
if ( !dev->irqh ) {
#endif
DRM_LOCK;
diff --git a/bsd-core/drm_os_freebsd.h b/bsd-core/drm_os_freebsd.h
index 52f7aa2a..0ab201ae 100644
--- a/bsd-core/drm_os_freebsd.h
+++ b/bsd-core/drm_os_freebsd.h
@@ -112,6 +112,9 @@
#define DRM_SUSER(p) suser(p)
#define DRM_TASKQUEUE_ARGS void *arg, int pending
#define DRM_IRQ_ARGS void *arg
+#define DRM_IRQ_RET void
+#define DRM_NONE
+#define DRM_HANDLED
#define DRM_DEVICE drm_device_t *dev = kdev->si_drv1
#define DRM_MALLOC(size) malloc( size, DRM(M_DRM), M_NOWAIT )
#define DRM_FREE(pt,size) free( pt, DRM(M_DRM) )
diff --git a/bsd-core/drm_os_netbsd.h b/bsd-core/drm_os_netbsd.h
index 6dfea613..d58f668a 100644
--- a/bsd-core/drm_os_netbsd.h
+++ b/bsd-core/drm_os_netbsd.h
@@ -85,6 +85,9 @@ extern struct cfdriver DRM(cd);
#define DRM_SUSER(p) suser(p->p_ucred, &p->p_acflag)
#define DRM_TASKQUEUE_ARGS void *dev, int pending
#define DRM_IRQ_ARGS void *arg
+#define DRM_IRQ_RET int
+#define DRM_NONE /* FIXME */
+#define DRM_HANDLED /* FIXME */
#define DRM_DEVICE drm_device_t *dev = device_lookup(&DRM(cd), minor(kdev))
/* XXX Not sure if this is the 'right' version.. */
#if __NetBSD_Version__ >= 106140000
diff --git a/bsd/drmP.h b/bsd/drmP.h
index 94a5710c..8b38d232 100644
--- a/bsd/drmP.h
+++ b/bsd/drmP.h
@@ -446,7 +446,7 @@ extern void DRM(reclaim_buffers)(drm_device_t *dev, DRMFILE filp);
#if __HAVE_DMA_IRQ
extern int DRM(irq_install)( drm_device_t *dev, int irq );
extern int DRM(irq_uninstall)( drm_device_t *dev );
-extern void DRM(dma_service)( DRM_IRQ_ARGS );
+extern DRM_IRQ_RET DRM(dma_service)( DRM_IRQ_ARGS );
extern void DRM(driver_irq_preinstall)( drm_device_t *dev );
extern void DRM(driver_irq_postinstall)( drm_device_t *dev );
extern void DRM(driver_irq_uninstall)( drm_device_t *dev );
diff --git a/bsd/drm_dma.h b/bsd/drm_dma.h
index 10c26e37..88ca2e39 100644
--- a/bsd/drm_dma.h
+++ b/bsd/drm_dma.h
@@ -217,7 +217,7 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
if ( retcode ) {
#elif defined(__NetBSD__)
dev->irqh = pci_intr_establish(&dev->pa.pa_pc, dev->ih, IPL_TTY,
- (int (*)(DRM_IRQ_ARGS))DRM(dma_service), dev);
+ (DRM_IRQ_RET (*)(DRM_IRQ_ARGS))DRM(dma_service), dev);
if ( !dev->irqh ) {
#endif
DRM_LOCK;
diff --git a/bsd/drm_os_freebsd.h b/bsd/drm_os_freebsd.h
index 52f7aa2a..0ab201ae 100644
--- a/bsd/drm_os_freebsd.h
+++ b/bsd/drm_os_freebsd.h
@@ -112,6 +112,9 @@
#define DRM_SUSER(p) suser(p)
#define DRM_TASKQUEUE_ARGS void *arg, int pending
#define DRM_IRQ_ARGS void *arg
+#define DRM_IRQ_RET void
+#define DRM_NONE
+#define DRM_HANDLED
#define DRM_DEVICE drm_device_t *dev = kdev->si_drv1
#define DRM_MALLOC(size) malloc( size, DRM(M_DRM), M_NOWAIT )
#define DRM_FREE(pt,size) free( pt, DRM(M_DRM) )
diff --git a/bsd/drm_os_netbsd.h b/bsd/drm_os_netbsd.h
index 6dfea613..d58f668a 100644
--- a/bsd/drm_os_netbsd.h
+++ b/bsd/drm_os_netbsd.h
@@ -85,6 +85,9 @@ extern struct cfdriver DRM(cd);
#define DRM_SUSER(p) suser(p->p_ucred, &p->p_acflag)
#define DRM_TASKQUEUE_ARGS void *dev, int pending
#define DRM_IRQ_ARGS void *arg
+#define DRM_IRQ_RET int
+#define DRM_NONE /* FIXME */
+#define DRM_HANDLED /* FIXME */
#define DRM_DEVICE drm_device_t *dev = device_lookup(&DRM(cd), minor(kdev))
/* XXX Not sure if this is the 'right' version.. */
#if __NetBSD_Version__ >= 106140000
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 2989c64c..7e052a86 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -580,7 +580,7 @@ typedef struct drm_device_dma {
*/
typedef struct drm_agp_mem {
unsigned long handle; /**< handle */
- agp_memory *memory;
+ DRM_AGP_MEM *memory;
unsigned long bound; /**< address */
int pages;
struct drm_agp_mem *prev; /**< previous entry */
@@ -593,7 +593,7 @@ typedef struct drm_agp_mem {
* \sa DRM(agp_init)() and drm_device::agp.
*/
typedef struct drm_agp_head {
- agp_kern_info agp_info; /**< AGP device information */
+ DRM_AGP_KERN agp_info; /**< AGP device information */
drm_agp_mem_t *memory; /**< memory entries */
unsigned long mode; /**< AGP mode */
int enabled; /**< whether the AGP bus as been enabled */
@@ -829,10 +829,10 @@ extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size,
extern void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev);
#if __REALLY_HAVE_AGP
-extern agp_memory *DRM(alloc_agp)(int pages, u32 type);
-extern int DRM(free_agp)(agp_memory *handle, int pages);
-extern int DRM(bind_agp)(agp_memory *handle, unsigned int start);
-extern int DRM(unbind_agp)(agp_memory *handle);
+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);
+extern int DRM(unbind_agp)(DRM_AGP_MEM *handle);
#endif
/* Misc. IOCTL support (drm_ioctl.h) */
@@ -937,8 +937,7 @@ extern int DRM(control)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(irq_install)( drm_device_t *dev, int irq );
extern int DRM(irq_uninstall)( drm_device_t *dev );
-extern void DRM(dma_service)( int irq, void *device,
- struct pt_regs *regs );
+extern DRM_IRQ_RET DRM(dma_service)( DRM_IRQ_ARGS );
extern void DRM(driver_irq_preinstall)( drm_device_t *dev );
extern void DRM(driver_irq_postinstall)( drm_device_t *dev );
extern void DRM(driver_irq_uninstall)( drm_device_t *dev );
@@ -976,10 +975,10 @@ extern int DRM(agp_unbind)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(agp_bind)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-extern agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type);
-extern int DRM(agp_free_memory)(agp_memory *handle);
-extern int DRM(agp_bind_memory)(agp_memory *handle, off_t start);
-extern int DRM(agp_unbind_memory)(agp_memory *handle);
+extern DRM_AGP_MEM *DRM(agp_allocate_memory)(size_t pages, u32 type);
+extern int DRM(agp_free_memory)(DRM_AGP_MEM *handle);
+extern int DRM(agp_bind_memory)(DRM_AGP_MEM *handle, off_t start);
+extern int DRM(agp_unbind_memory)(DRM_AGP_MEM *handle);
#endif
/* Stub support (drm_stub.h) */
diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c
index 6eaadfc2..a8f6197b 100644
--- a/linux-core/drm_agpsupport.c
+++ b/linux-core/drm_agpsupport.c
@@ -63,7 +63,7 @@ int DRM(agp_info)(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- agp_kern_info *kern;
+ DRM_AGP_KERN *kern;
drm_agp_info_t info;
if (!dev->agp || !dev->agp->acquired || !drm_agp->copy_info)
@@ -201,7 +201,7 @@ int DRM(agp_alloc)(struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
drm_agp_buffer_t request;
drm_agp_mem_t *entry;
- agp_memory *memory;
+ DRM_AGP_MEM *memory;
unsigned long pages;
u32 type;
@@ -424,14 +424,14 @@ void DRM(agp_uninit)(void)
}
/** Calls drm_agp->allocate_memory() */
-agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type)
+DRM_AGP_MEM *DRM(agp_allocate_memory)(size_t pages, u32 type)
{
if (!drm_agp->allocate_memory) return NULL;
return drm_agp->allocate_memory(pages, type);
}
/** Calls drm_agp->free_memory() */
-int DRM(agp_free_memory)(agp_memory *handle)
+int DRM(agp_free_memory)(DRM_AGP_MEM *handle)
{
if (!handle || !drm_agp->free_memory) return 0;
drm_agp->free_memory(handle);
@@ -439,14 +439,14 @@ int DRM(agp_free_memory)(agp_memory *handle)
}
/** Calls drm_agp->bind_memory() */
-int DRM(agp_bind_memory)(agp_memory *handle, off_t start)
+int DRM(agp_bind_memory)(DRM_AGP_MEM *handle, off_t start)
{
if (!handle || !drm_agp->bind_memory) return -EINVAL;
return drm_agp->bind_memory(handle, start);
}
/** Calls drm_agp->unbind_memory() */
-int DRM(agp_unbind_memory)(agp_memory *handle)
+int DRM(agp_unbind_memory)(DRM_AGP_MEM *handle)
{
if (!handle || !drm_agp->unbind_memory) return -EINVAL;
return drm_agp->unbind_memory(handle);
diff --git a/linux-core/drm_memory.h b/linux-core/drm_memory.h
index 2a969fcd..870f049d 100644
--- a/linux-core/drm_memory.h
+++ b/linux-core/drm_memory.h
@@ -332,25 +332,25 @@ void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev)
#if __REALLY_HAVE_AGP
/** Wrapper around agp_allocate_memory() */
-agp_memory *DRM(alloc_agp)(int pages, u32 type)
+DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type)
{
return DRM(agp_allocate_memory)(pages, type);
}
/** Wrapper around agp_free_memory() */
-int DRM(free_agp)(agp_memory *handle, int pages)
+int DRM(free_agp)(DRM_AGP_MEM *handle, int pages)
{
return DRM(agp_free_memory)(handle) ? 0 : -EINVAL;
}
/** Wrapper around agp_bind_memory() */
-int DRM(bind_agp)(agp_memory *handle, unsigned int start)
+int DRM(bind_agp)(DRM_AGP_MEM *handle, unsigned int start)
{
return DRM(agp_bind_memory)(handle, start);
}
/** Wrapper around agp_unbind_memory() */
-int DRM(unbind_agp)(agp_memory *handle)
+int DRM(unbind_agp)(DRM_AGP_MEM *handle)
{
return DRM(agp_unbind_memory)(handle);
}
diff --git a/linux-core/drm_memory_debug.h b/linux-core/drm_memory_debug.h
index 5cfff83a..3ef2a05c 100644
--- a/linux-core/drm_memory_debug.h
+++ b/linux-core/drm_memory_debug.h
@@ -343,9 +343,9 @@ void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev)
#if __REALLY_HAVE_AGP
-agp_memory *DRM(alloc_agp)(int pages, u32 type)
+DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type)
{
- agp_memory *handle;
+ DRM_AGP_MEM *handle;
if (!pages) {
DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Allocating 0 pages\n");
@@ -366,7 +366,7 @@ agp_memory *DRM(alloc_agp)(int pages, u32 type)
return NULL;
}
-int DRM(free_agp)(agp_memory *handle, int pages)
+int DRM(free_agp)(DRM_AGP_MEM *handle, int pages)
{
int alloc_count;
int free_count;
@@ -395,7 +395,7 @@ int DRM(free_agp)(agp_memory *handle, int pages)
return retval;
}
-int DRM(bind_agp)(agp_memory *handle, unsigned int start)
+int DRM(bind_agp)(DRM_AGP_MEM *handle, unsigned int start)
{
int retcode = -EINVAL;
@@ -419,7 +419,7 @@ int DRM(bind_agp)(agp_memory *handle, unsigned int start)
return retcode;
}
-int DRM(unbind_agp)(agp_memory *handle)
+int DRM(unbind_agp)(DRM_AGP_MEM *handle)
{
int alloc_count;
int free_count;
diff --git a/linux-core/drm_os_linux.h b/linux-core/drm_os_linux.h
index 66804c5b..94230dc4 100644
--- a/linux-core/drm_os_linux.h
+++ b/linux-core/drm_os_linux.h
@@ -34,8 +34,28 @@
#define DRM_DEVICE drm_file_t *priv = filp->private_data; \
drm_device_t *dev = priv->dev
-/** IRQ handler arguments */
-#define DRM_IRQ_ARGS int irq, void *arg, struct pt_regs *regs
+/** IRQ handler arguments and return type and values */
+#define DRM_IRQ_ARGS int irq, void *arg, struct pt_regs *regs
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)
+#define DRM_IRQ_RET void
+#define DRM_IRQ_NONE
+#define DRM_IRQ_HANDLED
+#else
+#define DRM_IRQ_RET irqreturn_t
+#define DRM_IRQ_NONE IRQ_NONE
+#define DRM_IRQ_HANDLED IRQ_HANDLED
+#endif
+
+/** AGP types */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,70)
+#define DRM_AGP_MEM agp_memory
+#define DRM_AGP_KERN agp_kern_info
+#else
+#define DRM_AGP_MEM struct agp_memory
+#define DRM_AGP_KERN struct agp_kern_info
+#endif
+
/** Task queue handler arguments */
#define DRM_TASKQUEUE_ARGS void *arg
diff --git a/linux-core/i830_irq.c b/linux-core/i830_irq.c
index 1fcd9f0a..301afc8a 100644
--- a/linux-core/i830_irq.c
+++ b/linux-core/i830_irq.c
@@ -36,7 +36,7 @@
#include <linux/delay.h>
-void DRM(dma_service)(int irq, void *device, struct pt_regs *regs)
+DRM_IRQ_RET DRM(dma_service)( DRM_IRQ_ARGS )
{
drm_device_t *dev = (drm_device_t *)device;
drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private;
@@ -45,15 +45,15 @@ void DRM(dma_service)(int irq, void *device, struct pt_regs *regs)
temp = I830_READ16(I830REG_INT_IDENTITY_R);
DRM_DEBUG("%x\n", temp);
- if (temp == 0)
- return;
+ if ( !( temp & 2 ) )
+ return DRM_IRQ_NONE;
I830_WRITE16(I830REG_INT_IDENTITY_R, temp);
- if (temp & 2) {
- atomic_inc(&dev_priv->irq_received);
- wake_up_interruptible(&dev_priv->irq_queue);
- }
+ atomic_inc(&dev_priv->irq_received);
+ wake_up_interruptible(&dev_priv->irq_queue);
+
+ return DRM_IRQ_HANDLED;
}
diff --git a/linux/drmP.h b/linux/drmP.h
index 2989c64c..7e052a86 100644
--- a/linux/drmP.h
+++ b/linux/drmP.h
@@ -580,7 +580,7 @@ typedef struct drm_device_dma {
*/
typedef struct drm_agp_mem {
unsigned long handle; /**< handle */
- agp_memory *memory;
+ DRM_AGP_MEM *memory;
unsigned long bound; /**< address */
int pages;
struct drm_agp_mem *prev; /**< previous entry */
@@ -593,7 +593,7 @@ typedef struct drm_agp_mem {
* \sa DRM(agp_init)() and drm_device::agp.
*/
typedef struct drm_agp_head {
- agp_kern_info agp_info; /**< AGP device information */
+ DRM_AGP_KERN agp_info; /**< AGP device information */
drm_agp_mem_t *memory; /**< memory entries */
unsigned long mode; /**< AGP mode */
int enabled; /**< whether the AGP bus as been enabled */
@@ -829,10 +829,10 @@ extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size,
extern void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev);
#if __REALLY_HAVE_AGP
-extern agp_memory *DRM(alloc_agp)(int pages, u32 type);
-extern int DRM(free_agp)(agp_memory *handle, int pages);
-extern int DRM(bind_agp)(agp_memory *handle, unsigned int start);
-extern int DRM(unbind_agp)(agp_memory *handle);
+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);
+extern int DRM(unbind_agp)(DRM_AGP_MEM *handle);
#endif
/* Misc. IOCTL support (drm_ioctl.h) */
@@ -937,8 +937,7 @@ extern int DRM(control)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(irq_install)( drm_device_t *dev, int irq );
extern int DRM(irq_uninstall)( drm_device_t *dev );
-extern void DRM(dma_service)( int irq, void *device,
- struct pt_regs *regs );
+extern DRM_IRQ_RET DRM(dma_service)( DRM_IRQ_ARGS );
extern void DRM(driver_irq_preinstall)( drm_device_t *dev );
extern void DRM(driver_irq_postinstall)( drm_device_t *dev );
extern void DRM(driver_irq_uninstall)( drm_device_t *dev );
@@ -976,10 +975,10 @@ extern int DRM(agp_unbind)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(agp_bind)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-extern agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type);
-extern int DRM(agp_free_memory)(agp_memory *handle);
-extern int DRM(agp_bind_memory)(agp_memory *handle, off_t start);
-extern int DRM(agp_unbind_memory)(agp_memory *handle);
+extern DRM_AGP_MEM *DRM(agp_allocate_memory)(size_t pages, u32 type);
+extern int DRM(agp_free_memory)(DRM_AGP_MEM *handle);
+extern int DRM(agp_bind_memory)(DRM_AGP_MEM *handle, off_t start);
+extern int DRM(agp_unbind_memory)(DRM_AGP_MEM *handle);
#endif
/* Stub support (drm_stub.h) */
diff --git a/linux/drm_agpsupport.h b/linux/drm_agpsupport.h
index 6eaadfc2..a8f6197b 100644
--- a/linux/drm_agpsupport.h
+++ b/linux/drm_agpsupport.h
@@ -63,7 +63,7 @@ int DRM(agp_info)(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- agp_kern_info *kern;
+ DRM_AGP_KERN *kern;
drm_agp_info_t info;
if (!dev->agp || !dev->agp->acquired || !drm_agp->copy_info)
@@ -201,7 +201,7 @@ int DRM(agp_alloc)(struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
drm_agp_buffer_t request;
drm_agp_mem_t *entry;
- agp_memory *memory;
+ DRM_AGP_MEM *memory;
unsigned long pages;
u32 type;
@@ -424,14 +424,14 @@ void DRM(agp_uninit)(void)
}
/** Calls drm_agp->allocate_memory() */
-agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type)
+DRM_AGP_MEM *DRM(agp_allocate_memory)(size_t pages, u32 type)
{
if (!drm_agp->allocate_memory) return NULL;
return drm_agp->allocate_memory(pages, type);
}
/** Calls drm_agp->free_memory() */
-int DRM(agp_free_memory)(agp_memory *handle)
+int DRM(agp_free_memory)(DRM_AGP_MEM *handle)
{
if (!handle || !drm_agp->free_memory) return 0;
drm_agp->free_memory(handle);
@@ -439,14 +439,14 @@ int DRM(agp_free_memory)(agp_memory *handle)
}
/** Calls drm_agp->bind_memory() */
-int DRM(agp_bind_memory)(agp_memory *handle, off_t start)
+int DRM(agp_bind_memory)(DRM_AGP_MEM *handle, off_t start)
{
if (!handle || !drm_agp->bind_memory) return -EINVAL;
return drm_agp->bind_memory(handle, start);
}
/** Calls drm_agp->unbind_memory() */
-int DRM(agp_unbind_memory)(agp_memory *handle)
+int DRM(agp_unbind_memory)(DRM_AGP_MEM *handle)
{
if (!handle || !drm_agp->unbind_memory) return -EINVAL;
return drm_agp->unbind_memory(handle);
diff --git a/linux/drm_memory.h b/linux/drm_memory.h
index 2a969fcd..870f049d 100644
--- a/linux/drm_memory.h
+++ b/linux/drm_memory.h
@@ -332,25 +332,25 @@ void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev)
#if __REALLY_HAVE_AGP
/** Wrapper around agp_allocate_memory() */
-agp_memory *DRM(alloc_agp)(int pages, u32 type)
+DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type)
{
return DRM(agp_allocate_memory)(pages, type);
}
/** Wrapper around agp_free_memory() */
-int DRM(free_agp)(agp_memory *handle, int pages)
+int DRM(free_agp)(DRM_AGP_MEM *handle, int pages)
{
return DRM(agp_free_memory)(handle) ? 0 : -EINVAL;
}
/** Wrapper around agp_bind_memory() */
-int DRM(bind_agp)(agp_memory *handle, unsigned int start)
+int DRM(bind_agp)(DRM_AGP_MEM *handle, unsigned int start)
{
return DRM(agp_bind_memory)(handle, start);
}
/** Wrapper around agp_unbind_memory() */
-int DRM(unbind_agp)(agp_memory *handle)
+int DRM(unbind_agp)(DRM_AGP_MEM *handle)
{
return DRM(agp_unbind_memory)(handle);
}
diff --git a/linux/drm_memory_debug.h b/linux/drm_memory_debug.h
index 5cfff83a..3ef2a05c 100644
--- a/linux/drm_memory_debug.h
+++ b/linux/drm_memory_debug.h
@@ -343,9 +343,9 @@ void DRM(ioremapfree)(void *pt, unsigned long size, drm_device_t *dev)
#if __REALLY_HAVE_AGP
-agp_memory *DRM(alloc_agp)(int pages, u32 type)
+DRM_AGP_MEM *DRM(alloc_agp)(int pages, u32 type)
{
- agp_memory *handle;
+ DRM_AGP_MEM *handle;
if (!pages) {
DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Allocating 0 pages\n");
@@ -366,7 +366,7 @@ agp_memory *DRM(alloc_agp)(int pages, u32 type)
return NULL;
}
-int DRM(free_agp)(agp_memory *handle, int pages)
+int DRM(free_agp)(DRM_AGP_MEM *handle, int pages)
{
int alloc_count;
int free_count;
@@ -395,7 +395,7 @@ int DRM(free_agp)(agp_memory *handle, int pages)
return retval;
}
-int DRM(bind_agp)(agp_memory *handle, unsigned int start)
+int DRM(bind_agp)(DRM_AGP_MEM *handle, unsigned int start)
{
int retcode = -EINVAL;
@@ -419,7 +419,7 @@ int DRM(bind_agp)(agp_memory *handle, unsigned int start)
return retcode;
}
-int DRM(unbind_agp)(agp_memory *handle)
+int DRM(unbind_agp)(DRM_AGP_MEM *handle)
{
int alloc_count;
int free_count;
diff --git a/linux/drm_os_linux.h b/linux/drm_os_linux.h
index 66804c5b..94230dc4 100644
--- a/linux/drm_os_linux.h
+++ b/linux/drm_os_linux.h
@@ -34,8 +34,28 @@
#define DRM_DEVICE drm_file_t *priv = filp->private_data; \
drm_device_t *dev = priv->dev
-/** IRQ handler arguments */
-#define DRM_IRQ_ARGS int irq, void *arg, struct pt_regs *regs
+/** IRQ handler arguments and return type and values */
+#define DRM_IRQ_ARGS int irq, void *arg, struct pt_regs *regs
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)
+#define DRM_IRQ_RET void
+#define DRM_IRQ_NONE
+#define DRM_IRQ_HANDLED
+#else
+#define DRM_IRQ_RET irqreturn_t
+#define DRM_IRQ_NONE IRQ_NONE
+#define DRM_IRQ_HANDLED IRQ_HANDLED
+#endif
+
+/** AGP types */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,70)
+#define DRM_AGP_MEM agp_memory
+#define DRM_AGP_KERN agp_kern_info
+#else
+#define DRM_AGP_MEM struct agp_memory
+#define DRM_AGP_KERN struct agp_kern_info
+#endif
+
/** Task queue handler arguments */
#define DRM_TASKQUEUE_ARGS void *arg
diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c
index 993ca36b..85a9c084 100644
--- a/linux/gamma_dma.c
+++ b/linux/gamma_dma.c
@@ -105,13 +105,14 @@ static inline int gamma_dma_is_ready(drm_device_t *dev)
return(!GAMMA_READ(GAMMA_DMACOUNT));
}
-void gamma_dma_service(int irq, void *device, struct pt_regs *regs)
+DRM_IRQ_RET gamma_dma_service( DRM_IRQ_ARGS )
{
- drm_device_t *dev = (drm_device_t *)device;
+ drm_device_t *dev = (drm_device_t *)arg;
drm_device_dma_t *dma = dev->dma;
drm_gamma_private_t *dev_priv =
(drm_gamma_private_t *)dev->dev_private;
+ /* FIXME: should check whether we're actually interested in the interrupt? */
atomic_inc(&dev->counts[6]); /* _DRM_STAT_IRQ */
while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3);
@@ -120,7 +121,7 @@ void gamma_dma_service(int irq, void *device, struct pt_regs *regs)
GAMMA_WRITE(GAMMA_GINTFLAGS, 0x2001);
if (gamma_dma_is_ready(dev)) {
/* Free previous buffer */
- if (test_and_set_bit(0, &dev->dma_flag)) return;
+ if (test_and_set_bit(0, &dev->dma_flag)) return DRM_IRQ_HANDLED;
if (dma->this_buffer) {
gamma_free_buffer(dev, dma->this_buffer);
dma->this_buffer = NULL;
@@ -135,6 +136,7 @@ void gamma_dma_service(int irq, void *device, struct pt_regs *regs)
schedule_work(&dev->work);
#endif
}
+ return DRM_IRQ_HANDLED;
}
/* Only called by gamma_dma_schedule. */
diff --git a/linux/i830_irq.c b/linux/i830_irq.c
index 1fcd9f0a..301afc8a 100644
--- a/linux/i830_irq.c
+++ b/linux/i830_irq.c
@@ -36,7 +36,7 @@
#include <linux/delay.h>
-void DRM(dma_service)(int irq, void *device, struct pt_regs *regs)
+DRM_IRQ_RET DRM(dma_service)( DRM_IRQ_ARGS )
{
drm_device_t *dev = (drm_device_t *)device;
drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private;
@@ -45,15 +45,15 @@ void DRM(dma_service)(int irq, void *device, struct pt_regs *regs)
temp = I830_READ16(I830REG_INT_IDENTITY_R);
DRM_DEBUG("%x\n", temp);
- if (temp == 0)
- return;
+ if ( !( temp & 2 ) )
+ return DRM_IRQ_NONE;
I830_WRITE16(I830REG_INT_IDENTITY_R, temp);
- if (temp & 2) {
- atomic_inc(&dev_priv->irq_received);
- wake_up_interruptible(&dev_priv->irq_queue);
- }
+ atomic_inc(&dev_priv->irq_received);
+ wake_up_interruptible(&dev_priv->irq_queue);
+
+ return DRM_IRQ_HANDLED;
}
diff --git a/shared-core/mga_irq.c b/shared-core/mga_irq.c
index a2a4db53..c53a4bc2 100644
--- a/shared-core/mga_irq.c
+++ b/shared-core/mga_irq.c
@@ -36,7 +36,7 @@
#include "mga_drm.h"
#include "mga_drv.h"
-void mga_dma_service( DRM_IRQ_ARGS )
+DRM_IRQ_RET mga_dma_service( DRM_IRQ_ARGS )
{
drm_device_t *dev = (drm_device_t *) arg;
drm_mga_private_t *dev_priv =
@@ -51,7 +51,9 @@ void mga_dma_service( DRM_IRQ_ARGS )
atomic_inc(&dev->vbl_received);
DRM_WAKEUP(&dev->vbl_queue);
DRM(vbl_send_signals)( dev );
+ return DRM_IRQ_HANDLED;
}
+ return DRM_IRQ_NONE;
}
int mga_vblank_wait(drm_device_t *dev, unsigned int *sequence)
diff --git a/shared-core/r128_irq.c b/shared-core/r128_irq.c
index f3f84d8c..5fe5b46b 100644
--- a/shared-core/r128_irq.c
+++ b/shared-core/r128_irq.c
@@ -36,7 +36,7 @@
#include "r128_drm.h"
#include "r128_drv.h"
-void r128_dma_service( DRM_IRQ_ARGS )
+DRM_IRQ_RET r128_dma_service( DRM_IRQ_ARGS )
{
drm_device_t *dev = (drm_device_t *) arg;
drm_r128_private_t *dev_priv =
@@ -51,7 +51,9 @@ void r128_dma_service( DRM_IRQ_ARGS )
atomic_inc(&dev->vbl_received);
DRM_WAKEUP(&dev->vbl_queue);
DRM(vbl_send_signals)( dev );
+ return DRM_IRQ_HANDLED;
}
+ return DRM_IRQ_NONE;
}
int DRM(vblank_wait)(drm_device_t *dev, unsigned int *sequence)
diff --git a/shared-core/radeon_irq.c b/shared-core/radeon_irq.c
index c6bd90e5..a42c7cf5 100644
--- a/shared-core/radeon_irq.c
+++ b/shared-core/radeon_irq.c
@@ -54,7 +54,7 @@
* tied to dma at all, this is just a hangover from dri prehistory.
*/
-void DRM(dma_service)( DRM_IRQ_ARGS )
+DRM_IRQ_RET DRM(dma_service)( DRM_IRQ_ARGS )
{
drm_device_t *dev = (drm_device_t *) arg;
drm_radeon_private_t *dev_priv =
@@ -67,7 +67,7 @@ void DRM(dma_service)( DRM_IRQ_ARGS )
stat = RADEON_READ(RADEON_GEN_INT_STATUS)
& (RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT);
if (!stat)
- return;
+ return DRM_IRQ_NONE;
/* SW interrupt */
if (stat & RADEON_SW_INT_TEST) {
@@ -83,6 +83,7 @@ void DRM(dma_service)( DRM_IRQ_ARGS )
/* Acknowledge interrupts we handle */
RADEON_WRITE(RADEON_GEN_INT_STATUS, stat);
+ return DRM_IRQ_HANDLED;
}
static __inline__ void radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv)
diff --git a/shared/mga_irq.c b/shared/mga_irq.c
index a2a4db53..c53a4bc2 100644
--- a/shared/mga_irq.c
+++ b/shared/mga_irq.c
@@ -36,7 +36,7 @@
#include "mga_drm.h"
#include "mga_drv.h"
-void mga_dma_service( DRM_IRQ_ARGS )
+DRM_IRQ_RET mga_dma_service( DRM_IRQ_ARGS )
{
drm_device_t *dev = (drm_device_t *) arg;
drm_mga_private_t *dev_priv =
@@ -51,7 +51,9 @@ void mga_dma_service( DRM_IRQ_ARGS )
atomic_inc(&dev->vbl_received);
DRM_WAKEUP(&dev->vbl_queue);
DRM(vbl_send_signals)( dev );
+ return DRM_IRQ_HANDLED;
}
+ return DRM_IRQ_NONE;
}
int mga_vblank_wait(drm_device_t *dev, unsigned int *sequence)
diff --git a/shared/r128_irq.c b/shared/r128_irq.c
index f3f84d8c..5fe5b46b 100644
--- a/shared/r128_irq.c
+++ b/shared/r128_irq.c
@@ -36,7 +36,7 @@
#include "r128_drm.h"
#include "r128_drv.h"
-void r128_dma_service( DRM_IRQ_ARGS )
+DRM_IRQ_RET r128_dma_service( DRM_IRQ_ARGS )
{
drm_device_t *dev = (drm_device_t *) arg;
drm_r128_private_t *dev_priv =
@@ -51,7 +51,9 @@ void r128_dma_service( DRM_IRQ_ARGS )
atomic_inc(&dev->vbl_received);
DRM_WAKEUP(&dev->vbl_queue);
DRM(vbl_send_signals)( dev );
+ return DRM_IRQ_HANDLED;
}
+ return DRM_IRQ_NONE;
}
int DRM(vblank_wait)(drm_device_t *dev, unsigned int *sequence)
diff --git a/shared/radeon_irq.c b/shared/radeon_irq.c
index c6bd90e5..a42c7cf5 100644
--- a/shared/radeon_irq.c
+++ b/shared/radeon_irq.c
@@ -54,7 +54,7 @@
* tied to dma at all, this is just a hangover from dri prehistory.
*/
-void DRM(dma_service)( DRM_IRQ_ARGS )
+DRM_IRQ_RET DRM(dma_service)( DRM_IRQ_ARGS )
{
drm_device_t *dev = (drm_device_t *) arg;
drm_radeon_private_t *dev_priv =
@@ -67,7 +67,7 @@ void DRM(dma_service)( DRM_IRQ_ARGS )
stat = RADEON_READ(RADEON_GEN_INT_STATUS)
& (RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT);
if (!stat)
- return;
+ return DRM_IRQ_NONE;
/* SW interrupt */
if (stat & RADEON_SW_INT_TEST) {
@@ -83,6 +83,7 @@ void DRM(dma_service)( DRM_IRQ_ARGS )
/* Acknowledge interrupts we handle */
RADEON_WRITE(RADEON_GEN_INT_STATUS, stat);
+ return DRM_IRQ_HANDLED;
}
static __inline__ void radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv)