99#include <linux/string.h>
1010#define NONE 0xFFFF
1111
12-
1312//--------------------------------------------------------------------------------
14-
1513/* TYPE and SUBTYPE
1614 * Define valid TYPE (or category or code-path, however you like to think of it)
1715 * and SUBTYPE s.
1816 * Type and SubType are treated as bitmasks.
1917 */
2018/*-----------------BEGIN TYPEs------------------------------------------*/
21- #define DBG_TYPE_INITEXIT (1 << 0) // 1
22- #define DBG_TYPE_TX (1 << 1) // 2
23- #define DBG_TYPE_RX (1 << 2) // 4
24- #define DBG_TYPE_OTHERS (1 << 3) // 8
19+ #define DBG_TYPE_INITEXIT (1 << 0) // 1
20+ #define DBG_TYPE_TX (1 << 1) // 2
21+ #define DBG_TYPE_RX (1 << 2) // 4
22+ #define DBG_TYPE_OTHERS (1 << 3) // 8
2523/*-----------------END TYPEs------------------------------------------*/
26- #define NUMTYPES 4 // careful!
27-
24+ #define NUMTYPES 4 // careful!
2825/*-----------------BEGIN SUBTYPEs---------------------------------------*/
2926
3027/*-SUBTYPEs for TX : TYPE is DBG_TYPE_TX -----//
3128 Transmit.c ,Arp.c, LeakyBucket.c, And Qos.c
3229 total 17 macros */
3330// Transmit.c
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)
31+ #define TX 1
32+ #define MP_SEND (TX << 0)
33+ #define NEXT_SEND (TX << 1)
34+ #define TX_FIFO (TX << 2)
35+ #define TX_CONTROL (TX << 3)
3936
4037// Arp.c
41- #define IP_ADDR (TX<< 4)
42- #define ARP_REQ (TX<< 5)
43- #define ARP_RESP (TX<< 6)
38+ #define IP_ADDR (TX << 4)
39+ #define ARP_REQ (TX << 5)
40+ #define ARP_RESP (TX << 6)
4441
4542// Leakybucket.c
46- #define TOKEN_COUNTS (TX<< 8)
47- #define CHECK_TOKENS (TX<< 9)
48- #define TX_PACKETS (TX<< 10)
49- #define TIMER (TX<< 11)
43+ #define TOKEN_COUNTS (TX << 8)
44+ #define CHECK_TOKENS (TX << 9)
45+ #define TX_PACKETS (TX << 10)
46+ #define TIMER (TX << 11)
5047
5148// Qos.c
52- #define QOS TX
53- #define QUEUE_INDEX (QOS<< 12)
54- #define IPV4_DBG (QOS<< 13)
55- #define IPV6_DBG (QOS<< 14)
56- #define PRUNE_QUEUE (QOS<< 15)
57- #define SEND_QUEUE (QOS<< 16)
49+ #define QOS TX
50+ #define QUEUE_INDEX (QOS << 12)
51+ #define IPV4_DBG (QOS << 13)
52+ #define IPV6_DBG (QOS << 14)
53+ #define PRUNE_QUEUE (QOS << 15)
54+ #define SEND_QUEUE (QOS << 16)
5855
5956//TX_Misc
60- #define TX_OSAL_DBG (TX<<17)
61-
57+ #define TX_OSAL_DBG (TX << 17)
6258
6359//--SUBTYPEs for ------INIT & EXIT---------------------
6460/*------------ TYPE is DBG_TYPE_INITEXIT -----//
6561DriverEntry.c, bcmfwup.c, ChipDetectTask.c, HaltnReset.c, InterfaceDDR.c */
66- #define MP 1
67- #define DRV_ENTRY (MP<<0)
68- #define MP_INIT (MP<<1)
69- #define READ_REG (MP<<3)
70- #define DISPATCH (MP<<2)
71- #define CLAIM_ADAP (MP<<4)
72- #define REG_IO_PORT (MP<<5)
73- #define INIT_DISP (MP<<6)
74- #define RX_INIT (MP<<7)
75-
62+ #define MP 1
63+ #define DRV_ENTRY (MP << 0)
64+ #define MP_INIT (MP << 1)
65+ #define READ_REG (MP << 3)
66+ #define DISPATCH (MP << 2)
67+ #define CLAIM_ADAP (MP << 4)
68+ #define REG_IO_PORT (MP << 5)
69+ #define INIT_DISP (MP << 6)
70+ #define RX_INIT (MP << 7)
7671
7772//-SUBTYPEs for --RX----------------------------------
7873//------------RX : TYPE is DBG_TYPE_RX -----//
7974// Receive.c
80- #define RX 1
81- #define RX_DPC (RX<<0)
82- #define RX_CTRL (RX<<3)
83- #define RX_DATA (RX<<4)
84- #define MP_RETURN (RX<<1)
85- #define LINK_MSG (RX<<2)
86-
75+ #define RX 1
76+ #define RX_DPC (RX << 0)
77+ #define RX_CTRL (RX << 3)
78+ #define RX_DATA (RX << 4)
79+ #define MP_RETURN (RX << 1)
80+ #define LINK_MSG (RX << 2)
8781
8882//-SUBTYPEs for ----OTHER ROUTINES------------------
8983//------------OTHERS : TYPE is DBG_TYPE_OTHER -----//
9084// HaltnReset,CheckForHang,PnP,Misc,CmHost
9185// total 12 macros
92- #define OTHERS 1
86+ #define OTHERS 1
9387// ??ISR.C
94-
95- #define ISR OTHERS
96- #define MP_DPC (ISR<<0)
88+ #define ISR OTHERS
89+ #define MP_DPC (ISR << 0)
9790
9891// HaltnReset.c
99- #define HALT OTHERS
100- #define MP_HALT (HALT<< 1)
101- #define CHECK_HANG (HALT<< 2)
102- #define MP_RESET (HALT<< 3)
103- #define MP_SHUTDOWN (HALT<< 4)
92+ #define HALT OTHERS
93+ #define MP_HALT (HALT << 1)
94+ #define CHECK_HANG (HALT << 2)
95+ #define MP_RESET (HALT << 3)
96+ #define MP_SHUTDOWN (HALT << 4)
10497
10598// pnp.c
106- #define PNP OTHERS
107- #define MP_PNP (PNP<< 5)
99+ #define PNP OTHERS
100+ #define MP_PNP (PNP << 5)
108101
109102// Misc.c
110- #define MISC OTHERS
111- #define DUMP_INFO (MISC<< 6)
112- #define CLASSIFY (MISC<< 7)
113- #define LINK_UP_MSG (MISC<< 8)
114- #define CP_CTRL_PKT (MISC<< 9)
115- #define DUMP_CONTROL (MISC<< 10)
116- #define LED_DUMP_INFO (MISC<< 11)
103+ #define MISC OTHERS
104+ #define DUMP_INFO (MISC << 6)
105+ #define CLASSIFY (MISC << 7)
106+ #define LINK_UP_MSG (MISC << 8)
107+ #define CP_CTRL_PKT (MISC << 9)
108+ #define DUMP_CONTROL (MISC << 10)
109+ #define LED_DUMP_INFO (MISC << 11)
117110
118111// CmHost.c
119- #define CMHOST OTHERS
120-
121-
122- #define SERIAL (OTHERS<<12)
123- #define IDLE_MODE (OTHERS<<13)
124-
125- #define WRM (OTHERS<<14)
126- #define RDM (OTHERS<<15)
112+ #define CMHOST OTHERS
113+ #define SERIAL (OTHERS << 12)
114+ #define IDLE_MODE (OTHERS << 13)
115+ #define WRM (OTHERS << 14)
116+ #define RDM (OTHERS << 15)
127117
128118// TODO - put PHS_SEND in Tx PHS_RECEIVE in Rx path ?
129- #define PHS_SEND (OTHERS<< 16)
130- #define PHS_RECEIVE (OTHERS<< 17)
131- #define PHS_MODULE (OTHERS<< 18)
132-
133- #define INTF_INIT (OTHERS<< 19)
134- #define INTF_ERR (OTHERS<< 20)
135- #define INTF_WARN (OTHERS<< 21)
136- #define INTF_NORM (OTHERS<< 22)
137-
138- #define IRP_COMPLETION (OTHERS<< 23)
139- #define SF_DESCRIPTOR_CNTS (OTHERS<< 24)
140- #define PHS_DISPATCH (OTHERS << 25)
141- #define OSAL_DBG (OTHERS << 26)
142- #define NVM_RW (OTHERS << 27)
143-
144- #define HOST_MIBS (OTHERS << 28)
145- #define CONN_MSG (CMHOST << 29)
119+ #define PHS_SEND (OTHERS << 16)
120+ #define PHS_RECEIVE (OTHERS << 17)
121+ #define PHS_MODULE (OTHERS << 18)
122+
123+ #define INTF_INIT (OTHERS << 19)
124+ #define INTF_ERR (OTHERS << 20)
125+ #define INTF_WARN (OTHERS << 21)
126+ #define INTF_NORM (OTHERS << 22)
127+
128+ #define IRP_COMPLETION (OTHERS << 23)
129+ #define SF_DESCRIPTOR_CNTS (OTHERS << 24)
130+ #define PHS_DISPATCH (OTHERS << 25)
131+ #define OSAL_DBG (OTHERS << 26)
132+ #define NVM_RW (OTHERS << 27)
133+
134+ #define HOST_MIBS (OTHERS << 28)
135+ #define CONN_MSG (CMHOST << 29)
146136/*-----------------END SUBTYPEs------------------------------------------*/
147137
148-
149138/* Debug level
150139 * We have 8 debug levels, in (numerical) increasing order of verbosity.
151140 * IMP: Currently implementing ONLY DBG_LVL_ALL , i.e. , all debug prints will
@@ -157,16 +146,16 @@ DriverEntry.c, bcmfwup.c, ChipDetectTask.c, HaltnReset.c, InterfaceDDR.c */
157146 * You can compile-time change that to any of the below, if you wish to. However, as of now, there's
158147 * no dynamic facility to have the userspace 'TestApp' set debug_level. Slated for future expansion.
159148 */
160- #define BCM_ALL 7
161- #define BCM_LOW 6
162- #define BCM_PRINT 5
163- #define BCM_NORMAL 4
164- #define BCM_MEDIUM 3
165- #define BCM_SCREAM 2
166- #define BCM_ERR 1
149+ #define BCM_ALL 7
150+ #define BCM_LOW 6
151+ #define BCM_PRINT 5
152+ #define BCM_NORMAL 4
153+ #define BCM_MEDIUM 3
154+ #define BCM_SCREAM 2
155+ #define BCM_ERR 1
167156/* Not meant for developer in debug prints.
168157 * To be used to disable all prints by setting the DBG_LVL_CURR to this value */
169- #define BCM_NONE 0
158+ #define BCM_NONE 0
170159
171160/* The current driver logging level.
172161 * Everything at this level and (numerically) lower (meaning higher prio)
@@ -177,7 +166,7 @@ DriverEntry.c, bcmfwup.c, ChipDetectTask.c, HaltnReset.c, InterfaceDDR.c */
177166 */
178167
179168#define DBG_LVL_CURR (BCM_ALL)
180- #define DBG_LVL_ALL BCM_ALL
169+ #define DBG_LVL_ALL BCM_ALL
181170
182171/*---Userspace mapping of Debug State.
183172 * Delibrately matches that of the Windows driver..
@@ -215,40 +204,39 @@ typedef struct _S_BCM_DEBUG_STATE {
215204 if (DBG_TYPE_PRINTK == Type) \
216205 pr_info("%s:" string, __func__, ##args); \
217206 else if (Adapter && \
218- (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \
219- (Type & Adapter->stDebugState.type) && \
220- (SubType & Adapter->stDebugState.subtype[Type])) { \
207+ (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \
208+ (Type & Adapter->stDebugState.type) && \
209+ (SubType & Adapter->stDebugState.subtype[Type])) { \
221210 if (dbg_level & DBG_NO_FUNC_PRINT) \
222211 printk(KERN_DEBUG string, ##args); \
223212 else \
224- printk(KERN_DEBUG "%s:" string, __func__, ##args); \
213+ printk(KERN_DEBUG "%s:" string, __func__, ##args); \
214+ } \
215+ } while (0)
216+
217+ #define BCM_DEBUG_PRINT_BUFFER (Adapter , Type , SubType , dbg_level , buffer , bufferlen ) \
218+ do { \
219+ if (DBG_TYPE_PRINTK == Type || \
220+ (Adapter && \
221+ (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \
222+ (Type & Adapter->stDebugState.type) && \
223+ (SubType & Adapter->stDebugState.subtype[Type]))) { \
224+ printk(KERN_DEBUG "%s:\n", __func__); \
225+ print_hex_dump(KERN_DEBUG, " ", DUMP_PREFIX_OFFSET, \
226+ 16, 1, buffer, bufferlen, false); \
225227 } \
226228 } while (0)
227229
228- #define BCM_DEBUG_PRINT_BUFFER (Adapter , Type , SubType , dbg_level , buffer , bufferlen ) do { \
229- if (DBG_TYPE_PRINTK == Type || \
230- (Adapter && \
231- (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level && \
232- (Type & Adapter->stDebugState.type) && \
233- (SubType & Adapter->stDebugState.subtype[Type]))) { \
234- printk(KERN_DEBUG "%s:\n", __func__); \
235- print_hex_dump(KERN_DEBUG, " ", DUMP_PREFIX_OFFSET, \
236- 16, 1, buffer, bufferlen, false); \
237- } \
238- } while(0)
239-
240-
241- #define BCM_SHOW_DEBUG_BITMAP (Adapter ) do { \
242- int i; \
243- for (i=0; i<(NUMTYPES*2)+1; i++) { \
230+ #define BCM_SHOW_DEBUG_BITMAP (Adapter ) do { \
231+ int i; \
232+ for (i = 0; i < (NUMTYPES * 2) + 1; i++) { \
244233 if ((i == 1) || (i == 2) || (i == 4) || (i == 8)) { \
245- /* CAUTION! Forcefully turn on ALL debug paths and subpaths! \
246- Adapter->stDebugState.subtype[i] = 0xffffffff; */ \
247- BCM_DEBUG_PRINT (Adapter , DBG_TYPE_PRINTK , 0 , 0 , "subtype[%d] = 0x%08x\n" , \
248- i , Adapter -> stDebugState .subtype [i ]); \
234+ /* CAUTION! Forcefully turn on ALL debug paths and subpaths! \
235+ Adapter->stDebugState.subtype[i] = 0xffffffff; */ \
236+ BCM_DEBUG_PRINT (Adapter , DBG_TYPE_PRINTK , 0 , 0 , "subtype[%d] = 0x%08x\n" , \
237+ i , Adapter -> stDebugState .subtype [i ]); \
249238 } \
250239 } \
251240} while (0 )
252241
253242#endif
254-
0 commit comments