XenevaOS
Loading...
Searching...
No Matches
XenevaOS
BaseHdr
linux
printk.h
Go to the documentation of this file.
1
#ifndef __LINUX_PRINTK_H__
2
#define __LINUX_PRINTK_H__
3
4
#include <
Drivers/uart.h
>
5
#include <
aucon.h
>
6
#include <
stdarg.h
>
/* va_list -- struct va_format below */
7
8
/*
9
* <linux/stringify.h> is not a mainline printk.h include -- mainline reaches
10
* __stringify() from <linux/device.h>, which drm_print.h also includes. DCL's
11
* device.h is a stub that stops at kobject/sysfs/property and carries no such
12
* chain, so drm_WARN_ON() (drm_print.h:789) expands to
13
*
14
* "drm_WARN_ON(" __stringify(x) ")"
15
*
16
* with __stringify() undefined: it reads as an implicit function call sitting
17
* between two string literals, and the diagnostic is "expected ')'" at the
18
* *caller's* if-statement -- no mention of __stringify() anywhere in it.
19
*
20
* printk.h is where the include lands because it is the one header every
21
* print-macro user in this tree already pulls, and __stringify()'s only users
22
* are print and sysfs macros (serial_core.h, sysfs.h, linkage.h,
23
* tty_ldisc.h), each of which currently survives only by the accident of
24
* which TU includes them.
25
*/
26
#include <
linux/stringify.h
>
27
28
/*
29
* struct va_format -- mainline's at printk.h:84, and <drm/drm_print.h> needs
30
* it in two ways: :176 declares a printer callback taking `struct va_format *`
31
* and :216 *builds* one, `struct va_format vaf = { .fmt = fmt, .va = va };`,
32
* so an incomplete type there is "variable has incomplete type" rather than
33
* an unknown name -- the struct is named but never defined anywhere in this
34
* tree. Both fields are required by that initializer.
35
*/
36
struct
va_format
{
37
const
char
*
fmt
;
38
va_list
*
va
;
39
};
40
41
#define KERN_EMERG ""
42
#define KERN_ALERT ""
43
#define KERN_CRIT ""
44
#define KERN_ERR ""
45
#define KERN_WARNING ""
46
#define KERN_NOTICE ""
47
#define KERN_INFO ""
48
#define KERN_DEBUG ""
49
50
#define printk(fmt, ...) UARTDebugOut(fmt, ##__VA_ARGS__)
51
52
#define pr_emerg(fmt, ...) printk(fmt, ##__VA_ARGS__)
53
#define pr_alert(fmt, ...) printk(fmt, ##__VA_ARGS__)
54
#define pr_crit(fmt, ...) printk(fmt, ##__VA_ARGS__)
55
#define pr_err(fmt, ...) printk(fmt, ##__VA_ARGS__)
56
#define pr_warn(fmt, ...) printk(fmt, ##__VA_ARGS__)
57
#define pr_notice(fmt, ...) printk(fmt, ##__VA_ARGS__)
58
#define pr_info(fmt, ...) printk(fmt, ##__VA_ARGS__)
59
#define pr_debug(fmt, ...) do {} while (0)
60
61
#define dev_emerg(dev, fmt, ...) printk(fmt, ##__VA_ARGS__)
62
#define dev_alert(dev, fmt, ...) printk(fmt, ##__VA_ARGS__)
63
#define dev_crit(dev, fmt, ...) printk(fmt, ##__VA_ARGS__)
64
#define dev_err(dev, fmt, ...) printk(fmt, ##__VA_ARGS__)
65
#define dev_warn(dev, fmt, ...) printk(fmt, ##__VA_ARGS__)
66
#define dev_notice(dev, fmt, ...) printk(fmt, ##__VA_ARGS__)
67
#define dev_info(dev, fmt, ...) printk(fmt, ##__VA_ARGS__)
68
#define dev_dbg(dev, fmt, ...) do {} while (0)
69
70
/*
71
* The _ratelimited spelling: same output, minus the flood. mainline routes
72
* these through a ratelimit_state so a driver spinning on a fault cannot fill
73
* the log; DCL has no ratelimit machinery, and the two call sites are
74
* serial8250_set_termios()'s "LSR safety check engaged!" (:2306) and the
75
* repeated-warning path at :2346 -- both once-per-change rather than
76
* once-per-byte. So the body is dev_info/dev_warn exactly, and what is *not*
77
* claimed is the limiting: if a call site ever spins, the right fix is a
78
* ratelimit, not a comment saying these were limited.
79
*/
80
#define dev_info_ratelimited(dev, fmt, ...) dev_info((dev), fmt, ##__VA_ARGS__)
81
#define dev_warn_ratelimited(dev, fmt, ...) dev_warn((dev), fmt, ##__VA_ARGS__)
82
83
/*
84
* oops_in_progress is set *before* the message goes out, not after: the whole
85
* point is that serial8250_console_write() reads it while printing this very
86
* panic, and a console write that happens after the fact protects nothing.
87
* Declared in <linux/kernel.h>, defined in DCL/linux_irq_shim.c.
88
*/
89
extern
int
oops_in_progress
;
90
91
#define panic(fmt, ...) do { oops_in_progress = 1; \
92
printk("PANIC: " fmt, ##__VA_ARGS__); while(1); } while(0)
93
94
95
/*
96
* DUMP_PREFIX_* and hex_dump_to_buffer -- mainline spells these just above
97
* its print_hex_dump() in <linux/printk.h>, and lib/seq_buf.c's
98
* seq_buf_hex_dump() reaches them through <linux/printk.h> alone. Two
99
* consumers: the switch at seq_buf.c:423/:427 selects the per-row prefix, and
100
* :419 calls hex_dump_to_buffer, whose body is Vendored/lib/hexdump.c.
101
*
102
* DCL has no print_hex_dump() and does not need one -- nothing in this tree
103
* calls it, and adding a declaration with no definition is how a link error
104
* gets found late rather than early.
105
*/
106
enum
{
107
DUMP_PREFIX_NONE
,
108
DUMP_PREFIX_ADDRESS
,
109
DUMP_PREFIX_OFFSET
110
};
111
extern
int
hex_dump_to_buffer
(
const
void
*buf,
size_t
len
,
int
rowsize,
112
int
groupsize,
char
*linebuf,
size_t
linebuflen,
113
bool
ascii);
114
115
#define dev_notice_ratelimited(dev, fmt, ...) dev_notice((dev), fmt, ##__VA_ARGS__)
116
117
/*
118
* dev_err_probe(dev, err, fmt, ...) -- "report this probe failure, unless it
119
* is -EPROBE_DEFER, which is normal".
120
*
121
* The whole behaviour is that one exception: mainline suppresses the
122
* -EPROBE_DEFER message because a deferred probe is the driver asking to be
123
* called again, not a fault, and printing every one would bury real errors.
124
* The value comes back unchanged either way -- the caller at serial_core.c:3575
125
* does `return dev_err_probe(...)`, so what matters is that the *original*
126
* error reaches the caller, not what was printed.
127
*
128
* Statement expression because it has both jobs in one call: evaluate the
129
* error once, print conditionally, yield the error. `dev` is dropped by
130
* dev_err below exactly as it is for every other dev_* in this header.
131
*/
132
#define dev_err_probe(dev, err, fmt, ...) \
133
({ \
134
int __e = (err); \
135
if (__e != -EPROBE_DEFER) \
136
dev_err((dev), fmt, ##__VA_ARGS__); \
137
__e; \
138
})
139
#endif
stdarg.h
va_list
char * va_list
Definition
acmsvcex.h:186
aucon.h
len
size_t len
Definition
initial.c:23
hex_dump_to_buffer
int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, char *linebuf, size_t linebuflen, bool ascii)
oops_in_progress
int oops_in_progress
DUMP_PREFIX_ADDRESS
@ DUMP_PREFIX_ADDRESS
Definition
printk.h:108
DUMP_PREFIX_NONE
@ DUMP_PREFIX_NONE
Definition
printk.h:107
DUMP_PREFIX_OFFSET
@ DUMP_PREFIX_OFFSET
Definition
printk.h:109
stringify.h
va_format
Definition
printk.h:36
va_format::fmt
const char * fmt
Definition
printk.h:37
va_format::va
va_list * va
Definition
printk.h:38
uart.h
Generated by
1.9.8