OSDN Git Service

nouveau: add runtime PM support (v0.9)
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / drivers / gpu / drm / nouveau / core / include / core / printk.h
1 #ifndef __NOUVEAU_PRINTK_H__
2 #define __NOUVEAU_PRINTK_H__
3
4 #include <core/os.h>
5 #include <core/debug.h>
6
7 struct nouveau_object;
8
9 #define NV_PRINTK_FATAL    KERN_CRIT
10 #define NV_PRINTK_ERROR    KERN_ERR
11 #define NV_PRINTK_WARN     KERN_WARNING
12 #define NV_PRINTK_INFO     KERN_INFO
13 #define NV_PRINTK_DEBUG    KERN_DEBUG
14 #define NV_PRINTK_PARANOIA KERN_DEBUG
15 #define NV_PRINTK_TRACE    KERN_DEBUG
16 #define NV_PRINTK_SPAM     KERN_DEBUG
17
18 extern int nv_printk_suspend_level;
19
20 #define NV_DBG_SUSPEND (nv_printk_suspend_level)
21 #define NV_PRINTK_SUSPEND  (nv_printk_level_to_pfx(nv_printk_suspend_level))
22
23 const char *nv_printk_level_to_pfx(int level);
24 void __printf(4, 5)
25 nv_printk_(struct nouveau_object *, const char *, int, const char *, ...);
26
27 #define nv_printk(o,l,f,a...) do {                                             \
28         if (NV_DBG_##l <= CONFIG_NOUVEAU_DEBUG)                                \
29                 nv_printk_(nv_object(o), NV_PRINTK_##l, NV_DBG_##l, f, ##a);   \
30 } while(0)
31
32 #define nv_fatal(o,f,a...) nv_printk((o), FATAL, f, ##a)
33 #define nv_error(o,f,a...) nv_printk((o), ERROR, f, ##a)
34 #define nv_warn(o,f,a...) nv_printk((o), WARN, f, ##a)
35 #define nv_info(o,f,a...) nv_printk((o), INFO, f, ##a)
36 #define nv_debug(o,f,a...) nv_printk((o), DEBUG, f, ##a)
37 #define nv_trace(o,f,a...) nv_printk((o), TRACE, f, ##a)
38 #define nv_spam(o,f,a...) nv_printk((o), SPAM, f, ##a)
39
40 #define nv_suspend(o,f,a...) nv_printk((o), SUSPEND, f, ##a)
41
42 static inline void nv_suspend_set_printk_level(int level)
43 {
44         nv_printk_suspend_level = level;
45 }
46
47 #define nv_assert(f,a...) do {                                                 \
48         if (NV_DBG_FATAL <= CONFIG_NOUVEAU_DEBUG)                              \
49                 nv_printk_(NULL, NV_PRINTK_FATAL, NV_DBG_FATAL, f "\n", ##a);  \
50         BUG_ON(1);                                                             \
51 } while(0)
52
53 #endif