diff options
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drmP.h | 23 | ||||
-rw-r--r-- | linux/drm_agpsupport.h | 12 | ||||
-rw-r--r-- | linux/drm_memory.h | 8 | ||||
-rw-r--r-- | linux/drm_memory_debug.h | 10 | ||||
-rw-r--r-- | linux/drm_os_linux.h | 24 | ||||
-rw-r--r-- | linux/gamma_dma.c | 8 | ||||
-rw-r--r-- | linux/i830_irq.c | 14 |
7 files changed, 60 insertions, 39 deletions
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; } |