1
2
3
4
5
6
7#ifndef _DEBUG_H
8#define _DEBUG_H
9#include <linux/string.h>
10#define NONE 0xFFFF
11
12
13
14
15
16
17
18
19
20
21#define DBG_TYPE_INITEXIT (1 << 0)
22#define DBG_TYPE_TX (1 << 1)
23#define DBG_TYPE_RX (1 << 2)
24#define DBG_TYPE_OTHERS (1 << 3)
25
26#define NUMTYPES 4
27
28
29
30
31
32
33
34#define TX 1
35#define MP_SEND (TX<<0)
36#define NEXT_SEND (TX<<1)
37#define TX_FIFO (TX<<2)
38#define TX_CONTROL (TX<<3)
39
40
41#define IP_ADDR (TX<<4)
42#define ARP_REQ (TX<<5)
43#define ARP_RESP (TX<<6)
44
45
46
47
48
49
50#define TOKEN_COUNTS (TX<<8)
51#define CHECK_TOKENS (TX<<9)
52#define TX_PACKETS (TX<<10)
53#define TIMER (TX<<11)
54
55
56#define QOS TX
57#define QUEUE_INDEX (QOS<<12)
58#define IPV4_DBG (QOS<<13)
59#define IPV6_DBG (QOS<<14)
60#define PRUNE_QUEUE (QOS<<15)
61#define SEND_QUEUE (QOS<<16)
62
63
64#define TX_OSAL_DBG (TX<<17)
65
66
67
68
69
70#define MP 1
71#define DRV_ENTRY (MP<<0)
72#define MP_INIT (MP<<1)
73#define READ_REG (MP<<3)
74#define DISPATCH (MP<<2)
75#define CLAIM_ADAP (MP<<4)
76#define REG_IO_PORT (MP<<5)
77#define INIT_DISP (MP<<6)
78#define RX_INIT (MP<<7)
79
80
81
82
83
84#define RX 1
85#define RX_DPC (RX<<0)
86#define RX_CTRL (RX<<3)
87#define RX_DATA (RX<<4)
88#define MP_RETURN (RX<<1)
89#define LINK_MSG (RX<<2)
90
91
92
93
94
95
96#define OTHERS 1
97
98
99#define ISR OTHERS
100#define MP_DPC (ISR<<0)
101
102
103#define HALT OTHERS
104#define MP_HALT (HALT<<1)
105#define CHECK_HANG (HALT<<2)
106#define MP_RESET (HALT<<3)
107#define MP_SHUTDOWN (HALT<<4)
108
109
110#define PNP OTHERS
111#define MP_PNP (PNP<<5)
112
113
114#define MISC OTHERS
115#define DUMP_INFO (MISC<<6)
116#define CLASSIFY (MISC<<7)
117#define LINK_UP_MSG (MISC<<8)
118#define CP_CTRL_PKT (MISC<<9)
119#define DUMP_CONTROL (MISC<<10)
120#define LED_DUMP_INFO (MISC<<11)
121
122
123#define CMHOST OTHERS
124
125
126#define SERIAL (OTHERS<<12)
127#define IDLE_MODE (OTHERS<<13)
128
129#define WRM (OTHERS<<14)
130#define RDM (OTHERS<<15)
131
132
133#define PHS_SEND (OTHERS<<16)
134#define PHS_RECIEVE (OTHERS<<17)
135#define PHS_MODULE (OTHERS<<18)
136
137#define INTF_INIT (OTHERS<<19)
138#define INTF_ERR (OTHERS<<20)
139#define INTF_WARN (OTHERS<<21)
140#define INTF_NORM (OTHERS<<22)
141
142#define IRP_COMPLETION (OTHERS<<23)
143#define SF_DESCRIPTOR_CNTS (OTHERS<<24)
144#define PHS_DISPATCH (OTHERS << 25)
145#define OSAL_DBG (OTHERS << 26)
146#define NVM_RW (OTHERS << 27)
147
148#define HOST_MIBS (OTHERS << 28)
149#define CONN_MSG (CMHOST << 29)
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165#define BCM_ALL 7
166#define BCM_LOW 6
167#define BCM_PRINT 5
168#define BCM_NORMAL 4
169#define BCM_MEDIUM 3
170#define BCM_SCREAM 2
171#define BCM_ERR 1
172
173
174#define BCM_NONE 0
175
176
177
178
179
180
181
182
183
184#define DBG_LVL_CURR (BCM_ALL)
185#define DBG_LVL_ALL BCM_ALL
186
187
188
189
190
191typedef struct
192{
193 unsigned int Subtype, Type;
194 unsigned int OnOff;
195
196} __attribute__((packed)) USER_BCM_DBG_STATE;
197
198
199typedef struct _S_BCM_DEBUG_STATE {
200 UINT type;
201
202
203
204
205
206 UINT subtype[(NUMTYPES*2)+1];
207 UINT debug_level;
208} S_BCM_DEBUG_STATE;
209
210
211
212#define DBG_NO_FUNC_PRINT 1 << 31
213#define DBG_LVL_BITMASK 0xFF
214
215
216#define DBG_TYPE_PRINTK 3
217
218#define BCM_DEBUG_PRINT(Adapter, Type, SubType, dbg_level, string, args...) \
219 do { \
220 if (DBG_TYPE_PRINTK == Type) \
221 pr_info("%s:" string, __func__, ##args); \
222 else if (Adapter && \
223 (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \
224 (Type & Adapter->stDebugState.type) && \
225 (SubType & Adapter->stDebugState.subtype[Type])) { \
226 if (dbg_level & DBG_NO_FUNC_PRINT) \
227 printk(KERN_DEBUG string, ##args); \
228 else \
229 printk(KERN_DEBUG "%s:" string, __func__, ##args); \
230 } \
231 } while (0)
232
233#define BCM_DEBUG_PRINT_BUFFER(Adapter, Type, SubType, dbg_level, buffer, bufferlen) do { \
234 if (DBG_TYPE_PRINTK == Type || \
235 (Adapter && \
236 (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \
237 (Type & Adapter->stDebugState.type) && \
238 (SubType & Adapter->stDebugState.subtype[Type]))) { \
239 printk(KERN_DEBUG "%s:\n", __func__); \
240 print_hex_dump(KERN_DEBUG, " ", DUMP_PREFIX_OFFSET, \
241 16, 1, buffer, bufferlen, false); \
242 } \
243} while(0)
244
245
246#define BCM_SHOW_DEBUG_BITMAP(Adapter) do { \
247 int i; \
248 for (i=0; i<(NUMTYPES*2)+1; i++) { \
249 if ((i == 1) || (i == 2) || (i == 4) || (i == 8)) { \
250
251 \
252 BCM_DEBUG_PRINT (Adapter, DBG_TYPE_PRINTK, 0, 0, "subtype[%d] = 0x%08x\n", \
253 i, Adapter->stDebugState.subtype[i]); \
254 } \
255 } \
256} while (0)
257
258#endif
259
260