1 /* Public domain. */
2
3 #ifndef _LINUX_PRINTK_H
4 #define _LINUX_PRINTK_H
5
6 #include <sys/types.h>
7 #include <sys/systm.h>
8 #include <sys/stdarg.h>
9
10 #include <linux/init.h>
11
12 #define KERN_CRIT "\0012"
13 #define KERN_ERR "\0013"
14 #define KERN_WARNING "\0014"
15 #define KERN_NOTICE "\0015"
16 #define KERN_INFO "\0016"
17 #define KERN_DEBUG "\0017"
18
19 #define KERN_CONT "\001c"
20
21 #ifndef pr_fmt
22 #define pr_fmt(fmt) fmt
23 #endif
24
25 #define printk_once(fmt, arg...) ({ \
26 static int __warned; \
27 if (!__warned) { \
28 printk(fmt, ## arg); \
29 __warned = 1; \
30 } \
31 })
32
33 #define printk_ratelimit() 1
34
35 int printk(const char *fmt, ...);
36
37 #define pr_warn(fmt, arg...) printk(KERN_WARNING pr_fmt(fmt), ## arg)
38 #define pr_warn_ratelimited(fmt, arg...) printk(KERN_WARNING pr_fmt(fmt), ## arg)
39 #define pr_warn_once(fmt, arg...) printk_once(KERN_WARNING pr_fmt(fmt), ## arg)
40 #define pr_notice(fmt, arg...) printk(KERN_NOTICE pr_fmt(fmt), ## arg)
41 #define pr_crit(fmt, arg...) printk(KERN_CRIT pr_fmt(fmt), ## arg)
42 #define pr_err(fmt, arg...) printk(KERN_ERR pr_fmt(fmt), ## arg)
43 #define pr_err_once(fmt, arg...) printk_once(KERN_ERR pr_fmt(fmt), ## arg)
44 #define pr_cont(fmt, arg...) printk(KERN_CONT pr_fmt(fmt), ## arg)
45
46 #ifdef DRMDEBUG
47 #define pr_info(fmt, arg...) printk(KERN_INFO pr_fmt(fmt), ## arg)
48 #define pr_info_ratelimited(fmt, arg...) printk(KERN_INFO pr_fmt(fmt), ## arg)
49 #define pr_info_once(fmt, arg...) printk_once(KERN_INFO pr_fmt(fmt), ## arg)
50 #define pr_debug(fmt, arg...) printk(KERN_DEBUG pr_fmt(fmt), ## arg)
51 #else
52 #define pr_info(fmt, arg...) do { } while(0)
53 #define pr_info_ratelimited(fmt, arg...) do { } while(0)
54 #define pr_info_once(fmt, arg...) do { } while(0)
55 #define pr_debug(fmt, arg...) do { } while(0)
56 #endif
57
58 enum {
59 DUMP_PREFIX_NONE,
60 DUMP_PREFIX_ADDRESS,
61 DUMP_PREFIX_OFFSET
62 };
63
64 void print_hex_dump(const char *, const char *, int, int, int,
65 const void *, size_t, bool);
66
67 struct va_format {
68 const char *fmt;
69 va_list *va;
70 };
71
72 static inline int
_in_dbg_master(void)73 _in_dbg_master(void)
74 {
75 #ifdef DDB
76 return (db_active);
77 #endif
78 return (0);
79 }
80
81 #define oops_in_progress _in_dbg_master()
82
83 #endif
84