#ifndef _DRM_P_H_
#define _DRM_P_H_
#ifdef __KERNEL__
#ifdef __alpha__
#include <asm/current.h>
#endif
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/miscdevice.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/file.h>
#include <linux/pci.h>
#include <linux/version.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#if defined(__alpha__) || defined(__powerpc__)
#include <asm/pgtable.h>
#endif
#include <asm/io.h>
#include <asm/mman.h>
#include <asm/uaccess.h>
#ifdef CONFIG_MTRR
#include <asm/mtrr.h>
#endif
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
#include <linux/types.h>
#include <linux/agp_backend.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
#define HAS_WORKQUEUE 0
#else
#define HAS_WORKQUEUE 1
#endif
#if !HAS_WORKQUEUE
#include <linux/tqueue.h>
#else
#include <linux/workqueue.h>
#endif
#include <linux/poll.h>
#include <asm/pgalloc.h>
#include "drm.h"
#include "drm_os_linux.h"
#ifndef __HAVE_AGP
#define __HAVE_AGP 0
#endif
#ifndef __HAVE_MTRR
#define __HAVE_MTRR 0
#endif
#ifndef __HAVE_CTX_BITMAP
#define __HAVE_CTX_BITMAP 0
#endif
#ifndef __HAVE_DMA
#define __HAVE_DMA 0
#endif
#ifndef __HAVE_IRQ
#define __HAVE_IRQ 0
#endif
#ifndef __HAVE_DMA_WAITLIST
#define __HAVE_DMA_WAITLIST 0
#endif
#ifndef __HAVE_DMA_FREELIST
#define __HAVE_DMA_FREELIST 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 DRM_DEBUG_CODE 2
#define DRM_HASH_SIZE 16
#define DRM_KERNEL_CONTEXT 0
#define DRM_RESERVED_CONTEXTS 1
#define DRM_LOOPING_LIMIT 5000000
#define DRM_BSZ 1024
#define DRM_TIME_SLICE (HZ/20)
#define DRM_LOCK_SLICE 1
#define DRM_FLAG_DEBUG 0x01
#define DRM_MEM_DMA 0
#define DRM_MEM_SAREA 1
#define DRM_MEM_DRIVER 2
#define DRM_MEM_MAGIC 3
#define DRM_MEM_IOCTLS 4
#define DRM_MEM_MAPS 5
#define DRM_MEM_VMAS 6
#define DRM_MEM_BUFS 7
#define DRM_MEM_SEGS 8
#define DRM_MEM_PAGES 9
#define DRM_MEM_FILES 10
#define DRM_MEM_QUEUES 11
#define DRM_MEM_CMDS 12
#define DRM_MEM_MAPPINGS 13
#define DRM_MEM_BUFLISTS 14
#define DRM_MEM_AGPLISTS 15
#define DRM_MEM_TOTALAGP 16
#define DRM_MEM_BOUNDAGP 17
#define DRM_MEM_CTXBITMAP 18
#define DRM_MEM_STUB 19
#define DRM_MEM_SGLISTS 20
#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
#ifndef minor
#define minor(x) MINOR((x))
#endif
#ifndef MODULE_LICENSE
#define MODULE_LICENSE(x)
#endif
#ifndef preempt_disable
#define preempt_disable()
#define preempt_enable()
#endif
#ifndef pte_offset_map
#define pte_offset_map pte_offset
#define pte_unmap(pte)
#endif
#ifndef list_for_each_safe
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
#endif
#ifndef list_for_each_entry
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
prefetch(pos->member.next); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member), \
prefetch(pos->member.next))
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
static inline struct page * vmalloc_to_page(void * vmalloc_addr)
{
unsigned long addr = (unsigned long) vmalloc_addr;
struct page *page = NULL;
pgd_t *pgd = pgd_offset_k(addr);
pmd_t *pmd;
pte_t *ptep, pte;
if (!pgd_none(*pgd)) {
pmd = pmd_offset(pgd, addr);
if (!pmd_none(*pmd)) {
preempt_disable();
ptep = pte_offset_map(pmd, addr);
pte = *ptep;
if (pte_present(pte))
page = pte_page(pte);
pte_unmap(ptep);
preempt_enable();
}
}
return page;
}
#endif
#ifndef REMAP_PAGE_RANGE_5_ARGS
#define DRM_RPR_ARG(vma)
#else
#define DRM_RPR_ARG(vma) vma,
#endif
#define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT)
#define DRM_ERROR(fmt, arg...) \
printk(KERN_ERR "[" DRM_NAME ":%s] *ERROR* " fmt , __FUNCTION__ , ##arg)
#define DRM_MEM_ERROR(area, fmt, arg...) \
printk(KERN_ERR "[" DRM_NAME ":%s:%s] *ERROR* " fmt , __FUNCTION__, \
DRM(mem_stats)[area].name , ##arg)
#define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg)
#if DRM_DEBUG_CODE
#define DRM_DEBUG(fmt, arg...) \
do { \
if ( DRM(flags) & DRM_FLAG_DEBUG ) \
printk(KERN_DEBUG \
"[" DRM_NAME ":%s] " fmt , \
__FUNCTION__ , ##arg); \
} while (0)
#else
#define DRM_DEBUG(fmt, arg...) do { } while (0)
#endif
#define DRM_PROC_LIMIT (PAGE_SIZE-80)
#define DRM_PROC_PRINT(fmt, arg...) \
len += sprintf(&buf[len], fmt , ##arg); \
if (len > DRM_PROC_LIMIT) { *eof = 1; return len - offset; }
#define DRM_PROC_PRINT_RET(ret, fmt, arg...) \
len += sprintf(&buf[len], fmt , ##arg); \
if (len > DRM_PROC_LIMIT) { ret; *eof = 1; return len - offset; }
#define DRM_IOREMAP(map, dev) \
(map)->handle = DRM(ioremap)( (map)->offset, (map)->size, (dev) )
#define DRM_IOREMAP_NOCACHE(map, dev) \
(map)->handle = DRM(ioremap_nocache)((map)->offset, (map)->size, (dev))
#define DRM_IOREMAPFREE(map, dev) \
do { \
if ( (map)->handle && (map)->size ) \
DRM(ioremapfree)( (map)->handle, (map)->size, (dev) ); \
} while (0)
#ifndef VMAP_4_ARGS
#define DRM_IOREMAPAGP(map, dev) \
(map)->handle = DRM(ioremap_agp)( (map)->offset, (map)->size, (dev) )
#define DRM_IOREMAPAGPFREE(map) \
do { \
if ( (map)->handle && (map)->size ) \
DRM(ioremap_agp_free)( (map)->handle, (map)->size ); \
} while (0)
#endif
#define DRM_FIND_MAP(_map, _o) \
do { \
struct list_head *_list; \
list_for_each( _list, &dev->maplist->head ) { \
drm_map_list_t *_entry = list_entry( _list, drm_map_list_t, head ); \
if ( _entry->map && \
_entry->map->offset == (_o) ) { \
(_map) = _entry->map; \
break; \
} \
} \
} while(0)
#define DRM_DROP_MAP(_map)
#define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#define DRM_MIN(a,b) ((a)<(b)?(a):(b))
#define DRM_MAX(a,b) ((a)>(b)?(a):(b))
#define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1))
#define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x))
#define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist)
#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
#define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \
(_map) = (_dev)->context_sareas[_ctx]; \
} while(0)
#define LOCK_TEST_WITH_RETURN( dev, filp ) \
do { \
if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \
dev->lock.filp != filp ) { \
DRM_ERROR( "%s called without lock held\n", \
__FUNCTION__ ); \
return -EINVAL; \
} \
} while (0)
typedef int drm_ioctl_t( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
typedef struct drm_pci_id_list
{
int vendor;
int device;
long driver_private;
char *name;
} drm_pci_id_list_t;
typedef struct drm_ioctl_desc {
drm_ioctl_t *func;
int auth_needed;
int root_only;
} drm_ioctl_desc_t;
typedef struct drm_devstate {
pid_t owner;
} drm_devstate_t;
typedef struct drm_magic_entry {
drm_magic_t magic;
struct drm_file *priv;
struct drm_magic_entry *next;
} drm_magic_entry_t;
typedef struct drm_magic_head {
struct drm_magic_entry *head;
struct drm_magic_entry *tail;
} drm_magic_head_t;
typedef struct drm_vma_entry {
struct vm_area_struct *vma;
struct drm_vma_entry *next;
pid_t pid;
} drm_vma_entry_t;
typedef struct drm_buf {
int idx;
int total;
int order;
int used;
unsigned long offset;
void *address;
unsigned long bus_address;
struct drm_buf *next;
__volatile__ int waiting;
__volatile__ int pending;
wait_queue_head_t dma_wait;
struct file *filp;
int context;
int while_locked;
enum {
DRM_LIST_NONE = 0,
DRM_LIST_FREE = 1,
DRM_LIST_WAIT = 2,
DRM_LIST_PEND = 3,
DRM_LIST_PRIO = 4,
DRM_LIST_RECLAIM = 5
} list;
int dev_priv_size;
void *dev_private;
} drm_buf_t;
typedef struct drm_waitlist {
int count;
drm_buf_t **bufs;
drm_buf_t **rp;
drm_buf_t **wp;
drm_buf_t **end;
spinlock_t read_lock;
spinlock_t write_lock;
} drm_waitlist_t;
typedef struct drm_freelist {
int initialized;
atomic_t count;
drm_buf_t *next;
wait_queue_head_t waiting;
int low_mark;
int high_mark;
atomic_t wfh;
spinlock_t lock;
} drm_freelist_t;
typedef struct drm_buf_entry {
int buf_size;
int buf_count;
drm_buf_t *buflist;
int seg_count;
int page_order;
unsigned long *seglist;
drm_freelist_t freelist;
} drm_buf_entry_t;
typedef struct drm_hw_lock {
__volatile__ unsigned int lock;
char padding[60];
} drm_hw_lock_t;
typedef struct drm_file {
int authenticated;
int minor;
pid_t pid;
uid_t uid;
drm_magic_t magic;
unsigned long ioctl_count;
struct drm_file *next;
struct drm_file *prev;
struct drm_device *dev;
int remove_auth_on_close;
unsigned long lock_count;
#ifdef DRIVER_FILE_FIELDS
DRIVER_FILE_FIELDS;
#endif
} drm_file_t;
typedef struct drm_queue {
atomic_t use_count;
atomic_t finalization;
atomic_t block_count;
atomic_t block_read;
wait_queue_head_t read_queue;
atomic_t block_write;
wait_queue_head_t write_queue;
#if 1
atomic_t total_queued;
atomic_t total_flushed;
atomic_t total_locks;
#endif
drm_ctx_flags_t flags;
drm_waitlist_t waitlist;
wait_queue_head_t flush_queue;
} drm_queue_t;
typedef struct drm_lock_data {
drm_hw_lock_t *hw_lock;
struct file *filp;
wait_queue_head_t lock_queue;
unsigned long lock_time;
} drm_lock_data_t;
typedef struct drm_device_dma {
drm_buf_entry_t bufs[DRM_MAX_ORDER+1];
int buf_count;
drm_buf_t **buflist;
int seg_count;
int page_count;
unsigned long *pagelist;
unsigned long byte_count;
enum {
_DRM_DMA_USE_AGP = 0x01,
_DRM_DMA_USE_SG = 0x02
} flags;
drm_buf_t *this_buffer;
drm_buf_t *next_buffer;
drm_queue_t *next_queue;
wait_queue_head_t waiting;
} drm_device_dma_t;
#if __REALLY_HAVE_AGP
typedef struct drm_agp_mem {
unsigned long handle;
DRM_AGP_MEM *memory;
unsigned long bound;
int pages;
struct drm_agp_mem *prev;
struct drm_agp_mem *next;
} drm_agp_mem_t;
typedef struct drm_agp_head {
DRM_AGP_KERN agp_info;
drm_agp_mem_t *memory;
unsigned long mode;
int enabled;
int acquired;
unsigned long base;
int agp_mtrr;
int cant_use_aperture;
unsigned long page_mask;
} drm_agp_head_t;
#endif
typedef struct drm_sg_mem {
unsigned long handle;
void *virtual;
int pages;
struct page **pagelist;
dma_addr_t *busaddr;
} drm_sg_mem_t;
typedef struct drm_sigdata {
int context;
drm_hw_lock_t *lock;
} drm_sigdata_t;
typedef struct drm_map_list {
struct list_head head;
drm_map_t *map;
} drm_map_list_t;
typedef drm_map_t drm_local_map_t;
#if __HAVE_VBL_IRQ
typedef struct drm_vbl_sig {
struct list_head head;
unsigned int sequence;
struct siginfo info;
struct task_struct *task;
} drm_vbl_sig_t;
#endif
typedef struct drm_device {
const char *name;
char *unique;
int unique_len;
dev_t device;
char *devname;
int minor;
int if_version;
int blocked;
struct proc_dir_entry *root;
spinlock_t count_lock;
struct semaphore struct_sem;
int open_count;
atomic_t ioctl_count;
atomic_t vma_count;
int buf_use;
atomic_t buf_alloc;
unsigned long counters;
drm_stat_type_t types[15];
atomic_t counts[15];
drm_file_t *file_first;
drm_file_t *file_last;
drm_magic_head_t magiclist[DRM_HASH_SIZE];
drm_map_list_t *maplist;
int map_count;
drm_map_t **context_sareas;
int max_context;
drm_vma_entry_t *vmalist;
drm_lock_data_t lock;
int queue_count;
int queue_reserved;
int queue_slots;
drm_queue_t **queuelist;
drm_device_dma_t *dma;
int irq;
int irq_enabled;
__volatile__ long context_flag;
__volatile__ long interrupt_flag;
__volatile__ long dma_flag;
struct timer_list timer;
wait_queue_head_t context_wait;
int last_checked;
int last_context;
unsigned long last_switch;
#if !HAS_WORKQUEUE
struct tq_struct tq;
#else
struct work_struct work;
#endif
#if __HAVE_VBL_IRQ
wait_queue_head_t vbl_queue;
atomic_t vbl_received;
spinlock_t vbl_lock;
drm_vbl_sig_t vbl_sigs;
unsigned int vbl_pending;
#endif
cycles_t ctx_start;
cycles_t lck_start;
char buf[DRM_BSZ];
char *buf_rp;
char *buf_wp;
char *buf_end;
struct fasync_struct *buf_async;
wait_queue_head_t buf_readers;
wait_queue_head_t buf_writers;
#if __REALLY_HAVE_AGP
drm_agp_head_t *agp;
#endif
struct pci_dev *pdev;
int pci_domain;
int pci_bus;
int pci_slot;
int pci_func;
#ifdef __alpha__
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3)
struct pci_controler *hose;
#else
struct pci_controller *hose;
#endif
#endif
drm_sg_mem_t *sg;
unsigned long *ctx_bitmap;
void *dev_private;
drm_sigdata_t sigdata;
sigset_t sigmask;
} drm_device_t;
extern int DRM(flags);
extern void DRM(parse_options)( char *s );
extern int DRM(cpu_valid)( void );
extern int DRM(version)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(open)(struct inode *inode, struct file *filp);
extern int DRM(release)(struct inode *inode, struct file *filp);
extern int DRM(ioctl)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(lock)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(unlock)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(open_helper)(struct inode *inode, struct file *filp,
drm_device_t *dev);
extern int DRM(flush)(struct file *filp);
extern int DRM(fasync)(int fd, struct file *filp, int on);
extern void DRM(vm_open)(struct vm_area_struct *vma);
extern void DRM(vm_close)(struct vm_area_struct *vma);
extern void DRM(vm_shm_close)(struct vm_area_struct *vma);
extern int DRM(mmap_dma)(struct file *filp,
struct vm_area_struct *vma);
extern int DRM(mmap)(struct file *filp, struct vm_area_struct *vma);
extern unsigned int DRM(poll)(struct file *filp, struct poll_table_struct *wait);
extern ssize_t DRM(read)(struct file *filp, char *buf, size_t count, loff_t *off);
extern void DRM(mem_init)(void);
extern int DRM(mem_info)(char *buf, char **start, off_t offset,
int request, int *eof, void *data);
extern void *DRM(alloc)(size_t size, int area);
extern void *DRM(calloc)(size_t nmemb, size_t size, int area);
extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size,
int area);
extern void DRM(free)(void *pt, size_t size, int area);
extern unsigned long DRM(alloc_pages)(int order, int area);
extern void DRM(free_pages)(unsigned long address, int order,
int area);
extern void *DRM(ioremap)(unsigned long offset, unsigned long size, drm_device_t *dev);
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
#ifndef VMAP_4_ARGS
extern void *DRM(ioremap_agp)(unsigned long offset, unsigned long size, drm_device_t *dev);
extern void DRM(ioremap_agp_free)(void *pt, unsigned long size);
#endif
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
extern int DRM(irq_by_busid)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(getunique)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(setunique)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(getmap)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(getclient)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(getstats)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(setversion)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(resctx)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(addctx)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(modctx)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(getctx)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(switchctx)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(newctx)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(rmctx)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(context_switch)(drm_device_t *dev, int old, int new);
extern int DRM(context_switch_complete)(drm_device_t *dev, int new);
#if __HAVE_CTX_BITMAP
extern int DRM(ctxbitmap_init)( drm_device_t *dev );
extern void DRM(ctxbitmap_cleanup)( drm_device_t *dev );
#endif
extern int DRM(setsareactx)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(getsareactx)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(adddraw)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(rmdraw)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv,
drm_magic_t magic);
extern int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic);
extern int DRM(getmagic)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(authmagic)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(noop)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(lock_take)(__volatile__ unsigned int *lock,
unsigned int context);
extern int DRM(lock_transfer)(drm_device_t *dev,
__volatile__ unsigned int *lock,
unsigned int context);
extern int DRM(lock_free)(drm_device_t *dev,
__volatile__ unsigned int *lock,
unsigned int context);
extern int DRM(notifier)(void *priv);
extern int DRM(order)( unsigned long size );
extern int DRM(addmap)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(rmmap)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
#if __HAVE_DMA
extern int DRM(addbufs)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(infobufs)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(markbufs)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(freebufs)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(mapbufs)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int DRM(dma_setup)(drm_device_t *dev);
extern void DRM(dma_takedown)(drm_device_t *dev);
extern void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf);
extern void DRM(reclaim_buffers)( struct file *filp );
#endif
#if __HAVE_IRQ || __HAVE_DMA
extern int DRM(control)( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
#endif
#if __HAVE_IRQ
extern int DRM(irq_install)( drm_device_t *dev );
extern int DRM(irq_uninstall)( drm_device_t *dev );
extern irqreturn_t DRM(irq_handler)( 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 );
#if __HAVE_VBL_IRQ
extern int DRM(wait_vblank)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(vblank_wait)(drm_device_t *dev, unsigned int *vbl_seq);
extern void DRM(vbl_send_signals)( drm_device_t *dev );
#endif
#if __HAVE_IRQ_BH
extern void DRM(irq_immediate_bh)( void *dev );
#endif
#endif
#if __REALLY_HAVE_AGP
extern drm_agp_head_t *DRM(agp_init)(void);
extern void DRM(agp_uninit)(void);
extern int DRM(agp_acquire)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern void DRM(agp_do_release)(void);
extern int DRM(agp_release)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(agp_enable)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(agp_info)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(agp_alloc)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(agp_free)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
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 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
int DRM(stub_register)(const char *name,
struct file_operations *fops,
drm_device_t *dev);
int DRM(stub_unregister)(int minor);
extern struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev,
int minor,
struct proc_dir_entry *root,
struct proc_dir_entry **dev_root);
extern int DRM(proc_cleanup)(int minor,
struct proc_dir_entry *root,
struct proc_dir_entry *dev_root);
#if __HAVE_SG
extern void DRM(sg_cleanup)(drm_sg_mem_t *entry);
extern int DRM(sg_alloc)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(sg_free)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
#endif
extern int DRM(ati_pcigart_init)(drm_device_t *dev,
unsigned long *addr,
dma_addr_t *bus_addr);
extern int DRM(ati_pcigart_cleanup)(drm_device_t *dev,
unsigned long addr,
dma_addr_t bus_addr);
#endif
#endif