serial: fix NULL pointer dereference
[safe/jmp/linux-2.6] / include / drm / drmP.h
index d4ddc22..c8e64bb 100644 (file)
@@ -34,9 +34,6 @@
 #ifndef _DRM_P_H_
 #define _DRM_P_H_
 
-/* If you want the memory alloc debug functionality, change define below */
-/* #define DEBUG_MEMORY */
-
 #ifdef __KERNEL__
 #ifdef __alpha__
 /* add include of current.h so that "current" is defined
@@ -91,7 +88,37 @@ struct drm_device;
 #define DRM_UT_CORE            0x01
 #define DRM_UT_DRIVER          0x02
 #define DRM_UT_KMS             0x04
-#define DRM_UT_MODE            0x08
+/*
+ * Three debug levels are defined.
+ * drm_core, drm_driver, drm_kms
+ * drm_core level can be used in the generic drm code. For example:
+ *     drm_ioctl, drm_mm, drm_memory
+ * The macro definiton of DRM_DEBUG is used.
+ *     DRM_DEBUG(fmt, args...)
+ *     The debug info by using the DRM_DEBUG can be obtained by adding
+ *     the boot option of "drm.debug=1".
+ *
+ * drm_driver level can be used in the specific drm driver. It is used
+ * to add the debug info related with the drm driver. For example:
+ * i915_drv, i915_dma, i915_gem, radeon_drv,
+ *     The macro definition of DRM_DEBUG_DRIVER can be used.
+ *     DRM_DEBUG_DRIVER(fmt, args...)
+ *     The debug info by using the DRM_DEBUG_DRIVER can be obtained by
+ *     adding the boot option of "drm.debug=0x02"
+ *
+ * drm_kms level can be used in the KMS code related with specific drm driver.
+ * It is used to add the debug info related with KMS mode. For example:
+ * the connector/crtc ,
+ *     The macro definition of DRM_DEBUG_KMS can be used.
+ *     DRM_DEBUG_KMS(fmt, args...)
+ *     The debug info by using the DRM_DEBUG_KMS can be obtained by
+ *     adding the boot option of "drm.debug=0x04"
+ *
+ * If we add the boot option of "drm.debug=0x06", we can get the debug info by
+ * using the DRM_DEBUG_KMS and DRM_DEBUG_DRIVER.
+ * If we add the boot option of "drm.debug=0x05", we can get the debug info by
+ * using the DRM_DEBUG_KMS and DRM_DEBUG.
+ */
 
 extern void drm_ut_debug_printk(unsigned int request_level,
                                const char *prefix,
@@ -133,31 +160,6 @@ extern void drm_ut_debug_printk(unsigned int request_level,
 
 #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_MEM_CTXLIST   21
-#define DRM_MEM_MM        22
-#define DRM_MEM_HASHTAB   23
-
 #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
 #define DRM_MAP_HASH_OFFSET 0x10000000
 
@@ -202,19 +204,14 @@ extern void drm_ut_debug_printk(unsigned int request_level,
                                        __func__, fmt, ##args);         \
        } while (0)
 
-#define DRM_DEBUG_DRIVER(prefix, fmt, args...)                         \
+#define DRM_DEBUG_DRIVER(fmt, args...)                                 \
        do {                                                            \
-               drm_ut_debug_printk(DRM_UT_DRIVER, prefix,              \
+               drm_ut_debug_printk(DRM_UT_DRIVER, DRM_NAME,            \
                                        __func__, fmt, ##args);         \
        } while (0)
-#define DRM_DEBUG_KMS(prefix, fmt, args...)                            \
+#define DRM_DEBUG_KMS(fmt, args...)                            \
        do {                                                            \
-               drm_ut_debug_printk(DRM_UT_KMS, prefix,                 \
-                                        __func__, fmt, ##args);        \
-       } while (0)
-#define DRM_DEBUG_MODE(prefix, fmt, args...)                           \
-       do {                                                            \
-               drm_ut_debug_printk(DRM_UT_MODE, prefix,                \
+               drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME,               \
                                         __func__, fmt, ##args);        \
        } while (0)
 #define DRM_LOG(fmt, args...)                                          \
@@ -238,9 +235,8 @@ extern void drm_ut_debug_printk(unsigned int request_level,
                                        NULL, fmt, ##args);             \
        } while (0)
 #else
-#define DRM_DEBUG_DRIVER(prefix, fmt, args...) do { } while (0)
-#define DRM_DEBUG_KMS(prefix, fmt, args...)    do { } while (0)
-#define DRM_DEBUG_MODE(prefix, fmt, args...)   do { } while (0)
+#define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0)
+#define DRM_DEBUG_KMS(fmt, args...)    do { } while (0)
 #define DRM_DEBUG(fmt, arg...)          do { } while (0)
 #define DRM_LOG(fmt, arg...)           do { } while (0)
 #define DRM_LOG_KMS(fmt, args...) do { } while (0)
@@ -814,6 +810,9 @@ struct drm_driver {
        int (*gem_init_object) (struct drm_gem_object *obj);
        void (*gem_free_object) (struct drm_gem_object *obj);
 
+       /* vga arb irq handler */
+       void (*vgaarb_irq)(struct drm_device *dev, bool state);
+
        /* Driver private ops for this object */
        struct vm_operations_struct *gem_vm_ops;
 
@@ -1445,7 +1444,7 @@ drm_gem_object_unreference(struct drm_gem_object *obj)
 
 int drm_gem_handle_create(struct drm_file *file_priv,
                          struct drm_gem_object *obj,
-                         int *handlep);
+                         u32 *handlep);
 
 static inline void
 drm_gem_object_handle_reference(struct drm_gem_object *obj)
@@ -1471,7 +1470,7 @@ drm_gem_object_handle_unreference(struct drm_gem_object *obj)
 
 struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev,
                                             struct drm_file *filp,
-                                            int handle);
+                                            u32 handle);
 int drm_gem_close_ioctl(struct drm_device *dev, void *data,
                        struct drm_file *file_priv);
 int drm_gem_flink_ioctl(struct drm_device *dev, void *data,
@@ -1517,24 +1516,6 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
 {
 }
 
-#ifndef DEBUG_MEMORY
-/** Wrapper around kmalloc() */
-static __inline__ void *drm_alloc(size_t size, int area)
-{
-       return kmalloc(size, GFP_KERNEL);
-}
-
-/** Wrapper around kfree() */
-static __inline__ void drm_free(void *pt, size_t size, int area)
-{
-       kfree(pt);
-}
-
-/** Wrapper around kcalloc() */
-static __inline__ void *drm_calloc(size_t nmemb, size_t size, int area)
-{
-       return kcalloc(nmemb, size, GFP_KERNEL);
-}
 
 static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
 {
@@ -1555,12 +1536,6 @@ static __inline void drm_free_large(void *ptr)
 
        vfree(ptr);
 }
-#else
-extern void *drm_alloc(size_t size, int area);
-extern void drm_free(void *pt, size_t size, int area);
-extern void *drm_calloc(size_t nmemb, size_t size, int area);
-#endif
-
 /*@}*/
 
 #endif                         /* __KERNEL__ */