sem2mutex: drivers/char/drm/
[safe/jmp/linux-2.6] / drivers / char / drm / drmP.h
index a3ad85e..71b8b32 100644 (file)
@@ -57,6 +57,7 @@
 #include <linux/smp_lock.h>    /* For (un)lock_kernel */
 #include <linux/mm.h>
 #include <linux/cdev.h>
+#include <linux/mutex.h>
 #if defined(__alpha__) || defined(__powerpc__)
 #include <asm/pgtable.h>       /* For pte_wrprotect */
 #endif
@@ -522,8 +523,9 @@ typedef struct drm_vbl_sig {
 typedef struct ati_pcigart_info {
        int gart_table_location;
        int is_pcie;
-       unsigned long addr;
+       void *addr;
        dma_addr_t bus_addr;
+       drm_local_map_t mapping;
 } drm_ati_pcigart_info;
 
 /**
@@ -549,7 +551,7 @@ struct drm_driver {
        int (*kernel_context_switch) (struct drm_device * dev, int old,
                                      int new);
        void (*kernel_context_switch_unlock) (struct drm_device * dev,
-                                             drm_lock_t * lock);
+                                             drm_lock_t *lock);
        int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence);
        int (*dri_library_name) (struct drm_device *dev, char *buf);
 
@@ -573,12 +575,11 @@ struct drm_driver {
        void (*irq_postinstall) (struct drm_device * dev);
        void (*irq_uninstall) (struct drm_device * dev);
        void (*reclaim_buffers) (struct drm_device * dev, struct file * filp);
-       void (*reclaim_buffers_locked) (struct drm_device *drv,
+       void (*reclaim_buffers_locked) (struct drm_device *dev,
                                        struct file *filp);
        unsigned long (*get_map_ofs) (drm_map_t * map);
        unsigned long (*get_reg_ofs) (struct drm_device * dev);
        void (*set_version) (struct drm_device * dev, drm_set_version_t * sv);
-       int (*version) (drm_version_t * version);
 
        int major;
        int minor;
@@ -623,7 +624,7 @@ typedef struct drm_device {
        /** \name Locks */
        /*@{ */
        spinlock_t count_lock;          /**< For inuse, drm_device::open_count, drm_device::buf_use */
-       struct semaphore struct_sem;    /**< For others */
+       struct mutex struct_mutex;      /**< For others */
        /*@} */
 
        /** \name Usage Counters */
@@ -658,7 +659,7 @@ typedef struct drm_device {
        /*@{ */
        drm_ctx_list_t *ctxlist;        /**< Linked list of context handles */
        int ctx_count;                  /**< Number of context handles */
-       struct semaphore ctxlist_sem;   /**< For ctxlist */
+       struct mutex ctxlist_mutex;     /**< For ctxlist */
 
        drm_map_t **context_sareas;         /**< per-context SAREA's */
        int max_context;
@@ -767,16 +768,26 @@ static inline int drm_mtrr_del(int handle, unsigned long offset,
 
 #else
 #define drm_core_has_MTRR(dev) (0)
+
+#define DRM_MTRR_WC            0
+
+static inline int drm_mtrr_add(unsigned long offset, unsigned long size,
+                              unsigned int flags)
+{
+       return 0;
+}
+
+static inline int drm_mtrr_del(int handle, unsigned long offset,
+                              unsigned long size, unsigned int flags)
+{
+       return 0;
+}
 #endif
 
 /******************************************************************/
 /** \name Internal function definitions */
 /*@{*/
 
-                               /* Misc. support (drm_init.h) */
-extern int drm_flags;
-extern void drm_parse_options(char *s);
-
                                /* Driver support (drm_drv.h) */
 extern int drm_init(struct drm_driver *driver);
 extern void drm_exit(struct drm_driver *driver);
@@ -830,6 +841,8 @@ 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_noop(struct inode *inode, struct file *filp,
+                   unsigned int cmd, unsigned long arg);
 
                                /* Context IOCTL support (drm_context.h) */
 extern int drm_resctx(struct inode *inode, struct file *filp,
@@ -868,10 +881,6 @@ extern int drm_getmagic(struct inode *inode, struct file *filp,
 extern int drm_authmagic(struct inode *inode, struct file *filp,
                         unsigned int cmd, unsigned long arg);
 
-                               /* Placeholder for ioctls past */
-extern int drm_noop(struct inode *inode, struct file *filp,
-                   unsigned int cmd, unsigned long arg);
-
                                /* Locking IOCTL support (drm_lock.h) */
 extern int drm_lock(struct inode *inode, struct file *filp,
                    unsigned int cmd, unsigned long arg);
@@ -884,6 +893,7 @@ extern int drm_lock_free(drm_device_t * dev,
                                /* Buffer management support (drm_bufs.h) */
 extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request);
 extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request);
+extern int drm_addbufs_fb(drm_device_t *dev, drm_buf_desc_t *request);
 extern int drm_addmap(drm_device_t * dev, unsigned int offset,
                      unsigned int size, drm_map_type_t type,
                      drm_map_flags_t flags, drm_local_map_t ** map_ptr);
@@ -919,8 +929,8 @@ extern void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp);
                                /* IRQ support (drm_irq.h) */
 extern int drm_control(struct inode *inode, struct file *filp,
                       unsigned int cmd, unsigned long arg);
-extern int drm_irq_uninstall(drm_device_t * dev);
 extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
+extern int drm_irq_uninstall(drm_device_t * dev);
 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);