Commit | Line | Data |
---|---|---|
533a23a1 TK |
1 | /***************************************************************************** |
2 | * | |
3 | * Copyright (c) 2016-2018 Samsung Electronics Co., Ltd. All rights reserved | |
4 | * | |
5 | *****************************************************************************/ | |
6 | ||
7 | #ifndef _SCSC_LOGRING_H_ | |
8 | #define _SCSC_LOGRING_H_ | |
9 | #include <linux/types.h> | |
10 | ||
11 | #include <linux/types.h> | |
12 | #include <linux/printk.h> | |
13 | #include <linux/device.h> | |
14 | #include <linux/sched/clock.h> | |
15 | ||
16 | /* NOTE_CREATING_TAGS: when adding a tag here REMEMBER to add it also | |
17 | * where required, taking care to maintain the same ordering. | |
18 | * (Search 4 NOTE_CREATING_TAGS) | |
19 | * | |
20 | * You must update "int *scsc_droplevels[]" to match. | |
21 | */ | |
22 | enum scsc_logring_tags { | |
23 | FIRST_TAG, | |
24 | FIRST_BIN_TAG = FIRST_TAG, | |
25 | BINARY = FIRST_BIN_TAG, | |
26 | BIN_WIFI_CTRL_RX, | |
27 | BIN_WIFI_DATA_RX, | |
28 | BIN_WIFI_CTRL_TX, | |
29 | BIN_WIFI_DATA_TX, | |
30 | LAST_BIN_TAG = BIN_WIFI_DATA_TX, | |
31 | NO_TAG, | |
32 | WLBT = NO_TAG, | |
33 | WIFI_RX, | |
34 | WIFI_TX, | |
35 | BT_COMMON, | |
36 | BT_H4, | |
37 | BT_FW, | |
38 | BT_RX, | |
39 | BT_TX, | |
40 | CPKTBUFF, | |
41 | FW_LOAD, | |
42 | FW_PANIC, | |
43 | GDB_TRANS, | |
44 | MIF, | |
45 | CLK20, | |
46 | CLK20_TEST, | |
47 | FM, | |
48 | FM_TEST, | |
49 | MX_FILE, | |
50 | MX_FW, | |
51 | MX_SAMPLER, | |
52 | MXLOG_TRANS, | |
53 | MXMAN, | |
54 | MXMAN_TEST, | |
55 | MXMGT_TRANS, | |
56 | MX_MMAP, | |
57 | MX_PROC, | |
58 | PANIC_MON, | |
59 | PCIE_MIF, | |
60 | PLAT_MIF, | |
61 | KIC_COMMON, | |
62 | WLBTD, | |
63 | WLOG, | |
64 | LERNA, | |
65 | MX_CFG, | |
66 | #ifdef CONFIG_SCSC_DEBUG_COMPATIBILITY | |
67 | SLSI_INIT_DEINIT, | |
68 | SLSI_NETDEV, | |
69 | SLSI_CFG80211, | |
70 | SLSI_MLME, | |
71 | SLSI_SUMMARY_FRAMES, | |
72 | SLSI_HYDRA, | |
73 | SLSI_TX, | |
74 | SLSI_RX, | |
75 | SLSI_UDI, | |
76 | SLSI_WIFI_FCQ, | |
77 | SLSI_HIP, | |
78 | SLSI_HIP_INIT_DEINIT, | |
79 | SLSI_HIP_FW_DL, | |
80 | SLSI_HIP_SDIO_OP, | |
81 | SLSI_HIP_PS, | |
82 | SLSI_HIP_TH, | |
83 | SLSI_HIP_FH, | |
84 | SLSI_HIP_SIG, | |
85 | SLSI_FUNC_TRACE, | |
86 | SLSI_TEST, | |
87 | SLSI_SRC_SINK, | |
88 | SLSI_FW_TEST, | |
89 | SLSI_RX_BA, | |
90 | SLSI_TDLS, | |
91 | SLSI_GSCAN, | |
92 | SLSI_MBULK, | |
93 | SLSI_FLOWC, | |
94 | SLSI_SMAPPER, | |
95 | #endif | |
96 | TEST_ME, | |
97 | MAX_TAG = TEST_ME /* keep it last */ | |
98 | }; | |
99 | ||
100 | ||
101 | #define NODEV_LABEL "" | |
102 | #define SCSC_SDEV_2_DEV(sdev) \ | |
103 | (((sdev) && (sdev)->wiphy) ? &((sdev)->wiphy->dev) : NULL) | |
104 | #define SCSC_NDEV_2_DEV(ndev) \ | |
105 | ((ndev) ? SCSC_SDEV_2_DEV(((struct netdev_vif *)netdev_priv(ndev))->sdev) : NULL) | |
106 | ||
107 | #define SCSC_PREFIX "wlbt: " /* prepended to log statements */ | |
108 | ||
109 | #define SCSC_TAG_FMT(tag, fmt) SCSC_PREFIX"[" # tag "]: %-5s: - %s: "fmt | |
110 | #define SCSC_TAG_DBG_FMT(tag, fmt) SCSC_PREFIX"[" # tag "]: %s: "fmt | |
111 | #define SCSC_DEV_FMT(fmt) SCSC_PREFIX"%-5s: - %s: "fmt | |
112 | #define SCSC_DBG_FMT(fmt) SCSC_PREFIX"%s: "fmt | |
113 | ||
114 | int scsc_logring_enable(bool logging_enable); | |
115 | ||
116 | #ifdef CONFIG_SCSC_PRINTK | |
117 | ||
118 | int scsc_printk_tag(int force, int tag, const char *fmt, ...); | |
119 | int scsc_printk_tag_dev(int force, int tag, struct device *dev, const char *fmt, ...); | |
120 | int scsc_printk_tag_dev_lvl(int force, int tag, struct device *dev, int lvl, const char *fmt, ...); | |
121 | int scsc_printk_tag_lvl(int tag, int lvl, const char *fmt, ...); | |
122 | int scsc_printk_bin(int force, int tag, int dlev, const void *start, size_t len); | |
123 | ||
124 | /** | |
125 | * This fields helps in trimming the behavior respect the kernel ring buffer: | |
126 | * - NO_FORCE_PRK: the tag-based filtering mechanism is obeyed. | |
127 | * - FORCE_PRK: the tag-based filtering is bypassed by this macro and message | |
128 | * always get to the kernel ring buffer | |
129 | * - NO_ECHO_PRK: disable completely the printk redirect. | |
130 | */ | |
131 | #define NO_FORCE_PRK 0 | |
132 | #define FORCE_PRK 1 | |
133 | #define NO_ECHO_PRK 2 | |
134 | ||
135 | #define SCSC_PRINTK(args ...) scsc_printk_tag(NO_FORCE_PRK, WLBT, \ | |
136 | args) | |
137 | ||
138 | #define SCSC_PRINTK_TAG(tag, args ...) scsc_printk_tag(NO_FORCE_PRK, (tag), \ | |
139 | args) | |
140 | #define SCSC_PRINTK_BIN(start, len) scsc_printk_bin(NO_FORCE_PRK, BINARY, \ | |
141 | -1, (start), (len)) | |
142 | ||
143 | #define SCSC_EMERG(fmt, args...) scsc_printk_tag(NO_FORCE_PRK, WLBT, \ | |
144 | KERN_EMERG SCSC_DBG_FMT(fmt), \ | |
145 | __func__, ## args) | |
146 | #define SCSC_ALERT(fmt, args...) scsc_printk_tag(NO_FORCE_PRK, WLBT, \ | |
147 | KERN_ALERT SCSC_DBG_FMT(fmt), \ | |
148 | __func__, ## args) | |
149 | #define SCSC_CRIT(fmt, args...) scsc_printk_tag(NO_FORCE_PRK, WLBT, \ | |
150 | KERN_CRIT SCSC_DBG_FMT(fmt), \ | |
151 | __func__, ## args) | |
152 | #define SCSC_ERR(fmt, args...) scsc_printk_tag(NO_FORCE_PRK, WLBT, \ | |
153 | KERN_ERR SCSC_DBG_FMT(fmt), \ | |
154 | __func__, ## args) | |
155 | #define SCSC_WARNING(fmt, args...) scsc_printk_tag(NO_FORCE_PRK, WLBT, \ | |
156 | KERN_WARNING SCSC_DBG_FMT(fmt), \ | |
157 | __func__, ## args) | |
158 | #define SCSC_NOTICE(fmt, args...) scsc_printk_tag(NO_FORCE_PRK, WLBT, \ | |
159 | KERN_NOTICE SCSC_DBG_FMT(fmt), \ | |
160 | __func__, ## args) | |
161 | #define SCSC_INFO(fmt, args...) scsc_printk_tag(NO_FORCE_PRK, WLBT, \ | |
162 | KERN_INFO SCSC_DBG_FMT(fmt), \ | |
163 | __func__, ## args) | |
164 | #define SCSC_DEBUG(fmt, args...) scsc_printk_tag(NO_FORCE_PRK, WLBT, \ | |
165 | KERN_DEBUG SCSC_DBG_FMT(fmt), \ | |
166 | __func__, ## args) | |
167 | ||
168 | #define SCSC_TAG_EMERG(tag, fmt, args...) scsc_printk_tag(NO_FORCE_PRK, (tag), \ | |
169 | KERN_EMERG SCSC_DBG_FMT(fmt), \ | |
170 | __func__, ## args) | |
171 | #define SCSC_TAG_ALERT(tag, fmt, args...) scsc_printk_tag(NO_FORCE_PRK, (tag), \ | |
172 | KERN_ALERT SCSC_DBG_FMT(fmt), \ | |
173 | __func__, ## args) | |
174 | #define SCSC_TAG_CRIT(tag, fmt, args ...) scsc_printk_tag(NO_FORCE_PRK, (tag), \ | |
175 | KERN_CRIT SCSC_DBG_FMT(fmt), \ | |
176 | __func__, ## args) | |
177 | #define SCSC_TAG_ERR(tag, fmt, args...) scsc_printk_tag(NO_FORCE_PRK, (tag), \ | |
178 | KERN_ERR SCSC_DBG_FMT(fmt), \ | |
179 | __func__, ## args) | |
180 | #define SCSC_TAG_WARNING(tag, fmt, args...) scsc_printk_tag(NO_FORCE_PRK, (tag), \ | |
181 | KERN_WARNING SCSC_DBG_FMT(fmt), \ | |
182 | __func__, ## args) | |
183 | #define SCSC_TAG_NOTICE(tag, fmt, args...) scsc_printk_tag(NO_FORCE_PRK, (tag), \ | |
184 | KERN_NOTICE SCSC_DBG_FMT(fmt), \ | |
185 | __func__, ## args) | |
186 | #define SCSC_TAG_INFO(tag, fmt, args...) scsc_printk_tag(NO_FORCE_PRK, (tag), \ | |
187 | KERN_INFO SCSC_DBG_FMT(fmt), \ | |
188 | __func__, ## args) | |
189 | #define SCSC_TAG_DEBUG(tag, fmt, args...) scsc_printk_tag(NO_FORCE_PRK, (tag), \ | |
190 | KERN_DEBUG SCSC_DBG_FMT(fmt), \ | |
191 | __func__, ## args) | |
192 | ||
193 | #define SCSC_TAG_ERR_SDEV(sdev, tag, fmt, args...) \ | |
194 | scsc_printk_tag_dev(NO_FORCE_PRK, (tag), SCSC_SDEV_2_DEV((sdev)), \ | |
195 | KERN_ERR SCSC_DBG_FMT(fmt), \ | |
196 | __func__, ## args) | |
197 | #define SCSC_TAG_WARNING_SDEV(sdev, tag, fmt, args...) \ | |
198 | scsc_printk_tag_dev(NO_FORCE_PRK, (tag), SCSC_SDEV_2_DEV((sdev)), \ | |
199 | KERN_WARNING SCSC_DBG_FMT(fmt), \ | |
200 | __func__, ## args) | |
201 | #define SCSC_TAG_INFO_SDEV(sdev, tag, fmt, args...) \ | |
202 | scsc_printk_tag_dev(NO_FORCE_PRK, (tag), SCSC_SDEV_2_DEV((sdev)), \ | |
203 | KERN_INFO SCSC_DBG_FMT(fmt), \ | |
204 | __func__, ## args) | |
205 | #define SCSC_TAG_DEBUG_SDEV(sdev, tag, fmt, args...) \ | |
206 | scsc_printk_tag_dev(NO_FORCE_PRK, (tag), SCSC_SDEV_2_DEV((sdev)), \ | |
207 | KERN_DEBUG SCSC_DBG_FMT(fmt), \ | |
208 | __func__, ## args) | |
209 | ||
210 | #define SCSC_TAG_ERR_NDEV(ndev, tag, fmt, args...) \ | |
211 | scsc_printk_tag_dev(NO_FORCE_PRK, (tag), SCSC_NDEV_2_DEV((ndev)), \ | |
212 | KERN_ERR SCSC_DEV_FMT(fmt), \ | |
213 | ((ndev) ? netdev_name(ndev) : NODEV_LABEL), \ | |
214 | __func__, ## args) | |
215 | #define SCSC_TAG_WARNING_NDEV(ndev, tag, fmt, args...) \ | |
216 | scsc_printk_tag_dev(NO_FORCE_PRK, (tag), SCSC_NDEV_2_DEV((ndev)), \ | |
217 | KERN_WARNING SCSC_DEV_FMT(fmt), \ | |
218 | ((ndev) ? netdev_name(ndev) : NODEV_LABEL), \ | |
219 | __func__, ## args) | |
220 | #define SCSC_TAG_INFO_NDEV(ndev, tag, fmt, args...) \ | |
221 | scsc_printk_tag_dev(NO_FORCE_PRK, (tag), SCSC_NDEV_2_DEV((ndev)), \ | |
222 | KERN_INFO SCSC_DEV_FMT(fmt), \ | |
223 | ((ndev) ? netdev_name(ndev) : NODEV_LABEL), \ | |
224 | __func__, ## args) | |
225 | #define SCSC_TAG_DEBUG_NDEV(ndev, tag, fmt, args...) \ | |
226 | scsc_printk_tag_dev(NO_FORCE_PRK, (tag), SCSC_NDEV_2_DEV((ndev)), \ | |
227 | KERN_DEBUG SCSC_DEV_FMT(fmt), \ | |
228 | ((ndev) ? netdev_name(ndev) : NODEV_LABEL), \ | |
229 | __func__, ## args) | |
230 | ||
231 | #define SCSC_TAG_ERR_DEV(tag, dev, fmt, args...) \ | |
232 | scsc_printk_tag_dev(NO_FORCE_PRK, (tag), dev, \ | |
233 | KERN_ERR SCSC_DBG_FMT(fmt), \ | |
234 | __func__, ## args) | |
235 | ||
236 | #define SCSC_TAG_WARNING_DEV(tag, dev, fmt, args...) \ | |
237 | scsc_printk_tag_dev(NO_FORCE_PRK, (tag), dev, \ | |
238 | KERN_WARNING SCSC_DBG_FMT(fmt), \ | |
239 | __func__, ## args) | |
240 | ||
241 | #define SCSC_TAG_INFO_DEV(tag, dev, fmt, args...) \ | |
242 | scsc_printk_tag_dev(NO_FORCE_PRK, (tag), dev, \ | |
243 | KERN_INFO SCSC_DBG_FMT(fmt), \ | |
244 | __func__, ## args) | |
245 | ||
246 | #define SCSC_TAG_DEBUG_DEV(tag, dev, fmt, args...) \ | |
247 | scsc_printk_tag_dev(NO_FORCE_PRK, (tag), dev, \ | |
248 | KERN_DEBUG SCSC_DBG_FMT(fmt), \ | |
249 | __func__, ## args) | |
250 | ||
251 | #define SCSC_ERR_SDEV(sdev, fmt, args...) \ | |
252 | SCSC_TAG_ERR_SDEV(sdev, WLBT, fmt, ## args) | |
253 | #define SCSC_WARNING_SDEV(sdev, fmt, args...) \ | |
254 | SCSC_TAG_WARNING_SDEV(sdev, WLBT, fmt, ## args) | |
255 | #define SCSC_INFO_SDEV(sdev, fmt, args...) \ | |
256 | SCSC_TAG_INFO_SDEV(sdev, WLBT, fmt, ## args) | |
257 | ||
258 | #define SCSC_ERR_NDEV(ndev, fmt, args...) \ | |
259 | SCSC_TAG_ERR_NDEV(ndev, WLBT, fmt, ## args) | |
260 | #define SCSC_WARNING_NDEV(ndev, fmt, args...) \ | |
261 | SCSC_TAG_WARNING_NDEV(ndev, WLBT, fmt, ## args) | |
262 | #define SCSC_INFO_NDEV(ndev, fmt, args...) \ | |
263 | SCSC_TAG_INFO_NDEV(ndev, WLBT, fmt, ## args) | |
264 | ||
265 | ||
266 | #define SCSC_BIN_EMERG(start, len) scsc_printk_bin(NO_FORCE_PRK, BINARY, 0, \ | |
267 | (start), (len)) | |
268 | #define SCSC_BIN_ALERT(start, len) scsc_printk_bin(NO_FORCE_PRK, BINARY, 1, \ | |
269 | (start), (len)) | |
270 | #define SCSC_BIN_CRIT(start, len) scsc_printk_bin(NO_FORCE_PRK, BINARY, 2, \ | |
271 | (start), (len)) | |
272 | #define SCSC_BIN_ERR(start, len) scsc_printk_bin(NO_FORCE_PRK, BINARY, 3, \ | |
273 | (start), (len)) | |
274 | #define SCSC_BIN_WARNING(start, len) scsc_printk_bin(NO_FORCE_PRK, BINARY, 4, \ | |
275 | (start), (len)) | |
276 | #define SCSC_BIN_NOTICE(start, len) scsc_printk_bin(NO_FORCE_PRK, BINARY, 5, \ | |
277 | (start), (len)) | |
278 | #define SCSC_BIN_INFO(start, len) scsc_printk_bin(NO_FORCE_PRK, BINARY, 6, \ | |
279 | (start), (len)) | |
280 | #define SCSC_BIN_DEBUG(start, len) scsc_printk_bin(NO_FORCE_PRK, BINARY, 7, \ | |
281 | (start), (len)) | |
282 | ||
283 | #define SCSC_BIN_TAG_EMERG(tag, start, len) scsc_printk_bin(NO_FORCE_PRK, (tag), 0, \ | |
284 | (start), (len)) | |
285 | #define SCSC_BIN_TAG_ALERT(tag, start, len) scsc_printk_bin(NO_FORCE_PRK, (tag), 1, \ | |
286 | (start), (len)) | |
287 | #define SCSC_BIN_TAG_CRIT(tag, start, len) scsc_printk_bin(NO_FORCE_PRK, (tag), 2, \ | |
288 | (start), (len)) | |
289 | #define SCSC_BIN_TAG_ERR(tag, start, len) scsc_printk_bin(NO_FORCE_PRK, (tag), 3, \ | |
290 | (start), (len)) | |
291 | #define SCSC_BIN_TAG_WARNING(tag, start, len) scsc_printk_bin(NO_FORCE_PRK, (tag), 4, \ | |
292 | (start), (len)) | |
293 | #define SCSC_BIN_TAG_NOTICE(tag, start, len) scsc_printk_bin(NO_FORCE_PRK, (tag), 5, \ | |
294 | (start), (len)) | |
295 | #define SCSC_BIN_TAG_INFO(tag, start, len) scsc_printk_bin(NO_FORCE_PRK, (tag), 6, \ | |
296 | (start), (len)) | |
297 | #define SCSC_BIN_TAG_DEBUG(tag, start, len) scsc_printk_bin(NO_FORCE_PRK, (tag), 7, \ | |
298 | (start), (len)) | |
299 | ||
300 | ||
301 | /* | |
302 | * These macros forces a redundant copy of their output to kernel log buffer and | |
303 | * console through standard kernel facilities, NO matter how the tag-based | |
304 | * filtering is configured and NO matter what the value in | |
305 | * scsc_redirect_to_printk_droplvl module param. | |
306 | */ | |
307 | #define SCSC_PRINTK_FF(args ...) scsc_printk_tag(FORCE_PRK, WLBT, args) | |
308 | #define SCSC_PRINTK_TAG_FF(tag, args ...) scsc_printk_tag(FORCE_PRK, (tag), args) | |
309 | #define SCSC_PRINTK_BIN_FF(start, len) scsc_printk_bin(FORCE_PRK, -1, \ | |
310 | (start), (len)) | |
311 | ||
312 | #define SCSC_EMERG_FF(args ...) scsc_printk_tag(FORCE_PRK, WLBT, \ | |
313 | KERN_EMERG SCSC_PREFIX args) | |
314 | #define SCSC_ALERT_FF(args ...) scsc_printk_tag(FORCE_PRK, WLBT, \ | |
315 | KERN_ALERT SCSC_PREFIX args) | |
316 | #define SCSC_CRIT_FF(args ...) scsc_printk_tag(FORCE_PRK, WLBT, \ | |
317 | KERN_CRIT SCSC_PREFIX args) | |
318 | #define SCSC_ERR_FF(args ...) scsc_printk_tag(FORCE_PRK, WLBT, \ | |
319 | KERN_ERR SCSC_PREFIX args) | |
320 | #define SCSC_WARNING_FF(args ...) scsc_printk_tag(FORCE_PRK, WLBT, \ | |
321 | KERN_WARNING SCSC_PREFIX args) | |
322 | #define SCSC_NOTICE_FF(args ...) scsc_printk_tag(FORCE_PRK, WLBT, \ | |
323 | KERN_NOTICE SCSC_PREFIX args) | |
324 | #define SCSC_INFO_FF(args ...) scsc_printk_tag(FORCE_PRK, WLBT, \ | |
325 | KERN_INFO SCSC_PREFIX args) | |
326 | #define SCSC_DEBUG_FF(args ...) scsc_printk_tag(FORCE_PRK, WLBT, \ | |
327 | KERN_DEBUG SCSC_PREFIX args) | |
328 | ||
329 | #define SCSC_TAG_EMERG_FF(tag, args ...) scsc_printk_tag(FORCE_PRK, (tag), \ | |
330 | KERN_EMERG SCSC_PREFIX args) | |
331 | #define SCSC_TAG_ALERT_FF(tag, args ...) scsc_printk_tag(FORCE_PRK, (tag), \ | |
332 | KERN_ALERT SCSC_PREFIX args) | |
333 | #define SCSC_TAG_CRIT_FF(tag, args ...) scsc_printk_tag(FORCE_PRK, (tag), \ | |
334 | KERN_CRIT SCSC_PREFIX args) | |
335 | #define SCSC_TAG_ERR_FF(tag, args ...) scsc_printk_tag(FORCE_PRK, (tag), \ | |
336 | KERN_ERR SCSC_PREFIX args) | |
337 | #define SCSC_TAG_WARNING_FF(tag, args ...) scsc_printk_tag(FORCE_PRK, (tag), \ | |
338 | KERN_WARNING SCSC_PREFIX args) | |
339 | #define SCSC_TAG_NOTICE_FF(tag, args ...) scsc_printk_tag(FORCE_PRK, (tag), \ | |
340 | KERN_NOTICE SCSC_PREFIX args) | |
341 | #define SCSC_TAG_INFO_FF(tag, args ...) scsc_printk_tag(FORCE_PRK, (tag), \ | |
342 | KERN_INFO SCSC_PREFIX args) | |
343 | #define SCSC_TAG_DEBUG_FF(tag, args ...) scsc_printk_tag(FORCE_PRK, (tag), \ | |
344 | KERN_DEBUG SCSC_PREFIX args) | |
345 | ||
346 | #define SCSC_BIN_EMERG_FF(start, len) scsc_printk_bin(FORCE_PRK, 0, \ | |
347 | (start), (len)) | |
348 | #define SCSC_BIN_ALERT_FF(start, len) scsc_printk_bin(FORCE_PRK, 1, \ | |
349 | (start), (len)) | |
350 | #define SCSC_BIN_CRIT_FF(start, len) scsc_printk_bin(FORCE_PRK, 2, \ | |
351 | (start), (len)) | |
352 | #define SCSC_BIN_ERR_FF(start, len) scsc_printk_bin(FORCE_PRK, 3, \ | |
353 | (start), (len)) | |
354 | #define SCSC_BIN_WARNING_FF(start, len) scsc_printk_bin(FORCE_PRK, 4, \ | |
355 | (start), (len)) | |
356 | #define SCSC_BIN_NOTICE_FF(start, len) scsc_printk_bin(FORCE_PRK, 5, \ | |
357 | (start), (len)) | |
358 | #define SCSC_BIN_INFO_FF(start, len) scsc_printk_bin(FORCE_PRK, 6, \ | |
359 | (start), (len)) | |
360 | #define SCSC_BIN_DEBUG_FF(start, len) scsc_printk_bin(FORCE_PRK, 7, \ | |
361 | (start), (len)) | |
362 | ||
363 | #define SCSC_TAG_LVL(tag, lvl, fmt, args...) \ | |
364 | scsc_printk_tag_lvl((tag), (lvl), fmt, ## args) | |
365 | ||
366 | #define SCSC_TAG_DEV_LVL(tag, lvl, dev, fmt, args...) \ | |
367 | scsc_printk_tag_dev_lvl(NO_FORCE_PRK, (tag), (dev), (lvl), fmt, ## args) | |
368 | ||
369 | ||
370 | #define SCSC_TAG_DBG1_SDEV(sdev, tag, fmt, args...) \ | |
371 | SCSC_TAG_DEV_LVL((tag), 7, SCSC_SDEV_2_DEV((sdev)), \ | |
372 | SCSC_DBG_FMT(fmt), __func__, ## args) | |
373 | ||
374 | #define SCSC_TAG_DBG2_SDEV(sdev, tag, fmt, args...) \ | |
375 | SCSC_TAG_DEV_LVL((tag), 8, SCSC_SDEV_2_DEV((sdev)), \ | |
376 | SCSC_DBG_FMT(fmt), __func__, ## args) | |
377 | ||
378 | #define SCSC_TAG_DBG3_SDEV(sdev, tag, fmt, args...) \ | |
379 | SCSC_TAG_DEV_LVL((tag), 9, SCSC_SDEV_2_DEV((sdev)), \ | |
380 | SCSC_DBG_FMT(fmt), __func__, ## args) | |
381 | ||
382 | #define SCSC_TAG_DBG4_SDEV(sdev, tag, fmt, args...) \ | |
383 | SCSC_TAG_DEV_LVL((tag), 10, SCSC_SDEV_2_DEV((sdev)), \ | |
384 | SCSC_DBG_FMT(fmt), __func__, ## args) | |
385 | ||
386 | #define SCSC_TAG_DBG1_NDEV(ndev, tag, fmt, args...) \ | |
387 | SCSC_TAG_DEV_LVL((tag), 7, SCSC_NDEV_2_DEV((ndev)), SCSC_DEV_FMT(fmt), \ | |
388 | ((ndev) ? netdev_name(ndev) : NODEV_LABEL), \ | |
389 | __func__, ## args) | |
390 | ||
391 | #define SCSC_TAG_DBG2_NDEV(ndev, tag, fmt, args...) \ | |
392 | SCSC_TAG_DEV_LVL((tag), 8, SCSC_NDEV_2_DEV((ndev)), SCSC_DEV_FMT(fmt), \ | |
393 | ((ndev) ? netdev_name(ndev) : NODEV_LABEL), \ | |
394 | __func__, ## args) | |
395 | ||
396 | #define SCSC_TAG_DBG3_NDEV(ndev, tag, fmt, args...) \ | |
397 | SCSC_TAG_DEV_LVL((tag), 9, SCSC_NDEV_2_DEV((ndev)), SCSC_DEV_FMT(fmt), \ | |
398 | ((ndev) ? netdev_name(ndev) : NODEV_LABEL), \ | |
399 | __func__, ## args) | |
400 | ||
401 | #define SCSC_TAG_DBG4_NDEV(ndev, tag, fmt, args...) \ | |
402 | SCSC_TAG_DEV_LVL((tag), 10, SCSC_NDEV_2_DEV((ndev)), SCSC_DEV_FMT(fmt), \ | |
403 | ((ndev) ? netdev_name(ndev) : NODEV_LABEL), \ | |
404 | __func__, ## args) | |
405 | ||
406 | #define SCSC_TAG_DBG1(tag, fmt, args ...) \ | |
407 | SCSC_TAG_LVL((tag), 7, fmt, ## args) | |
408 | ||
409 | #define SCSC_TAG_DBG2(tag, fmt, args ...) \ | |
410 | SCSC_TAG_LVL((tag), 8, fmt, ## args) | |
411 | ||
412 | #define SCSC_TAG_DBG3(tag, fmt, args ...) \ | |
413 | SCSC_TAG_LVL((tag), 9, fmt, ## args) | |
414 | ||
415 | #define SCSC_TAG_DBG4(tag, fmt, args ...) \ | |
416 | SCSC_TAG_LVL((tag), 10, fmt, ## args) | |
417 | ||
418 | #else /* CONFIG_SCSC_PRINTK */ | |
419 | ||
420 | #define SCSC_TAG_LVL(tag, lvl, fmt, args...) \ | |
421 | do {\ | |
422 | if ((lvl) < 7)\ | |
423 | printk_emit(0, (lvl), NULL, 0, fmt, ## args);\ | |
424 | } while (0) | |
425 | ||
426 | #define SCSC_TAG_DEV_LVL(tag, lvl, dev, fmt, args...) \ | |
427 | do {\ | |
428 | if ((lvl) < 7)\ | |
429 | dev_printk_emit((lvl), (dev), fmt, ## args);\ | |
430 | } while (0) | |
431 | ||
432 | #define SCSC_PRINTK(fmt, args ...) printk(SCSC_PREFIX fmt, ## args) | |
433 | #define SCSC_PRINTK_TAG(tag, fmt, args ...) printk(SCSC_PREFIX "[" # tag "] "fmt, ## args) | |
434 | #define SCSC_PRINTK_BIN(start, len) print_hex_dump(KERN_INFO, \ | |
435 | SCSC_PREFIX"[BINARY]->|", \ | |
436 | DUMP_PREFIX_ADDRESS, \ | |
437 | 16, 4, start, \ | |
438 | len, true) | |
439 | ||
440 | #define SCSC_PRINTK_FF(fmt, args ...) printk(SCSC_PREFIX fmt, ## args) | |
441 | #define SCSC_PRINTK_TAG_FF(tag, fmt, args ...) printk(SCSC_PREFIX"[" # tag "] "fmt, ## args) | |
442 | #define SCSC_PRINTK_BIN_FF(start, len) print_hex_dump(KERN_INFO, \ | |
443 | SCSC_PREFIX"[BINARY]->|", \ | |
444 | DUMP_PREFIX_ADDRESS, \ | |
445 | 16, 4, start, \ | |
446 | len, true) | |
447 | ||
448 | #define SCSC_EMERG(fmt, args...) pr_emerg(SCSC_DBG_FMT(fmt), __func__, ## args) | |
449 | #define SCSC_ALERT(fmt, args...) pr_alert(SCSC_DBG_FMT(fmt), __func__, ## args) | |
450 | #define SCSC_CRIT(fmt, args...) pr_crit(SCSC_DBG_FMT(fmt), __func__, ## args) | |
451 | #define SCSC_ERR(fmt, args...) pr_err(SCSC_DBG_FMT(fmt), __func__, ## args) | |
452 | #define SCSC_WARNING(fmt, args...) pr_warn(SCSC_DBG_FMT(fmt), __func__, ## args) | |
453 | #define SCSC_NOTICE(fmt, args...) pr_notice(SCSC_DBG_FMT(fmt), __func__, ## args) | |
454 | #define SCSC_INFO(fmt, args...) pr_info(SCSC_DBG_FMT(fmt), __func__, ## args) | |
455 | #define SCSC_DEBUG(args...) do {} while (0) | |
456 | ||
457 | /* Reverting to pr_* keeping the [tag] */ | |
458 | #define SCSC_TAG_EMERG(tag, fmt, args...) \ | |
459 | pr_emerg(SCSC_TAG_DBG_FMT(tag, fmt), __func__, ## args) | |
460 | #define SCSC_TAG_ALERT(tag, fmt, args...) \ | |
461 | pr_alert(SCSC_TAG_DBG_FMT(tag, fmt), __func__, ## args) | |
462 | #define SCSC_TAG_CRIT(tag, fmt, args...) \ | |
463 | pr_crit(SCSC_TAG_DBG_FMT(tag, fmt), __func__, ## args) | |
464 | #define SCSC_TAG_ERR(tag, fmt, args...) \ | |
465 | pr_err(SCSC_TAG_DBG_FMT(tag, fmt), __func__, ## args) | |
466 | #define SCSC_TAG_WARNING(tag, fmt, args...) \ | |
467 | pr_warn(SCSC_TAG_DBG_FMT(tag, fmt), __func__, ## args) | |
468 | #define SCSC_TAG_NOTICE(tag, fmt, args...) \ | |
469 | pr_notice(SCSC_TAG_DBG_FMT(tag, fmt), __func__, ## args) | |
470 | #define SCSC_TAG_INFO(tag, fmt, args...) \ | |
471 | pr_info(SCSC_TAG_DBG_FMT(tag, fmt), __func__, ## args) | |
472 | #define SCSC_TAG_DEBUG(tag, fmt, args...) do {} while (0) | |
473 | ||
474 | ||
475 | #define SCSC_BIN_EMERG(start, len) print_hex_dump(KERN_EMERG, \ | |
476 | SCSC_PREFIX"[BINARY]->|", \ | |
477 | DUMP_PREFIX_ADDRESS, \ | |
478 | 16, 4, start, \ | |
479 | len, true) | |
480 | ||
481 | #define SCSC_BIN_ALERT(start, len) print_hex_dump(KERN_ALERT, \ | |
482 | SCSC_PREFIX"[BINARY]->|", \ | |
483 | DUMP_PREFIX_ADDRESS, \ | |
484 | 16, 4, start, \ | |
485 | len, true) | |
486 | ||
487 | #define SCSC_BIN_CRIT(start, len) print_hex_dump(KERN_CRIT, \ | |
488 | SCSC_PREFIX"[BINARY]->|", \ | |
489 | DUMP_PREFIX_ADDRESS, \ | |
490 | 16, 4, start, \ | |
491 | len, true) | |
492 | ||
493 | #define SCSC_BIN_ERR(start, len) print_hex_dump(KERN_ERR, \ | |
494 | SCSC_PREFIX"[BINARY]->|", \ | |
495 | DUMP_PREFIX_ADDRESS, \ | |
496 | 16, 4, start, \ | |
497 | len, true) | |
498 | ||
499 | #define SCSC_BIN_WARNING(start, len) print_hex_dump(KERN_WARNING, \ | |
500 | SCSC_PREFIX"[BINARY]->|", \ | |
501 | DUMP_PREFIX_ADDRESS, \ | |
502 | 16, 4, start, \ | |
503 | len, true) | |
504 | ||
505 | #define SCSC_BIN_NOTICE(start, len) print_hex_dump(KERN_NOTICE, \ | |
506 | SCSC_PREFIX"[BINARY]->|", \ | |
507 | DUMP_PREFIX_ADDRESS, \ | |
508 | 16, 4, start, \ | |
509 | len, true) | |
510 | ||
511 | #define SCSC_BIN_INFO(start, len) print_hex_dump(KERN_INFO, \ | |
512 | SCSC_PREFIX"[BINARY]->|", \ | |
513 | DUMP_PREFIX_ADDRESS, \ | |
514 | 16, 4, start, \ | |
515 | len, true) | |
516 | ||
517 | #define SCSC_BIN_DEBUG(start, len) do {} while (0) | |
518 | ||
519 | ||
520 | #define SCSC_BIN_TAG_EMERG(tag, start, len) print_hex_dump(KERN_EMERG, \ | |
521 | SCSC_PREFIX"[" # tag "]->|", \ | |
522 | DUMP_PREFIX_ADDRESS, \ | |
523 | 16, 4, start, \ | |
524 | len, true) | |
525 | ||
526 | #define SCSC_BIN_TAG_ALERT(tag, start, len) print_hex_dump(KERN_ALERT, \ | |
527 | SCSC_PREFIX"[" # tag "]->|", \ | |
528 | DUMP_PREFIX_ADDRESS, \ | |
529 | 16, 4, start, \ | |
530 | len, true) | |
531 | ||
532 | #define SCSC_BIN_TAG_CRIT(tag, start, len) print_hex_dump(KERN_CRIT, \ | |
533 | SCSC_PREFIX"[" # tag "]->|", \ | |
534 | DUMP_PREFIX_ADDRESS, \ | |
535 | 16, 4, start, \ | |
536 | len, true) | |
537 | ||
538 | #define SCSC_BIN_TAG_ERR(tag, start, len) print_hex_dump(KERN_ERR, \ | |
539 | SCSC_PREFIX"[" # tag "]->|", \ | |
540 | DUMP_PREFIX_ADDRESS, \ | |
541 | 16, 4, start, \ | |
542 | len, true) | |
543 | ||
544 | #define SCSC_BIN_TAG_WARNING(tag, start, len) print_hex_dump(KERN_WARNING, \ | |
545 | SCSC_PREFIX"[" # tag "]->|", \ | |
546 | DUMP_PREFIX_ADDRESS, \ | |
547 | 16, 4, start, \ | |
548 | len, true) | |
549 | ||
550 | #define SCSC_BIN_TAG_NOTICE(tag, start, len) print_hex_dump(KERN_NOTICE, \ | |
551 | SCSC_PREFIX"[" # tag "]->|", \ | |
552 | DUMP_PREFIX_ADDRESS, \ | |
553 | 16, 4, start, \ | |
554 | len, true) | |
555 | ||
556 | #define SCSC_BIN_TAG_INFO(tag, start, len) print_hex_dump(KERN_INFO, \ | |
557 | SCSC_PREFIX"[" # tag "]->|", \ | |
558 | DUMP_PREFIX_NONE, \ | |
559 | 16, 1, start, \ | |
560 | len, false) | |
561 | ||
562 | #define SCSC_BIN_TAG_DEBUG(tag, start, len) do {} while (0) | |
563 | ||
564 | ||
565 | #define SCSC_EMERG_FF(args ...) pr_emerg(SCSC_PREFIX args) | |
566 | #define SCSC_ALERT_FF(args ...) pr_alert(SCSC_PREFIX args) | |
567 | #define SCSC_CRIT_FF(args ...) pr_crit(SCSC_PREFIX args) | |
568 | #define SCSC_ERR_FF(args ...) pr_err(SCSC_PREFIX args) | |
569 | #define SCSC_WARNING_FF(args ...) pr_warn(SCSC_PREFIX args) | |
570 | #define SCSC_NOTICE_FF(args ...) pr_notice(SCSC_PREFIX args) | |
571 | #define SCSC_INFO_FF(args ...) pr_info(SCSC_PREFIX args) | |
572 | #define SCSC_DEBUG_FF(args ...) do {} while (0) | |
573 | ||
574 | ||
575 | #define SCSC_TAG_EMERG_FF(tag, fmt, args ...) pr_emerg(SCSC_TAG_DBG_FMT(tag, fmt), \ | |
576 | __func__, ## args) | |
577 | #define SCSC_TAG_ALERT_FF(tag, fmt, args ...) pr_alert(SCSC_TAG_DBG_FMT(tag, fmt), \ | |
578 | __func__, ## args) | |
579 | #define SCSC_TAG_CRIT_FF(tag, fmt, args ...) pr_crit(SCSC_TAG_DBG_FMT(tag, fmt), \ | |
580 | __func__, ## args) | |
581 | #define SCSC_TAG_ERR_FF(tag, fmt, args ...) pr_err(SCSC_TAG_DBG_FMT(tag, fmt), \ | |
582 | __func__, ## args) | |
583 | #define SCSC_TAG_WARNING_FF(tag, fmt, args ...) pr_warn(SCSC_TAG_DBG_FMT(tag, fmt), \ | |
584 | __func__, ## args) | |
585 | #define SCSC_TAG_NOTICE_FF(tag, fmt, args ...) pr_notice(SCSC_TAG_DBG_FMT(tag, fmt), \ | |
586 | __func__, ## args) | |
587 | #define SCSC_TAG_INFO_FF(tag, fmt, args ...) pr_info(SCSC_TAG_DBG_FMT(tag, fmt), \ | |
588 | __func__, ## args) | |
589 | #define SCSC_TAG_DEBUG_FF(tag, fmt, args ...) do {} while (0) | |
590 | ||
591 | #define SCSC_BIN_EMERG_FF(start, len) print_hex_dump(KERN_EMERG, \ | |
592 | SCSC_PREFIX"[BINARY]->|", \ | |
593 | DUMP_PREFIX_ADDRESS, \ | |
594 | 16, 4, start, \ | |
595 | len, true) | |
596 | ||
597 | #define SCSC_BIN_ALERT_FF(start, len) print_hex_dump(KERN_ALERT, \ | |
598 | SCSC_PREFIX"[BINARY]->|", \ | |
599 | DUMP_PREFIX_ADDRESS, \ | |
600 | 16, 4, start, \ | |
601 | len, true) | |
602 | ||
603 | #define SCSC_BIN_CRIT_FF(start, len) print_hex_dump(KERN_CRIT, \ | |
604 | SCSC_PREFIX"[BINARY]->|", \ | |
605 | DUMP_PREFIX_ADDRESS, \ | |
606 | 16, 4, start, \ | |
607 | len, true) | |
608 | ||
609 | #define SCSC_BIN_ERR_FF(start, len) print_hex_dump(KERN_ERR, \ | |
610 | SCSC_PREFIX"[BINARY]->|", \ | |
611 | DUMP_PREFIX_ADDRESS, \ | |
612 | 16, 4, start, \ | |
613 | len, true) | |
614 | ||
615 | #define SCSC_BIN_WARNING_FF(start, len) print_hex_dump(KERN_WARNING, \ | |
616 | SCSC_PREFIX"[BINARY]->|", \ | |
617 | DUMP_PREFIX_ADDRESS, \ | |
618 | 16, 4, start, \ | |
619 | len, true) | |
620 | ||
621 | #define SCSC_BIN_NOTICE_FF(start, len) print_hex_dump(KERN_NOTICE, \ | |
622 | SCSC_PREFIX"[BINARY]->|", \ | |
623 | DUMP_PREFIX_ADDRESS, \ | |
624 | 16, 4, start, \ | |
625 | len, true) | |
626 | ||
627 | #define SCSC_BIN_INFO_FF(start, len) print_hex_dump(KERN_INFO, \ | |
628 | SCSC_PREFIX"[BINARY]->|", \ | |
629 | DUMP_PREFIX_ADDRESS, \ | |
630 | 16, 4, start, \ | |
631 | len, true) | |
632 | ||
633 | #define SCSC_BIN_DEBUG_FF(start, len) do {} while (0) | |
634 | ||
635 | ||
636 | #define SCSC_TAG_ERR_SDEV(sdev, tag, fmt, args...) \ | |
637 | dev_err(SCSC_SDEV_2_DEV((sdev)), SCSC_TAG_DBG_FMT(tag, fmt), \ | |
638 | __func__, ## args) | |
639 | ||
640 | #define SCSC_TAG_WARNING_SDEV(sdev, tag, fmt, args...) \ | |
641 | dev_warn(SCSC_SDEV_2_DEV((sdev)), SCSC_TAG_DBG_FMT(tag, fmt), \ | |
642 | __func__, ## args) | |
643 | ||
644 | #define SCSC_TAG_INFO_SDEV(sdev, tag, fmt, args...) \ | |
645 | dev_info(SCSC_SDEV_2_DEV((sdev)), SCSC_TAG_DBG_FMT(tag, fmt), \ | |
646 | __func__, ## args) | |
647 | ||
648 | #define SCSC_TAG_DEBUG_SDEV(sdev, tag, fmt, args...) do {} while (0) | |
649 | ||
650 | ||
651 | #define SCSC_TAG_ERR_NDEV(ndev, tag, fmt, args...) \ | |
652 | dev_err(SCSC_NDEV_2_DEV((ndev)), SCSC_TAG_FMT(tag, fmt), \ | |
653 | ((ndev) ? netdev_name(ndev) : NODEV_LABEL), __func__, ## args) | |
654 | #define SCSC_TAG_WARNING_NDEV(ndev, tag, fmt, args...) \ | |
655 | dev_warn(SCSC_NDEV_2_DEV((ndev)), SCSC_TAG_FMT(tag, fmt), \ | |
656 | ((ndev) ? netdev_name(ndev) : NODEV_LABEL), __func__, ## args) | |
657 | #define SCSC_TAG_INFO_NDEV(ndev, tag, fmt, args...) \ | |
658 | dev_info(SCSC_NDEV_2_DEV((ndev)), SCSC_TAG_FMT(tag, fmt), \ | |
659 | ((ndev) ? netdev_name(ndev) : NODEV_LABEL), __func__, ## args) | |
660 | ||
661 | #define SCSC_TAG_DEBUG_NDEV(ndev, tag, fmt, args...) do {} while (0) | |
662 | ||
663 | #define SCSC_TAG_ERR_DEV(tag, dev, fmt, args...) \ | |
664 | dev_err(dev, SCSC_TAG_DBG_FMT(tag, fmt), \ | |
665 | __func__, ## args) | |
666 | ||
667 | #define SCSC_TAG_WARNING_DEV(tag, dev, fmt, args...) \ | |
668 | dev_warn(dev, SCSC_TAG_DBG_FMT(tag, fmt), \ | |
669 | __func__, ## args) | |
670 | ||
671 | #define SCSC_TAG_INFO_DEV(tag, dev, fmt, args...) \ | |
672 | dev_info(dev, SCSC_TAG_DBG_FMT(tag, fmt), \ | |
673 | __func__, ## args) | |
674 | ||
675 | #define SCSC_TAG_DEBUG_DEV(tag, dev, fmt, args...) do {} while (0) | |
676 | ||
677 | #define SCSC_ERR_SDEV(sdev, fmt, args...) \ | |
678 | SCSC_TAG_ERR_SDEV(sdev, WLBT, fmt, ## args) | |
679 | #define SCSC_WARNING_SDEV(sdev, fmt, args...) \ | |
680 | SCSC_TAG_WARNING_SDEV(sdev, WLBT, fmt, ## args) | |
681 | #define SCSC_INFO_SDEV(sdev, fmt, args...) \ | |
682 | SCSC_TAG_INFO_SDEV(sdev, WLBT, fmt, ## args) | |
683 | ||
684 | #define SCSC_ERR_NDEV(ndev, fmt, args...) \ | |
685 | SCSC_TAG_ERR_NDEV(ndev, WLBT, fmt, ## args) | |
686 | #define SCSC_WARNING_NDEV(ndev, fmt, args...) \ | |
687 | SCSC_TAG_WARNING_NDEV(ndev, WLBT, fmt, ## args) | |
688 | #define SCSC_INFO_NDEV(ndev, fmt, args...) \ | |
689 | SCSC_TAG_INFO_NDEV(ndev, WLBT, fmt, ## args) | |
690 | ||
691 | ||
692 | #define SCSC_TAG_DBG1_SDEV(sdev, tag, fmt, args...) do {} while (0) | |
693 | #define SCSC_TAG_DBG2_SDEV(sdev, tag, fmt, args...) do {} while (0) | |
694 | #define SCSC_TAG_DBG3_SDEV(sdev, tag, fmt, args...) do {} while (0) | |
695 | #define SCSC_TAG_DBG4_SDEV(sdev, tag, fmt, args...) do {} while (0) | |
696 | ||
697 | #define SCSC_TAG_DBG1_NDEV(ndev, tag, fmt, args...) do {} while (0) | |
698 | #define SCSC_TAG_DBG2_NDEV(ndev, tag, fmt, args...) do {} while (0) | |
699 | #define SCSC_TAG_DBG3_NDEV(ndev, tag, fmt, args...) do {} while (0) | |
700 | #define SCSC_TAG_DBG4_NDEV(ndev, tag, fmt, args...) do {} while (0) | |
701 | ||
702 | #define SCSC_TAG_DBG1(tag, fmt, args ...) do {} while (0) | |
703 | #define SCSC_TAG_DBG2(tag, fmt, args ...) do {} while (0) | |
704 | #define SCSC_TAG_DBG3(tag, fmt, args ...) do {} while (0) | |
705 | #define SCSC_TAG_DBG4(tag, fmt, args ...) do {} while (0) | |
706 | ||
707 | #endif | |
708 | ||
709 | #endif /* _SCSC_LOGRING_H_ */ |