1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _ICNSS_DEBUG_H
#define _ICNSS_DEBUG_H
#include <linux/ipc_logging.h>
#include <linux/printk.h>
#define NUM_LOG_PAGES 10
#define NUM_LOG_LONG_PAGES 4
extern void *icnss_ipc_log_context;
extern void *icnss_ipc_log_long_context;
#define icnss_ipc_log_string(_x...) \
ipc_log_string(icnss_ipc_log_context, _x)
#define icnss_ipc_log_long_string(_x...) \
ipc_log_string(icnss_ipc_log_long_context, _x)
#define icnss_pr_err(_fmt, ...) do { \
printk("%s" pr_fmt(_fmt), KERN_ERR, ##__VA_ARGS__); \
icnss_ipc_log_string("%s" pr_fmt(_fmt), "", \
##__VA_ARGS__); \
} while (0)
#define icnss_pr_warn(_fmt, ...) do { \
printk("%s" pr_fmt(_fmt), KERN_WARNING, ##__VA_ARGS__); \
icnss_ipc_log_string("%s" pr_fmt(_fmt), "", \
##__VA_ARGS__); \
} while (0)
#define icnss_pr_info(_fmt, ...) do { \
printk("%s" pr_fmt(_fmt), KERN_INFO, ##__VA_ARGS__); \
icnss_ipc_log_string("%s" pr_fmt(_fmt), "", \
##__VA_ARGS__); \
} while (0)
#if defined(CONFIG_DYNAMIC_DEBUG)
#define icnss_pr_dbg(_fmt, ...) do { \
pr_debug(_fmt, ##__VA_ARGS__); \
icnss_ipc_log_string(pr_fmt(_fmt), ##__VA_ARGS__); \
} while (0)
#define icnss_pr_vdbg(_fmt, ...) do { \
pr_debug(_fmt, ##__VA_ARGS__); \
icnss_ipc_log_long_string(pr_fmt(_fmt), ##__VA_ARGS__); \
} while (0)
#elif defined(DEBUG)
#define icnss_pr_dbg(_fmt, ...) do { \
printk("%s" pr_fmt(_fmt), KERN_DEBUG, ##__VA_ARGS__); \
icnss_ipc_log_string("%s" pr_fmt(_fmt), "", \
##__VA_ARGS__); \
} while (0)
#define icnss_pr_vdbg(_fmt, ...) do { \
printk("%s" pr_fmt(_fmt), KERN_DEBUG, ##__VA_ARGS__); \
icnss_ipc_log_long_string("%s" pr_fmt(_fmt), "", \
##__VA_ARGS__); \
} while (0)
#else
#define icnss_pr_dbg(_fmt, ...) do { \
no_printk("%s" pr_fmt(_fmt), KERN_DEBUG, ##__VA_ARGS__); \
icnss_ipc_log_string("%s" pr_fmt(_fmt), "", \
##__VA_ARGS__); \
} while (0)
#define icnss_pr_vdbg(_fmt, ...) do { \
no_printk("%s" pr_fmt(_fmt), KERN_DEBUG, ##__VA_ARGS__); \
icnss_ipc_log_long_string("%s" pr_fmt(_fmt), "", \
##__VA_ARGS__); \
} while (0)
#endif
#ifdef CONFIG_ICNSS2_DEBUG
#define ICNSS_ASSERT(_condition) do { \
if (!(_condition)) { \
icnss_pr_err("ASSERT at line %d\n", __LINE__); \
BUG(); \
} \
} while (0)
#else
#define ICNSS_ASSERT(_condition) do { } while (0)
#endif
#define icnss_fatal_err(_fmt, ...) \
icnss_pr_err("fatal: "_fmt, ##__VA_ARGS__)
enum icnss_debug_quirks {
HW_ALWAYS_ON,
HW_DEBUG_ENABLE,
SKIP_QMI,
RECOVERY_DISABLE,
SSR_ONLY,
PDR_ONLY,
ENABLE_DAEMON_SUPPORT,
FW_REJUVENATE_ENABLE,
};
void icnss_debug_init(void);
void icnss_debug_deinit(void);
int icnss_debugfs_create(struct icnss_priv *priv);
void icnss_debugfs_destroy(struct icnss_priv *priv);
#endif /* _ICNSS_DEBUG_H */
|