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 #define HW_ERR		"HW_ERR: "
22 
23 #ifndef pr_fmt
24 #define pr_fmt(fmt) fmt
25 #endif
26 
27 #define printk_once(fmt, arg...) ({		\
28 	static int __warned;			\
29 	if (!__warned) {			\
30 		printk(fmt, ## arg);		\
31 		__warned = 1;			\
32 	}					\
33 })
34 
35 #define printk_ratelimit()	1
36 
37 int printk(const char *fmt, ...);
38 
39 #define pr_warn(fmt, arg...)	printk(KERN_WARNING pr_fmt(fmt), ## arg)
40 #define pr_warn_ratelimited(fmt, arg...)	printk(KERN_WARNING pr_fmt(fmt), ## arg)
41 #define pr_warn_once(fmt, arg...)	printk_once(KERN_WARNING pr_fmt(fmt), ## arg)
42 #define pr_notice(fmt, arg...)	printk(KERN_NOTICE pr_fmt(fmt), ## arg)
43 #define pr_crit(fmt, arg...)	printk(KERN_CRIT pr_fmt(fmt), ## arg)
44 #define pr_err(fmt, arg...)	printk(KERN_ERR pr_fmt(fmt), ## arg)
45 #define pr_err_once(fmt, arg...)	printk_once(KERN_ERR pr_fmt(fmt), ## arg)
46 #define pr_cont(fmt, arg...)	printk(KERN_CONT pr_fmt(fmt), ## arg)
47 
48 #ifdef DRMDEBUG
49 #define pr_info(fmt, arg...)	printk(KERN_INFO pr_fmt(fmt), ## arg)
50 #define pr_info_ratelimited(fmt, arg...)	printk(KERN_INFO pr_fmt(fmt), ## arg)
51 #define pr_info_once(fmt, arg...)	printk_once(KERN_INFO pr_fmt(fmt), ## arg)
52 #define pr_debug(fmt, arg...)	printk(KERN_DEBUG pr_fmt(fmt), ## arg)
53 #else
54 #define pr_info(fmt, arg...)	do { } while(0)
55 #define pr_info_ratelimited(fmt, arg...)	do { } while(0)
56 #define pr_info_once(fmt, arg...)	do { } while(0)
57 #define pr_debug(fmt, arg...)	do { } while(0)
58 #endif
59 
60 enum {
61 	DUMP_PREFIX_NONE,
62 	DUMP_PREFIX_ADDRESS,
63 	DUMP_PREFIX_OFFSET
64 };
65 
66 void print_hex_dump(const char *, const char *, int, int, int,
67 	 const void *, size_t, bool);
68 
69 struct va_format {
70 	const char *fmt;
71 	va_list *va;
72 };
73 
74 static inline int
_in_dbg_master(void)75 _in_dbg_master(void)
76 {
77 #ifdef DDB
78 	return (db_active);
79 #endif
80 	return (0);
81 }
82 
83 #define oops_in_progress _in_dbg_master()
84 
85 #endif
86