hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
/** @file */
/******************************************************************************
 *
 * Copyright(c) 2019 Realtek Corporation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 ******************************************************************************/
 
#ifndef _MAC_AX_ERR_H_
#define _MAC_AX_ERR_H_
 
#define MACSUCCESS    0  /* Success return value */
#define MACPFCB        1  /* Callback of platform is null */
#define MACPFED        2  /* Endian of platform error */
#define MACBADDR    3  /* Invalid base address */
#define MACLSUS        4  /* Leave suspend error */
#define MACNPTR        5  /* Pointer is null */
#define MACCHIPID    6  /* Chip ID is undefined */
#define MACADAPTER    7  /* Can not get MAC adapter */
#define MACSTCAL    8  /* Unexpected structure alignment */
#define MACNOBUF    9  /* Buffer space is not enough */
#define MACBUFSZ    10 /* Buffer size error */
#define MACNOITEM    11 /* Invalid item */
#define MACPOLLTO    12 /* Polling timeout */
#define MACPWRSW    13 /* Power switch fail */
#define MACBUFALLOC    14 /* Buffer allocation fail */
#define MACWQBUSY    15 /* Work queue is busy */
#define MACCMP        16 /* Failed compare result */
#define MACINTF        17 /* Wrong interface */
#define MACFWBIN    18 /* Incorrect FW bin file */
#define MACFFCFG    19 /* Wrong FIFO configuration */
#define MACSAMACID    20 /* Same MACID */
#define MACMACIDFL    21 /* MACID full */
#define MACNOFW        22 /* There is no FW */
#define MACPROCBUSY    23 /* Process is busy */
#define MACPROCERR    24 /* state machine error */
#define MACEFUSEBANK    25 /* switch efuse bank fail */
#define MACEFUSEREAD    26 /* read efuse fail */
#define MACEFUSEWRITE    27 /* write efuse fail */
#define MACEFUSESIZE    28 /* efuse size error */
#define MACEFUSEPARSE    29 /* eeprom parsing fail */
#define MACEFUSECMP    30 /* compare efuse fail */
#define MACSECUREON    31 /* secure on, no host indirect access */
#define MACTXCHDMA    32 /* invalid tx dma channel */
#define MACADDRCAMUPDERR 33 /* address cam update error */
#define MACPWRSTAT    34 /* Power state error */
#define MACSDIOMIXMODE    35 /* SDIO Tx mix mode */
#define MACSDIOSEQERR    36 /* SDIO Tx sequence error */
#define MACHFCH2CQTA    37 /* HCI FC invalid H2C quota */
#define MACHFCCH011QTA    38 /* HCI FC invalid CH0-11 quota */
#define MACHFCCH011GRP    39 /* HCI FC invalid CH0-11 group */
#define MACHFCPUBQTA    40 /* HCI FC invalid public quota */
#define MACHFCPUBINFO    41 /* HCI FC public info error */
#define MACRFPMCAM    42 /* RX forwarding PM CAM access fail */
#define MACHFSWDENOTNUF    43 /* HCI FC WDE page not enough */
#define MACHFSPLENOTNUF    44 /* HCI FC PLE page not enough */
#define MACMEMRO    45 /* Address is not writable */
#define MACFUNCINPUT    46 /* invalid function input */
#define MACALRDYON    47 /* MAC has already powered on */
#define MACADDRCAMFL    48 /* ADDRESS CAM full */
#define MACBSSIDCAMFL    49 /* BSSID CAM full */
#define MACGPIOUSED    50 /* GPIO is used */
#define MACDLELINK    51 /* DLE link error */
#define MACPOLLTXIDLE    52 /* polling Tx idle fail */
#define MACPARSEERR    53 /* parse report err */
#define MACROLEINITFL    54 /* Role API init fail or C2H notify role init fail */
#define MACPORTCFGTYPE    55 /* Port cfg type error */
#define MACPORTERR    56 /* Invalid Port number */
#define MACWNGKEYTYPE    57 /* Sec cam wrong key type*/
#define MACKEYNOTEXT    58 /* Delete key , key not exist*/
#define MACSECCAMFL    59 /* SEC CAM full*/
#define MACADDRCAMKEYFL    60 /* Addr CAM key full*/
#define MACNOROLE    61 /* SEC no this role*/
#define MACHWNOTEN    62 /* hw module not enable*/
#define MACPTMTXFAIL    63 /* platform TX fail*/
#define MACSSLINK    64 /* STA scheduler link error */
#define MACDBGPORTSEL    65 /* Debug port sel error */
#define MACDBGPORTDMP    66 /* Debug port dump error */
#define MACCPWMSEQERR    67 /* CPWM sequence mismatch */
#define MACCPWMSTATERR    68 /* CPWM state mismatch */
#define MACCPUSTATE    69 /* Incorrect CPU state */
#define MACPSSTATFAIL    70 /* protocol power state check tx pause fail */
#define MACLV1STEPERR    71 /* lv1 rcvy step sel error */
#define MACFWCHKSUM    72 /* FW checksum is incorrect */
#define MACFWSECBOOT    73 /* FW security boot is failed */
#define MACFWCUT    74 /* Mismatch chip and FW cut */
#define MACSUBSPCERR    75 /* Beacon sub-space setting fail */
#define MACLENCMP    76 /* Length is not match */
#define MACCHKSUMEMPTY    77 /* Checksum report empty  */
#define MACCHKSUMFAIL    78 /* Checksum report fail  */
#define MACVERERR    79 /* Map and mask version mismatch */
#define MACFWNONRDY    80 /* FW not ready h2c error*/
#define MACGPIONUM    81 /* The gpio number is wrong */
#define MACNOTSUP    82 /* The function is NOT supported */
#define MACCSIBUFIDERR    83 /* CSI buffer index is NOT supported */
#define MACSNDSTSIDERR    84 /* Sounding status ID is NOT supported */
#define MACCCTLWRFAIL    85 /* control info wrrite fail */
#define MACHWNOSUP    86 /* HW not support */
#define MACUNDEFCH    87 /* Channel is undefined */
#define MACHWERR    88 /* HW error */
#define MACFWTESTFAIL    89 /* FW auto test fail */
#define MACP2PSTFAIL    90 /* P2P state fail */
#define MACFLASHFAIL    91 /* FW auto test fail */
#define MACSETVALERR    92 /* Setting value error */
#define MACIOERRPWR    93 /* IO not allow when power not on */
#define MACIOERRSERL1    94 /* IO not allow when SER Lv1 */
#define MACIOERRLPS    95 /* IO not allow when LPS */
#define MACIOERRDMAC    96 /* IO not allow when dmac not en */
#define MACIOERRCMAC0    97 /* IO not allow when cmac0 not en */
#define MACIOERRCMAC1    98 /* IO not allow when cmac1 not en */
#define MACIOERRBB0    99 /* IO not allow when bb0 not en */
#define MACIOERRBB1    100 /* IO not allow when bb1 not en */
#define MACIOERRRF    101 /* IO not allow when rf not en */
#define MACIOERRIND    102 /* IO not allow when indirect access */
#define MACIOERRRSVD    103 /* IO not allow if address is rsvd */
#define MACC2HREGEMP    104 /* C2H reg empty */
#define MACBADC2HREG    105 /* received unexpected c2hreg */
#define MACFIOOFLD    106 /* IO offload fail */
#define MACROLEALOCFL    107 /* C2H notify alloc role failed */
#define MACROLEHWUPDFL    108 /* C2H notify addrcam upd failed*/
#define MACSDIOTXMODE    109 /* SDIO Tx mode undefined*/
#define MACSDIOOPNMODE    110 /* SDIO opn mode unknown*/
#define MACFWSTATUSFAIL 111 /* fw status command fail */
#define MACIOERRPLAT    112 /* IO not allow when platform not on */
#define MACCPWMPWRSTATERR    113 /* CPWM power state mismatch */
#define MACIOERRISH        114 /* IO not allow when io state hang */
#define MACHWDMACERR    115 /* DMAC_ERR_ISR */
#define MACHWCMAC0ERR    116 /* CMAC0_ERR_ISR */
#define MACDRVRM    117 /* driver is removed unexpectedly */
#define MACMCCGPFL    118 /* Get MCC Group index fail*/
#define MACFWSTATEERR    119 /* fw state error */
#define MACFWLOGINTERR 120 /*fw log parsing error*/
#define MACSYSSTEERR    121 /* Whole System Power State error */
#define MACHWCMAC1ERR    122 /* CMAC1_ERR_ISR */
#define MACFWASSERT    123 /* FW Assertion error */
#define MACFWEXCEP    124 /* FW Exception error */
#define MACFWRXI300    125 /* FW RXI300 error */
#define MACFWPCHANG    126 /* FW PC hang error */
#define MACRXDMAHANG    127 /*USB RXDMA HANG */
#define MACUSBRXHANG    128 /*USB RX HANG */
#define MACCPWMINTFERR    129 /* CPWM interface error */
#define MACUSBPAUSEERR    130 /* USB EP PAUSE error */
#define MACARDYDONE    131 /* The flow is already done */
#define MACPSSTATPWRBITFAIL    132 /* protocol power state check pwr bit fail */
#define MACIOERRINSEC    133 /* Security ic not allow indirect access */
#define MACIOTESTERR    140 /* general io test error */
#define MACFWNOSUPPORT    145 /* FW no support */
 
/*MAC DBG Status Indication*/
#define MACSCH_NONEMPTY    1 /* MAC Scheduler non empty */
 
/* Debug Package Indication */
/* STA Scheduler 0, indirect */
#define SS_TX_LEN_BE        BIT(0)
#define SS_TX_LEN_BK        BIT(1)
#define SS_TX_LEN_VI        BIT(2)
#define SS_TX_LEN_VO        BIT(3)
#define SS_LINK_WMM0_BE        BIT(4)
#define SS_LINK_WMM0_BK        (SS_LINK_WMM0_BE << 1)
#define SS_LINK_WMM0_VI        (SS_LINK_WMM0_BE << 2)
#define SS_LINK_WMM0_VO        (SS_LINK_WMM0_BE << 3)
#define SS_LINK_WMM1_BE        (SS_LINK_WMM0_BE << 4)
#define SS_LINK_WMM1_BK        (SS_LINK_WMM0_BE << 5)
#define SS_LINK_WMM1_VI        (SS_LINK_WMM0_BE << 6)
#define SS_LINK_WMM1_VO        (SS_LINK_WMM0_BE << 7)
#define SS_LINK_WMM2_BE        (SS_LINK_WMM0_BE << 8)
#define SS_LINK_WMM2_BK        (SS_LINK_WMM0_BE << 9)
#define SS_LINK_WMM2_VI        (SS_LINK_WMM0_BE << 10)
#define SS_LINK_WMM2_VO        (SS_LINK_WMM0_BE << 11)
#define SS_LINK_WMM3_BE        (SS_LINK_WMM0_BE << 12)
#define SS_LINK_WMM3_BK        (SS_LINK_WMM0_BE << 13)
#define SS_LINK_WMM3_VI        (SS_LINK_WMM0_BE << 14)
#define SS_LINK_WMM3_VO        (SS_LINK_WMM0_BE << 15)
#define SS_LINK_UL        (SS_LINK_WMM0_BE << 16)
#define SS_POLL_OWN_TX_LEN    BIT(24)
#define SS_POLL_OWN_LINK    BIT(25)
#define SS_POLL_STAT_TX_LEN    BIT(26)
#define SS_POLL_STAT_LINK    BIT(27)
/* STA Scheduler 1, direct */
#define SS_TX_HW_LEN_UDN    BIT(0)
#define SS_TX_SW_LEN_UDN    BIT(1)
#define SS_TX_HW_LEN_OVF    BIT(2)
#define SS_STAT_FWTX        BIT(8)
#define SS_STAT_RPTA        BIT(9)
#define SS_STAT_WDEA        BIT(10)
#define SS_STAT_PLEA        BIT(11)
#define SS_STAT_ULRU        BIT(12)
#define SS_STAT_DLTX        BIT(13)
 
#ifdef CONFIG_NEW_HALMAC_INTERFACE
#define PLTFM_MSG_ALWAYS(...)                                                  \
   _os_dbgdump("[MAC][ERR] " fmt, ##__VA_ARGS__)
#else
#define PLTFM_MSG_ALWAYS(...)                                                  \
   adapter->pltfm_cb->msg_print(adapter->drv_adapter, _PHL_ALWAYS_,  __VA_ARGS__)
#endif
 
#if MAC_AX_DBG_MSG_EN
 
#undef PLTFM_MSG_ALWAYS
 
#define    MAC_DBG_MSG(max_buff_len, used_len, buff_addr, remain_len, fmt, ...)\
do {                                    \
   u32 *used_len_tmp = &(used_len);                \
   PLTFM_MUTEX_LOCK(&adapter->fw_dbgcmd.lock);            \
   if (*used_len_tmp < max_buff_len)                \
       *used_len_tmp += PLTFM_SNPRINTF(buff_addr, remain_len, fmt, ##__VA_ARGS__);\
   PLTFM_MUTEX_UNLOCK(&adapter->fw_dbgcmd.lock);            \
} while (0)
 
#define    MAC_LOG2OUTPUT(prefix, ...)\
do {                                    \
   char *output_tmp = adapter->fw_dbgcmd.buf;                \
   u32 output_len_tmp = adapter->fw_dbgcmd.out_len;            \
   u32 *used_tmp = &adapter->fw_dbgcmd.used;                \
   if (adapter->fw_dbgcmd.dbg_console_log_on) {                \
       MAC_DBG_MSG(output_len_tmp, *used_tmp, output_tmp + *used_tmp, \
               output_len_tmp - *used_tmp, \
               prefix); \
       MAC_DBG_MSG(output_len_tmp, *used_tmp, output_tmp + *used_tmp, \
               output_len_tmp - *used_tmp, \
               ##__VA_ARGS__); \
   }                                    \
} while (0)
 
#ifdef CONFIG_NEW_HALMAC_INTERFACE
 
   #if (MAC_AX_MSG_LEVEL >= MAC_AX_MSG_LEVEL_ALWAYS)
   #define PLTFM_MSG_ALWAYS(...)   do { \
       if (adapter->fw_dbgcmd.dbg_bg_log_on)            \
           _os_dbgdump("[MAC][LOG] " fmt, ##__VA_ARGS__);    \
       MAC_LOG2OUTPUT("[MAC][LOG] ", fmt, ##__VA_ARGS__);\
   } while (0)
   #else
   #define PLTFM_MSG_ALWAYS(...)    do {} while (0)
   #endif
 
   /* Enable debug msg depends on  HALMAC_MSG_LEVEL */
   #if (MAC_AX_MSG_LEVEL >= MAC_AX_MSG_LEVEL_ERR)
   #define PLTFM_MSG_ERR(...)      do {\
       if (adapter->fw_dbgcmd.dbg_bg_log_on)            \
           _os_dbgdump("[MAC][ERR] " fmt, ##__VA_ARGS__);    \
       MAC_LOG2OUTPUT("[MAC][ERR] ", fmt, ##__VA_ARGS__);\
   } while (0)
   #else
   #define PLTFM_MSG_ERR(...)    do {} while (0)
   #endif
 
   #if (MAC_AX_MSG_LEVEL >= MAC_AX_MSG_LEVEL_WARNING)
   #define PLTFM_MSG_WARN(...)                                          \
       _os_dbgdump("[MAC][WARN] " fmt, ##__VA_ARGS__)
   #else
   #define PLTFM_MSG_WARN(...)    do {} while (0)
   #endif
 
   #if (MAC_AX_MSG_LEVEL >= MAC_AX_MSG_LEVEL_TRACE)
   #define PLTFM_MSG_TRACE(...)                                         \
       _os_dbgdump("[MAC][TRACE] " fmt, ##__VA_ARGS__)
   #else
   #define PLTFM_MSG_TRACE(...)    do {} while (0)
   #endif
 
#else
 
   #if (MAC_AX_MSG_LEVEL >= MAC_AX_MSG_LEVEL_ALWAYS)
   #define PLTFM_MSG_ALWAYS(...)   do {\
       if (adapter->fw_dbgcmd.dbg_bg_log_on)                \
           adapter->pltfm_cb->msg_print(adapter->drv_adapter,    \
                            _PHL_ALWAYS_, __VA_ARGS__);\
       MAC_LOG2OUTPUT("[MAC][LOG] ", __VA_ARGS__);\
   } while (0)
   #else
   #define PLTFM_MSG_ALWAYS(...)    do {} while (0)
   #endif
 
   /* Enable debug msg depends on  HALMAC_MSG_LEVEL */
   #if (MAC_AX_MSG_LEVEL >= MAC_AX_MSG_LEVEL_ERR)
   #define PLTFM_MSG_ERR(...)      do {\
       if (adapter->fw_dbgcmd.dbg_bg_log_on)                \
           adapter->pltfm_cb->msg_print(adapter->drv_adapter,    \
                            _PHL_ERR_, __VA_ARGS__);    \
       MAC_LOG2OUTPUT("[MAC][ERR] ", __VA_ARGS__);\
   } while (0)
   #else
   #define PLTFM_MSG_ERR(...)    do {} while (0)
   #endif
 
   #if (MAC_AX_MSG_LEVEL >= MAC_AX_MSG_LEVEL_WARNING)
   #define PLTFM_MSG_WARN(...)                                          \
       adapter->pltfm_cb->msg_print(adapter->drv_adapter, _PHL_WARNING_, __VA_ARGS__)
   #else
   #define PLTFM_MSG_WARN(...)    do {} while (0)
   #endif
 
   #if (MAC_AX_MSG_LEVEL >= MAC_AX_MSG_LEVEL_TRACE)
   #define PLTFM_MSG_TRACE(...)                                         \
       adapter->pltfm_cb->msg_print(adapter->drv_adapter, _PHL_DEBUG_, __VA_ARGS__)
   #else
   #define PLTFM_MSG_TRACE(...)    do {} while (0)
   #endif
#endif /*CONFIG_NEW_HALMAC_INTERFACE*/
 
#else
 
/* Disable debug msg  */
#define PLTFM_MSG_ALWAYS(...)    do {} while (0)
#define PLTFM_MSG_ERR(...)    do {} while (0)
#define PLTFM_MSG_WARN(...)    do {} while (0)
#define PLTFM_MSG_TRACE(...)    do {} while (0)
 
#endif
 
#endif