blob: 828eee7298dd736c6acbe0f51b2b76d8240395e3 [file] [log] [blame]
developer66e89bc2024-04-23 14:50:01 +08001From 6b19a7a6cfa1095afbf622419d085c54e11d05b3 Mon Sep 17 00:00:00 2001
2From: Shayne Chen <shayne.chen@mediatek.com>
3Date: Fri, 24 Mar 2023 14:02:32 +0800
4Subject: [PATCH 020/116] mtk: wifi: mt76: mt7996: add debug tool
5
6Change-Id: Ie10390b01f17db893dbfbf3221bf63a4bd1fe38f
7Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
8
9Add PSM bit in sta_info
10
11CR-Id: WCNCR00240772
12Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
13Change-Id: I591b558a9eec2fbd46d166c9bb1580a94e22072c
14
15Remove the duplicate function in mtk_debugfs.c & mtk_debug_i.c
16Only enable mt7996_mcu_fw_log_2_host function in mcu.c
17
18CR-ID: WCNCR00240597
19Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
20
21Support more ids category NDPA/NDP TXD/FBK and debug log recommended by
22CTD members.
23
24This commit equals to run the follwoing commands on Logan driver:
25command:
261. iwpriv ra0 set fw_dbg=1:84
272. iwpriv ra0 set fw_dbg=2:84
283. iwpriv ra0 set fw_dbg=1:101
29
30CR-Id: WCNCR00261410
31Change-Id: Ifddd4db86982d39f2d39d198b8f5d3e7028983c2
32Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
33
34mtk: wifi: mt76: mt7996: add wtbl_info support for mt7992
35
36Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
37
38mtk: wifi: mt76: mt7996: add mt7992 & mt7996 CR debug offset revision
39
40Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
41
42mtk: wifi: mt76: mt7992: refactor code for FW log
43
44Refactor code for FW log.
45
46CR-Id: WCNCR00298425
47Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
48Change-Id: I00c760b31009142848e32b1249d305800585e7fd
49
50mtk: wifi: mt76: mt7996: support disable muru debug info when recording fwlog
51
52When we record fwlog, we will also enable recording muru debug info log by
53default. However, in certain test scenarios, this can result in
54recording too many logs, causing inconvenience during issue analysis.
55Therefore, this commit adds an debug option, fw_debug_muru_disable, in
56debugfs. User can modify this option to enable/disable recording muru
57debug info log.
58
59[Usage]
60Set:
61$ echo val > debugfs/fw_debug_muru_disable
62Get:
63$ cat debugfs/fw_debug_muru_disable
64
65val can be the following values:
660 = enable recording muru debug info (Default value)
671 = disable recording muru debug info
68
69Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
70
71mtk: wifi: mt76: mt7996: add adie id & ver dump
72
73Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
74---
75 mt76.h | 2 +
76 mt7996/Makefile | 4 +
77 mt7996/coredump.c | 10 +-
78 mt7996/coredump.h | 7 +
79 mt7996/debugfs.c | 128 ++-
80 mt7996/mac.c | 3 +
81 mt7996/mt7996.h | 13 +
82 mt7996/mtk_debug.h | 2286 ++++++++++++++++++++++++++++++++++++++
83 mt7996/mtk_debugfs.c | 2507 ++++++++++++++++++++++++++++++++++++++++++
84 mt7996/mtk_mcu.c | 39 +
85 mt7996/mtk_mcu.h | 19 +
86 tools/fwlog.c | 25 +-
87 12 files changed, 5018 insertions(+), 25 deletions(-)
88 create mode 100644 mt7996/mtk_debug.h
89 create mode 100644 mt7996/mtk_debugfs.c
90 create mode 100644 mt7996/mtk_mcu.c
91 create mode 100644 mt7996/mtk_mcu.h
92
93diff --git a/mt76.h b/mt76.h
94index 2cbea731e..599787db2 100644
95--- a/mt76.h
96+++ b/mt76.h
97@@ -399,6 +399,8 @@ struct mt76_txwi_cache {
98 struct sk_buff *skb;
99 void *ptr;
100 };
101+
102+ unsigned long jiffies;
103 };
104
105 struct mt76_rx_tid {
106diff --git a/mt7996/Makefile b/mt7996/Makefile
107index 07c8b555c..a056b40e0 100644
108--- a/mt7996/Makefile
109+++ b/mt7996/Makefile
110@@ -1,4 +1,6 @@
111 # SPDX-License-Identifier: ISC
112+EXTRA_CFLAGS += -DCONFIG_MT76_LEDS
113+EXTRA_CFLAGS += -DCONFIG_MTK_DEBUG
114
115 obj-$(CONFIG_MT7996E) += mt7996e.o
116
117@@ -6,3 +8,5 @@ mt7996e-y := pci.o init.o dma.o eeprom.o main.o mcu.o mac.o \
118 debugfs.o mmio.o
119
120 mt7996e-$(CONFIG_DEV_COREDUMP) += coredump.o
121+
122+mt7996e-y += mtk_debugfs.o mtk_mcu.o
123diff --git a/mt7996/coredump.c b/mt7996/coredump.c
124index 60b88085c..a7f91b56d 100644
125--- a/mt7996/coredump.c
126+++ b/mt7996/coredump.c
127@@ -195,7 +195,7 @@ mt7996_coredump_fw_stack(struct mt7996_dev *dev, u8 type, struct mt7996_coredump
128 }
129 }
130
131-static struct mt7996_coredump *mt7996_coredump_build(struct mt7996_dev *dev, u8 type)
132+struct mt7996_coredump *mt7996_coredump_build(struct mt7996_dev *dev, u8 type, bool full_dump)
133 {
134 struct mt7996_crash_data *crash_data = dev->coredump.crash_data[type];
135 struct mt7996_coredump *dump;
136@@ -206,7 +206,7 @@ static struct mt7996_coredump *mt7996_coredump_build(struct mt7996_dev *dev, u8
137
138 len = hdr_len;
139
140- if (coredump_memdump && crash_data->memdump_buf_len)
141+ if (full_dump && coredump_memdump && crash_data->memdump_buf_len)
142 len += sizeof(*dump_mem) + crash_data->memdump_buf_len;
143
144 sofar += hdr_len;
145@@ -248,6 +248,9 @@ static struct mt7996_coredump *mt7996_coredump_build(struct mt7996_dev *dev, u8
146 mt7996_coredump_fw_state(dev, type, dump, &exception);
147 mt7996_coredump_fw_stack(dev, type, dump, exception);
148
149+ if (!full_dump)
150+ goto skip_dump_mem;
151+
152 /* gather memory content */
153 dump_mem = (struct mt7996_coredump_mem *)(buf + sofar);
154 dump_mem->len = crash_data->memdump_buf_len;
155@@ -255,6 +258,7 @@ static struct mt7996_coredump *mt7996_coredump_build(struct mt7996_dev *dev, u8
156 memcpy(dump_mem->data, crash_data->memdump_buf,
157 crash_data->memdump_buf_len);
158
159+skip_dump_mem:
160 mutex_unlock(&dev->dump_mutex);
161
162 return dump;
163@@ -264,7 +268,7 @@ int mt7996_coredump_submit(struct mt7996_dev *dev, u8 type)
164 {
165 struct mt7996_coredump *dump;
166
167- dump = mt7996_coredump_build(dev, type);
168+ dump = mt7996_coredump_build(dev, type, true);
169 if (!dump) {
170 dev_warn(dev->mt76.dev, "no crash dump data found\n");
171 return -ENODATA;
172diff --git a/mt7996/coredump.h b/mt7996/coredump.h
173index 01ed3731c..93cd84a03 100644
174--- a/mt7996/coredump.h
175+++ b/mt7996/coredump.h
176@@ -75,6 +75,7 @@ struct mt7996_mem_region {
177 const struct mt7996_mem_region *
178 mt7996_coredump_get_mem_layout(struct mt7996_dev *dev, u8 type, u32 *num);
179 struct mt7996_crash_data *mt7996_coredump_new(struct mt7996_dev *dev, u8 type);
180+struct mt7996_coredump *mt7996_coredump_build(struct mt7996_dev *dev, u8 type, bool full_dump);
181 int mt7996_coredump_submit(struct mt7996_dev *dev, u8 type);
182 int mt7996_coredump_register(struct mt7996_dev *dev);
183 void mt7996_coredump_unregister(struct mt7996_dev *dev);
184@@ -92,6 +93,12 @@ static inline int mt7996_coredump_submit(struct mt7996_dev *dev, u8 type)
185 return 0;
186 }
187
188+static inline struct
189+mt7996_coredump *mt7996_coredump_build(struct mt7996_dev *dev, u8 type, bool full_dump)
190+{
191+ return NULL;
192+}
193+
194 static inline struct
195 mt7996_crash_data *mt7996_coredump_new(struct mt7996_dev *dev, u8 type)
196 {
197diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
198index 62c03d088..344c759c0 100644
199--- a/mt7996/debugfs.c
200+++ b/mt7996/debugfs.c
201@@ -295,11 +295,39 @@ mt7996_fw_debug_wm_set(void *data, u64 val)
202 DEBUG_SPL,
203 DEBUG_RPT_RX,
204 DEBUG_RPT_RA = 68,
205- } debug;
206+ DEBUG_IDS_SND = 84,
207+ DEBUG_IDS_PP = 93,
208+ DEBUG_IDS_RA = 94,
209+ DEBUG_IDS_BF = 95,
210+ DEBUG_IDS_SR = 96,
211+ DEBUG_IDS_RU = 97,
212+ DEBUG_IDS_MUMIMO = 98,
213+ DEBUG_IDS_ERR_LOG = 101,
214+ };
215+ u8 debug_category[] = {
216+ DEBUG_TXCMD,
217+ DEBUG_CMD_RPT_TX,
218+ DEBUG_CMD_RPT_TRIG,
219+ DEBUG_SPL,
220+ DEBUG_RPT_RX,
221+ DEBUG_RPT_RA,
222+ DEBUG_IDS_SND,
223+ DEBUG_IDS_PP,
224+ DEBUG_IDS_RA,
225+ DEBUG_IDS_BF,
226+ DEBUG_IDS_SR,
227+ DEBUG_IDS_RU,
228+ DEBUG_IDS_MUMIMO,
229+ DEBUG_IDS_ERR_LOG,
230+ };
231 bool tx, rx, en;
232 int ret;
233+ u8 i;
234
235 dev->fw_debug_wm = val ? MCU_FW_LOG_TO_HOST : 0;
236+#ifdef CONFIG_MTK_DEBUG
237+ dev->fw_debug_wm = val;
238+#endif
239
240 if (dev->fw_debug_bin)
241 val = MCU_FW_LOG_RELAY;
242@@ -314,18 +342,21 @@ mt7996_fw_debug_wm_set(void *data, u64 val)
243 if (ret)
244 return ret;
245
246- for (debug = DEBUG_TXCMD; debug <= DEBUG_RPT_RA; debug++) {
247- if (debug == 67)
248- continue;
249-
250- if (debug == DEBUG_RPT_RX)
251+ for (i = 0; i < ARRAY_SIZE(debug_category); i++) {
252+ if (debug_category[i] == DEBUG_RPT_RX)
253 val = en && rx;
254 else
255 val = en && tx;
256
257- ret = mt7996_mcu_fw_dbg_ctrl(dev, debug, val);
258+ ret = mt7996_mcu_fw_dbg_ctrl(dev, debug_category[i], val);
259 if (ret)
260 return ret;
261+
262+ if (debug_category[i] == DEBUG_IDS_SND && en) {
263+ ret = mt7996_mcu_fw_dbg_ctrl(dev, debug_category[i], 2);
264+ if (ret)
265+ return ret;
266+ }
267 }
268
269 return 0;
270@@ -397,6 +428,39 @@ remove_buf_file_cb(struct dentry *f)
271 return 0;
272 }
273
274+static int
275+mt7996_fw_debug_muru_set(void *data)
276+{
277+ struct mt7996_dev *dev = data;
278+ enum {
279+ DEBUG_BSRP_STATUS = 256,
280+ DEBUG_TX_DATA_BYTE_CONUT,
281+ DEBUG_RX_DATA_BYTE_CONUT,
282+ DEBUG_RX_TOTAL_BYTE_CONUT,
283+ DEBUG_INVALID_TID_BSR,
284+ DEBUG_UL_LONG_TERM_PPDU_TYPE,
285+ DEBUG_DL_LONG_TERM_PPDU_TYPE,
286+ DEBUG_PPDU_CLASS_TRIG_ONOFF,
287+ DEBUG_AIRTIME_BUSY_STATUS,
288+ DEBUG_UL_OFDMA_MIMO_STATUS,
289+ DEBUG_RU_CANDIDATE,
290+ DEBUG_MEC_UPDATE_AMSDU,
291+ } debug;
292+ int ret;
293+
294+ if (dev->fw_debug_muru_disable)
295+ return 0;
296+
297+ for (debug = DEBUG_BSRP_STATUS; debug <= DEBUG_MEC_UPDATE_AMSDU; debug++) {
298+ ret = mt7996_mcu_muru_dbg_info(dev, debug,
299+ dev->fw_debug_bin & BIT(0));
300+ if (ret)
301+ return ret;
302+ }
303+
304+ return 0;
305+}
306+
307 static int
308 mt7996_fw_debug_bin_set(void *data, u64 val)
309 {
310@@ -405,17 +469,23 @@ mt7996_fw_debug_bin_set(void *data, u64 val)
311 .remove_buf_file = remove_buf_file_cb,
312 };
313 struct mt7996_dev *dev = data;
314+ int ret;
315
316- if (!dev->relay_fwlog)
317+ if (!dev->relay_fwlog) {
318 dev->relay_fwlog = relay_open("fwlog_data", dev->debugfs_dir,
319 1500, 512, &relay_cb, NULL);
320- if (!dev->relay_fwlog)
321- return -ENOMEM;
322+ if (!dev->relay_fwlog)
323+ return -ENOMEM;
324+ }
325
326 dev->fw_debug_bin = val;
327
328 relay_reset(dev->relay_fwlog);
329
330+ ret = mt7996_fw_debug_muru_set(dev);
331+ if (ret)
332+ return ret;
333+
334 return mt7996_fw_debug_wm_set(dev, dev->fw_debug_wm);
335 }
336
337@@ -785,6 +855,30 @@ mt7996_rf_regval_set(void *data, u64 val)
338 DEFINE_DEBUGFS_ATTRIBUTE(fops_rf_regval, mt7996_rf_regval_get,
339 mt7996_rf_regval_set, "0x%08llx\n");
340
341+static int
342+mt7996_fw_debug_muru_disable_set(void *data, u64 val)
343+{
344+ struct mt7996_dev *dev = data;
345+
346+ dev->fw_debug_muru_disable = !!val;
347+
348+ return 0;
349+}
350+
351+static int
352+mt7996_fw_debug_muru_disable_get(void *data, u64 *val)
353+{
354+ struct mt7996_dev *dev = data;
355+
356+ *val = dev->fw_debug_muru_disable;
357+
358+ return 0;
359+}
360+
361+DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_debug_muru_disable,
362+ mt7996_fw_debug_muru_disable_get,
363+ mt7996_fw_debug_muru_disable_set, "%lld\n");
364+
365 int mt7996_init_debugfs(struct mt7996_phy *phy)
366 {
367 struct mt7996_dev *dev = phy->dev;
368@@ -820,10 +914,17 @@ int mt7996_init_debugfs(struct mt7996_phy *phy)
369 debugfs_create_devm_seqfile(dev->mt76.dev, "rdd_monitor", dir,
370 mt7996_rdd_monitor);
371 }
372+ debugfs_create_file("fw_debug_muru_disable", 0600, dir, dev,
373+ &fops_fw_debug_muru_disable);
374
375 if (phy == &dev->phy)
376 dev->debugfs_dir = dir;
377
378+#ifdef CONFIG_MTK_DEBUG
379+ debugfs_create_u16("wlan_idx", 0600, dir, &dev->wlan_idx);
380+ mt7996_mtk_init_debugfs(phy, dir);
381+#endif
382+
383 return 0;
384 }
385
386@@ -835,7 +936,11 @@ mt7996_debugfs_write_fwlog(struct mt7996_dev *dev, const void *hdr, int hdrlen,
387 unsigned long flags;
388 void *dest;
389
390+ if (!dev->relay_fwlog)
391+ return;
392+
393 spin_lock_irqsave(&lock, flags);
394+
395 dest = relay_reserve(dev->relay_fwlog, hdrlen + len + 4);
396 if (dest) {
397 *(u32 *)dest = hdrlen + len;
398@@ -868,9 +973,6 @@ void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int
399 .msg_type = cpu_to_le16(PKT_TYPE_RX_FW_MONITOR),
400 };
401
402- if (!dev->relay_fwlog)
403- return;
404-
405 hdr.serial_id = cpu_to_le16(dev->fw_debug_seq++);
406 hdr.timestamp = cpu_to_le32(mt76_rr(dev, MT_LPON_FRCR(0)));
407 hdr.len = *(__le16 *)data;
408diff --git a/mt7996/mac.c b/mt7996/mac.c
409index d88bbfb24..1f53d2303 100644
410--- a/mt7996/mac.c
411+++ b/mt7996/mac.c
412@@ -936,6 +936,9 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
413 id = mt76_token_consume(mdev, &t);
414 if (id < 0)
415 return id;
416+#ifdef CONFIG_MTK_DEBUG
417+ t->jiffies = jiffies;
418+#endif
419
420 pid = mt76_tx_status_skb_add(mdev, wcid, tx_info->skb);
421 memset(txwi_ptr, 0, MT_TXD_SIZE);
422diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
423index e12ad318d..696e16fa1 100644
424--- a/mt7996/mt7996.h
425+++ b/mt7996/mt7996.h
426@@ -362,6 +362,7 @@ struct mt7996_dev {
427 u8 fw_debug_wa;
428 u8 fw_debug_bin;
429 u16 fw_debug_seq;
430+ bool fw_debug_muru_disable;
431
432 struct dentry *debugfs_dir;
433 struct rchan *relay_fwlog;
434@@ -374,6 +375,17 @@ struct mt7996_dev {
435 spinlock_t reg_lock;
436
437 u8 wtbl_size_group;
438+
439+#ifdef CONFIG_MTK_DEBUG
440+ u16 wlan_idx;
441+ struct {
442+ u8 sku_disable;
443+ u32 fw_dbg_module;
444+ u8 fw_dbg_lv;
445+ u32 bcn_total_cnt[__MT_MAX_BAND];
446+ } dbg;
447+ const struct mt7996_dbg_reg_desc *dbg_reg;
448+#endif
449 };
450
451 enum {
452@@ -670,6 +682,7 @@ u32 mt7996_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
453
454 #ifdef CONFIG_MTK_DEBUG
455 int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir);
456+int mt7996_mcu_muru_dbg_info(struct mt7996_dev *dev, u16 item, u8 val);
457 #endif
458
459 #ifdef CONFIG_NET_MEDIATEK_SOC_WED
460diff --git a/mt7996/mtk_debug.h b/mt7996/mtk_debug.h
461new file mode 100644
462index 000000000..27d8f1cb2
463--- /dev/null
464+++ b/mt7996/mtk_debug.h
465@@ -0,0 +1,2286 @@
466+#ifndef __MTK_DEBUG_H
467+#define __MTK_DEBUG_H
468+
469+#ifdef CONFIG_MTK_DEBUG
470+#define NO_SHIFT_DEFINE 0xFFFFFFFF
471+#define BITS(m, n) (~(BIT(m)-1) & ((BIT(n) - 1) | BIT(n)))
472+
473+#define GET_FIELD(_field, _reg) \
474+ ({ \
475+ (((_reg) & (_field##_MASK)) >> (_field##_SHIFT)); \
476+ })
477+
478+#define __DBG_OFFS(id) (dev->dbg_reg->offs_rev[(id)])
479+
480+enum dbg_offs_rev {
481+ AGG_AALCR2,
482+ AGG_AALCR3,
483+ AGG_AALCR4,
484+ AGG_AALCR5,
485+ AGG_AALCR6,
486+ AGG_AALCR7,
487+ MIB_TDRCR0,
488+ MIB_TDRCR1,
489+ MIB_TDRCR2,
490+ MIB_TDRCR3,
491+ MIB_TDRCR4,
492+ MIB_RSCR26,
493+ MIB_TSCR18,
494+ MIB_TRDR0,
495+ MIB_TRDR2,
496+ MIB_TRDR3,
497+ MIB_TRDR4,
498+ MIB_TRDR5,
499+ MIB_TRDR6,
500+ MIB_TRDR7,
501+ MIB_TRDR8,
502+ MIB_TRDR9,
503+ MIB_TRDR10,
504+ MIB_TRDR11,
505+ MIB_TRDR12,
506+ MIB_TRDR13,
507+ MIB_TRDR14,
508+ MIB_TRDR15,
509+ MIB_MSR0,
510+ MIB_MSR1,
511+ MIB_MSR2,
512+ MIB_MCTR5,
513+ MIB_MCTR6,
514+ __MT_DBG_OFFS_REV_MAX,
515+};
516+
517+static const u32 mt7996_dbg_offs[] = {
518+ [AGG_AALCR2] = 0x128,
519+ [AGG_AALCR3] = 0x12c,
520+ [AGG_AALCR4] = 0x130,
521+ [AGG_AALCR5] = 0x134,
522+ [AGG_AALCR6] = 0x138,
523+ [AGG_AALCR7] = 0x13c,
524+ [MIB_TDRCR0] = 0x728,
525+ [MIB_TDRCR1] = 0x72c,
526+ [MIB_TDRCR2] = 0x730,
527+ [MIB_TDRCR3] = 0x734,
528+ [MIB_TDRCR4] = 0x738,
529+ [MIB_RSCR26] = 0x950,
530+ [MIB_TSCR18] = 0xa1c,
531+ [MIB_TRDR0] = 0xa24,
532+ [MIB_TRDR2] = 0xa2c,
533+ [MIB_TRDR3] = 0xa30,
534+ [MIB_TRDR4] = 0xa34,
535+ [MIB_TRDR5] = 0xa38,
536+ [MIB_TRDR6] = 0xa3c,
537+ [MIB_TRDR7] = 0xa40,
538+ [MIB_TRDR8] = 0xa44,
539+ [MIB_TRDR9] = 0xa48,
540+ [MIB_TRDR10] = 0xa4c,
541+ [MIB_TRDR11] = 0xa50,
542+ [MIB_TRDR12] = 0xa54,
543+ [MIB_TRDR13] = 0xa58,
544+ [MIB_TRDR14] = 0xa5c,
545+ [MIB_TRDR15] = 0xa60,
546+ [MIB_MSR0] = 0xa64,
547+ [MIB_MSR1] = 0xa68,
548+ [MIB_MSR2] = 0xa6c,
549+ [MIB_MCTR5] = 0xa70,
550+ [MIB_MCTR6] = 0xa74,
551+};
552+
553+static const u32 mt7992_dbg_offs[] = {
554+ [AGG_AALCR2] = 0x12c,
555+ [AGG_AALCR3] = 0x130,
556+ [AGG_AALCR4] = 0x134,
557+ [AGG_AALCR5] = 0x138,
558+ [AGG_AALCR6] = 0x13c,
559+ [AGG_AALCR7] = 0x140,
560+ [MIB_TDRCR0] = 0x768,
561+ [MIB_TDRCR1] = 0x76c,
562+ [MIB_TDRCR2] = 0x770,
563+ [MIB_TDRCR3] = 0x774,
564+ [MIB_TDRCR4] = 0x778,
565+ [MIB_RSCR26] = 0x994,
566+ [MIB_TSCR18] = 0xb18,
567+ [MIB_TRDR0] = 0xb20,
568+ [MIB_TRDR2] = 0xb28,
569+ [MIB_TRDR3] = 0xb2c,
570+ [MIB_TRDR4] = 0xb30,
571+ [MIB_TRDR5] = 0xb34,
572+ [MIB_TRDR6] = 0xb38,
573+ [MIB_TRDR7] = 0xb3c,
574+ [MIB_TRDR8] = 0xb40,
575+ [MIB_TRDR9] = 0xb44,
576+ [MIB_TRDR10] = 0xb48,
577+ [MIB_TRDR11] = 0xb4c,
578+ [MIB_TRDR12] = 0xb50,
579+ [MIB_TRDR13] = 0xb54,
580+ [MIB_TRDR14] = 0xb58,
581+ [MIB_TRDR15] = 0xb5c,
582+ [MIB_MSR0] = 0xb60,
583+ [MIB_MSR1] = 0xb64,
584+ [MIB_MSR2] = 0xb68,
585+ [MIB_MCTR5] = 0xb6c,
586+ [MIB_MCTR6] = 0xb70,
587+};
588+
589+/* used to differentiate between generations */
590+struct mt7996_dbg_reg_desc {
591+ const u32 id;
592+ const u32 *offs_rev;
593+};
594+
595+/* AGG */
596+#define BN0_WF_AGG_TOP_BASE 0x820e2000
597+#define BN1_WF_AGG_TOP_BASE 0x820f2000
598+#define IP1_BN0_WF_AGG_TOP_BASE 0x830e2000
599+
600+#define BN0_WF_AGG_TOP_SCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x0) // 2000
601+#define BN0_WF_AGG_TOP_SCR0_ADDR (BN0_WF_AGG_TOP_BASE + 0x4) // 2004
602+#define BN0_WF_AGG_TOP_SCR1_ADDR (BN0_WF_AGG_TOP_BASE + 0x8) // 2008
603+#define BN0_WF_AGG_TOP_BCR_ADDR (BN0_WF_AGG_TOP_BASE + 0xc) // 200C
604+#define BN0_WF_AGG_TOP_BWCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x10) // 2010
605+#define BN0_WF_AGG_TOP_ARCR0_ADDR (BN0_WF_AGG_TOP_BASE + 0x14) // 2014
606+#define BN0_WF_AGG_TOP_ARUCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x18) // 2018
607+#define BN0_WF_AGG_TOP_ARDCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x1c) // 201C
608+#define BN0_WF_AGG_TOP_AALCR0_ADDR (BN0_WF_AGG_TOP_BASE + 0x20) // 2020
609+#define BN0_WF_AGG_TOP_AALCR1_ADDR (BN0_WF_AGG_TOP_BASE + 0x24) // 2024
610+#define BN0_WF_AGG_TOP_PCR0_ADDR (BN0_WF_AGG_TOP_BASE + 0x28) // 2028
611+#define BN0_WF_AGG_TOP_PCR1_ADDR (BN0_WF_AGG_TOP_BASE + 0x2c) // 202C
612+#define BN0_WF_AGG_TOP_TTCR0_ADDR (BN0_WF_AGG_TOP_BASE + 0x30) // 2030
613+#define BN0_WF_AGG_TOP_TTCR1_ADDR (BN0_WF_AGG_TOP_BASE + 0x34) // 2034
614+#define BN0_WF_AGG_TOP_ACR1_ADDR (BN0_WF_AGG_TOP_BASE + 0x38) // 2038
615+#define BN0_WF_AGG_TOP_ACR4_ADDR (BN0_WF_AGG_TOP_BASE + 0x3c) // 203C
616+#define BN0_WF_AGG_TOP_ACR5_ADDR (BN0_WF_AGG_TOP_BASE + 0x40) // 2040
617+#define BN0_WF_AGG_TOP_ACR6_ADDR (BN0_WF_AGG_TOP_BASE + 0x44) // 2044
618+#define BN0_WF_AGG_TOP_ACR8_ADDR (BN0_WF_AGG_TOP_BASE + 0x4c) // 204C
619+#define BN0_WF_AGG_TOP_MRCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x50) // 2050
620+#define BN0_WF_AGG_TOP_MMPDR_ADDR (BN0_WF_AGG_TOP_BASE + 0x54) // 2054
621+#define BN0_WF_AGG_TOP_GFPDR_ADDR (BN0_WF_AGG_TOP_BASE + 0x58) // 2058
622+#define BN0_WF_AGG_TOP_VHTPDR_ADDR (BN0_WF_AGG_TOP_BASE + 0x5c) // 205C
623+#define BN0_WF_AGG_TOP_HEPDR_ADDR (BN0_WF_AGG_TOP_BASE + 0x60) // 2060
624+#define BN0_WF_AGG_TOP_CTCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x64) // 2064
625+#define BN0_WF_AGG_TOP_ATCR3_ADDR (BN0_WF_AGG_TOP_BASE + 0x68) // 2068
626+#define BN0_WF_AGG_TOP_SRCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x6c) // 206C
627+#define BN0_WF_AGG_TOP_VBCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x70) // 2070
628+#define BN0_WF_AGG_TOP_TCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x74) // 2074
629+#define BN0_WF_AGG_TOP_SRHS_ADDR (BN0_WF_AGG_TOP_BASE + 0x78) // 2078
630+#define BN0_WF_AGG_TOP_DBRCR0_ADDR (BN0_WF_AGG_TOP_BASE + 0x7c) // 207C
631+#define BN0_WF_AGG_TOP_DBRCR1_ADDR (BN0_WF_AGG_TOP_BASE + 0x80) // 2080
632+#define BN0_WF_AGG_TOP_CTETCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x84) // 2084
633+#define BN0_WF_AGG_TOP_WPDR_ADDR (BN0_WF_AGG_TOP_BASE + 0x88) // 2088
634+#define BN0_WF_AGG_TOP_PLRPDR_ADDR (BN0_WF_AGG_TOP_BASE + 0x8c) // 208C
635+#define BN0_WF_AGG_TOP_CECR_ADDR (BN0_WF_AGG_TOP_BASE + 0x90) // 2090
636+#define BN0_WF_AGG_TOP_OMRCR0_ADDR (BN0_WF_AGG_TOP_BASE + 0x94) // 2094
637+#define BN0_WF_AGG_TOP_OMRCR1_ADDR (BN0_WF_AGG_TOP_BASE + 0x98) // 2098
638+#define BN0_WF_AGG_TOP_OMRCR2_ADDR (BN0_WF_AGG_TOP_BASE + 0x9c) // 209C
639+#define BN0_WF_AGG_TOP_OMRCR3_ADDR (BN0_WF_AGG_TOP_BASE + 0xa0) // 20A0
640+#define BN0_WF_AGG_TOP_TMCR_ADDR (BN0_WF_AGG_TOP_BASE + 0xa4) // 20A4
641+#define BN0_WF_AGG_TOP_TWTCR_ADDR (BN0_WF_AGG_TOP_BASE + 0xa8) // 20A8
642+#define BN0_WF_AGG_TOP_TWTSTACR_ADDR (BN0_WF_AGG_TOP_BASE + 0xac) // 20AC
643+#define BN0_WF_AGG_TOP_TWTE0TB_ADDR (BN0_WF_AGG_TOP_BASE + 0xb0) // 20B0
644+#define BN0_WF_AGG_TOP_TWTE1TB_ADDR (BN0_WF_AGG_TOP_BASE + 0xb4) // 20B4
645+#define BN0_WF_AGG_TOP_TWTE2TB_ADDR (BN0_WF_AGG_TOP_BASE + 0xb8) // 20B8
646+#define BN0_WF_AGG_TOP_TWTE3TB_ADDR (BN0_WF_AGG_TOP_BASE + 0xbc) // 20BC
647+#define BN0_WF_AGG_TOP_TWTE4TB_ADDR (BN0_WF_AGG_TOP_BASE + 0xc0) // 20C0
648+#define BN0_WF_AGG_TOP_TWTE5TB_ADDR (BN0_WF_AGG_TOP_BASE + 0xc4) // 20C4
649+#define BN0_WF_AGG_TOP_TWTE6TB_ADDR (BN0_WF_AGG_TOP_BASE + 0xc8) // 20C8
650+#define BN0_WF_AGG_TOP_TWTE7TB_ADDR (BN0_WF_AGG_TOP_BASE + 0xcc) // 20CC
651+#define BN0_WF_AGG_TOP_TWTE8TB_ADDR (BN0_WF_AGG_TOP_BASE + 0xd0) // 20D0
652+#define BN0_WF_AGG_TOP_TWTE9TB_ADDR (BN0_WF_AGG_TOP_BASE + 0xd4) // 20D4
653+#define BN0_WF_AGG_TOP_TWTEATB_ADDR (BN0_WF_AGG_TOP_BASE + 0xd8) // 20D8
654+#define BN0_WF_AGG_TOP_TWTEBTB_ADDR (BN0_WF_AGG_TOP_BASE + 0xdc) // 20DC
655+#define BN0_WF_AGG_TOP_TWTECTB_ADDR (BN0_WF_AGG_TOP_BASE + 0xe0) // 20E0
656+#define BN0_WF_AGG_TOP_TWTEDTB_ADDR (BN0_WF_AGG_TOP_BASE + 0xe4) // 20E4
657+#define BN0_WF_AGG_TOP_TWTEETB_ADDR (BN0_WF_AGG_TOP_BASE + 0xe8) // 20E8
658+#define BN0_WF_AGG_TOP_TWTEFTB_ADDR (BN0_WF_AGG_TOP_BASE + 0xec) // 20EC
659+#define BN0_WF_AGG_TOP_ATCR0_ADDR (BN0_WF_AGG_TOP_BASE + 0x108) // 2108
660+#define BN0_WF_AGG_TOP_ATCR1_ADDR (BN0_WF_AGG_TOP_BASE + 0x10c) // 210C
661+#define BN0_WF_AGG_TOP_TCCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x110) // 2110
662+#define BN0_WF_AGG_TOP_TFCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x114) // 2114
663+#define BN0_WF_AGG_TOP_MUCR0_ADDR (BN0_WF_AGG_TOP_BASE + 0x118) // 2118
664+#define BN0_WF_AGG_TOP_MUCR1_ADDR (BN0_WF_AGG_TOP_BASE + 0x11c) // 211C
665+#define BN0_WF_AGG_TOP_AALCR2_ADDR (BN0_WF_AGG_TOP_BASE + __DBG_OFFS(AGG_AALCR2))
666+#define BN0_WF_AGG_TOP_AALCR3_ADDR (BN0_WF_AGG_TOP_BASE + __DBG_OFFS(AGG_AALCR3))
667+#define BN0_WF_AGG_TOP_AALCR4_ADDR (BN0_WF_AGG_TOP_BASE + __DBG_OFFS(AGG_AALCR4))
668+#define BN0_WF_AGG_TOP_AALCR5_ADDR (BN0_WF_AGG_TOP_BASE + __DBG_OFFS(AGG_AALCR5))
669+#define BN0_WF_AGG_TOP_AALCR6_ADDR (BN0_WF_AGG_TOP_BASE + __DBG_OFFS(AGG_AALCR6))
670+#define BN0_WF_AGG_TOP_AALCR7_ADDR (BN0_WF_AGG_TOP_BASE + __DBG_OFFS(AGG_AALCR7))
671+#define BN0_WF_AGG_TOP_CSDCR0_ADDR (BN0_WF_AGG_TOP_BASE + 0x150) // 2150
672+#define BN0_WF_AGG_TOP_CSDCR1_ADDR (BN0_WF_AGG_TOP_BASE + 0x154) // 2154
673+#define BN0_WF_AGG_TOP_CSDCR2_ADDR (BN0_WF_AGG_TOP_BASE + 0x158) // 2158
674+#define BN0_WF_AGG_TOP_CSDCR3_ADDR (BN0_WF_AGG_TOP_BASE + 0x15c) // 215C
675+#define BN0_WF_AGG_TOP_CSDCR4_ADDR (BN0_WF_AGG_TOP_BASE + 0x160) // 2160
676+#define BN0_WF_AGG_TOP_DYNSCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x178) // 2178
677+#define BN0_WF_AGG_TOP_DYNSSCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x198) // 2198
678+#define BN0_WF_AGG_TOP_TCDCNT0_ADDR (BN0_WF_AGG_TOP_BASE + 0x2c8) // 22C8
679+#define BN0_WF_AGG_TOP_TCDCNT1_ADDR (BN0_WF_AGG_TOP_BASE + 0x2cc) // 22CC
680+#define BN0_WF_AGG_TOP_TCSR0_ADDR (BN0_WF_AGG_TOP_BASE + 0x2d0) // 22D0
681+#define BN0_WF_AGG_TOP_TCSR1_ADDR (BN0_WF_AGG_TOP_BASE + 0x2d4) // 22D4
682+#define BN0_WF_AGG_TOP_TCSR2_ADDR (BN0_WF_AGG_TOP_BASE + 0x2d8) // 22D8
683+#define BN0_WF_AGG_TOP_DCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x2e4) // 22E4
684+#define BN0_WF_AGG_TOP_SMDCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x2e8) // 22E8
685+#define BN0_WF_AGG_TOP_TXCMDSMCR_ADDR (BN0_WF_AGG_TOP_BASE + 0x2ec) // 22EC
686+#define BN0_WF_AGG_TOP_SMCR0_ADDR (BN0_WF_AGG_TOP_BASE + 0x2f0) // 22F0
687+#define BN0_WF_AGG_TOP_SMCR1_ADDR (BN0_WF_AGG_TOP_BASE + 0x2f4) // 22F4
688+#define BN0_WF_AGG_TOP_SMCR2_ADDR (BN0_WF_AGG_TOP_BASE + 0x2f8) // 22F8
689+#define BN0_WF_AGG_TOP_SMCR3_ADDR (BN0_WF_AGG_TOP_BASE + 0x2fc) // 22FC
690+
691+#define BN0_WF_AGG_TOP_AALCR0_AC01_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR0_ADDR
692+#define BN0_WF_AGG_TOP_AALCR0_AC01_AGG_LIMIT_MASK 0x03FF0000 // AC01_AGG_LIMIT[25..16]
693+#define BN0_WF_AGG_TOP_AALCR0_AC01_AGG_LIMIT_SHFT 16
694+#define BN0_WF_AGG_TOP_AALCR0_AC00_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR0_ADDR
695+#define BN0_WF_AGG_TOP_AALCR0_AC00_AGG_LIMIT_MASK 0x000003FF // AC00_AGG_LIMIT[9..0]
696+#define BN0_WF_AGG_TOP_AALCR0_AC00_AGG_LIMIT_SHFT 0
697+
698+#define BN0_WF_AGG_TOP_AALCR1_AC03_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR1_ADDR
699+#define BN0_WF_AGG_TOP_AALCR1_AC03_AGG_LIMIT_MASK 0x03FF0000 // AC03_AGG_LIMIT[25..16]
700+#define BN0_WF_AGG_TOP_AALCR1_AC03_AGG_LIMIT_SHFT 16
701+#define BN0_WF_AGG_TOP_AALCR1_AC02_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR1_ADDR
702+#define BN0_WF_AGG_TOP_AALCR1_AC02_AGG_LIMIT_MASK 0x000003FF // AC02_AGG_LIMIT[9..0]
703+#define BN0_WF_AGG_TOP_AALCR1_AC02_AGG_LIMIT_SHFT 0
704+
705+#define BN0_WF_AGG_TOP_AALCR2_AC11_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR2_ADDR
706+#define BN0_WF_AGG_TOP_AALCR2_AC11_AGG_LIMIT_MASK 0x03FF0000 // AC11_AGG_LIMIT[25..16]
707+#define BN0_WF_AGG_TOP_AALCR2_AC11_AGG_LIMIT_SHFT 16
708+#define BN0_WF_AGG_TOP_AALCR2_AC10_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR2_ADDR
709+#define BN0_WF_AGG_TOP_AALCR2_AC10_AGG_LIMIT_MASK 0x000003FF // AC10_AGG_LIMIT[9..0]
710+#define BN0_WF_AGG_TOP_AALCR2_AC10_AGG_LIMIT_SHFT 0
711+
712+#define BN0_WF_AGG_TOP_AALCR3_AC13_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR3_ADDR
713+#define BN0_WF_AGG_TOP_AALCR3_AC13_AGG_LIMIT_MASK 0x03FF0000 // AC13_AGG_LIMIT[25..16]
714+#define BN0_WF_AGG_TOP_AALCR3_AC13_AGG_LIMIT_SHFT 16
715+#define BN0_WF_AGG_TOP_AALCR3_AC12_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR3_ADDR
716+#define BN0_WF_AGG_TOP_AALCR3_AC12_AGG_LIMIT_MASK 0x000003FF // AC12_AGG_LIMIT[9..0]
717+#define BN0_WF_AGG_TOP_AALCR3_AC12_AGG_LIMIT_SHFT 0
718+
719+#define BN0_WF_AGG_TOP_AALCR4_AC21_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR4_ADDR
720+#define BN0_WF_AGG_TOP_AALCR4_AC21_AGG_LIMIT_MASK 0x03FF0000 // AC21_AGG_LIMIT[25..16]
721+#define BN0_WF_AGG_TOP_AALCR4_AC21_AGG_LIMIT_SHFT 16
722+#define BN0_WF_AGG_TOP_AALCR4_AC20_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR4_ADDR
723+#define BN0_WF_AGG_TOP_AALCR4_AC20_AGG_LIMIT_MASK 0x000003FF // AC20_AGG_LIMIT[9..0]
724+#define BN0_WF_AGG_TOP_AALCR4_AC20_AGG_LIMIT_SHFT 0
725+
726+#define BN0_WF_AGG_TOP_AALCR5_AC23_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR5_ADDR
727+#define BN0_WF_AGG_TOP_AALCR5_AC23_AGG_LIMIT_MASK 0x03FF0000 // AC23_AGG_LIMIT[25..16]
728+#define BN0_WF_AGG_TOP_AALCR5_AC23_AGG_LIMIT_SHFT 16
729+#define BN0_WF_AGG_TOP_AALCR5_AC22_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR5_ADDR
730+#define BN0_WF_AGG_TOP_AALCR5_AC22_AGG_LIMIT_MASK 0x000003FF // AC22_AGG_LIMIT[9..0]
731+#define BN0_WF_AGG_TOP_AALCR5_AC22_AGG_LIMIT_SHFT 0
732+
733+#define BN0_WF_AGG_TOP_AALCR6_AC31_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR6_ADDR
734+#define BN0_WF_AGG_TOP_AALCR6_AC31_AGG_LIMIT_MASK 0x03FF0000 // AC31_AGG_LIMIT[25..16]
735+#define BN0_WF_AGG_TOP_AALCR6_AC31_AGG_LIMIT_SHFT 16
736+#define BN0_WF_AGG_TOP_AALCR6_AC30_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR6_ADDR
737+#define BN0_WF_AGG_TOP_AALCR6_AC30_AGG_LIMIT_MASK 0x000003FF // AC30_AGG_LIMIT[9..0]
738+#define BN0_WF_AGG_TOP_AALCR6_AC30_AGG_LIMIT_SHFT 0
739+#define BN0_WF_AGG_TOP_AALCR7_AC33_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR7_ADDR
740+#define BN0_WF_AGG_TOP_AALCR7_AC33_AGG_LIMIT_MASK 0x03FF0000 // AC33_AGG_LIMIT[25..16]
741+#define BN0_WF_AGG_TOP_AALCR7_AC33_AGG_LIMIT_SHFT 16
742+#define BN0_WF_AGG_TOP_AALCR7_AC32_AGG_LIMIT_ADDR BN0_WF_AGG_TOP_AALCR7_ADDR
743+#define BN0_WF_AGG_TOP_AALCR7_AC32_AGG_LIMIT_MASK 0x000003FF // AC32_AGG_LIMIT[9..0]
744+#define BN0_WF_AGG_TOP_AALCR7_AC32_AGG_LIMIT_SHFT 0
745+
746+/* DMA */
747+struct queue_desc {
748+ u32 hw_desc_base;
749+ u16 ring_size;
750+ char *const ring_info;
751+};
752+
753+// HOST DMA
754+#define WF_WFDMA_HOST_DMA0_BASE 0xd4000
755+
756+#define WF_WFDMA_HOST_DMA0_HOST_INT_STA_ADDR \
757+ (WF_WFDMA_HOST_DMA0_BASE + 0x200) /* 4200 */
758+#define WF_WFDMA_HOST_DMA0_HOST_INT_ENA_ADDR \
759+ (WF_WFDMA_HOST_DMA0_BASE + 0X204) /* 4204 */
760+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_ADDR \
761+ (WF_WFDMA_HOST_DMA0_BASE + 0x208) /* 4208 */
762+
763+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_RX_DMA_BUSY_ADDR \
764+ WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_ADDR
765+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_RX_DMA_BUSY_MASK \
766+ 0x00000008 /* RX_DMA_BUSY[3] */
767+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_RX_DMA_BUSY_SHFT 3
768+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_RX_DMA_EN_ADDR \
769+ WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_ADDR
770+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_RX_DMA_EN_MASK \
771+ 0x00000004 /* RX_DMA_EN[2] */
772+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_RX_DMA_EN_SHFT 2
773+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_TX_DMA_BUSY_ADDR \
774+ WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_ADDR
775+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_TX_DMA_BUSY_MASK \
776+ 0x00000002 /* TX_DMA_BUSY[1] */
777+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_TX_DMA_BUSY_SHFT 1
778+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_TX_DMA_EN_ADDR \
779+ WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_ADDR
780+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_TX_DMA_EN_MASK \
781+ 0x00000001 /* TX_DMA_EN[0] */
782+#define WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_TX_DMA_EN_SHFT 0
783+
784+
785+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING0_CTRL0_ADDR \
786+ (WF_WFDMA_HOST_DMA0_BASE + 0x300) /* 4300 */
787+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING0_CTRL1_ADDR \
788+ (WF_WFDMA_HOST_DMA0_BASE + 0x304) /* 4304 */
789+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING0_CTRL2_ADDR \
790+ (WF_WFDMA_HOST_DMA0_BASE + 0x308) /* 4308 */
791+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING0_CTRL3_ADDR \
792+ (WF_WFDMA_HOST_DMA0_BASE + 0x30c) /* 430C */
793+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING1_CTRL0_ADDR \
794+ (WF_WFDMA_HOST_DMA0_BASE + 0x310) /* 4310 */
795+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING1_CTRL1_ADDR \
796+ (WF_WFDMA_HOST_DMA0_BASE + 0x314) /* 4314 */
797+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING1_CTRL2_ADDR \
798+ (WF_WFDMA_HOST_DMA0_BASE + 0x318) /* 4318 */
799+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING1_CTRL3_ADDR \
800+ (WF_WFDMA_HOST_DMA0_BASE + 0x31c) /* 431C */
801+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING2_CTRL0_ADDR \
802+ (WF_WFDMA_HOST_DMA0_BASE + 0x320) /* 4320 */
803+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING2_CTRL1_ADDR \
804+ (WF_WFDMA_HOST_DMA0_BASE + 0x324) /* 4324 */
805+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING2_CTRL2_ADDR \
806+ (WF_WFDMA_HOST_DMA0_BASE + 0x328) /* 4328 */
807+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING2_CTRL3_ADDR \
808+ (WF_WFDMA_HOST_DMA0_BASE + 0x32c) /* 432C */
809+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING3_CTRL0_ADDR \
810+ (WF_WFDMA_HOST_DMA0_BASE + 0x330) /* 4330 */
811+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING3_CTRL1_ADDR \
812+ (WF_WFDMA_HOST_DMA0_BASE + 0x334) /* 4334 */
813+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING3_CTRL2_ADDR \
814+ (WF_WFDMA_HOST_DMA0_BASE + 0x338) /* 4338 */
815+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING3_CTRL3_ADDR \
816+ (WF_WFDMA_HOST_DMA0_BASE + 0x33c) /* 433C */
817+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING4_CTRL0_ADDR \
818+ (WF_WFDMA_HOST_DMA0_BASE + 0x340) /* 4340 */
819+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING4_CTRL1_ADDR \
820+ (WF_WFDMA_HOST_DMA0_BASE + 0x344) /* 4344 */
821+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING4_CTRL2_ADDR \
822+ (WF_WFDMA_HOST_DMA0_BASE + 0x348) /* 4348 */
823+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING4_CTRL3_ADDR \
824+ (WF_WFDMA_HOST_DMA0_BASE + 0x34c) /* 434C */
825+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING5_CTRL0_ADDR \
826+ (WF_WFDMA_HOST_DMA0_BASE + 0x350) /* 4350 */
827+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING5_CTRL1_ADDR \
828+ (WF_WFDMA_HOST_DMA0_BASE + 0x354) /* 4354 */
829+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING5_CTRL2_ADDR \
830+ (WF_WFDMA_HOST_DMA0_BASE + 0x358) /* 4358 */
831+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING5_CTRL3_ADDR \
832+ (WF_WFDMA_HOST_DMA0_BASE + 0x35c) /* 435C */
833+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING6_CTRL0_ADDR \
834+ (WF_WFDMA_HOST_DMA0_BASE + 0x360) /* 4360 */
835+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING6_CTRL1_ADDR \
836+ (WF_WFDMA_HOST_DMA0_BASE + 0x364) /* 4364 */
837+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING6_CTRL2_ADDR \
838+ (WF_WFDMA_HOST_DMA0_BASE + 0x368) /* 4368 */
839+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING6_CTRL3_ADDR \
840+ (WF_WFDMA_HOST_DMA0_BASE + 0x36c) /* 436C */
841+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING16_CTRL0_ADDR \
842+ (WF_WFDMA_HOST_DMA0_BASE + 0x400) /* 4400 */
843+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING16_CTRL1_ADDR \
844+ (WF_WFDMA_HOST_DMA0_BASE + 0x404) /* 4404 */
845+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING16_CTRL2_ADDR \
846+ (WF_WFDMA_HOST_DMA0_BASE + 0x408) /* 4408 */
847+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING16_CTRL3_ADDR \
848+ (WF_WFDMA_HOST_DMA0_BASE + 0x40c) /* 440C */
849+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING17_CTRL0_ADDR \
850+ (WF_WFDMA_HOST_DMA0_BASE + 0x410) /* 4410 */
851+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING17_CTRL1_ADDR \
852+ (WF_WFDMA_HOST_DMA0_BASE + 0x414) /* 4414 */
853+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING17_CTRL2_ADDR \
854+ (WF_WFDMA_HOST_DMA0_BASE + 0x418) /* 4418 */
855+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING17_CTRL3_ADDR \
856+ (WF_WFDMA_HOST_DMA0_BASE + 0x41c) /* 441C */
857+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING18_CTRL0_ADDR \
858+ (WF_WFDMA_HOST_DMA0_BASE + 0x420) /* 4420 */
859+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING18_CTRL1_ADDR \
860+ (WF_WFDMA_HOST_DMA0_BASE + 0x424) /* 4424 */
861+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING18_CTRL2_ADDR \
862+ (WF_WFDMA_HOST_DMA0_BASE + 0x428) /* 4428 */
863+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING18_CTRL3_ADDR \
864+ (WF_WFDMA_HOST_DMA0_BASE + 0x42c) /* 442C */
865+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING19_CTRL0_ADDR \
866+ (WF_WFDMA_HOST_DMA0_BASE + 0x430) /* 4430 */
867+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING19_CTRL1_ADDR \
868+ (WF_WFDMA_HOST_DMA0_BASE + 0x434) /* 4434 */
869+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING19_CTRL2_ADDR \
870+ (WF_WFDMA_HOST_DMA0_BASE + 0x438) /* 4438 */
871+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING19_CTRL3_ADDR \
872+ (WF_WFDMA_HOST_DMA0_BASE + 0x43c) /* 443C */
873+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING20_CTRL0_ADDR \
874+ (WF_WFDMA_HOST_DMA0_BASE + 0x440) /* 4440 */
875+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING20_CTRL1_ADDR \
876+ (WF_WFDMA_HOST_DMA0_BASE + 0x444) /* 4444 */
877+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING20_CTRL2_ADDR \
878+ (WF_WFDMA_HOST_DMA0_BASE + 0x448) /* 4448 */
879+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING20_CTRL3_ADDR \
880+ (WF_WFDMA_HOST_DMA0_BASE + 0x44c) /* 444C */
881+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING21_CTRL0_ADDR \
882+ (WF_WFDMA_HOST_DMA0_BASE + 0x450) /* 4450 */
883+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING21_CTRL1_ADDR \
884+ (WF_WFDMA_HOST_DMA0_BASE + 0x454) /* 4454 */
885+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING21_CTRL2_ADDR \
886+ (WF_WFDMA_HOST_DMA0_BASE + 0x458) /* 4458 */
887+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING21_CTRL3_ADDR \
888+ (WF_WFDMA_HOST_DMA0_BASE + 0x45c) /* 445c */
889+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING22_CTRL0_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x460) // 4460
890+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING22_CTRL1_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x464) // 4464
891+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING22_CTRL2_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x468) // 4468
892+#define WF_WFDMA_HOST_DMA0_WPDMA_TX_RING22_CTRL3_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x46c) // 446C
893+
894+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING0_CTRL0_ADDR \
895+ (WF_WFDMA_HOST_DMA0_BASE + 0x500) /* 4500 */
896+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING0_CTRL1_ADDR \
897+ (WF_WFDMA_HOST_DMA0_BASE + 0x504) /* 4504 */
898+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING0_CTRL2_ADDR \
899+ (WF_WFDMA_HOST_DMA0_BASE + 0x508) /* 4508 */
900+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING0_CTRL3_ADDR \
901+ (WF_WFDMA_HOST_DMA0_BASE + 0x50c) /* 450C */
902+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING1_CTRL0_ADDR \
903+ (WF_WFDMA_HOST_DMA0_BASE + 0x510) /* 4510 */
904+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING1_CTRL1_ADDR \
905+ (WF_WFDMA_HOST_DMA0_BASE + 0x514) /* 4514 */
906+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING1_CTRL2_ADDR \
907+ (WF_WFDMA_HOST_DMA0_BASE + 0x518) /* 4518 */
908+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING1_CTRL3_ADDR \
909+ (WF_WFDMA_HOST_DMA0_BASE + 0x51c) /* 451C */
910+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING2_CTRL0_ADDR \
911+ (WF_WFDMA_HOST_DMA0_BASE + 0x520) /* 4520 */
912+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING2_CTRL1_ADDR \
913+ (WF_WFDMA_HOST_DMA0_BASE + 0x524) /* 4524 */
914+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING2_CTRL2_ADDR \
915+ (WF_WFDMA_HOST_DMA0_BASE + 0x528) /* 4528 */
916+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING2_CTRL3_ADDR \
917+ (WF_WFDMA_HOST_DMA0_BASE + 0x52C) /* 452C */
918+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING3_CTRL0_ADDR \
919+ (WF_WFDMA_HOST_DMA0_BASE + 0x530) /* 4530 */
920+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING3_CTRL1_ADDR \
921+ (WF_WFDMA_HOST_DMA0_BASE + 0x534) /* 4534 */
922+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING3_CTRL2_ADDR \
923+ (WF_WFDMA_HOST_DMA0_BASE + 0x538) /* 4538 */
924+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING3_CTRL3_ADDR \
925+ (WF_WFDMA_HOST_DMA0_BASE + 0x53C) /* 453C */
926+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING4_CTRL0_ADDR \
927+ (WF_WFDMA_HOST_DMA0_BASE + 0x540) /* 4540 */
928+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING4_CTRL1_ADDR \
929+ (WF_WFDMA_HOST_DMA0_BASE + 0x544) /* 4544 */
930+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING4_CTRL2_ADDR \
931+ (WF_WFDMA_HOST_DMA0_BASE + 0x548) /* 4548 */
932+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING4_CTRL3_ADDR \
933+ (WF_WFDMA_HOST_DMA0_BASE + 0x54c) /* 454C */
934+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING5_CTRL0_ADDR \
935+ (WF_WFDMA_HOST_DMA0_BASE + 0x550) /* 4550 */
936+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING5_CTRL1_ADDR \
937+ (WF_WFDMA_HOST_DMA0_BASE + 0x554) /* 4554 */
938+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING5_CTRL2_ADDR \
939+ (WF_WFDMA_HOST_DMA0_BASE + 0x558) /* 4558 */
940+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING5_CTRL3_ADDR \
941+ (WF_WFDMA_HOST_DMA0_BASE + 0x55c) /* 455C */
942+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING6_CTRL0_ADDR \
943+ (WF_WFDMA_HOST_DMA0_BASE + 0x560) /* 4560 */
944+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING6_CTRL1_ADDR \
945+ (WF_WFDMA_HOST_DMA0_BASE + 0x564) /* 4564 */
946+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING6_CTRL2_ADDR \
947+ (WF_WFDMA_HOST_DMA0_BASE + 0x568) /* 4568 */
948+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING6_CTRL3_ADDR \
949+ (WF_WFDMA_HOST_DMA0_BASE + 0x56c) /* 456C */
950+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING7_CTRL0_ADDR \
951+ (WF_WFDMA_HOST_DMA0_BASE + 0x570) /* 4570 */
952+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING7_CTRL1_ADDR \
953+ (WF_WFDMA_HOST_DMA0_BASE + 0x574) /* 4574 */
954+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING7_CTRL2_ADDR \
955+ (WF_WFDMA_HOST_DMA0_BASE + 0x578) /* 4578 */
956+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING7_CTRL3_ADDR \
957+ (WF_WFDMA_HOST_DMA0_BASE + 0x57c) /* 457C */
958+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING8_CTRL0_ADDR \
959+ (WF_WFDMA_HOST_DMA0_BASE + 0x580) /* 4580 */
960+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING8_CTRL1_ADDR \
961+ (WF_WFDMA_HOST_DMA0_BASE + 0x584) /* 4584 */
962+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING8_CTRL2_ADDR \
963+ (WF_WFDMA_HOST_DMA0_BASE + 0x588) /* 4588 */
964+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING8_CTRL3_ADDR \
965+ (WF_WFDMA_HOST_DMA0_BASE + 0x58c) /* 458C */
966+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING9_CTRL0_ADDR \
967+ (WF_WFDMA_HOST_DMA0_BASE + 0x590) /* 4590 */
968+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING9_CTRL1_ADDR \
969+ (WF_WFDMA_HOST_DMA0_BASE + 0x594) /* 4594 */
970+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING9_CTRL2_ADDR \
971+ (WF_WFDMA_HOST_DMA0_BASE + 0x598) /* 4598 */
972+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING9_CTRL3_ADDR \
973+ (WF_WFDMA_HOST_DMA0_BASE + 0x59c) /* 459C */
974+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING10_CTRL0_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x5a0) // 45A0
975+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING10_CTRL1_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x5a4) // 45A4
976+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING10_CTRL2_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x5a8) // 45A8
977+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING10_CTRL3_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x5ac) // 45AC
978+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING11_CTRL0_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x5b0) // 45B0
979+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING11_CTRL1_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x5b4) // 45B4
980+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING11_CTRL2_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x5b8) // 45B8
981+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING11_CTRL3_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x5bc) // 45BC
982+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING12_CTRL0_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x5C0) // 45C0
983+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING12_CTRL1_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x5C4) // 45C4
984+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING12_CTRL2_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x5C8) // 45C8
985+#define WF_WFDMA_HOST_DMA0_WPDMA_RX_RING12_CTRL3_ADDR (WF_WFDMA_HOST_DMA0_BASE + 0x5CC) // 45CC
986+
987+// HOST PCIE1 DMA
988+#define WF_WFDMA_HOST_DMA0_PCIE1_BASE 0xd8000
989+
990+#define WF_WFDMA_HOST_DMA0_PCIE1_HOST_INT_STA_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x200) // 8200
991+#define WF_WFDMA_HOST_DMA0_PCIE1_HOST_INT_ENA_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0X204) // 8204
992+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x208) // 8208
993+
994+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_PDMA_BT_SIZE_SHFT 4
995+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_RX_DMA_BUSY_MASK 0x00000008
996+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_RX_DMA_BUSY_SHFT 3
997+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_RX_DMA_EN_MASK 0x00000004
998+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_RX_DMA_EN_SHFT 2
999+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_TX_DMA_BUSY_MASK 0x00000002
1000+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_TX_DMA_BUSY_SHFT 1
1001+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_TX_DMA_EN_MASK 0x00000001
1002+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_TX_DMA_EN_SHFT 0
1003+
1004+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING21_CTRL0_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x450) // 8450
1005+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING21_CTRL1_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x454) // 8454
1006+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING21_CTRL2_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x458) // 8458
1007+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING21_CTRL3_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x45c) // 845C
1008+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING22_CTRL0_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x460) // 8460
1009+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING22_CTRL1_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x464) // 8464
1010+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING22_CTRL2_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x468) // 8468
1011+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING22_CTRL3_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x46c) // 846C
1012+
1013+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING3_CTRL0_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x530) // 8530
1014+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING3_CTRL1_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x534) // 8534
1015+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING3_CTRL2_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x538) // 8538
1016+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING3_CTRL3_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x53C) // 853C
1017+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING5_CTRL0_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x550) // 8550
1018+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING5_CTRL1_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x554) // 8554
1019+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING5_CTRL2_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x558) // 8558
1020+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING5_CTRL3_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x55c) // 855C
1021+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING6_CTRL0_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x560) // 8560
1022+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING6_CTRL1_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x564) // 8564
1023+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING6_CTRL2_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x568) // 8568
1024+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING6_CTRL3_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x56c) // 856C
1025+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING7_CTRL0_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x570) // 8570
1026+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING7_CTRL1_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x574) // 8574
1027+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING7_CTRL2_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x578) // 8578
1028+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING7_CTRL3_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x57c) // 857C
1029+//MCU DMA
1030+//#define WF_WFDMA_MCU_DMA0_BASE 0x02000
1031+#define WF_WFDMA_MCU_DMA0_BASE 0x54000000
1032+
1033+#define WF_WFDMA_MCU_DMA0_HOST_INT_STA_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x200) // 0200
1034+#define WF_WFDMA_MCU_DMA0_HOST_INT_ENA_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0X204) // 0204
1035+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x208) // 0208
1036+
1037+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_RX_DMA_BUSY_ADDR WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_ADDR
1038+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_RX_DMA_BUSY_MASK 0x00000008 // RX_DMA_BUSY[3]
1039+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_RX_DMA_BUSY_SHFT 3
1040+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_RX_DMA_EN_ADDR WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_ADDR
1041+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_RX_DMA_EN_MASK 0x00000004 // RX_DMA_EN[2]
1042+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_RX_DMA_EN_SHFT 2
1043+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_TX_DMA_BUSY_ADDR WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_ADDR
1044+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_TX_DMA_BUSY_MASK 0x00000002 // TX_DMA_BUSY[1]
1045+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_TX_DMA_BUSY_SHFT 1
1046+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_TX_DMA_EN_ADDR WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_ADDR
1047+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_TX_DMA_EN_MASK 0x00000001 // TX_DMA_EN[0]
1048+#define WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_TX_DMA_EN_SHFT 0
1049+
1050+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING0_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x300) // 0300
1051+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING0_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x304) // 0304
1052+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING0_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x308) // 0308
1053+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING0_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x30c) // 030C
1054+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING1_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x310) // 0310
1055+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING1_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x314) // 0314
1056+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING1_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x318) // 0318
1057+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING1_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x31c) // 031C
1058+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING2_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x320) // 0320
1059+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING2_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x324) // 0324
1060+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING2_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x328) // 0328
1061+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING2_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x32c) // 032C
1062+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING3_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x330) // 0330
1063+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING3_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x334) // 0334
1064+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING3_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x338) // 0338
1065+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING3_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x33c) // 033C
1066+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING4_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x340) // 0340
1067+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING4_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x344) // 0344
1068+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING4_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x348) // 0348
1069+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING4_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x34c) // 034C
1070+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING5_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x350) // 0350
1071+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING5_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x354) // 0354
1072+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING5_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x358) // 0358
1073+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING5_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x35c) // 035C
1074+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING6_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x360) // 0360
1075+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING6_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x364) // 0364
1076+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING6_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x368) // 0368
1077+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING6_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x36c) // 036C
1078+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING7_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x370) // 0370
1079+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING7_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x374) // 0374
1080+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING7_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x378) // 0378
1081+#define WF_WFDMA_MCU_DMA0_WPDMA_TX_RING7_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x37c) // 037C
1082+
1083+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING0_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x500) // 0500
1084+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING0_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x504) // 0504
1085+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING0_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x508) // 0508
1086+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING0_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x50c) // 050C
1087+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING1_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x510) // 0510
1088+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING1_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x514) // 0514
1089+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING1_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x518) // 0518
1090+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING1_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x51c) // 051C
1091+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING2_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x520) // 0520
1092+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING2_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x524) // 0524
1093+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING2_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x528) // 0528
1094+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING2_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x52C) // 052C
1095+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING3_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x530) // 0530
1096+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING3_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x534) // 0534
1097+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING3_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x538) // 0538
1098+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING3_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x53C) // 053C
1099+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING4_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x540) // 0540
1100+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING4_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x544) // 0544
1101+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING4_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x548) // 0548
1102+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING4_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x54C) // 054C
1103+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING5_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x550) // 0550
1104+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING5_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x554) // 0554
1105+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING5_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x558) // 0558
1106+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING5_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x55C) // 055C
1107+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING6_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x560) // 0560
1108+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING6_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x564) // 0564
1109+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING6_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x568) // 0568
1110+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING6_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x56c) // 056C
1111+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING7_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x570) // 0570
1112+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING7_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x574) // 0574
1113+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING7_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x578) // 0578
1114+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING7_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x57c) // 057C
1115+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING8_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x580) // 0580
1116+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING8_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x584) // 0584
1117+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING8_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x588) // 0588
1118+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING8_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x58c) // 058C
1119+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING9_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x590) // 0590
1120+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING9_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x594) // 0594
1121+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING9_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x598) // 0598
1122+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING9_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x59c) // 059C
1123+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING10_CTRL0_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x5A0) // 05A0
1124+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING10_CTRL1_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x5A4) // 05A4
1125+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING10_CTRL2_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x5A8) // 05A8
1126+#define WF_WFDMA_MCU_DMA0_WPDMA_RX_RING10_CTRL3_ADDR (WF_WFDMA_MCU_DMA0_BASE + 0x5Ac) // 05AC
1127+
1128+// MEM DMA
1129+#define WF_WFDMA_MEM_DMA_BASE 0x58000000
1130+
1131+#define WF_WFDMA_MEM_DMA_HOST_INT_STA_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x200) // 0200
1132+#define WF_WFDMA_MEM_DMA_HOST_INT_ENA_ADDR (WF_WFDMA_MEM_DMA_BASE + 0X204) // 0204
1133+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x208) // 0208
1134+
1135+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_RX_DMA_BUSY_ADDR WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_ADDR
1136+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_RX_DMA_BUSY_MASK 0x00000008 // RX_DMA_BUSY[3]
1137+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_RX_DMA_BUSY_SHFT 3
1138+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_RX_DMA_EN_ADDR WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_ADDR
1139+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_RX_DMA_EN_MASK 0x00000004 // RX_DMA_EN[2]
1140+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_RX_DMA_EN_SHFT 2
1141+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_TX_DMA_BUSY_ADDR WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_ADDR
1142+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_TX_DMA_BUSY_MASK 0x00000002 // TX_DMA_BUSY[1]
1143+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_TX_DMA_BUSY_SHFT 1
1144+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_TX_DMA_EN_ADDR WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_ADDR
1145+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_TX_DMA_EN_MASK 0x00000001 // TX_DMA_EN[0]
1146+#define WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_TX_DMA_EN_SHFT 0
1147+
1148+#define WF_WFDMA_MEM_DMA_WPDMA_TX_RING0_CTRL0_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x300) // 0300
1149+#define WF_WFDMA_MEM_DMA_WPDMA_TX_RING0_CTRL1_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x304) // 0304
1150+#define WF_WFDMA_MEM_DMA_WPDMA_TX_RING0_CTRL2_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x308) // 0308
1151+#define WF_WFDMA_MEM_DMA_WPDMA_TX_RING0_CTRL3_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x30c) // 030C
1152+#define WF_WFDMA_MEM_DMA_WPDMA_TX_RING1_CTRL0_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x310) // 0310
1153+#define WF_WFDMA_MEM_DMA_WPDMA_TX_RING1_CTRL1_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x314) // 0314
1154+#define WF_WFDMA_MEM_DMA_WPDMA_TX_RING1_CTRL2_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x318) // 0318
1155+#define WF_WFDMA_MEM_DMA_WPDMA_TX_RING1_CTRL3_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x31c) // 031C
1156+#define WF_WFDMA_MEM_DMA_WPDMA_TX_RING2_CTRL0_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x320) // 0320
1157+#define WF_WFDMA_MEM_DMA_WPDMA_TX_RING2_CTRL1_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x324) // 0324
1158+#define WF_WFDMA_MEM_DMA_WPDMA_TX_RING2_CTRL2_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x328) // 0328
1159+#define WF_WFDMA_MEM_DMA_WPDMA_TX_RING2_CTRL3_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x32c) // 032C
1160+
1161+#define WF_WFDMA_MEM_DMA_WPDMA_RX_RING0_CTRL0_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x500) // 0500
1162+#define WF_WFDMA_MEM_DMA_WPDMA_RX_RING0_CTRL1_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x504) // 0504
1163+#define WF_WFDMA_MEM_DMA_WPDMA_RX_RING0_CTRL2_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x508) // 0508
1164+#define WF_WFDMA_MEM_DMA_WPDMA_RX_RING0_CTRL3_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x50c) // 050C
1165+#define WF_WFDMA_MEM_DMA_WPDMA_RX_RING1_CTRL0_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x510) // 0510
1166+#define WF_WFDMA_MEM_DMA_WPDMA_RX_RING1_CTRL1_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x514) // 0514
1167+#define WF_WFDMA_MEM_DMA_WPDMA_RX_RING1_CTRL2_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x518) // 0518
1168+#define WF_WFDMA_MEM_DMA_WPDMA_RX_RING1_CTRL3_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x51c) // 051C
1169+#define WF_WFDMA_MEM_DMA_WPDMA_RX_RING2_CTRL0_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x520) // 0520
1170+#define WF_WFDMA_MEM_DMA_WPDMA_RX_RING2_CTRL1_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x524) // 0524
1171+#define WF_WFDMA_MEM_DMA_WPDMA_RX_RING2_CTRL2_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x528) // 0528
1172+#define WF_WFDMA_MEM_DMA_WPDMA_RX_RING2_CTRL3_ADDR (WF_WFDMA_MEM_DMA_BASE + 0x52C) // 052C
1173+
1174+/* MIB */
1175+#define WF_UMIB_TOP_BASE 0x820cd000
1176+#define BN0_WF_MIB_TOP_BASE 0x820ed000
1177+#define BN1_WF_MIB_TOP_BASE 0x820fd000
1178+#define IP1_BN0_WF_MIB_TOP_BASE 0x830ed000
1179+
1180+#define WF_UMIB_TOP_B0BROCR_ADDR (WF_UMIB_TOP_BASE + 0x484) // D484
1181+#define WF_UMIB_TOP_B0BRBCR_ADDR (WF_UMIB_TOP_BASE + 0x4D4) // D4D4
1182+#define WF_UMIB_TOP_B0BRDCR_ADDR (WF_UMIB_TOP_BASE + 0x524) // D524
1183+#define WF_UMIB_TOP_B1BROCR_ADDR (WF_UMIB_TOP_BASE + 0x5E8) // D5E8
1184+#define WF_UMIB_TOP_B2BROCR_ADDR (WF_UMIB_TOP_BASE + 0x74C) // D74C
1185+
1186+#define BN0_WF_MIB_TOP_M0SCR0_ADDR (BN0_WF_MIB_TOP_BASE + 0x000) // D000
1187+#define BN0_WF_MIB_TOP_M0SDR6_ADDR (BN0_WF_MIB_TOP_BASE + 0x020) // D020
1188+#define BN0_WF_MIB_TOP_M0SDR9_ADDR (BN0_WF_MIB_TOP_BASE + 0x024) // D024
1189+#define BN0_WF_MIB_TOP_M0SDR18_ADDR (BN0_WF_MIB_TOP_BASE + 0x030) // D030
1190+#define BN0_WF_MIB_TOP_BTOCR_ADDR (BN0_WF_MIB_TOP_BASE + 0x400) // D400
1191+#define BN0_WF_MIB_TOP_BTBCR_ADDR (BN0_WF_MIB_TOP_BASE + 0x450) // D450
1192+#define BN0_WF_MIB_TOP_BTDCR_ADDR (BN0_WF_MIB_TOP_BASE + 0x590) // D590
1193+#define BN0_WF_MIB_TOP_BTCR_ADDR (BN0_WF_MIB_TOP_BASE + 0x5A0) // D5A0
1194+#define BN0_WF_MIB_TOP_RVSR0_ADDR (BN0_WF_MIB_TOP_BASE + __OFFS(MIB_RVSR0))
1195+
1196+#define BN0_WF_MIB_TOP_TSCR0_ADDR (BN0_WF_MIB_TOP_BASE + 0x6B0) // D6B0
1197+#define BN0_WF_MIB_TOP_TSCR3_ADDR (BN0_WF_MIB_TOP_BASE + 0x6BC) // D6BC
1198+#define BN0_WF_MIB_TOP_TSCR4_ADDR (BN0_WF_MIB_TOP_BASE + 0x6C0) // D6C0
1199+#define BN0_WF_MIB_TOP_TSCR5_ADDR (BN0_WF_MIB_TOP_BASE + 0x6C4) // D6C4
1200+#define BN0_WF_MIB_TOP_TSCR6_ADDR (BN0_WF_MIB_TOP_BASE + 0x6C8) // D6C8
1201+#define BN0_WF_MIB_TOP_TSCR7_ADDR (BN0_WF_MIB_TOP_BASE + 0x6D0) // D6D0
1202+#define BN0_WF_MIB_TOP_TSCR8_ADDR (BN0_WF_MIB_TOP_BASE + 0x6CC) // D6CC
1203+
1204+#define BN0_WF_MIB_TOP_TBCR0_ADDR (BN0_WF_MIB_TOP_BASE + 0x6EC) // D6EC
1205+#define BN0_WF_MIB_TOP_TBCR1_ADDR (BN0_WF_MIB_TOP_BASE + 0x6F0) // D6F0
1206+#define BN0_WF_MIB_TOP_TBCR2_ADDR (BN0_WF_MIB_TOP_BASE + 0x6F4) // D6F4
1207+#define BN0_WF_MIB_TOP_TBCR3_ADDR (BN0_WF_MIB_TOP_BASE + 0x6F8) // D6F8
1208+#define BN0_WF_MIB_TOP_TBCR4_ADDR (BN0_WF_MIB_TOP_BASE + 0x6FC) // D6FC
1209+
1210+#define BN0_WF_MIB_TOP_TDRCR0_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TDRCR0))
1211+#define BN0_WF_MIB_TOP_TDRCR1_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TDRCR1))
1212+#define BN0_WF_MIB_TOP_TDRCR2_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TDRCR2))
1213+#define BN0_WF_MIB_TOP_TDRCR3_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TDRCR3))
1214+#define BN0_WF_MIB_TOP_TDRCR4_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TDRCR4))
1215+
1216+#define BN0_WF_MIB_TOP_BTSCR0_ADDR (BN0_WF_MIB_TOP_BASE + 0x5E0) // D5E0
1217+#define BN0_WF_MIB_TOP_BTSCR1_ADDR (BN0_WF_MIB_TOP_BASE + 0x5F0) // D5F0
1218+#define BN0_WF_MIB_TOP_BTSCR2_ADDR (BN0_WF_MIB_TOP_BASE + 0x600) // D600
1219+#define BN0_WF_MIB_TOP_BTSCR3_ADDR (BN0_WF_MIB_TOP_BASE + 0x610) // D610
1220+#define BN0_WF_MIB_TOP_BTSCR4_ADDR (BN0_WF_MIB_TOP_BASE + 0x620) // D620
1221+#define BN0_WF_MIB_TOP_BTSCR5_ADDR (BN0_WF_MIB_TOP_BASE + __OFFS(MIB_BTSCR5))
1222+#define BN0_WF_MIB_TOP_BTSCR6_ADDR (BN0_WF_MIB_TOP_BASE + __OFFS(MIB_BTSCR6))
1223+
1224+#define BN0_WF_MIB_TOP_RSCR1_ADDR (BN0_WF_MIB_TOP_BASE + __OFFS(MIB_RSCR1))
1225+#define BN0_WF_MIB_TOP_BSCR2_ADDR (BN0_WF_MIB_TOP_BASE + __OFFS(MIB_BSCR2))
1226+#define BN0_WF_MIB_TOP_TSCR18_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TSCR18))
1227+
1228+#define BN0_WF_MIB_TOP_MSR0_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_MSR0))
1229+#define BN0_WF_MIB_TOP_MSR1_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_MSR1))
1230+#define BN0_WF_MIB_TOP_MSR2_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_MSR2))
1231+#define BN0_WF_MIB_TOP_MCTR5_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_MCTR5))
1232+#define BN0_WF_MIB_TOP_MCTR6_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_MCTR6))
1233+
1234+#define BN0_WF_MIB_TOP_RSCR26_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_RSCR26))
1235+#define BN0_WF_MIB_TOP_RSCR27_ADDR (BN0_WF_MIB_TOP_BASE + __OFFS(MIB_RSCR27))
1236+#define BN0_WF_MIB_TOP_RSCR28_ADDR (BN0_WF_MIB_TOP_BASE + __OFFS(MIB_RSCR28))
1237+#define BN0_WF_MIB_TOP_RSCR31_ADDR (BN0_WF_MIB_TOP_BASE + __OFFS(MIB_RSCR31))
1238+#define BN0_WF_MIB_TOP_RSCR33_ADDR (BN0_WF_MIB_TOP_BASE + __OFFS(MIB_RSCR33))
1239+#define BN0_WF_MIB_TOP_RSCR35_ADDR (BN0_WF_MIB_TOP_BASE + __OFFS(MIB_RSCR35))
1240+#define BN0_WF_MIB_TOP_RSCR36_ADDR (BN0_WF_MIB_TOP_BASE + __OFFS(MIB_RSCR36))
1241+
1242+#define BN0_WF_MIB_TOP_TSCR3_AMPDU_MPDU_COUNT_MASK 0xFFFFFFFF // AMPDU_MPDU_COUNT[31..0]
1243+#define BN0_WF_MIB_TOP_TSCR4_AMPDU_ACKED_COUNT_MASK 0xFFFFFFFF // AMPDU_ACKED_COUNT[31..0]
1244+#define BN0_WF_MIB_TOP_M0SDR6_CHANNEL_IDLE_COUNT_MASK 0x0000FFFF // CHANNEL_IDLE_COUNT[15..0]
1245+#define BN0_WF_MIB_TOP_M0SDR9_CCA_NAV_TX_TIME_MASK 0x00FFFFFF // CCA_NAV_TX_TIME[23..0]
1246+#define BN0_WF_MIB_TOP_RSCR26_RX_MDRDY_COUNT_MASK 0xFFFFFFFF // RX_MDRDY_COUNT[31..0]
1247+#define BN0_WF_MIB_TOP_MSR0_CCK_MDRDY_TIME_MASK 0xFFFFFFFF // CCK_MDRDY_TIME[31..0]
1248+#define BN0_WF_MIB_TOP_MSR1_OFDM_LG_MIXED_VHT_MDRDY_TIME_MASK 0xFFFFFFFF // OFDM_LG_MIXED_VHT_MDRDY_TIME[31..0]
1249+#define BN0_WF_MIB_TOP_MSR2_OFDM_GREEN_MDRDY_TIME_MASK 0xFFFFFFFF // OFDM_GREEN_MDRDY_TIME[31..0]
1250+#define BN0_WF_MIB_TOP_MCTR5_P_CCA_TIME_MASK 0xFFFFFFFF // P_CCA_TIME[31..0]
1251+#define BN0_WF_MIB_TOP_MCTR6_S_CCA_TIME_MASK 0xFFFFFFFF // S_CCA_TIME[31..0]
1252+#define BN0_WF_MIB_TOP_M0SDR18_P_ED_TIME_MASK 0x00FFFFFF // P_ED_TIME[23..0]
1253+#define BN0_WF_MIB_TOP_TSCR18_BEACONTXCOUNT_MASK 0xFFFFFFFF // BEACONTXCOUNT[31..0]
1254+#define BN0_WF_MIB_TOP_TBCR0_TX_20MHZ_CNT_MASK 0xFFFFFFFF // TX_20MHZ_CNT[31..0]
1255+#define BN0_WF_MIB_TOP_TBCR1_TX_40MHZ_CNT_MASK 0xFFFFFFFF // TX_40MHZ_CNT[31..0]
1256+#define BN0_WF_MIB_TOP_TBCR2_TX_80MHZ_CNT_MASK 0xFFFFFFFF // TX_80MHZ_CNT[31..0]
1257+#define BN0_WF_MIB_TOP_TBCR3_TX_160MHZ_CNT_MASK 0xFFFFFFFF // TX_160MHZ_CNT[31..0]
1258+#define BN0_WF_MIB_TOP_TBCR4_TX_320MHZ_CNT_MASK 0xFFFFFFFF // TX_320MHZ_CNT[31..0]
1259+#define BN0_WF_MIB_TOP_BSCR2_MUBF_TX_COUNT_MASK 0xFFFFFFFF // MUBF_TX_COUNT[31..0]
1260+#define BN0_WF_MIB_TOP_RVSR0_VEC_MISS_COUNT_MASK 0xFFFFFFFF // VEC_MISS_COUNT[31..0]
1261+#define BN0_WF_MIB_TOP_RSCR35_DELIMITER_FAIL_COUNT_MASK 0xFFFFFFFF // DELIMITER_FAIL_COUNT[31..0]
1262+#define BN0_WF_MIB_TOP_RSCR1_RX_FCS_ERROR_COUNT_MASK 0xFFFFFFFF // RX_FCS_ERROR_COUNT[31..0]
1263+#define BN0_WF_MIB_TOP_RSCR33_RX_FIFO_FULL_COUNT_MASK 0xFFFFFFFF // RX_FIFO_FULL_COUNT[31..0]
1264+#define BN0_WF_MIB_TOP_RSCR36_RX_LEN_MISMATCH_MASK 0xFFFFFFFF // RX_LEN_MISMATCH[31..0]
1265+#define BN0_WF_MIB_TOP_RSCR31_RX_MPDU_COUNT_MASK 0xFFFFFFFF // RX_MPDU_COUNT[31..0]
1266+#define BN0_WF_MIB_TOP_BTSCR5_RTSTXCOUNTn_MASK 0xFFFFFFFF // RTSTXCOUNTn[31..0]
1267+#define BN0_WF_MIB_TOP_BTSCR6_RTSRETRYCOUNTn_MASK 0xFFFFFFFF // RTSRETRYCOUNTn[31..0]
1268+#define BN0_WF_MIB_TOP_BTSCR0_BAMISSCOUNTn_MASK 0xFFFFFFFF // BAMISSCOUNTn[31..0]
1269+#define BN0_WF_MIB_TOP_BTSCR1_ACKFAILCOUNTn_MASK 0xFFFFFFFF // ACKFAILCOUNTn[31..0]
1270+#define BN0_WF_MIB_TOP_BTSCR2_FRAMERETRYCOUNTn_MASK 0xFFFFFFFF // FRAMERETRYCOUNTn[31..0]
1271+#define BN0_WF_MIB_TOP_BTSCR3_FRAMERETRY2COUNTn_MASK 0xFFFFFFFF // FRAMERETRY2COUNTn[31..0]
1272+#define BN0_WF_MIB_TOP_BTSCR4_FRAMERETRY3COUNTn_MASK 0xFFFFFFFF // FRAMERETRY3COUNTn[31..0]
1273+#define BN0_WF_MIB_TOP_TRARC0_ADDR (BN0_WF_MIB_TOP_BASE + 0x0B0) // D0B0
1274+#define BN0_WF_MIB_TOP_TRARC1_ADDR (BN0_WF_MIB_TOP_BASE + 0x0B4) // D0B4
1275+#define BN0_WF_MIB_TOP_TRARC2_ADDR (BN0_WF_MIB_TOP_BASE + 0x0B8) // D0B8
1276+#define BN0_WF_MIB_TOP_TRARC3_ADDR (BN0_WF_MIB_TOP_BASE + 0x0BC) // D0BC
1277+#define BN0_WF_MIB_TOP_TRARC4_ADDR (BN0_WF_MIB_TOP_BASE + 0x0C0) // D0C0
1278+#define BN0_WF_MIB_TOP_TRARC5_ADDR (BN0_WF_MIB_TOP_BASE + 0x0C4) // D0C4
1279+#define BN0_WF_MIB_TOP_TRARC6_ADDR (BN0_WF_MIB_TOP_BASE + 0x0C8) // D0C8
1280+#define BN0_WF_MIB_TOP_TRARC7_ADDR (BN0_WF_MIB_TOP_BASE + 0x0CC) // D0CC
1281+
1282+#define BN0_WF_MIB_TOP_TRDR0_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR0))
1283+#define BN0_WF_MIB_TOP_TRDR1_ADDR (BN0_WF_MIB_TOP_BASE + __OFFS(MIB_TRDR1))
1284+#define BN0_WF_MIB_TOP_TRDR2_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR2))
1285+#define BN0_WF_MIB_TOP_TRDR3_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR3))
1286+#define BN0_WF_MIB_TOP_TRDR4_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR4))
1287+#define BN0_WF_MIB_TOP_TRDR5_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR5))
1288+#define BN0_WF_MIB_TOP_TRDR6_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR6))
1289+#define BN0_WF_MIB_TOP_TRDR7_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR7))
1290+#define BN0_WF_MIB_TOP_TRDR8_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR8))
1291+#define BN0_WF_MIB_TOP_TRDR9_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR9))
1292+#define BN0_WF_MIB_TOP_TRDR10_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR10))
1293+#define BN0_WF_MIB_TOP_TRDR11_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR11))
1294+#define BN0_WF_MIB_TOP_TRDR12_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR12))
1295+#define BN0_WF_MIB_TOP_TRDR13_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR13))
1296+#define BN0_WF_MIB_TOP_TRDR14_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR14))
1297+#define BN0_WF_MIB_TOP_TRDR15_ADDR (BN0_WF_MIB_TOP_BASE + __DBG_OFFS(MIB_TRDR15))
1298+
1299+#define BN0_WF_MIB_TOP_TRARC0_AGG_RANG_SEL_1_ADDR BN0_WF_MIB_TOP_TRARC0_ADDR
1300+#define BN0_WF_MIB_TOP_TRARC0_AGG_RANG_SEL_1_MASK 0x03FF0000 // AGG_RANG_SEL_1[25..16]
1301+#define BN0_WF_MIB_TOP_TRARC0_AGG_RANG_SEL_1_SHFT 16
1302+#define BN0_WF_MIB_TOP_TRARC0_AGG_RANG_SEL_0_ADDR BN0_WF_MIB_TOP_TRARC0_ADDR
1303+#define BN0_WF_MIB_TOP_TRARC0_AGG_RANG_SEL_0_MASK 0x000003FF // AGG_RANG_SEL_0[9..0]
1304+#define BN0_WF_MIB_TOP_TRARC0_AGG_RANG_SEL_0_SHFT 0
1305+
1306+#define BN0_WF_MIB_TOP_TRARC1_AGG_RANG_SEL_3_ADDR BN0_WF_MIB_TOP_TRARC1_ADDR
1307+#define BN0_WF_MIB_TOP_TRARC1_AGG_RANG_SEL_3_MASK 0x03FF0000 // AGG_RANG_SEL_3[25..16]
1308+#define BN0_WF_MIB_TOP_TRARC1_AGG_RANG_SEL_3_SHFT 16
1309+#define BN0_WF_MIB_TOP_TRARC1_AGG_RANG_SEL_2_ADDR BN0_WF_MIB_TOP_TRARC1_ADDR
1310+#define BN0_WF_MIB_TOP_TRARC1_AGG_RANG_SEL_2_MASK 0x000003FF // AGG_RANG_SEL_2[9..0]
1311+#define BN0_WF_MIB_TOP_TRARC1_AGG_RANG_SEL_2_SHFT 0
1312+
1313+#define BN0_WF_MIB_TOP_TRARC2_AGG_RANG_SEL_5_ADDR BN0_WF_MIB_TOP_TRARC2_ADDR
1314+#define BN0_WF_MIB_TOP_TRARC2_AGG_RANG_SEL_5_MASK 0x03FF0000 // AGG_RANG_SEL_5[25..16]
1315+#define BN0_WF_MIB_TOP_TRARC2_AGG_RANG_SEL_5_SHFT 16
1316+#define BN0_WF_MIB_TOP_TRARC2_AGG_RANG_SEL_4_ADDR BN0_WF_MIB_TOP_TRARC2_ADDR
1317+#define BN0_WF_MIB_TOP_TRARC2_AGG_RANG_SEL_4_MASK 0x000003FF // AGG_RANG_SEL_4[9..0]
1318+#define BN0_WF_MIB_TOP_TRARC2_AGG_RANG_SEL_4_SHFT 0
1319+
1320+#define BN0_WF_MIB_TOP_TRARC3_AGG_RANG_SEL_7_ADDR BN0_WF_MIB_TOP_TRARC3_ADDR
1321+#define BN0_WF_MIB_TOP_TRARC3_AGG_RANG_SEL_7_MASK 0x03FF0000 // AGG_RANG_SEL_7[25..16]
1322+#define BN0_WF_MIB_TOP_TRARC3_AGG_RANG_SEL_7_SHFT 16
1323+#define BN0_WF_MIB_TOP_TRARC3_AGG_RANG_SEL_6_ADDR BN0_WF_MIB_TOP_TRARC3_ADDR
1324+#define BN0_WF_MIB_TOP_TRARC3_AGG_RANG_SEL_6_MASK 0x000003FF // AGG_RANG_SEL_6[9..0]
1325+#define BN0_WF_MIB_TOP_TRARC3_AGG_RANG_SEL_6_SHFT 0
1326+
1327+#define BN0_WF_MIB_TOP_TRARC4_AGG_RANG_SEL_9_ADDR BN0_WF_MIB_TOP_TRARC4_ADDR
1328+#define BN0_WF_MIB_TOP_TRARC4_AGG_RANG_SEL_9_MASK 0x03FF0000 // AGG_RANG_SEL_9[25..16]
1329+#define BN0_WF_MIB_TOP_TRARC4_AGG_RANG_SEL_9_SHFT 16
1330+#define BN0_WF_MIB_TOP_TRARC4_AGG_RANG_SEL_8_ADDR BN0_WF_MIB_TOP_TRARC4_ADDR
1331+#define BN0_WF_MIB_TOP_TRARC4_AGG_RANG_SEL_8_MASK 0x000003FF // AGG_RANG_SEL_8[9..0]
1332+#define BN0_WF_MIB_TOP_TRARC4_AGG_RANG_SEL_8_SHFT 0
1333+
1334+#define BN0_WF_MIB_TOP_TRARC5_AGG_RANG_SEL_11_ADDR BN0_WF_MIB_TOP_TRARC5_ADDR
1335+#define BN0_WF_MIB_TOP_TRARC5_AGG_RANG_SEL_11_MASK 0x03FF0000 // AGG_RANG_SEL_11[25..16]
1336+#define BN0_WF_MIB_TOP_TRARC5_AGG_RANG_SEL_11_SHFT 16
1337+#define BN0_WF_MIB_TOP_TRARC5_AGG_RANG_SEL_10_ADDR BN0_WF_MIB_TOP_TRARC5_ADDR
1338+#define BN0_WF_MIB_TOP_TRARC5_AGG_RANG_SEL_10_MASK 0x000003FF // AGG_RANG_SEL_10[9..0]
1339+#define BN0_WF_MIB_TOP_TRARC5_AGG_RANG_SEL_10_SHFT 0
1340+
1341+#define BN0_WF_MIB_TOP_TRARC6_AGG_RANG_SEL_13_ADDR BN0_WF_MIB_TOP_TRARC6_ADDR
1342+#define BN0_WF_MIB_TOP_TRARC6_AGG_RANG_SEL_13_MASK 0x03FF0000 // AGG_RANG_SEL_13[25..16]
1343+#define BN0_WF_MIB_TOP_TRARC6_AGG_RANG_SEL_13_SHFT 16
1344+#define BN0_WF_MIB_TOP_TRARC6_AGG_RANG_SEL_12_ADDR BN0_WF_MIB_TOP_TRARC6_ADDR
1345+#define BN0_WF_MIB_TOP_TRARC6_AGG_RANG_SEL_12_MASK 0x000003FF // AGG_RANG_SEL_12[9..0]
1346+#define BN0_WF_MIB_TOP_TRARC6_AGG_RANG_SEL_12_SHFT 0
1347+
1348+#define BN0_WF_MIB_TOP_TRARC7_AGG_RANG_SEL_14_ADDR BN0_WF_MIB_TOP_TRARC7_ADDR
1349+#define BN0_WF_MIB_TOP_TRARC7_AGG_RANG_SEL_14_MASK 0x000003FF // AGG_RANG_SEL_14[9..0]
1350+#define BN0_WF_MIB_TOP_TRARC7_AGG_RANG_SEL_14_SHFT 0
1351+
1352+/* RRO TOP */
1353+#define WF_RRO_TOP_BASE 0xA000 /*0x820C2000 */
1354+#define WF_RRO_TOP_IND_CMD_0_CTRL0_ADDR (WF_RRO_TOP_BASE + 0x40) // 2040
1355+ //
1356+/* WTBL */
1357+enum mt7996_wtbl_type {
1358+ WTBL_TYPE_LMAC, /* WTBL in LMAC */
1359+ WTBL_TYPE_UMAC, /* WTBL in UMAC */
1360+ WTBL_TYPE_KEY, /* Key Table */
1361+ MAX_NUM_WTBL_TYPE
1362+};
1363+
1364+struct berse_wtbl_parse {
1365+ u8 *name;
1366+ u32 mask;
1367+ u32 shift;
1368+ u8 new_line;
1369+};
1370+
1371+enum muar_idx {
1372+ MUAR_INDEX_OWN_MAC_ADDR_0 = 0,
1373+ MUAR_INDEX_OWN_MAC_ADDR_1,
1374+ MUAR_INDEX_OWN_MAC_ADDR_2,
1375+ MUAR_INDEX_OWN_MAC_ADDR_3,
1376+ MUAR_INDEX_OWN_MAC_ADDR_4,
1377+ MUAR_INDEX_OWN_MAC_ADDR_BC_MC = 0xE,
1378+ MUAR_INDEX_UNMATCHED = 0xF,
1379+ MUAR_INDEX_OWN_MAC_ADDR_11 = 0x11,
1380+ MUAR_INDEX_OWN_MAC_ADDR_12,
1381+ MUAR_INDEX_OWN_MAC_ADDR_13,
1382+ MUAR_INDEX_OWN_MAC_ADDR_14,
1383+ MUAR_INDEX_OWN_MAC_ADDR_15,
1384+ MUAR_INDEX_OWN_MAC_ADDR_16,
1385+ MUAR_INDEX_OWN_MAC_ADDR_17,
1386+ MUAR_INDEX_OWN_MAC_ADDR_18,
1387+ MUAR_INDEX_OWN_MAC_ADDR_19,
1388+ MUAR_INDEX_OWN_MAC_ADDR_1A,
1389+ MUAR_INDEX_OWN_MAC_ADDR_1B,
1390+ MUAR_INDEX_OWN_MAC_ADDR_1C,
1391+ MUAR_INDEX_OWN_MAC_ADDR_1D,
1392+ MUAR_INDEX_OWN_MAC_ADDR_1E,
1393+ MUAR_INDEX_OWN_MAC_ADDR_1F,
1394+ MUAR_INDEX_OWN_MAC_ADDR_20,
1395+ MUAR_INDEX_OWN_MAC_ADDR_21,
1396+ MUAR_INDEX_OWN_MAC_ADDR_22,
1397+ MUAR_INDEX_OWN_MAC_ADDR_23,
1398+ MUAR_INDEX_OWN_MAC_ADDR_24,
1399+ MUAR_INDEX_OWN_MAC_ADDR_25,
1400+ MUAR_INDEX_OWN_MAC_ADDR_26,
1401+ MUAR_INDEX_OWN_MAC_ADDR_27,
1402+ MUAR_INDEX_OWN_MAC_ADDR_28,
1403+ MUAR_INDEX_OWN_MAC_ADDR_29,
1404+ MUAR_INDEX_OWN_MAC_ADDR_2A,
1405+ MUAR_INDEX_OWN_MAC_ADDR_2B,
1406+ MUAR_INDEX_OWN_MAC_ADDR_2C,
1407+ MUAR_INDEX_OWN_MAC_ADDR_2D,
1408+ MUAR_INDEX_OWN_MAC_ADDR_2E,
1409+ MUAR_INDEX_OWN_MAC_ADDR_2F
1410+};
1411+
1412+enum cipher_suit {
1413+ IGTK_CIPHER_SUIT_NONE = 0,
1414+ IGTK_CIPHER_SUIT_BIP,
1415+ IGTK_CIPHER_SUIT_BIP_256
1416+};
1417+
1418+#define LWTBL_LEN_IN_DW 36
1419+#define UWTBL_LEN_IN_DW 16
1420+
1421+#define MT_DBG_WTBL_BASE 0x820D8000
1422+
1423+#define MT_DBG_WTBLON_TOP_BASE 0x820d4000
1424+#define MT_DBG_WTBLON_TOP_WDUCR_ADDR (MT_DBG_WTBLON_TOP_BASE + 0x0370) // 4370
1425+#define MT_DBG_WTBLON_TOP_WDUCR_GROUP GENMASK(4, 0)
1426+
1427+#define MT_DBG_UWTBL_TOP_BASE 0x820c4000
1428+#define MT_DBG_UWTBL_TOP_WDUCR_ADDR (MT_DBG_UWTBL_TOP_BASE + 0x0104) // 4104
1429+#define MT_DBG_UWTBL_TOP_WDUCR_GROUP GENMASK(5, 0)
1430+#define MT_DBG_UWTBL_TOP_WDUCR_TARGET BIT(31)
1431+
1432+#define LWTBL_IDX2BASE_ID GENMASK(14, 8)
1433+#define LWTBL_IDX2BASE_DW GENMASK(7, 2)
1434+#define LWTBL_IDX2BASE(_id, _dw) (MT_DBG_WTBL_BASE | \
1435+ FIELD_PREP(LWTBL_IDX2BASE_ID, _id) | \
1436+ FIELD_PREP(LWTBL_IDX2BASE_DW, _dw))
1437+
1438+#define UWTBL_IDX2BASE_ID GENMASK(12, 6)
1439+#define UWTBL_IDX2BASE_DW GENMASK(5, 2)
1440+#define UWTBL_IDX2BASE(_id, _dw) (MT_DBG_UWTBL_TOP_BASE | 0x2000 | \
1441+ FIELD_PREP(UWTBL_IDX2BASE_ID, _id) | \
1442+ FIELD_PREP(UWTBL_IDX2BASE_DW, _dw))
1443+
1444+#define KEYTBL_IDX2BASE_KEY GENMASK(12, 6)
1445+#define KEYTBL_IDX2BASE_DW GENMASK(5, 2)
1446+#define KEYTBL_IDX2BASE(_key, _dw) (MT_DBG_UWTBL_TOP_BASE | 0x2000 | \
1447+ FIELD_PREP(KEYTBL_IDX2BASE_KEY, _key) | \
1448+ FIELD_PREP(KEYTBL_IDX2BASE_DW, _dw))
1449+
1450+// UMAC WTBL
1451+// DW0
1452+#define WF_UWTBL_PEER_MLD_ADDRESS_47_32__DW 0
1453+#define WF_UWTBL_PEER_MLD_ADDRESS_47_32__ADDR 0
1454+#define WF_UWTBL_PEER_MLD_ADDRESS_47_32__MASK 0x0000ffff // 15- 0
1455+#define WF_UWTBL_PEER_MLD_ADDRESS_47_32__SHIFT 0
1456+#define WF_UWTBL_OWN_MLD_ID_DW 0
1457+#define WF_UWTBL_OWN_MLD_ID_ADDR 0
1458+#define WF_UWTBL_OWN_MLD_ID_MASK 0x003f0000 // 21-16
1459+#define WF_UWTBL_OWN_MLD_ID_SHIFT 16
1460+// DW1
1461+#define WF_UWTBL_PEER_MLD_ADDRESS_31_0__DW 1
1462+#define WF_UWTBL_PEER_MLD_ADDRESS_31_0__ADDR 4
1463+#define WF_UWTBL_PEER_MLD_ADDRESS_31_0__MASK 0xffffffff // 31- 0
1464+#define WF_UWTBL_PEER_MLD_ADDRESS_31_0__SHIFT 0
1465+// DW2
1466+#define WF_UWTBL_PN_31_0__DW 2
1467+#define WF_UWTBL_PN_31_0__ADDR 8
1468+#define WF_UWTBL_PN_31_0__MASK 0xffffffff // 31- 0
1469+#define WF_UWTBL_PN_31_0__SHIFT 0
1470+// DW3
1471+#define WF_UWTBL_PN_47_32__DW 3
1472+#define WF_UWTBL_PN_47_32__ADDR 12
1473+#define WF_UWTBL_PN_47_32__MASK 0x0000ffff // 15- 0
1474+#define WF_UWTBL_PN_47_32__SHIFT 0
1475+#define WF_UWTBL_COM_SN_DW 3
1476+#define WF_UWTBL_COM_SN_ADDR 12
1477+#define WF_UWTBL_COM_SN_MASK 0x0fff0000 // 27-16
1478+#define WF_UWTBL_COM_SN_SHIFT 16
1479+// DW4
1480+#define WF_UWTBL_TID0_SN_DW 4
1481+#define WF_UWTBL_TID0_SN_ADDR 16
1482+#define WF_UWTBL_TID0_SN_MASK 0x00000fff // 11- 0
1483+#define WF_UWTBL_TID0_SN_SHIFT 0
1484+#define WF_UWTBL_RX_BIPN_31_0__DW 4
1485+#define WF_UWTBL_RX_BIPN_31_0__ADDR 16
1486+#define WF_UWTBL_RX_BIPN_31_0__MASK 0xffffffff // 31- 0
1487+#define WF_UWTBL_RX_BIPN_31_0__SHIFT 0
1488+#define WF_UWTBL_TID1_SN_DW 4
1489+#define WF_UWTBL_TID1_SN_ADDR 16
1490+#define WF_UWTBL_TID1_SN_MASK 0x00fff000 // 23-12
1491+#define WF_UWTBL_TID1_SN_SHIFT 12
1492+#define WF_UWTBL_TID2_SN_7_0__DW 4
1493+#define WF_UWTBL_TID2_SN_7_0__ADDR 16
1494+#define WF_UWTBL_TID2_SN_7_0__MASK 0xff000000 // 31-24
1495+#define WF_UWTBL_TID2_SN_7_0__SHIFT 24
1496+// DW5
1497+#define WF_UWTBL_TID2_SN_11_8__DW 5
1498+#define WF_UWTBL_TID2_SN_11_8__ADDR 20
1499+#define WF_UWTBL_TID2_SN_11_8__MASK 0x0000000f // 3- 0
1500+#define WF_UWTBL_TID2_SN_11_8__SHIFT 0
1501+#define WF_UWTBL_RX_BIPN_47_32__DW 5
1502+#define WF_UWTBL_RX_BIPN_47_32__ADDR 20
1503+#define WF_UWTBL_RX_BIPN_47_32__MASK 0x0000ffff // 15- 0
1504+#define WF_UWTBL_RX_BIPN_47_32__SHIFT 0
1505+#define WF_UWTBL_TID3_SN_DW 5
1506+#define WF_UWTBL_TID3_SN_ADDR 20
1507+#define WF_UWTBL_TID3_SN_MASK 0x0000fff0 // 15- 4
1508+#define WF_UWTBL_TID3_SN_SHIFT 4
1509+#define WF_UWTBL_TID4_SN_DW 5
1510+#define WF_UWTBL_TID4_SN_ADDR 20
1511+#define WF_UWTBL_TID4_SN_MASK 0x0fff0000 // 27-16
1512+#define WF_UWTBL_TID4_SN_SHIFT 16
1513+#define WF_UWTBL_TID5_SN_3_0__DW 5
1514+#define WF_UWTBL_TID5_SN_3_0__ADDR 20
1515+#define WF_UWTBL_TID5_SN_3_0__MASK 0xf0000000 // 31-28
1516+#define WF_UWTBL_TID5_SN_3_0__SHIFT 28
1517+// DW6
1518+#define WF_UWTBL_TID5_SN_11_4__DW 6
1519+#define WF_UWTBL_TID5_SN_11_4__ADDR 24
1520+#define WF_UWTBL_TID5_SN_11_4__MASK 0x000000ff // 7- 0
1521+#define WF_UWTBL_TID5_SN_11_4__SHIFT 0
1522+#define WF_UWTBL_KEY_LOC2_DW 6
1523+#define WF_UWTBL_KEY_LOC2_ADDR 24
1524+#define WF_UWTBL_KEY_LOC2_MASK 0x00001fff // 12- 0
1525+#define WF_UWTBL_KEY_LOC2_SHIFT 0
1526+#define WF_UWTBL_TID6_SN_DW 6
1527+#define WF_UWTBL_TID6_SN_ADDR 24
1528+#define WF_UWTBL_TID6_SN_MASK 0x000fff00 // 19- 8
1529+#define WF_UWTBL_TID6_SN_SHIFT 8
1530+#define WF_UWTBL_TID7_SN_DW 6
1531+#define WF_UWTBL_TID7_SN_ADDR 24
1532+#define WF_UWTBL_TID7_SN_MASK 0xfff00000 // 31-20
1533+#define WF_UWTBL_TID7_SN_SHIFT 20
1534+// DW7
1535+#define WF_UWTBL_KEY_LOC0_DW 7
1536+#define WF_UWTBL_KEY_LOC0_ADDR 28
1537+#define WF_UWTBL_KEY_LOC0_MASK 0x00001fff // 12- 0
1538+#define WF_UWTBL_KEY_LOC0_SHIFT 0
1539+#define WF_UWTBL_KEY_LOC1_DW 7
1540+#define WF_UWTBL_KEY_LOC1_ADDR 28
1541+#define WF_UWTBL_KEY_LOC1_MASK 0x1fff0000 // 28-16
1542+#define WF_UWTBL_KEY_LOC1_SHIFT 16
1543+// DW8
1544+#define WF_UWTBL_AMSDU_CFG_DW 8
1545+#define WF_UWTBL_AMSDU_CFG_ADDR 32
1546+#define WF_UWTBL_AMSDU_CFG_MASK 0x00000fff // 11- 0
1547+#define WF_UWTBL_AMSDU_CFG_SHIFT 0
1548+#define WF_UWTBL_SEC_ADDR_MODE_DW 8
1549+#define WF_UWTBL_SEC_ADDR_MODE_ADDR 32
1550+#define WF_UWTBL_SEC_ADDR_MODE_MASK 0x00300000 // 21-20
1551+#define WF_UWTBL_SEC_ADDR_MODE_SHIFT 20
1552+#define WF_UWTBL_WMM_Q_DW 8
1553+#define WF_UWTBL_WMM_Q_ADDR 32
1554+#define WF_UWTBL_WMM_Q_MASK 0x06000000 // 26-25
1555+#define WF_UWTBL_WMM_Q_SHIFT 25
1556+#define WF_UWTBL_QOS_DW 8
1557+#define WF_UWTBL_QOS_ADDR 32
1558+#define WF_UWTBL_QOS_MASK 0x08000000 // 27-27
1559+#define WF_UWTBL_QOS_SHIFT 27
1560+#define WF_UWTBL_HT_DW 8
1561+#define WF_UWTBL_HT_ADDR 32
1562+#define WF_UWTBL_HT_MASK 0x10000000 // 28-28
1563+#define WF_UWTBL_HT_SHIFT 28
1564+#define WF_UWTBL_HDRT_MODE_DW 8
1565+#define WF_UWTBL_HDRT_MODE_ADDR 32
1566+#define WF_UWTBL_HDRT_MODE_MASK 0x20000000 // 29-29
1567+#define WF_UWTBL_HDRT_MODE_SHIFT 29
1568+// DW9
1569+#define WF_UWTBL_RELATED_IDX0_DW 9
1570+#define WF_UWTBL_RELATED_IDX0_ADDR 36
1571+#define WF_UWTBL_RELATED_IDX0_MASK 0x00000fff // 11- 0
1572+#define WF_UWTBL_RELATED_IDX0_SHIFT 0
1573+#define WF_UWTBL_RELATED_BAND0_DW 9
1574+#define WF_UWTBL_RELATED_BAND0_ADDR 36
1575+#define WF_UWTBL_RELATED_BAND0_MASK 0x00003000 // 13-12
1576+#define WF_UWTBL_RELATED_BAND0_SHIFT 12
1577+#define WF_UWTBL_PRIMARY_MLD_BAND_DW 9
1578+#define WF_UWTBL_PRIMARY_MLD_BAND_ADDR 36
1579+#define WF_UWTBL_PRIMARY_MLD_BAND_MASK 0x0000c000 // 15-14
1580+#define WF_UWTBL_PRIMARY_MLD_BAND_SHIFT 14
1581+#define WF_UWTBL_RELATED_IDX1_DW 9
1582+#define WF_UWTBL_RELATED_IDX1_ADDR 36
1583+#define WF_UWTBL_RELATED_IDX1_MASK 0x0fff0000 // 27-16
1584+#define WF_UWTBL_RELATED_IDX1_SHIFT 16
1585+#define WF_UWTBL_RELATED_BAND1_DW 9
1586+#define WF_UWTBL_RELATED_BAND1_ADDR 36
1587+#define WF_UWTBL_RELATED_BAND1_MASK 0x30000000 // 29-28
1588+#define WF_UWTBL_RELATED_BAND1_SHIFT 28
1589+#define WF_UWTBL_SECONDARY_MLD_BAND_DW 9
1590+#define WF_UWTBL_SECONDARY_MLD_BAND_ADDR 36
1591+#define WF_UWTBL_SECONDARY_MLD_BAND_MASK 0xc0000000 // 31-30
1592+#define WF_UWTBL_SECONDARY_MLD_BAND_SHIFT 30
1593+
1594+/* LMAC WTBL */
1595+// DW0
1596+#define WF_LWTBL_PEER_LINK_ADDRESS_47_32__DW 0
1597+#define WF_LWTBL_PEER_LINK_ADDRESS_47_32__ADDR 0
1598+#define WF_LWTBL_PEER_LINK_ADDRESS_47_32__MASK \
1599+ 0x0000ffff // 15- 0
1600+#define WF_LWTBL_PEER_LINK_ADDRESS_47_32__SHIFT 0
1601+#define WF_LWTBL_MUAR_DW 0
1602+#define WF_LWTBL_MUAR_ADDR 0
1603+#define WF_LWTBL_MUAR_MASK \
1604+ 0x003f0000 // 21-16
1605+#define WF_LWTBL_MUAR_SHIFT 16
1606+#define WF_LWTBL_RCA1_DW 0
1607+#define WF_LWTBL_RCA1_ADDR 0
1608+#define WF_LWTBL_RCA1_MASK \
1609+ 0x00400000 // 22-22
1610+#define WF_LWTBL_RCA1_SHIFT 22
1611+#define WF_LWTBL_KID_DW 0
1612+#define WF_LWTBL_KID_ADDR 0
1613+#define WF_LWTBL_KID_MASK \
1614+ 0x01800000 // 24-23
1615+#define WF_LWTBL_KID_SHIFT 23
1616+#define WF_LWTBL_RCID_DW 0
1617+#define WF_LWTBL_RCID_ADDR 0
1618+#define WF_LWTBL_RCID_MASK \
1619+ 0x02000000 // 25-25
1620+#define WF_LWTBL_RCID_SHIFT 25
1621+#define WF_LWTBL_BAND_DW 0
1622+#define WF_LWTBL_BAND_ADDR 0
1623+#define WF_LWTBL_BAND_MASK \
1624+ 0x0c000000 // 27-26
1625+#define WF_LWTBL_BAND_SHIFT 26
1626+#define WF_LWTBL_RV_DW 0
1627+#define WF_LWTBL_RV_ADDR 0
1628+#define WF_LWTBL_RV_MASK \
1629+ 0x10000000 // 28-28
1630+#define WF_LWTBL_RV_SHIFT 28
1631+#define WF_LWTBL_RCA2_DW 0
1632+#define WF_LWTBL_RCA2_ADDR 0
1633+#define WF_LWTBL_RCA2_MASK \
1634+ 0x20000000 // 29-29
1635+#define WF_LWTBL_RCA2_SHIFT 29
1636+#define WF_LWTBL_WPI_FLAG_DW 0
1637+#define WF_LWTBL_WPI_FLAG_ADDR 0
1638+#define WF_LWTBL_WPI_FLAG_MASK \
1639+ 0x40000000 // 30-30
1640+#define WF_LWTBL_WPI_FLAG_SHIFT 30
1641+// DW1
1642+#define WF_LWTBL_PEER_LINK_ADDRESS_31_0__DW 1
1643+#define WF_LWTBL_PEER_LINK_ADDRESS_31_0__ADDR 4
1644+#define WF_LWTBL_PEER_LINK_ADDRESS_31_0__MASK \
1645+ 0xffffffff // 31- 0
1646+#define WF_LWTBL_PEER_LINK_ADDRESS_31_0__SHIFT 0
1647+// DW2
1648+#define WF_LWTBL_AID_DW 2
1649+#define WF_LWTBL_AID_ADDR 8
1650+#define WF_LWTBL_AID_MASK \
1651+ 0x00000fff // 11- 0
1652+#define WF_LWTBL_AID_SHIFT 0
1653+#define WF_LWTBL_GID_SU_DW 2
1654+#define WF_LWTBL_GID_SU_ADDR 8
1655+#define WF_LWTBL_GID_SU_MASK \
1656+ 0x00001000 // 12-12
1657+#define WF_LWTBL_GID_SU_SHIFT 12
1658+#define WF_LWTBL_SPP_EN_DW 2
1659+#define WF_LWTBL_SPP_EN_ADDR 8
1660+#define WF_LWTBL_SPP_EN_MASK \
1661+ 0x00002000 // 13-13
1662+#define WF_LWTBL_SPP_EN_SHIFT 13
1663+#define WF_LWTBL_WPI_EVEN_DW 2
1664+#define WF_LWTBL_WPI_EVEN_ADDR 8
1665+#define WF_LWTBL_WPI_EVEN_MASK \
1666+ 0x00004000 // 14-14
1667+#define WF_LWTBL_WPI_EVEN_SHIFT 14
1668+#define WF_LWTBL_AAD_OM_DW 2
1669+#define WF_LWTBL_AAD_OM_ADDR 8
1670+#define WF_LWTBL_AAD_OM_MASK \
1671+ 0x00008000 // 15-15
1672+#define WF_LWTBL_AAD_OM_SHIFT 15
1673+/* kite DW2 field bit 13-14 */
1674+#define WF_LWTBL_DUAL_PTEC_EN_DW 2
1675+#define WF_LWTBL_DUAL_PTEC_EN_ADDR 8
1676+#define WF_LWTBL_DUAL_PTEC_EN_MASK \
1677+ 0x00002000 // 13-13
1678+#define WF_LWTBL_DUAL_PTEC_EN_SHIFT 13
1679+#define WF_LWTBL_DUAL_CTS_CAP_DW 2
1680+#define WF_LWTBL_DUAL_CTS_CAP_ADDR 8
1681+#define WF_LWTBL_DUAL_CTS_CAP_MASK \
1682+ 0x00004000 // 14-14
1683+#define WF_LWTBL_DUAL_CTS_CAP_SHIFT 14
1684+#define WF_LWTBL_CIPHER_SUIT_PGTK_DW 2
1685+#define WF_LWTBL_CIPHER_SUIT_PGTK_ADDR 8
1686+#define WF_LWTBL_CIPHER_SUIT_PGTK_MASK \
1687+ 0x001f0000 // 20-16
1688+#define WF_LWTBL_CIPHER_SUIT_PGTK_SHIFT 16
1689+#define WF_LWTBL_FD_DW 2
1690+#define WF_LWTBL_FD_ADDR 8
1691+#define WF_LWTBL_FD_MASK \
1692+ 0x00200000 // 21-21
1693+#define WF_LWTBL_FD_SHIFT 21
1694+#define WF_LWTBL_TD_DW 2
1695+#define WF_LWTBL_TD_ADDR 8
1696+#define WF_LWTBL_TD_MASK \
1697+ 0x00400000 // 22-22
1698+#define WF_LWTBL_TD_SHIFT 22
1699+#define WF_LWTBL_SW_DW 2
1700+#define WF_LWTBL_SW_ADDR 8
1701+#define WF_LWTBL_SW_MASK \
1702+ 0x00800000 // 23-23
1703+#define WF_LWTBL_SW_SHIFT 23
1704+#define WF_LWTBL_UL_DW 2
1705+#define WF_LWTBL_UL_ADDR 8
1706+#define WF_LWTBL_UL_MASK \
1707+ 0x01000000 // 24-24
1708+#define WF_LWTBL_UL_SHIFT 24
1709+#define WF_LWTBL_TX_PS_DW 2
1710+#define WF_LWTBL_TX_PS_ADDR 8
1711+#define WF_LWTBL_TX_PS_MASK \
1712+ 0x02000000 // 25-25
1713+#define WF_LWTBL_TX_PS_SHIFT 25
1714+#define WF_LWTBL_QOS_DW 2
1715+#define WF_LWTBL_QOS_ADDR 8
1716+#define WF_LWTBL_QOS_MASK \
1717+ 0x04000000 // 26-26
1718+#define WF_LWTBL_QOS_SHIFT 26
1719+#define WF_LWTBL_HT_DW 2
1720+#define WF_LWTBL_HT_ADDR 8
1721+#define WF_LWTBL_HT_MASK \
1722+ 0x08000000 // 27-27
1723+#define WF_LWTBL_HT_SHIFT 27
1724+#define WF_LWTBL_VHT_DW 2
1725+#define WF_LWTBL_VHT_ADDR 8
1726+#define WF_LWTBL_VHT_MASK \
1727+ 0x10000000 // 28-28
1728+#define WF_LWTBL_VHT_SHIFT 28
1729+#define WF_LWTBL_HE_DW 2
1730+#define WF_LWTBL_HE_ADDR 8
1731+#define WF_LWTBL_HE_MASK \
1732+ 0x20000000 // 29-29
1733+#define WF_LWTBL_HE_SHIFT 29
1734+#define WF_LWTBL_EHT_DW 2
1735+#define WF_LWTBL_EHT_ADDR 8
1736+#define WF_LWTBL_EHT_MASK \
1737+ 0x40000000 // 30-30
1738+#define WF_LWTBL_EHT_SHIFT 30
1739+#define WF_LWTBL_MESH_DW 2
1740+#define WF_LWTBL_MESH_ADDR 8
1741+#define WF_LWTBL_MESH_MASK \
1742+ 0x80000000 // 31-31
1743+#define WF_LWTBL_MESH_SHIFT 31
1744+// DW3
1745+#define WF_LWTBL_WMM_Q_DW 3
1746+#define WF_LWTBL_WMM_Q_ADDR 12
1747+#define WF_LWTBL_WMM_Q_MASK \
1748+ 0x00000003 // 1- 0
1749+#define WF_LWTBL_WMM_Q_SHIFT 0
1750+#define WF_LWTBL_EHT_SIG_MCS_DW 3
1751+#define WF_LWTBL_EHT_SIG_MCS_ADDR 12
1752+#define WF_LWTBL_EHT_SIG_MCS_MASK \
1753+ 0x0000000c // 3- 2
1754+#define WF_LWTBL_EHT_SIG_MCS_SHIFT 2
1755+#define WF_LWTBL_HDRT_MODE_DW 3
1756+#define WF_LWTBL_HDRT_MODE_ADDR 12
1757+#define WF_LWTBL_HDRT_MODE_MASK \
1758+ 0x00000010 // 4- 4
1759+#define WF_LWTBL_HDRT_MODE_SHIFT 4
1760+#define WF_LWTBL_BEAM_CHG_DW 3
1761+#define WF_LWTBL_BEAM_CHG_ADDR 12
1762+#define WF_LWTBL_BEAM_CHG_MASK \
1763+ 0x00000020 // 5- 5
1764+#define WF_LWTBL_BEAM_CHG_SHIFT 5
1765+#define WF_LWTBL_EHT_LTF_SYM_NUM_OPT_DW 3
1766+#define WF_LWTBL_EHT_LTF_SYM_NUM_OPT_ADDR 12
1767+#define WF_LWTBL_EHT_LTF_SYM_NUM_OPT_MASK \
1768+ 0x000000c0 // 7- 6
1769+#define WF_LWTBL_EHT_LTF_SYM_NUM_OPT_SHIFT 6
1770+#define WF_LWTBL_PFMU_IDX_DW 3
1771+#define WF_LWTBL_PFMU_IDX_ADDR 12
1772+#define WF_LWTBL_PFMU_IDX_MASK \
1773+ 0x0000ff00 // 15- 8
1774+#define WF_LWTBL_PFMU_IDX_SHIFT 8
1775+#define WF_LWTBL_ULPF_IDX_DW 3
1776+#define WF_LWTBL_ULPF_IDX_ADDR 12
1777+#define WF_LWTBL_ULPF_IDX_MASK \
1778+ 0x00ff0000 // 23-16
1779+#define WF_LWTBL_ULPF_IDX_SHIFT 16
1780+#define WF_LWTBL_RIBF_DW 3
1781+#define WF_LWTBL_RIBF_ADDR 12
1782+#define WF_LWTBL_RIBF_MASK \
1783+ 0x01000000 // 24-24
1784+#define WF_LWTBL_RIBF_SHIFT 24
1785+#define WF_LWTBL_ULPF_DW 3
1786+#define WF_LWTBL_ULPF_ADDR 12
1787+#define WF_LWTBL_ULPF_MASK \
1788+ 0x02000000 // 25-25
1789+#define WF_LWTBL_ULPF_SHIFT 25
1790+#define WF_LWTBL_BYPASS_TXSMM_DW 3
1791+#define WF_LWTBL_BYPASS_TXSMM_ADDR 12
1792+#define WF_LWTBL_BYPASS_TXSMM_MASK \
1793+ 0x04000000 // 26-26
1794+#define WF_LWTBL_BYPASS_TXSMM_SHIFT 26
1795+#define WF_LWTBL_TBF_HT_DW 3
1796+#define WF_LWTBL_TBF_HT_ADDR 12
1797+#define WF_LWTBL_TBF_HT_MASK \
1798+ 0x08000000 // 27-27
1799+#define WF_LWTBL_TBF_HT_SHIFT 27
1800+#define WF_LWTBL_TBF_VHT_DW 3
1801+#define WF_LWTBL_TBF_VHT_ADDR 12
1802+#define WF_LWTBL_TBF_VHT_MASK \
1803+ 0x10000000 // 28-28
1804+#define WF_LWTBL_TBF_VHT_SHIFT 28
1805+#define WF_LWTBL_TBF_HE_DW 3
1806+#define WF_LWTBL_TBF_HE_ADDR 12
1807+#define WF_LWTBL_TBF_HE_MASK \
1808+ 0x20000000 // 29-29
1809+#define WF_LWTBL_TBF_HE_SHIFT 29
1810+#define WF_LWTBL_TBF_EHT_DW 3
1811+#define WF_LWTBL_TBF_EHT_ADDR 12
1812+#define WF_LWTBL_TBF_EHT_MASK \
1813+ 0x40000000 // 30-30
1814+#define WF_LWTBL_TBF_EHT_SHIFT 30
1815+#define WF_LWTBL_IGN_FBK_DW 3
1816+#define WF_LWTBL_IGN_FBK_ADDR 12
1817+#define WF_LWTBL_IGN_FBK_MASK \
1818+ 0x80000000 // 31-31
1819+#define WF_LWTBL_IGN_FBK_SHIFT 31
1820+// DW4
1821+#define WF_LWTBL_NEGOTIATED_WINSIZE0_DW 4
1822+#define WF_LWTBL_NEGOTIATED_WINSIZE0_ADDR 16
1823+#define WF_LWTBL_NEGOTIATED_WINSIZE0_MASK \
1824+ 0x00000007 // 2- 0
1825+#define WF_LWTBL_NEGOTIATED_WINSIZE0_SHIFT 0
1826+#define WF_LWTBL_NEGOTIATED_WINSIZE1_DW 4
1827+#define WF_LWTBL_NEGOTIATED_WINSIZE1_ADDR 16
1828+#define WF_LWTBL_NEGOTIATED_WINSIZE1_MASK \
1829+ 0x00000038 // 5- 3
1830+#define WF_LWTBL_NEGOTIATED_WINSIZE1_SHIFT 3
1831+#define WF_LWTBL_NEGOTIATED_WINSIZE2_DW 4
1832+#define WF_LWTBL_NEGOTIATED_WINSIZE2_ADDR 16
1833+#define WF_LWTBL_NEGOTIATED_WINSIZE2_MASK \
1834+ 0x000001c0 // 8- 6
1835+#define WF_LWTBL_NEGOTIATED_WINSIZE2_SHIFT 6
1836+#define WF_LWTBL_NEGOTIATED_WINSIZE3_DW 4
1837+#define WF_LWTBL_NEGOTIATED_WINSIZE3_ADDR 16
1838+#define WF_LWTBL_NEGOTIATED_WINSIZE3_MASK \
1839+ 0x00000e00 // 11- 9
1840+#define WF_LWTBL_NEGOTIATED_WINSIZE3_SHIFT 9
1841+#define WF_LWTBL_NEGOTIATED_WINSIZE4_DW 4
1842+#define WF_LWTBL_NEGOTIATED_WINSIZE4_ADDR 16
1843+#define WF_LWTBL_NEGOTIATED_WINSIZE4_MASK \
1844+ 0x00007000 // 14-12
1845+#define WF_LWTBL_NEGOTIATED_WINSIZE4_SHIFT 12
1846+#define WF_LWTBL_NEGOTIATED_WINSIZE5_DW 4
1847+#define WF_LWTBL_NEGOTIATED_WINSIZE5_ADDR 16
1848+#define WF_LWTBL_NEGOTIATED_WINSIZE5_MASK \
1849+ 0x00038000 // 17-15
1850+#define WF_LWTBL_NEGOTIATED_WINSIZE5_SHIFT 15
1851+#define WF_LWTBL_NEGOTIATED_WINSIZE6_DW 4
1852+#define WF_LWTBL_NEGOTIATED_WINSIZE6_ADDR 16
1853+#define WF_LWTBL_NEGOTIATED_WINSIZE6_MASK \
1854+ 0x001c0000 // 20-18
1855+#define WF_LWTBL_NEGOTIATED_WINSIZE6_SHIFT 18
1856+#define WF_LWTBL_NEGOTIATED_WINSIZE7_DW 4
1857+#define WF_LWTBL_NEGOTIATED_WINSIZE7_ADDR 16
1858+#define WF_LWTBL_NEGOTIATED_WINSIZE7_MASK \
1859+ 0x00e00000 // 23-21
1860+#define WF_LWTBL_NEGOTIATED_WINSIZE7_SHIFT 21
1861+#define WF_LWTBL_PE_DW 4
1862+#define WF_LWTBL_PE_ADDR 16
1863+#define WF_LWTBL_PE_MASK \
1864+ 0x03000000 // 25-24
1865+#define WF_LWTBL_PE_SHIFT 24
1866+#define WF_LWTBL_DIS_RHTR_DW 4
1867+#define WF_LWTBL_DIS_RHTR_ADDR 16
1868+#define WF_LWTBL_DIS_RHTR_MASK \
1869+ 0x04000000 // 26-26
1870+#define WF_LWTBL_DIS_RHTR_SHIFT 26
1871+#define WF_LWTBL_LDPC_HT_DW 4
1872+#define WF_LWTBL_LDPC_HT_ADDR 16
1873+#define WF_LWTBL_LDPC_HT_MASK \
1874+ 0x08000000 // 27-27
1875+#define WF_LWTBL_LDPC_HT_SHIFT 27
1876+#define WF_LWTBL_LDPC_VHT_DW 4
1877+#define WF_LWTBL_LDPC_VHT_ADDR 16
1878+#define WF_LWTBL_LDPC_VHT_MASK \
1879+ 0x10000000 // 28-28
1880+#define WF_LWTBL_LDPC_VHT_SHIFT 28
1881+#define WF_LWTBL_LDPC_HE_DW 4
1882+#define WF_LWTBL_LDPC_HE_ADDR 16
1883+#define WF_LWTBL_LDPC_HE_MASK \
1884+ 0x20000000 // 29-29
1885+#define WF_LWTBL_LDPC_HE_SHIFT 29
1886+#define WF_LWTBL_LDPC_EHT_DW 4
1887+#define WF_LWTBL_LDPC_EHT_ADDR 16
1888+#define WF_LWTBL_LDPC_EHT_MASK \
1889+ 0x40000000 // 30-30
1890+#define WF_LWTBL_LDPC_EHT_SHIFT 30
1891+#define WF_LWTBL_BA_MODE_DW 4
1892+#define WF_LWTBL_BA_MODE_ADDR 16
1893+#define WF_LWTBL_BA_MODE_MASK \
1894+ 0x80000000 // 31-31
1895+#define WF_LWTBL_BA_MODE_SHIFT 31
1896+// DW5
1897+#define WF_LWTBL_AF_DW 5
1898+#define WF_LWTBL_AF_ADDR 20
1899+#define WF_LWTBL_AF_MASK \
1900+ 0x00000007 // 2- 0
1901+#define WF_LWTBL_AF_MASK_7992 \
1902+ 0x0000000f // 3- 0
1903+#define WF_LWTBL_AF_SHIFT 0
1904+#define WF_LWTBL_AF_HE_DW 5
1905+#define WF_LWTBL_AF_HE_ADDR 20
1906+#define WF_LWTBL_AF_HE_MASK \
1907+ 0x00000018 // 4- 3
1908+#define WF_LWTBL_AF_HE_SHIFT 3
1909+#define WF_LWTBL_RTS_DW 5
1910+#define WF_LWTBL_RTS_ADDR 20
1911+#define WF_LWTBL_RTS_MASK \
1912+ 0x00000020 // 5- 5
1913+#define WF_LWTBL_RTS_SHIFT 5
1914+#define WF_LWTBL_SMPS_DW 5
1915+#define WF_LWTBL_SMPS_ADDR 20
1916+#define WF_LWTBL_SMPS_MASK \
1917+ 0x00000040 // 6- 6
1918+#define WF_LWTBL_SMPS_SHIFT 6
1919+#define WF_LWTBL_DYN_BW_DW 5
1920+#define WF_LWTBL_DYN_BW_ADDR 20
1921+#define WF_LWTBL_DYN_BW_MASK \
1922+ 0x00000080 // 7- 7
1923+#define WF_LWTBL_DYN_BW_SHIFT 7
1924+#define WF_LWTBL_MMSS_DW 5
1925+#define WF_LWTBL_MMSS_ADDR 20
1926+#define WF_LWTBL_MMSS_MASK \
1927+ 0x00000700 // 10- 8
1928+#define WF_LWTBL_MMSS_SHIFT 8
1929+#define WF_LWTBL_USR_DW 5
1930+#define WF_LWTBL_USR_ADDR 20
1931+#define WF_LWTBL_USR_MASK \
1932+ 0x00000800 // 11-11
1933+#define WF_LWTBL_USR_SHIFT 11
1934+#define WF_LWTBL_SR_R_DW 5
1935+#define WF_LWTBL_SR_R_ADDR 20
1936+#define WF_LWTBL_SR_R_MASK \
1937+ 0x00007000 // 14-12
1938+#define WF_LWTBL_SR_R_SHIFT 12
1939+#define WF_LWTBL_SR_ABORT_DW 5
1940+#define WF_LWTBL_SR_ABORT_ADDR 20
1941+#define WF_LWTBL_SR_ABORT_MASK \
1942+ 0x00008000 // 15-15
1943+#define WF_LWTBL_SR_ABORT_SHIFT 15
1944+#define WF_LWTBL_TX_POWER_OFFSET_DW 5
1945+#define WF_LWTBL_TX_POWER_OFFSET_ADDR 20
1946+#define WF_LWTBL_TX_POWER_OFFSET_MASK \
1947+ 0x003f0000 // 21-16
1948+#define WF_LWTBL_TX_POWER_OFFSET_SHIFT 16
1949+#define WF_LWTBL_LTF_EHT_DW 5
1950+#define WF_LWTBL_LTF_EHT_ADDR 20
1951+#define WF_LWTBL_LTF_EHT_MASK \
1952+ 0x00c00000 // 23-22
1953+#define WF_LWTBL_LTF_EHT_SHIFT 22
1954+#define WF_LWTBL_GI_EHT_DW 5
1955+#define WF_LWTBL_GI_EHT_ADDR 20
1956+#define WF_LWTBL_GI_EHT_MASK \
1957+ 0x03000000 // 25-24
1958+#define WF_LWTBL_GI_EHT_SHIFT 24
1959+#define WF_LWTBL_DOPPL_DW 5
1960+#define WF_LWTBL_DOPPL_ADDR 20
1961+#define WF_LWTBL_DOPPL_MASK \
1962+ 0x04000000 // 26-26
1963+#define WF_LWTBL_DOPPL_SHIFT 26
1964+#define WF_LWTBL_TXOP_PS_CAP_DW 5
1965+#define WF_LWTBL_TXOP_PS_CAP_ADDR 20
1966+#define WF_LWTBL_TXOP_PS_CAP_MASK \
1967+ 0x08000000 // 27-27
1968+#define WF_LWTBL_TXOP_PS_CAP_SHIFT 27
1969+#define WF_LWTBL_DU_I_PSM_DW 5
1970+#define WF_LWTBL_DU_I_PSM_ADDR 20
1971+#define WF_LWTBL_DU_I_PSM_MASK \
1972+ 0x10000000 // 28-28
1973+#define WF_LWTBL_DU_I_PSM_SHIFT 28
1974+#define WF_LWTBL_I_PSM_DW 5
1975+#define WF_LWTBL_I_PSM_ADDR 20
1976+#define WF_LWTBL_I_PSM_MASK \
1977+ 0x20000000 // 29-29
1978+#define WF_LWTBL_I_PSM_SHIFT 29
1979+#define WF_LWTBL_PSM_DW 5
1980+#define WF_LWTBL_PSM_ADDR 20
1981+#define WF_LWTBL_PSM_MASK \
1982+ 0x40000000 // 30-30
1983+#define WF_LWTBL_PSM_SHIFT 30
1984+#define WF_LWTBL_SKIP_TX_DW 5
1985+#define WF_LWTBL_SKIP_TX_ADDR 20
1986+#define WF_LWTBL_SKIP_TX_MASK \
1987+ 0x80000000 // 31-31
1988+#define WF_LWTBL_SKIP_TX_SHIFT 31
1989+// DW6
1990+#define WF_LWTBL_CBRN_DW 6
1991+#define WF_LWTBL_CBRN_ADDR 24
1992+#define WF_LWTBL_CBRN_MASK \
1993+ 0x00000007 // 2- 0
1994+#define WF_LWTBL_CBRN_SHIFT 0
1995+#define WF_LWTBL_DBNSS_EN_DW 6
1996+#define WF_LWTBL_DBNSS_EN_ADDR 24
1997+#define WF_LWTBL_DBNSS_EN_MASK \
1998+ 0x00000008 // 3- 3
1999+#define WF_LWTBL_DBNSS_EN_SHIFT 3
2000+#define WF_LWTBL_BAF_EN_DW 6
2001+#define WF_LWTBL_BAF_EN_ADDR 24
2002+#define WF_LWTBL_BAF_EN_MASK \
2003+ 0x00000010 // 4- 4
2004+#define WF_LWTBL_BAF_EN_SHIFT 4
2005+#define WF_LWTBL_RDGBA_DW 6
2006+#define WF_LWTBL_RDGBA_ADDR 24
2007+#define WF_LWTBL_RDGBA_MASK \
2008+ 0x00000020 // 5- 5
2009+#define WF_LWTBL_RDGBA_SHIFT 5
2010+#define WF_LWTBL_R_DW 6
2011+#define WF_LWTBL_R_ADDR 24
2012+#define WF_LWTBL_R_MASK \
2013+ 0x00000040 // 6- 6
2014+#define WF_LWTBL_R_SHIFT 6
2015+#define WF_LWTBL_SPE_IDX_DW 6
2016+#define WF_LWTBL_SPE_IDX_ADDR 24
2017+#define WF_LWTBL_SPE_IDX_MASK \
2018+ 0x00000f80 // 11- 7
2019+#define WF_LWTBL_SPE_IDX_SHIFT 7
2020+#define WF_LWTBL_G2_DW 6
2021+#define WF_LWTBL_G2_ADDR 24
2022+#define WF_LWTBL_G2_MASK \
2023+ 0x00001000 // 12-12
2024+#define WF_LWTBL_G2_SHIFT 12
2025+#define WF_LWTBL_G4_DW 6
2026+#define WF_LWTBL_G4_ADDR 24
2027+#define WF_LWTBL_G4_MASK \
2028+ 0x00002000 // 13-13
2029+#define WF_LWTBL_G4_SHIFT 13
2030+#define WF_LWTBL_G8_DW 6
2031+#define WF_LWTBL_G8_ADDR 24
2032+#define WF_LWTBL_G8_MASK \
2033+ 0x00004000 // 14-14
2034+#define WF_LWTBL_G8_SHIFT 14
2035+#define WF_LWTBL_G16_DW 6
2036+#define WF_LWTBL_G16_ADDR 24
2037+#define WF_LWTBL_G16_MASK \
2038+ 0x00008000 // 15-15
2039+#define WF_LWTBL_G16_SHIFT 15
2040+#define WF_LWTBL_G2_LTF_DW 6
2041+#define WF_LWTBL_G2_LTF_ADDR 24
2042+#define WF_LWTBL_G2_LTF_MASK \
2043+ 0x00030000 // 17-16
2044+#define WF_LWTBL_G2_LTF_SHIFT 16
2045+#define WF_LWTBL_G4_LTF_DW 6
2046+#define WF_LWTBL_G4_LTF_ADDR 24
2047+#define WF_LWTBL_G4_LTF_MASK \
2048+ 0x000c0000 // 19-18
2049+#define WF_LWTBL_G4_LTF_SHIFT 18
2050+#define WF_LWTBL_G8_LTF_DW 6
2051+#define WF_LWTBL_G8_LTF_ADDR 24
2052+#define WF_LWTBL_G8_LTF_MASK \
2053+ 0x00300000 // 21-20
2054+#define WF_LWTBL_G8_LTF_SHIFT 20
2055+#define WF_LWTBL_G16_LTF_DW 6
2056+#define WF_LWTBL_G16_LTF_ADDR 24
2057+#define WF_LWTBL_G16_LTF_MASK \
2058+ 0x00c00000 // 23-22
2059+#define WF_LWTBL_G16_LTF_SHIFT 22
2060+#define WF_LWTBL_G2_HE_DW 6
2061+#define WF_LWTBL_G2_HE_ADDR 24
2062+#define WF_LWTBL_G2_HE_MASK \
2063+ 0x03000000 // 25-24
2064+#define WF_LWTBL_G2_HE_SHIFT 24
2065+#define WF_LWTBL_G4_HE_DW 6
2066+#define WF_LWTBL_G4_HE_ADDR 24
2067+#define WF_LWTBL_G4_HE_MASK \
2068+ 0x0c000000 // 27-26
2069+#define WF_LWTBL_G4_HE_SHIFT 26
2070+#define WF_LWTBL_G8_HE_DW 6
2071+#define WF_LWTBL_G8_HE_ADDR 24
2072+#define WF_LWTBL_G8_HE_MASK \
2073+ 0x30000000 // 29-28
2074+#define WF_LWTBL_G8_HE_SHIFT 28
2075+#define WF_LWTBL_G16_HE_DW 6
2076+#define WF_LWTBL_G16_HE_ADDR 24
2077+#define WF_LWTBL_G16_HE_MASK \
2078+ 0xc0000000 // 31-30
2079+#define WF_LWTBL_G16_HE_SHIFT 30
2080+// DW7
2081+#define WF_LWTBL_BA_WIN_SIZE0_DW 7
2082+#define WF_LWTBL_BA_WIN_SIZE0_ADDR 28
2083+#define WF_LWTBL_BA_WIN_SIZE0_MASK \
2084+ 0x0000000f // 3- 0
2085+#define WF_LWTBL_BA_WIN_SIZE0_SHIFT 0
2086+#define WF_LWTBL_BA_WIN_SIZE1_DW 7
2087+#define WF_LWTBL_BA_WIN_SIZE1_ADDR 28
2088+#define WF_LWTBL_BA_WIN_SIZE1_MASK \
2089+ 0x000000f0 // 7- 4
2090+#define WF_LWTBL_BA_WIN_SIZE1_SHIFT 4
2091+#define WF_LWTBL_BA_WIN_SIZE2_DW 7
2092+#define WF_LWTBL_BA_WIN_SIZE2_ADDR 28
2093+#define WF_LWTBL_BA_WIN_SIZE2_MASK \
2094+ 0x00000f00 // 11- 8
2095+#define WF_LWTBL_BA_WIN_SIZE2_SHIFT 8
2096+#define WF_LWTBL_BA_WIN_SIZE3_DW 7
2097+#define WF_LWTBL_BA_WIN_SIZE3_ADDR 28
2098+#define WF_LWTBL_BA_WIN_SIZE3_MASK \
2099+ 0x0000f000 // 15-12
2100+#define WF_LWTBL_BA_WIN_SIZE3_SHIFT 12
2101+#define WF_LWTBL_BA_WIN_SIZE4_DW 7
2102+#define WF_LWTBL_BA_WIN_SIZE4_ADDR 28
2103+#define WF_LWTBL_BA_WIN_SIZE4_MASK \
2104+ 0x000f0000 // 19-16
2105+#define WF_LWTBL_BA_WIN_SIZE4_SHIFT 16
2106+#define WF_LWTBL_BA_WIN_SIZE5_DW 7
2107+#define WF_LWTBL_BA_WIN_SIZE5_ADDR 28
2108+#define WF_LWTBL_BA_WIN_SIZE5_MASK \
2109+ 0x00f00000 // 23-20
2110+#define WF_LWTBL_BA_WIN_SIZE5_SHIFT 20
2111+#define WF_LWTBL_BA_WIN_SIZE6_DW 7
2112+#define WF_LWTBL_BA_WIN_SIZE6_ADDR 28
2113+#define WF_LWTBL_BA_WIN_SIZE6_MASK \
2114+ 0x0f000000 // 27-24
2115+#define WF_LWTBL_BA_WIN_SIZE6_SHIFT 24
2116+#define WF_LWTBL_BA_WIN_SIZE7_DW 7
2117+#define WF_LWTBL_BA_WIN_SIZE7_ADDR 28
2118+#define WF_LWTBL_BA_WIN_SIZE7_MASK \
2119+ 0xf0000000 // 31-28
2120+#define WF_LWTBL_BA_WIN_SIZE7_SHIFT 28
2121+// DW8
2122+#define WF_LWTBL_AC0_RTS_FAIL_CNT_DW 8
2123+#define WF_LWTBL_AC0_RTS_FAIL_CNT_ADDR 32
2124+#define WF_LWTBL_AC0_RTS_FAIL_CNT_MASK \
2125+ 0x0000001f // 4- 0
2126+#define WF_LWTBL_AC0_RTS_FAIL_CNT_SHIFT 0
2127+#define WF_LWTBL_AC1_RTS_FAIL_CNT_DW 8
2128+#define WF_LWTBL_AC1_RTS_FAIL_CNT_ADDR 32
2129+#define WF_LWTBL_AC1_RTS_FAIL_CNT_MASK \
2130+ 0x000003e0 // 9- 5
2131+#define WF_LWTBL_AC1_RTS_FAIL_CNT_SHIFT 5
2132+#define WF_LWTBL_AC2_RTS_FAIL_CNT_DW 8
2133+#define WF_LWTBL_AC2_RTS_FAIL_CNT_ADDR 32
2134+#define WF_LWTBL_AC2_RTS_FAIL_CNT_MASK \
2135+ 0x00007c00 // 14-10
2136+#define WF_LWTBL_AC2_RTS_FAIL_CNT_SHIFT 10
2137+#define WF_LWTBL_AC3_RTS_FAIL_CNT_DW 8
2138+#define WF_LWTBL_AC3_RTS_FAIL_CNT_ADDR 32
2139+#define WF_LWTBL_AC3_RTS_FAIL_CNT_MASK \
2140+ 0x000f8000 // 19-15
2141+#define WF_LWTBL_AC3_RTS_FAIL_CNT_SHIFT 15
2142+#define WF_LWTBL_PARTIAL_AID_DW 8
2143+#define WF_LWTBL_PARTIAL_AID_ADDR 32
2144+#define WF_LWTBL_PARTIAL_AID_MASK \
2145+ 0x1ff00000 // 28-20
2146+#define WF_LWTBL_PARTIAL_AID_SHIFT 20
2147+#define WF_LWTBL_CHK_PER_DW 8
2148+#define WF_LWTBL_CHK_PER_ADDR 32
2149+#define WF_LWTBL_CHK_PER_MASK \
2150+ 0x80000000 // 31-31
2151+#define WF_LWTBL_CHK_PER_SHIFT 31
2152+// DW9
2153+#define WF_LWTBL_RX_AVG_MPDU_SIZE_DW 9
2154+#define WF_LWTBL_RX_AVG_MPDU_SIZE_ADDR 36
2155+#define WF_LWTBL_RX_AVG_MPDU_SIZE_MASK \
2156+ 0x00003fff // 13- 0
2157+#define WF_LWTBL_RX_AVG_MPDU_SIZE_SHIFT 0
2158+#define WF_LWTBL_PRITX_SW_MODE_DW 9
2159+#define WF_LWTBL_PRITX_SW_MODE_ADDR 36
2160+#define WF_LWTBL_PRITX_SW_MODE_MASK \
2161+ 0x00008000 // 15-15
2162+#define WF_LWTBL_PRITX_SW_MODE_SHIFT 15
2163+#define WF_LWTBL_PRITX_SW_MODE_MASK_7992 \
2164+ 0x00004000 // 14-14
2165+#define WF_LWTBL_PRITX_SW_MODE_SHIFT_7992 14
2166+#define WF_LWTBL_PRITX_ERSU_DW 9
2167+#define WF_LWTBL_PRITX_ERSU_ADDR 36
2168+#define WF_LWTBL_PRITX_ERSU_MASK \
2169+ 0x00010000 // 16-16
2170+#define WF_LWTBL_PRITX_ERSU_SHIFT 16
2171+#define WF_LWTBL_PRITX_ERSU_MASK_7992 \
2172+ 0x00008000 // 15-15
2173+#define WF_LWTBL_PRITX_ERSU_SHIFT_7992 15
2174+#define WF_LWTBL_PRITX_PLR_DW 9
2175+#define WF_LWTBL_PRITX_PLR_ADDR 36
2176+#define WF_LWTBL_PRITX_PLR_MASK \
2177+ 0x00020000 // 17-17
2178+#define WF_LWTBL_PRITX_PLR_SHIFT 17
2179+#define WF_LWTBL_PRITX_PLR_MASK_7992 \
2180+ 0x00030000 // 17-16
2181+#define WF_LWTBL_PRITX_PLR_SHIFT_7992 16
2182+#define WF_LWTBL_PRITX_DCM_DW 9
2183+#define WF_LWTBL_PRITX_DCM_ADDR 36
2184+#define WF_LWTBL_PRITX_DCM_MASK \
2185+ 0x00040000 // 18-18
2186+#define WF_LWTBL_PRITX_DCM_SHIFT 18
2187+#define WF_LWTBL_PRITX_ER106T_DW 9
2188+#define WF_LWTBL_PRITX_ER106T_ADDR 36
2189+#define WF_LWTBL_PRITX_ER106T_MASK \
2190+ 0x00080000 // 19-19
2191+#define WF_LWTBL_PRITX_ER106T_SHIFT 19
2192+#define WF_LWTBL_FCAP_DW 9
2193+#define WF_LWTBL_FCAP_ADDR 36
2194+#define WF_LWTBL_FCAP_MASK \
2195+ 0x00700000 // 22-20
2196+#define WF_LWTBL_FCAP_SHIFT 20
2197+#define WF_LWTBL_MPDU_FAIL_CNT_DW 9
2198+#define WF_LWTBL_MPDU_FAIL_CNT_ADDR 36
2199+#define WF_LWTBL_MPDU_FAIL_CNT_MASK \
2200+ 0x03800000 // 25-23
2201+#define WF_LWTBL_MPDU_FAIL_CNT_SHIFT 23
2202+#define WF_LWTBL_MPDU_OK_CNT_DW 9
2203+#define WF_LWTBL_MPDU_OK_CNT_ADDR 36
2204+#define WF_LWTBL_MPDU_OK_CNT_MASK \
2205+ 0x1c000000 // 28-26
2206+#define WF_LWTBL_MPDU_OK_CNT_SHIFT 26
2207+#define WF_LWTBL_RATE_IDX_DW 9
2208+#define WF_LWTBL_RATE_IDX_ADDR 36
2209+#define WF_LWTBL_RATE_IDX_MASK \
2210+ 0xe0000000 // 31-29
2211+#define WF_LWTBL_RATE_IDX_SHIFT 29
2212+// DW10
2213+#define WF_LWTBL_RATE1_DW 10
2214+#define WF_LWTBL_RATE1_ADDR 40
2215+#define WF_LWTBL_RATE1_MASK \
2216+ 0x00007fff // 14- 0
2217+#define WF_LWTBL_RATE1_SHIFT 0
2218+#define WF_LWTBL_RATE2_DW 10
2219+#define WF_LWTBL_RATE2_ADDR 40
2220+#define WF_LWTBL_RATE2_MASK \
2221+ 0x7fff0000 // 30-16
2222+#define WF_LWTBL_RATE2_SHIFT 16
2223+// DW11
2224+#define WF_LWTBL_RATE3_DW 11
2225+#define WF_LWTBL_RATE3_ADDR 44
2226+#define WF_LWTBL_RATE3_MASK \
2227+ 0x00007fff // 14- 0
2228+#define WF_LWTBL_RATE3_SHIFT 0
2229+#define WF_LWTBL_RATE4_DW 11
2230+#define WF_LWTBL_RATE4_ADDR 44
2231+#define WF_LWTBL_RATE4_MASK \
2232+ 0x7fff0000 // 30-16
2233+#define WF_LWTBL_RATE4_SHIFT 16
2234+// DW12
2235+#define WF_LWTBL_RATE5_DW 12
2236+#define WF_LWTBL_RATE5_ADDR 48
2237+#define WF_LWTBL_RATE5_MASK \
2238+ 0x00007fff // 14- 0
2239+#define WF_LWTBL_RATE5_SHIFT 0
2240+#define WF_LWTBL_RATE6_DW 12
2241+#define WF_LWTBL_RATE6_ADDR 48
2242+#define WF_LWTBL_RATE6_MASK \
2243+ 0x7fff0000 // 30-16
2244+#define WF_LWTBL_RATE6_SHIFT 16
2245+// DW13
2246+#define WF_LWTBL_RATE7_DW 13
2247+#define WF_LWTBL_RATE7_ADDR 52
2248+#define WF_LWTBL_RATE7_MASK \
2249+ 0x00007fff // 14- 0
2250+#define WF_LWTBL_RATE7_SHIFT 0
2251+#define WF_LWTBL_RATE8_DW 13
2252+#define WF_LWTBL_RATE8_ADDR 52
2253+#define WF_LWTBL_RATE8_MASK \
2254+ 0x7fff0000 // 30-16
2255+#define WF_LWTBL_RATE8_SHIFT 16
2256+// DW14
2257+#define WF_LWTBL_RATE1_TX_CNT_DW 14
2258+#define WF_LWTBL_RATE1_TX_CNT_ADDR 56
2259+#define WF_LWTBL_RATE1_TX_CNT_MASK \
2260+ 0x0000ffff // 15- 0
2261+#define WF_LWTBL_RATE1_TX_CNT_SHIFT 0
2262+#define WF_LWTBL_CIPHER_SUIT_IGTK_DW 14
2263+#define WF_LWTBL_CIPHER_SUIT_IGTK_ADDR 56
2264+#define WF_LWTBL_CIPHER_SUIT_IGTK_MASK \
2265+ 0x00003000 // 13-12
2266+#define WF_LWTBL_CIPHER_SUIT_IGTK_SHIFT 12
2267+#define WF_LWTBL_CIPHER_SUIT_BIGTK_DW 14
2268+#define WF_LWTBL_CIPHER_SUIT_BIGTK_ADDR 56
2269+#define WF_LWTBL_CIPHER_SUIT_BIGTK_MASK \
2270+ 0x0000c000 // 15-14
2271+#define WF_LWTBL_CIPHER_SUIT_BIGTK_SHIFT 14
2272+#define WF_LWTBL_RATE1_FAIL_CNT_DW 14
2273+#define WF_LWTBL_RATE1_FAIL_CNT_ADDR 56
2274+#define WF_LWTBL_RATE1_FAIL_CNT_MASK \
2275+ 0xffff0000 // 31-16
2276+#define WF_LWTBL_RATE1_FAIL_CNT_SHIFT 16
2277+// DW15
2278+#define WF_LWTBL_RATE2_OK_CNT_DW 15
2279+#define WF_LWTBL_RATE2_OK_CNT_ADDR 60
2280+#define WF_LWTBL_RATE2_OK_CNT_MASK \
2281+ 0x0000ffff // 15- 0
2282+#define WF_LWTBL_RATE2_OK_CNT_SHIFT 0
2283+#define WF_LWTBL_RATE3_OK_CNT_DW 15
2284+#define WF_LWTBL_RATE3_OK_CNT_ADDR 60
2285+#define WF_LWTBL_RATE3_OK_CNT_MASK \
2286+ 0xffff0000 // 31-16
2287+#define WF_LWTBL_RATE3_OK_CNT_SHIFT 16
2288+// DW16
2289+#define WF_LWTBL_CURRENT_BW_TX_CNT_DW 16
2290+#define WF_LWTBL_CURRENT_BW_TX_CNT_ADDR 64
2291+#define WF_LWTBL_CURRENT_BW_TX_CNT_MASK \
2292+ 0x0000ffff // 15- 0
2293+#define WF_LWTBL_CURRENT_BW_TX_CNT_SHIFT 0
2294+#define WF_LWTBL_CURRENT_BW_FAIL_CNT_DW 16
2295+#define WF_LWTBL_CURRENT_BW_FAIL_CNT_ADDR 64
2296+#define WF_LWTBL_CURRENT_BW_FAIL_CNT_MASK \
2297+ 0xffff0000 // 31-16
2298+#define WF_LWTBL_CURRENT_BW_FAIL_CNT_SHIFT 16
2299+// DW17
2300+#define WF_LWTBL_OTHER_BW_TX_CNT_DW 17
2301+#define WF_LWTBL_OTHER_BW_TX_CNT_ADDR 68
2302+#define WF_LWTBL_OTHER_BW_TX_CNT_MASK \
2303+ 0x0000ffff // 15- 0
2304+#define WF_LWTBL_OTHER_BW_TX_CNT_SHIFT 0
2305+#define WF_LWTBL_OTHER_BW_FAIL_CNT_DW 17
2306+#define WF_LWTBL_OTHER_BW_FAIL_CNT_ADDR 68
2307+#define WF_LWTBL_OTHER_BW_FAIL_CNT_MASK \
2308+ 0xffff0000 // 31-16
2309+#define WF_LWTBL_OTHER_BW_FAIL_CNT_SHIFT 16
2310+// DW18
2311+#define WF_LWTBL_RTS_OK_CNT_DW 18
2312+#define WF_LWTBL_RTS_OK_CNT_ADDR 72
2313+#define WF_LWTBL_RTS_OK_CNT_MASK \
2314+ 0x0000ffff // 15- 0
2315+#define WF_LWTBL_RTS_OK_CNT_SHIFT 0
2316+#define WF_LWTBL_RTS_FAIL_CNT_DW 18
2317+#define WF_LWTBL_RTS_FAIL_CNT_ADDR 72
2318+#define WF_LWTBL_RTS_FAIL_CNT_MASK \
2319+ 0xffff0000 // 31-16
2320+#define WF_LWTBL_RTS_FAIL_CNT_SHIFT 16
2321+// DW19
2322+#define WF_LWTBL_DATA_RETRY_CNT_DW 19
2323+#define WF_LWTBL_DATA_RETRY_CNT_ADDR 76
2324+#define WF_LWTBL_DATA_RETRY_CNT_MASK \
2325+ 0x0000ffff // 15- 0
2326+#define WF_LWTBL_DATA_RETRY_CNT_SHIFT 0
2327+#define WF_LWTBL_MGNT_RETRY_CNT_DW 19
2328+#define WF_LWTBL_MGNT_RETRY_CNT_ADDR 76
2329+#define WF_LWTBL_MGNT_RETRY_CNT_MASK \
2330+ 0xffff0000 // 31-16
2331+#define WF_LWTBL_MGNT_RETRY_CNT_SHIFT 16
2332+// DW20
2333+#define WF_LWTBL_AC0_CTT_CDT_CRB_DW 20
2334+#define WF_LWTBL_AC0_CTT_CDT_CRB_ADDR 80
2335+#define WF_LWTBL_AC0_CTT_CDT_CRB_MASK \
2336+ 0xffffffff // 31- 0
2337+#define WF_LWTBL_AC0_CTT_CDT_CRB_SHIFT 0
2338+// DW21
2339+// DO NOT process repeat field(adm[0])
2340+// DW22
2341+#define WF_LWTBL_AC1_CTT_CDT_CRB_DW 22
2342+#define WF_LWTBL_AC1_CTT_CDT_CRB_ADDR 88
2343+#define WF_LWTBL_AC1_CTT_CDT_CRB_MASK \
2344+ 0xffffffff // 31- 0
2345+#define WF_LWTBL_AC1_CTT_CDT_CRB_SHIFT 0
2346+// DW23
2347+// DO NOT process repeat field(adm[1])
2348+// DW24
2349+#define WF_LWTBL_AC2_CTT_CDT_CRB_DW 24
2350+#define WF_LWTBL_AC2_CTT_CDT_CRB_ADDR 96
2351+#define WF_LWTBL_AC2_CTT_CDT_CRB_MASK \
2352+ 0xffffffff // 31- 0
2353+#define WF_LWTBL_AC2_CTT_CDT_CRB_SHIFT 0
2354+// DW25
2355+// DO NOT process repeat field(adm[2])
2356+// DW26
2357+#define WF_LWTBL_AC3_CTT_CDT_CRB_DW 26
2358+#define WF_LWTBL_AC3_CTT_CDT_CRB_ADDR 104
2359+#define WF_LWTBL_AC3_CTT_CDT_CRB_MASK \
2360+ 0xffffffff // 31- 0
2361+#define WF_LWTBL_AC3_CTT_CDT_CRB_SHIFT 0
2362+// DW27
2363+// DO NOT process repeat field(adm[3])
2364+// DW28
2365+#define WF_LWTBL_RELATED_IDX0_DW 28
2366+#define WF_LWTBL_RELATED_IDX0_ADDR 112
2367+#define WF_LWTBL_RELATED_IDX0_MASK \
2368+ 0x00000fff // 11- 0
2369+#define WF_LWTBL_RELATED_IDX0_SHIFT 0
2370+#define WF_LWTBL_RELATED_BAND0_DW 28
2371+#define WF_LWTBL_RELATED_BAND0_ADDR 112
2372+#define WF_LWTBL_RELATED_BAND0_MASK \
2373+ 0x00003000 // 13-12
2374+#define WF_LWTBL_RELATED_BAND0_SHIFT 12
2375+#define WF_LWTBL_PRIMARY_MLD_BAND_DW 28
2376+#define WF_LWTBL_PRIMARY_MLD_BAND_ADDR 112
2377+#define WF_LWTBL_PRIMARY_MLD_BAND_MASK \
2378+ 0x0000c000 // 15-14
2379+#define WF_LWTBL_PRIMARY_MLD_BAND_SHIFT 14
2380+#define WF_LWTBL_RELATED_IDX1_DW 28
2381+#define WF_LWTBL_RELATED_IDX1_ADDR 112
2382+#define WF_LWTBL_RELATED_IDX1_MASK \
2383+ 0x0fff0000 // 27-16
2384+#define WF_LWTBL_RELATED_IDX1_SHIFT 16
2385+#define WF_LWTBL_RELATED_BAND1_DW 28
2386+#define WF_LWTBL_RELATED_BAND1_ADDR 112
2387+#define WF_LWTBL_RELATED_BAND1_MASK \
2388+ 0x30000000 // 29-28
2389+#define WF_LWTBL_RELATED_BAND1_SHIFT 28
2390+#define WF_LWTBL_SECONDARY_MLD_BAND_DW 28
2391+#define WF_LWTBL_SECONDARY_MLD_BAND_ADDR 112
2392+#define WF_LWTBL_SECONDARY_MLD_BAND_MASK \
2393+ 0xc0000000 // 31-30
2394+#define WF_LWTBL_SECONDARY_MLD_BAND_SHIFT 30
2395+// DW29
2396+#define WF_LWTBL_DISPATCH_POLICY0_DW 29
2397+#define WF_LWTBL_DISPATCH_POLICY0_ADDR 116
2398+#define WF_LWTBL_DISPATCH_POLICY0_MASK \
2399+ 0x00000003 // 1- 0
2400+#define WF_LWTBL_DISPATCH_POLICY0_SHIFT 0
2401+#define WF_LWTBL_DISPATCH_POLICY1_DW 29
2402+#define WF_LWTBL_DISPATCH_POLICY1_ADDR 116
2403+#define WF_LWTBL_DISPATCH_POLICY1_MASK \
2404+ 0x0000000c // 3- 2
2405+#define WF_LWTBL_DISPATCH_POLICY1_SHIFT 2
2406+#define WF_LWTBL_DISPATCH_POLICY2_DW 29
2407+#define WF_LWTBL_DISPATCH_POLICY2_ADDR 116
2408+#define WF_LWTBL_DISPATCH_POLICY2_MASK \
2409+ 0x00000030 // 5- 4
2410+#define WF_LWTBL_DISPATCH_POLICY2_SHIFT 4
2411+#define WF_LWTBL_DISPATCH_POLICY3_DW 29
2412+#define WF_LWTBL_DISPATCH_POLICY3_ADDR 116
2413+#define WF_LWTBL_DISPATCH_POLICY3_MASK \
2414+ 0x000000c0 // 7- 6
2415+#define WF_LWTBL_DISPATCH_POLICY3_SHIFT 6
2416+#define WF_LWTBL_DISPATCH_POLICY4_DW 29
2417+#define WF_LWTBL_DISPATCH_POLICY4_ADDR 116
2418+#define WF_LWTBL_DISPATCH_POLICY4_MASK \
2419+ 0x00000300 // 9- 8
2420+#define WF_LWTBL_DISPATCH_POLICY4_SHIFT 8
2421+#define WF_LWTBL_DISPATCH_POLICY5_DW 29
2422+#define WF_LWTBL_DISPATCH_POLICY5_ADDR 116
2423+#define WF_LWTBL_DISPATCH_POLICY5_MASK \
2424+ 0x00000c00 // 11-10
2425+#define WF_LWTBL_DISPATCH_POLICY5_SHIFT 10
2426+#define WF_LWTBL_DISPATCH_POLICY6_DW 29
2427+#define WF_LWTBL_DISPATCH_POLICY6_ADDR 116
2428+#define WF_LWTBL_DISPATCH_POLICY6_MASK \
2429+ 0x00003000 // 13-12
2430+#define WF_LWTBL_DISPATCH_POLICY6_SHIFT 12
2431+#define WF_LWTBL_DISPATCH_POLICY7_DW 29
2432+#define WF_LWTBL_DISPATCH_POLICY7_ADDR 116
2433+#define WF_LWTBL_DISPATCH_POLICY7_MASK \
2434+ 0x0000c000 // 15-14
2435+#define WF_LWTBL_DISPATCH_POLICY7_SHIFT 14
2436+#define WF_LWTBL_OWN_MLD_ID_DW 29
2437+#define WF_LWTBL_OWN_MLD_ID_ADDR 116
2438+#define WF_LWTBL_OWN_MLD_ID_MASK \
2439+ 0x003f0000 // 21-16
2440+#define WF_LWTBL_OWN_MLD_ID_SHIFT 16
2441+#define WF_LWTBL_EMLSR0_DW 29
2442+#define WF_LWTBL_EMLSR0_ADDR 116
2443+#define WF_LWTBL_EMLSR0_MASK \
2444+ 0x00400000 // 22-22
2445+#define WF_LWTBL_EMLSR0_SHIFT 22
2446+#define WF_LWTBL_EMLMR0_DW 29
2447+#define WF_LWTBL_EMLMR0_ADDR 116
2448+#define WF_LWTBL_EMLMR0_MASK \
2449+ 0x00800000 // 23-23
2450+#define WF_LWTBL_EMLMR0_SHIFT 23
2451+#define WF_LWTBL_EMLSR1_DW 29
2452+#define WF_LWTBL_EMLSR1_ADDR 116
2453+#define WF_LWTBL_EMLSR1_MASK \
2454+ 0x01000000 // 24-24
2455+#define WF_LWTBL_EMLSR1_SHIFT 24
2456+#define WF_LWTBL_EMLMR1_DW 29
2457+#define WF_LWTBL_EMLMR1_ADDR 116
2458+#define WF_LWTBL_EMLMR1_MASK \
2459+ 0x02000000 // 25-25
2460+#define WF_LWTBL_EMLMR1_SHIFT 25
2461+#define WF_LWTBL_EMLSR2_DW 29
2462+#define WF_LWTBL_EMLSR2_ADDR 116
2463+#define WF_LWTBL_EMLSR2_MASK \
2464+ 0x04000000 // 26-26
2465+#define WF_LWTBL_EMLSR2_SHIFT 26
2466+#define WF_LWTBL_EMLMR2_DW 29
2467+#define WF_LWTBL_EMLMR2_ADDR 116
2468+#define WF_LWTBL_EMLMR2_MASK \
2469+ 0x08000000 // 27-27
2470+#define WF_LWTBL_EMLMR2_SHIFT 27
2471+#define WF_LWTBL_STR_BITMAP_DW 29
2472+#define WF_LWTBL_STR_BITMAP_ADDR 116
2473+#define WF_LWTBL_STR_BITMAP_MASK \
2474+ 0xe0000000 // 31-29
2475+#define WF_LWTBL_STR_BITMAP_SHIFT 29
2476+// DW30
2477+#define WF_LWTBL_DISPATCH_ORDER_DW 30
2478+#define WF_LWTBL_DISPATCH_ORDER_ADDR 120
2479+#define WF_LWTBL_DISPATCH_ORDER_MASK \
2480+ 0x0000007f // 6- 0
2481+#define WF_LWTBL_DISPATCH_ORDER_SHIFT 0
2482+#define WF_LWTBL_DISPATCH_RATIO_DW 30
2483+#define WF_LWTBL_DISPATCH_RATIO_ADDR 120
2484+#define WF_LWTBL_DISPATCH_RATIO_MASK \
2485+ 0x00003f80 // 13- 7
2486+#define WF_LWTBL_DISPATCH_RATIO_SHIFT 7
2487+#define WF_LWTBL_LINK_MGF_DW 30
2488+#define WF_LWTBL_LINK_MGF_ADDR 120
2489+#define WF_LWTBL_LINK_MGF_MASK \
2490+ 0xffff0000 // 31-16
2491+#define WF_LWTBL_LINK_MGF_SHIFT 16
2492+// DW31
2493+#define WF_LWTBL_BFTX_TB_DW 31
2494+#define WF_LWTBL_BFTX_TB_ADDR 124
2495+#define WF_LWTBL_BFTX_TB_MASK \
2496+ 0x00800000 // 23-23
2497+#define WF_LWTBL_DROP_DW 31
2498+#define WF_LWTBL_DROP_ADDR 124
2499+#define WF_LWTBL_DROP_MASK \
2500+ 0x01000000 // 24-24
2501+#define WF_LWTBL_DROP_SHIFT 24
2502+#define WF_LWTBL_CASCAD_DW 31
2503+#define WF_LWTBL_CASCAD_ADDR 124
2504+#define WF_LWTBL_CASCAD_MASK \
2505+ 0x02000000 // 25-25
2506+#define WF_LWTBL_CASCAD_SHIFT 25
2507+#define WF_LWTBL_ALL_ACK_DW 31
2508+#define WF_LWTBL_ALL_ACK_ADDR 124
2509+#define WF_LWTBL_ALL_ACK_MASK \
2510+ 0x04000000 // 26-26
2511+#define WF_LWTBL_ALL_ACK_SHIFT 26
2512+#define WF_LWTBL_MPDU_SIZE_DW 31
2513+#define WF_LWTBL_MPDU_SIZE_ADDR 124
2514+#define WF_LWTBL_MPDU_SIZE_MASK \
2515+ 0x18000000 // 28-27
2516+#define WF_LWTBL_MPDU_SIZE_SHIFT 27
2517+#define WF_LWTBL_RXD_DUP_MODE_DW 31
2518+#define WF_LWTBL_RXD_DUP_MODE_ADDR 124
2519+#define WF_LWTBL_RXD_DUP_MODE_MASK \
2520+ 0x60000000 // 30-29
2521+#define WF_LWTBL_RXD_DUP_MODE_SHIFT 29
2522+#define WF_LWTBL_ACK_EN_DW 31
2523+#define WF_LWTBL_ACK_EN_ADDR 128
2524+#define WF_LWTBL_ACK_EN_MASK \
2525+ 0x80000000 // 31-31
2526+#define WF_LWTBL_ACK_EN_SHIFT 31
2527+// DW32
2528+#define WF_LWTBL_OM_INFO_DW 32
2529+#define WF_LWTBL_OM_INFO_ADDR 128
2530+#define WF_LWTBL_OM_INFO_MASK \
2531+ 0x00000fff // 11- 0
2532+#define WF_LWTBL_OM_INFO_SHIFT 0
2533+#define WF_LWTBL_OM_INFO_EHT_DW 32
2534+#define WF_LWTBL_OM_INFO_EHT_ADDR 128
2535+#define WF_LWTBL_OM_INFO_EHT_MASK \
2536+ 0x0000f000 // 15-12
2537+#define WF_LWTBL_OM_INFO_EHT_SHIFT 12
2538+#define WF_LWTBL_RXD_DUP_FOR_OM_CHG_DW 32
2539+#define WF_LWTBL_RXD_DUP_FOR_OM_CHG_ADDR 128
2540+#define WF_LWTBL_RXD_DUP_FOR_OM_CHG_MASK \
2541+ 0x00010000 // 16-16
2542+#define WF_LWTBL_RXD_DUP_FOR_OM_CHG_SHIFT 16
2543+#define WF_LWTBL_RXD_DUP_WHITE_LIST_DW 32
2544+#define WF_LWTBL_RXD_DUP_WHITE_LIST_ADDR 128
2545+#define WF_LWTBL_RXD_DUP_WHITE_LIST_MASK \
2546+ 0x1ffe0000 // 28-17
2547+#define WF_LWTBL_RXD_DUP_WHITE_LIST_SHIFT 17
2548+// DW33
2549+#define WF_LWTBL_USER_RSSI_DW 33
2550+#define WF_LWTBL_USER_RSSI_ADDR 132
2551+#define WF_LWTBL_USER_RSSI_MASK \
2552+ 0x000001ff // 8- 0
2553+#define WF_LWTBL_USER_RSSI_SHIFT 0
2554+#define WF_LWTBL_USER_SNR_DW 33
2555+#define WF_LWTBL_USER_SNR_ADDR 132
2556+#define WF_LWTBL_USER_SNR_MASK \
2557+ 0x00007e00 // 14- 9
2558+#define WF_LWTBL_USER_SNR_SHIFT 9
2559+#define WF_LWTBL_RAPID_REACTION_RATE_DW 33
2560+#define WF_LWTBL_RAPID_REACTION_RATE_ADDR 132
2561+#define WF_LWTBL_RAPID_REACTION_RATE_MASK \
2562+ 0x0fff0000 // 27-16
2563+#define WF_LWTBL_RAPID_REACTION_RATE_SHIFT 16
2564+#define WF_LWTBL_HT_AMSDU_DW 33
2565+#define WF_LWTBL_HT_AMSDU_ADDR 132
2566+#define WF_LWTBL_HT_AMSDU_MASK \
2567+ 0x40000000 // 30-30
2568+#define WF_LWTBL_HT_AMSDU_SHIFT 30
2569+#define WF_LWTBL_AMSDU_CROSS_LG_DW 33
2570+#define WF_LWTBL_AMSDU_CROSS_LG_ADDR 132
2571+#define WF_LWTBL_AMSDU_CROSS_LG_MASK \
2572+ 0x80000000 // 31-31
2573+#define WF_LWTBL_AMSDU_CROSS_LG_SHIFT 31
2574+// DW34
2575+#define WF_LWTBL_RESP_RCPI0_DW 34
2576+#define WF_LWTBL_RESP_RCPI0_ADDR 136
2577+#define WF_LWTBL_RESP_RCPI0_MASK \
2578+ 0x000000ff // 7- 0
2579+#define WF_LWTBL_RESP_RCPI0_SHIFT 0
2580+#define WF_LWTBL_RESP_RCPI1_DW 34
2581+#define WF_LWTBL_RESP_RCPI1_ADDR 136
2582+#define WF_LWTBL_RESP_RCPI1_MASK \
2583+ 0x0000ff00 // 15- 8
2584+#define WF_LWTBL_RESP_RCPI1_SHIFT 8
2585+#define WF_LWTBL_RESP_RCPI2_DW 34
2586+#define WF_LWTBL_RESP_RCPI2_ADDR 136
2587+#define WF_LWTBL_RESP_RCPI2_MASK \
2588+ 0x00ff0000 // 23-16
2589+#define WF_LWTBL_RESP_RCPI2_SHIFT 16
2590+#define WF_LWTBL_RESP_RCPI3_DW 34
2591+#define WF_LWTBL_RESP_RCPI3_ADDR 136
2592+#define WF_LWTBL_RESP_RCPI3_MASK \
2593+ 0xff000000 // 31-24
2594+#define WF_LWTBL_RESP_RCPI3_SHIFT 24
2595+// DW35
2596+#define WF_LWTBL_SNR_RX0_DW 35
2597+#define WF_LWTBL_SNR_RX0_ADDR 140
2598+#define WF_LWTBL_SNR_RX0_MASK \
2599+ 0x0000003f // 5- 0
2600+#define WF_LWTBL_SNR_RX0_SHIFT 0
2601+#define WF_LWTBL_SNR_RX1_DW 35
2602+#define WF_LWTBL_SNR_RX1_ADDR 140
2603+#define WF_LWTBL_SNR_RX1_MASK \
2604+ 0x00000fc0 // 11- 6
2605+#define WF_LWTBL_SNR_RX1_SHIFT 6
2606+#define WF_LWTBL_SNR_RX2_DW 35
2607+#define WF_LWTBL_SNR_RX2_ADDR 140
2608+#define WF_LWTBL_SNR_RX2_MASK \
2609+ 0x0003f000 // 17-12
2610+#define WF_LWTBL_SNR_RX2_SHIFT 12
2611+#define WF_LWTBL_SNR_RX3_DW 35
2612+#define WF_LWTBL_SNR_RX3_ADDR 140
2613+#define WF_LWTBL_SNR_RX3_MASK \
2614+ 0x00fc0000 // 23-18
2615+#define WF_LWTBL_SNR_RX3_SHIFT 18
2616+
2617+/* WTBL Group - Packet Number */
2618+/* DW 2 */
2619+#define WTBL_PN0_MASK BITS(0, 7)
2620+#define WTBL_PN0_OFFSET 0
2621+#define WTBL_PN1_MASK BITS(8, 15)
2622+#define WTBL_PN1_OFFSET 8
2623+#define WTBL_PN2_MASK BITS(16, 23)
2624+#define WTBL_PN2_OFFSET 16
2625+#define WTBL_PN3_MASK BITS(24, 31)
2626+#define WTBL_PN3_OFFSET 24
2627+
2628+/* DW 3 */
2629+#define WTBL_PN4_MASK BITS(0, 7)
2630+#define WTBL_PN4_OFFSET 0
2631+#define WTBL_PN5_MASK BITS(8, 15)
2632+#define WTBL_PN5_OFFSET 8
2633+
2634+/* DW 4 */
2635+#define WTBL_BIPN0_MASK BITS(0, 7)
2636+#define WTBL_BIPN0_OFFSET 0
2637+#define WTBL_BIPN1_MASK BITS(8, 15)
2638+#define WTBL_BIPN1_OFFSET 8
2639+#define WTBL_BIPN2_MASK BITS(16, 23)
2640+#define WTBL_BIPN2_OFFSET 16
2641+#define WTBL_BIPN3_MASK BITS(24, 31)
2642+#define WTBL_BIPN3_OFFSET 24
2643+
2644+/* DW 5 */
2645+#define WTBL_BIPN4_MASK BITS(0, 7)
2646+#define WTBL_BIPN4_OFFSET 0
2647+#define WTBL_BIPN5_MASK BITS(8, 15)
2648+#define WTBL_BIPN5_OFFSET 8
2649+
2650+/* UWTBL DW 6 */
2651+#define WTBL_AMSDU_LEN_MASK BITS(0, 5)
2652+#define WTBL_AMSDU_LEN_OFFSET 0
2653+#define WTBL_AMSDU_NUM_MASK BITS(6, 10)
2654+#define WTBL_AMSDU_NUM_OFFSET 6
2655+#define WTBL_AMSDU_EN_MASK BIT(11)
2656+#define WTBL_AMSDU_EN_OFFSET 11
2657+
2658+/* UWTBL DW 8 */
2659+#define WTBL_SEC_ADDR_MODE_MASK BITS(20, 21)
2660+#define WTBL_SEC_ADDR_MODE_OFFSET 20
2661+
2662+/* LWTBL Rate field */
2663+#define WTBL_RATE_TX_RATE_MASK BITS(0, 5)
2664+#define WTBL_RATE_TX_RATE_OFFSET 0
2665+#define WTBL_RATE_TX_MODE_MASK BITS(6, 9)
2666+#define WTBL_RATE_TX_MODE_OFFSET 6
2667+#define WTBL_RATE_NSTS_MASK BITS(10, 13)
2668+#define WTBL_RATE_NSTS_OFFSET 10
2669+#define WTBL_RATE_STBC_MASK BIT(14)
2670+#define WTBL_RATE_STBC_OFFSET 14
2671+
2672+/***** WTBL(LMAC) DW Offset *****/
2673+/* LMAC WTBL Group - Peer Unique Information */
2674+#define WTBL_GROUP_PEER_INFO_DW_0 0
2675+#define WTBL_GROUP_PEER_INFO_DW_1 1
2676+
2677+/* WTBL Group - TxRx Capability/Information */
2678+#define WTBL_GROUP_TRX_CAP_DW_2 2
2679+#define WTBL_GROUP_TRX_CAP_DW_3 3
2680+#define WTBL_GROUP_TRX_CAP_DW_4 4
2681+#define WTBL_GROUP_TRX_CAP_DW_5 5
2682+#define WTBL_GROUP_TRX_CAP_DW_6 6
2683+#define WTBL_GROUP_TRX_CAP_DW_7 7
2684+#define WTBL_GROUP_TRX_CAP_DW_8 8
2685+#define WTBL_GROUP_TRX_CAP_DW_9 9
2686+
2687+/* WTBL Group - Auto Rate Table*/
2688+#define WTBL_GROUP_AUTO_RATE_1_2 10
2689+#define WTBL_GROUP_AUTO_RATE_3_4 11
2690+#define WTBL_GROUP_AUTO_RATE_5_6 12
2691+#define WTBL_GROUP_AUTO_RATE_7_8 13
2692+
2693+/* WTBL Group - Tx Counter */
2694+#define WTBL_GROUP_TX_CNT_LINE_1 14
2695+#define WTBL_GROUP_TX_CNT_LINE_2 15
2696+#define WTBL_GROUP_TX_CNT_LINE_3 16
2697+#define WTBL_GROUP_TX_CNT_LINE_4 17
2698+#define WTBL_GROUP_TX_CNT_LINE_5 18
2699+#define WTBL_GROUP_TX_CNT_LINE_6 19
2700+
2701+/* WTBL Group - Admission Control Counter */
2702+#define WTBL_GROUP_ADM_CNT_LINE_1 20
2703+#define WTBL_GROUP_ADM_CNT_LINE_2 21
2704+#define WTBL_GROUP_ADM_CNT_LINE_3 22
2705+#define WTBL_GROUP_ADM_CNT_LINE_4 23
2706+#define WTBL_GROUP_ADM_CNT_LINE_5 24
2707+#define WTBL_GROUP_ADM_CNT_LINE_6 25
2708+#define WTBL_GROUP_ADM_CNT_LINE_7 26
2709+#define WTBL_GROUP_ADM_CNT_LINE_8 27
2710+
2711+/* WTBL Group -MLO Info */
2712+#define WTBL_GROUP_MLO_INFO_LINE_1 28
2713+#define WTBL_GROUP_MLO_INFO_LINE_2 29
2714+#define WTBL_GROUP_MLO_INFO_LINE_3 30
2715+
2716+/* WTBL Group -RESP Info */
2717+#define WTBL_GROUP_RESP_INFO_DW_31 31
2718+
2719+/* WTBL Group -RX DUP Info */
2720+#define WTBL_GROUP_RX_DUP_INFO_DW_32 32
2721+
2722+/* WTBL Group - Rx Statistics Counter */
2723+#define WTBL_GROUP_RX_STAT_CNT_LINE_1 33
2724+#define WTBL_GROUP_RX_STAT_CNT_LINE_2 34
2725+#define WTBL_GROUP_RX_STAT_CNT_LINE_3 35
2726+
2727+/* UWTBL Group - HW AMSDU */
2728+#define UWTBL_HW_AMSDU_DW WF_UWTBL_AMSDU_CFG_DW
2729+
2730+/* LWTBL DW 4 */
2731+#define WTBL_DIS_RHTR WF_LWTBL_DIS_RHTR_MASK
2732+
2733+/* UWTBL DW 5 */
2734+#define WTBL_KEY_LINK_DW_KEY_LOC0_MASK BITS(0, 10)
2735+#define WTBL_PSM WF_LWTBL_PSM_MASK
2736+
2737+/* Need to sync with FW define */
2738+#define INVALID_KEY_ENTRY WTBL_KEY_LINK_DW_KEY_LOC0_MASK
2739+
2740+// RATE
2741+#define WTBL_RATE_TX_RATE_MASK BITS(0, 5)
2742+#define WTBL_RATE_TX_RATE_OFFSET 0
2743+#define WTBL_RATE_TX_MODE_MASK BITS(6, 9)
2744+#define WTBL_RATE_TX_MODE_OFFSET 6
2745+#define WTBL_RATE_NSTS_MASK BITS(10, 13)
2746+#define WTBL_RATE_NSTS_OFFSET 10
2747+#define WTBL_RATE_STBC_MASK BIT(14)
2748+#define WTBL_RATE_STBC_OFFSET 14
2749+#endif
2750+
2751+#endif
2752diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
2753new file mode 100644
2754index 000000000..8baf27c76
2755--- /dev/null
2756+++ b/mt7996/mtk_debugfs.c
2757@@ -0,0 +1,2507 @@
2758+// SPDX-License-Identifier: ISC
2759+/*
2760+ * Copyright (C) 2023 MediaTek Inc.
2761+ */
2762+#include "mt7996.h"
2763+#include "../mt76.h"
2764+#include "mcu.h"
2765+#include "mac.h"
2766+#include "eeprom.h"
2767+#include "mtk_debug.h"
2768+#include "mtk_mcu.h"
2769+#include "coredump.h"
2770+
2771+#ifdef CONFIG_MTK_DEBUG
2772+
2773+/* AGG INFO */
2774+static int
2775+mt7996_agginfo_read_per_band(struct seq_file *s, int band_idx)
2776+{
2777+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
2778+ u64 total_burst, total_ampdu, ampdu_cnt[16];
2779+ u32 value, idx, row_idx, col_idx, start_range, agg_rang_sel[16], burst_cnt[16], band_offset = 0;
2780+ u8 partial_str[16] = {}, full_str[64] = {};
2781+
2782+ switch (band_idx) {
2783+ case 0:
2784+ band_offset = 0;
2785+ break;
2786+ case 1:
2787+ band_offset = BN1_WF_AGG_TOP_BASE - BN0_WF_AGG_TOP_BASE;
2788+ break;
2789+ case 2:
2790+ band_offset = IP1_BN0_WF_AGG_TOP_BASE - BN0_WF_AGG_TOP_BASE;
2791+ break;
2792+ default:
2793+ return 0;
2794+ }
2795+
2796+ seq_printf(s, "Band %d AGG Status\n", band_idx);
2797+ seq_printf(s, "===============================\n");
2798+ value = mt76_rr(dev, BN0_WF_AGG_TOP_AALCR0_ADDR + band_offset);
2799+ seq_printf(s, "AC00 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR0_AC00_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR0_AC00_AGG_LIMIT_SHFT);
2800+ seq_printf(s, "AC01 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR0_AC01_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR0_AC01_AGG_LIMIT_SHFT);
2801+ value = mt76_rr(dev, BN0_WF_AGG_TOP_AALCR1_ADDR + band_offset);
2802+ seq_printf(s, "AC02 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR1_AC02_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR1_AC02_AGG_LIMIT_SHFT);
2803+ seq_printf(s, "AC03 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR1_AC03_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR1_AC03_AGG_LIMIT_SHFT);
2804+ value = mt76_rr(dev, BN0_WF_AGG_TOP_AALCR2_ADDR + band_offset);
2805+ seq_printf(s, "AC10 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR2_AC10_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR2_AC10_AGG_LIMIT_SHFT);
2806+ seq_printf(s, "AC11 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR2_AC11_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR2_AC11_AGG_LIMIT_SHFT);
2807+ value = mt76_rr(dev, BN0_WF_AGG_TOP_AALCR3_ADDR + band_offset);
2808+ seq_printf(s, "AC12 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR3_AC12_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR3_AC12_AGG_LIMIT_SHFT);
2809+ seq_printf(s, "AC13 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR3_AC13_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR3_AC13_AGG_LIMIT_SHFT);
2810+ value = mt76_rr(dev, BN0_WF_AGG_TOP_AALCR4_ADDR + band_offset);
2811+ seq_printf(s, "AC20 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR4_AC20_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR4_AC20_AGG_LIMIT_SHFT);
2812+ seq_printf(s, "AC21 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR4_AC21_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR4_AC21_AGG_LIMIT_SHFT);
2813+ value = mt76_rr(dev, BN0_WF_AGG_TOP_AALCR5_ADDR + band_offset);
2814+ seq_printf(s, "AC22 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR5_AC22_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR5_AC22_AGG_LIMIT_SHFT);
2815+ seq_printf(s, "AC23 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR5_AC23_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR5_AC23_AGG_LIMIT_SHFT);
2816+ value = mt76_rr(dev, BN0_WF_AGG_TOP_AALCR6_ADDR + band_offset);
2817+ seq_printf(s, "AC30 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR6_AC30_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR6_AC30_AGG_LIMIT_SHFT);
2818+ seq_printf(s, "AC31 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR6_AC31_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR6_AC31_AGG_LIMIT_SHFT);
2819+ value = mt76_rr(dev, BN0_WF_AGG_TOP_AALCR7_ADDR + band_offset);
2820+ seq_printf(s, "AC32 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR7_AC32_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR7_AC32_AGG_LIMIT_SHFT);
2821+ seq_printf(s, "AC33 Agg limit = %d\t", (value & BN0_WF_AGG_TOP_AALCR7_AC33_AGG_LIMIT_MASK) >> BN0_WF_AGG_TOP_AALCR7_AC33_AGG_LIMIT_SHFT);
2822+
2823+ switch (band_idx) {
2824+ case 0:
2825+ band_offset = 0;
2826+ break;
2827+ case 1:
2828+ band_offset = BN1_WF_MIB_TOP_BASE - BN0_WF_MIB_TOP_BASE;
2829+ break;
2830+ case 2:
2831+ band_offset = IP1_BN0_WF_MIB_TOP_BASE - BN0_WF_MIB_TOP_BASE;
2832+ break;
2833+ default:
2834+ return 0;
2835+ }
2836+
2837+ seq_printf(s, "===AMPDU Related Counters===\n");
2838+
2839+ value = mt76_rr(dev, BN0_WF_MIB_TOP_TRARC0_ADDR + band_offset);
2840+ agg_rang_sel[0] = (value & BN0_WF_MIB_TOP_TRARC0_AGG_RANG_SEL_0_MASK) >> BN0_WF_MIB_TOP_TRARC0_AGG_RANG_SEL_0_SHFT;
2841+ agg_rang_sel[1] = (value & BN0_WF_MIB_TOP_TRARC0_AGG_RANG_SEL_1_MASK) >> BN0_WF_MIB_TOP_TRARC0_AGG_RANG_SEL_1_SHFT;
2842+ value = mt76_rr(dev, BN0_WF_MIB_TOP_TRARC1_ADDR + band_offset);
2843+ agg_rang_sel[2] = (value & BN0_WF_MIB_TOP_TRARC1_AGG_RANG_SEL_2_MASK) >> BN0_WF_MIB_TOP_TRARC1_AGG_RANG_SEL_2_SHFT;
2844+ agg_rang_sel[3] = (value & BN0_WF_MIB_TOP_TRARC1_AGG_RANG_SEL_3_MASK) >> BN0_WF_MIB_TOP_TRARC1_AGG_RANG_SEL_3_SHFT;
2845+ value = mt76_rr(dev, BN0_WF_MIB_TOP_TRARC2_ADDR + band_offset);
2846+ agg_rang_sel[4] = (value & BN0_WF_MIB_TOP_TRARC2_AGG_RANG_SEL_4_MASK) >> BN0_WF_MIB_TOP_TRARC2_AGG_RANG_SEL_4_SHFT;
2847+ agg_rang_sel[5] = (value & BN0_WF_MIB_TOP_TRARC2_AGG_RANG_SEL_5_MASK) >> BN0_WF_MIB_TOP_TRARC2_AGG_RANG_SEL_5_SHFT;
2848+ value = mt76_rr(dev, BN0_WF_MIB_TOP_TRARC3_ADDR + band_offset);
2849+ agg_rang_sel[6] = (value & BN0_WF_MIB_TOP_TRARC3_AGG_RANG_SEL_6_MASK) >> BN0_WF_MIB_TOP_TRARC3_AGG_RANG_SEL_6_SHFT;
2850+ agg_rang_sel[7] = (value & BN0_WF_MIB_TOP_TRARC3_AGG_RANG_SEL_7_MASK) >> BN0_WF_MIB_TOP_TRARC3_AGG_RANG_SEL_7_SHFT;
2851+ value = mt76_rr(dev, BN0_WF_MIB_TOP_TRARC4_ADDR + band_offset);
2852+ agg_rang_sel[8] = (value & BN0_WF_MIB_TOP_TRARC4_AGG_RANG_SEL_8_MASK) >> BN0_WF_MIB_TOP_TRARC4_AGG_RANG_SEL_8_SHFT;
2853+ agg_rang_sel[9] = (value & BN0_WF_MIB_TOP_TRARC4_AGG_RANG_SEL_9_MASK) >> BN0_WF_MIB_TOP_TRARC4_AGG_RANG_SEL_9_SHFT;
2854+ value = mt76_rr(dev, BN0_WF_MIB_TOP_TRARC5_ADDR + band_offset);
2855+ agg_rang_sel[10] = (value & BN0_WF_MIB_TOP_TRARC5_AGG_RANG_SEL_10_MASK) >> BN0_WF_MIB_TOP_TRARC5_AGG_RANG_SEL_10_SHFT;
2856+ agg_rang_sel[11] = (value & BN0_WF_MIB_TOP_TRARC5_AGG_RANG_SEL_11_MASK) >> BN0_WF_MIB_TOP_TRARC5_AGG_RANG_SEL_11_SHFT;
2857+ value = mt76_rr(dev, BN0_WF_MIB_TOP_TRARC6_ADDR + band_offset);
2858+ agg_rang_sel[12] = (value & BN0_WF_MIB_TOP_TRARC6_AGG_RANG_SEL_12_MASK) >> BN0_WF_MIB_TOP_TRARC6_AGG_RANG_SEL_12_SHFT;
2859+ agg_rang_sel[13] = (value & BN0_WF_MIB_TOP_TRARC6_AGG_RANG_SEL_13_MASK) >> BN0_WF_MIB_TOP_TRARC6_AGG_RANG_SEL_13_SHFT;
2860+ value = mt76_rr(dev, BN0_WF_MIB_TOP_TRARC7_ADDR + band_offset);
2861+ agg_rang_sel[14] = (value & BN0_WF_MIB_TOP_TRARC7_AGG_RANG_SEL_14_MASK) >> BN0_WF_MIB_TOP_TRARC7_AGG_RANG_SEL_14_SHFT;
2862+
2863+ burst_cnt[0] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR0_ADDR + band_offset);
2864+ burst_cnt[1] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR1_ADDR + band_offset);
2865+ burst_cnt[2] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR2_ADDR + band_offset);
2866+ burst_cnt[3] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR3_ADDR + band_offset);
2867+ burst_cnt[4] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR4_ADDR + band_offset);
2868+ burst_cnt[5] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR5_ADDR + band_offset);
2869+ burst_cnt[6] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR6_ADDR + band_offset);
2870+ burst_cnt[7] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR7_ADDR + band_offset);
2871+ burst_cnt[8] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR8_ADDR + band_offset);
2872+ burst_cnt[9] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR9_ADDR + band_offset);
2873+ burst_cnt[10] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR10_ADDR + band_offset);
2874+ burst_cnt[11] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR11_ADDR + band_offset);
2875+ burst_cnt[12] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR12_ADDR + band_offset);
2876+ burst_cnt[13] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR13_ADDR + band_offset);
2877+ burst_cnt[14] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR14_ADDR + band_offset);
2878+ burst_cnt[15] = mt76_rr(dev, BN0_WF_MIB_TOP_TRDR15_ADDR + band_offset);
2879+
2880+ start_range = 1;
2881+ total_burst = 0;
2882+ total_ampdu = 0;
2883+ agg_rang_sel[15] = 1023;
2884+
2885+ /* Need to add 1 after read from AGG_RANG_SEL CR */
2886+ for (idx = 0; idx < 16; idx++) {
2887+ agg_rang_sel[idx]++;
2888+ total_burst += burst_cnt[idx];
2889+
2890+ if (start_range == agg_rang_sel[idx])
2891+ ampdu_cnt[idx] = (u64) start_range * burst_cnt[idx];
2892+ else
2893+ ampdu_cnt[idx] = (u64) ((start_range + agg_rang_sel[idx]) >> 1) * burst_cnt[idx];
2894+
2895+ start_range = agg_rang_sel[idx] + 1;
2896+ total_ampdu += ampdu_cnt[idx];
2897+ }
2898+
2899+ start_range = 1;
2900+ sprintf(full_str, "%13s ", "Tx Agg Range:");
2901+
2902+ for (row_idx = 0; row_idx < 4; row_idx++) {
2903+ for (col_idx = 0; col_idx < 4; col_idx++, idx++) {
2904+ idx = 4 * row_idx + col_idx;
2905+
2906+ if (start_range == agg_rang_sel[idx])
2907+ sprintf(partial_str, "%d", agg_rang_sel[idx]);
2908+ else
2909+ sprintf(partial_str, "%d~%d", start_range, agg_rang_sel[idx]);
2910+
2911+ start_range = agg_rang_sel[idx] + 1;
2912+ sprintf(full_str + strlen(full_str), "%-11s ", partial_str);
2913+ }
2914+
2915+ idx = 4 * row_idx;
2916+
2917+ seq_printf(s, "%s\n", full_str);
2918+ seq_printf(s, "%13s 0x%-9x 0x%-9x 0x%-9x 0x%-9x\n",
2919+ row_idx ? "" : "Burst count:",
2920+ burst_cnt[idx], burst_cnt[idx + 1],
2921+ burst_cnt[idx + 2], burst_cnt[idx + 3]);
2922+
2923+ if (total_burst != 0) {
2924+ if (row_idx == 0)
2925+ sprintf(full_str, "%13s ",
2926+ "Burst ratio:");
2927+ else
2928+ sprintf(full_str, "%13s ", "");
2929+
2930+ for (col_idx = 0; col_idx < 4; col_idx++) {
2931+ u64 count = (u64) burst_cnt[idx + col_idx] * 100;
2932+
2933+ sprintf(partial_str, "(%llu%%)",
2934+ div64_u64(count, total_burst));
2935+ sprintf(full_str + strlen(full_str),
2936+ "%-11s ", partial_str);
2937+ }
2938+
2939+ seq_printf(s, "%s\n", full_str);
2940+
2941+ if (row_idx == 0)
2942+ sprintf(full_str, "%13s ",
2943+ "MDPU ratio:");
2944+ else
2945+ sprintf(full_str, "%13s ", "");
2946+
2947+ for (col_idx = 0; col_idx < 4; col_idx++) {
2948+ u64 count = ampdu_cnt[idx + col_idx] * 100;
2949+
2950+ sprintf(partial_str, "(%llu%%)",
2951+ div64_u64(count, total_ampdu));
2952+ sprintf(full_str + strlen(full_str),
2953+ "%-11s ", partial_str);
2954+ }
2955+
2956+ seq_printf(s, "%s\n", full_str);
2957+ }
2958+
2959+ sprintf(full_str, "%13s ", "");
2960+ }
2961+
2962+ return 0;
2963+}
2964+
2965+static int mt7996_agginfo_read_band0(struct seq_file *s, void *data)
2966+{
2967+ mt7996_agginfo_read_per_band(s, MT_BAND0);
2968+ return 0;
2969+}
2970+
2971+static int mt7996_agginfo_read_band1(struct seq_file *s, void *data)
2972+{
2973+ mt7996_agginfo_read_per_band(s, MT_BAND1);
2974+ return 0;
2975+}
2976+
2977+static int mt7996_agginfo_read_band2(struct seq_file *s, void *data)
2978+{
2979+ mt7996_agginfo_read_per_band(s, MT_BAND2);
2980+ return 0;
2981+}
2982+
2983+/* AMSDU INFO */
2984+static int mt7996_amsdu_result_read(struct seq_file *s, void *data)
2985+{
2986+#define HW_MSDU_CNT_ADDR 0xf400
2987+#define HW_MSDU_NUM_MAX 33
2988+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
2989+ u32 ple_stat[HW_MSDU_NUM_MAX] = {0}, total_amsdu = 0;
2990+ u8 i;
2991+
2992+ for (i = 0; i < HW_MSDU_NUM_MAX; i++)
2993+ ple_stat[i] = mt76_rr(dev, HW_MSDU_CNT_ADDR + i * 0x04);
2994+
2995+ seq_printf(s, "TXD counter status of MSDU:\n");
2996+
2997+ for (i = 0; i < HW_MSDU_NUM_MAX; i++)
2998+ total_amsdu += ple_stat[i];
2999+
3000+ for (i = 0; i < HW_MSDU_NUM_MAX; i++) {
3001+ seq_printf(s, "AMSDU pack count of %d MSDU in TXD: 0x%x ", i, ple_stat[i]);
3002+ if (total_amsdu != 0)
3003+ seq_printf(s, "(%d%%)\n", ple_stat[i] * 100 / total_amsdu);
3004+ else
3005+ seq_printf(s, "\n");
3006+ }
3007+
3008+ return 0;
3009+}
3010+
3011+/* DBG MODLE */
3012+static int
3013+mt7996_fw_debug_module_set(void *data, u64 module)
3014+{
3015+ struct mt7996_dev *dev = data;
3016+
3017+ dev->dbg.fw_dbg_module = module;
3018+ return 0;
3019+}
3020+
3021+static int
3022+mt7996_fw_debug_module_get(void *data, u64 *module)
3023+{
3024+ struct mt7996_dev *dev = data;
3025+
3026+ *module = dev->dbg.fw_dbg_module;
3027+ return 0;
3028+}
3029+
3030+DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_debug_module, mt7996_fw_debug_module_get,
3031+ mt7996_fw_debug_module_set, "%lld\n");
3032+
3033+static int
3034+mt7996_fw_debug_level_set(void *data, u64 level)
3035+{
3036+ struct mt7996_dev *dev = data;
3037+
3038+ dev->dbg.fw_dbg_lv = level;
3039+ mt7996_mcu_fw_dbg_ctrl(dev, dev->dbg.fw_dbg_module, dev->dbg.fw_dbg_lv);
3040+ return 0;
3041+}
3042+
3043+static int
3044+mt7996_fw_debug_level_get(void *data, u64 *level)
3045+{
3046+ struct mt7996_dev *dev = data;
3047+
3048+ *level = dev->dbg.fw_dbg_lv;
3049+ return 0;
3050+}
3051+
3052+DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_debug_level, mt7996_fw_debug_level_get,
3053+ mt7996_fw_debug_level_set, "%lld\n");
3054+
3055+/* usage: echo 0x[arg3][arg2][arg1] > fw_wa_set */
3056+static int
3057+mt7996_wa_set(void *data, u64 val)
3058+{
3059+ struct mt7996_dev *dev = data;
3060+ u32 arg1, arg2, arg3;
3061+
3062+ arg1 = FIELD_GET(GENMASK_ULL(7, 0), val);
3063+ arg2 = FIELD_GET(GENMASK_ULL(15, 8), val);
3064+ arg3 = FIELD_GET(GENMASK_ULL(23, 16), val);
3065+
3066+ return mt7996_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET),
3067+ arg1, arg2, arg3);
3068+}
3069+
3070+DEFINE_DEBUGFS_ATTRIBUTE(fops_wa_set, NULL, mt7996_wa_set,
3071+ "0x%llx\n");
3072+
3073+/* usage: echo 0x[arg3][arg2][arg1] > fw_wa_query */
3074+static int
3075+mt7996_wa_query(void *data, u64 val)
3076+{
3077+ struct mt7996_dev *dev = data;
3078+ u32 arg1, arg2, arg3;
3079+
3080+ arg1 = FIELD_GET(GENMASK_ULL(7, 0), val);
3081+ arg2 = FIELD_GET(GENMASK_ULL(15, 8), val);
3082+ arg3 = FIELD_GET(GENMASK_ULL(23, 16), val);
3083+
3084+ return mt7996_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(QUERY),
3085+ arg1, arg2, arg3);
3086+ return 0;
3087+}
3088+
3089+DEFINE_DEBUGFS_ATTRIBUTE(fops_wa_query, NULL, mt7996_wa_query,
3090+ "0x%llx\n");
3091+
3092+static int mt7996_dump_version(struct seq_file *s, void *data)
3093+{
3094+#define MAX_ADIE_NUM 3
3095+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
3096+ u32 regval;
3097+ u16 adie_chip_id, adie_chip_ver;
3098+ int adie_idx;
3099+ static const char * const fem_type[] = {
3100+ [MT7996_FEM_UNSET] = "N/A",
3101+ [MT7996_FEM_EXT] = "eFEM",
3102+ [MT7996_FEM_INT] = "iFEM",
3103+ [MT7996_FEM_MIX] = "mixed FEM",
3104+ };
3105+
3106+ seq_printf(s, "Version: 4.3.24.3\n");
3107+
3108+ if (!test_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state))
3109+ return 0;
3110+
3111+ seq_printf(s, "Rom Patch Build Time: %.16s\n", dev->patch_build_date);
3112+ seq_printf(s, "WM Patch Build Time: %.15s, Mode: %s\n",
3113+ dev->ram_build_date[MT7996_RAM_TYPE_WM],
3114+ dev->testmode_enable ? "Testmode" : "Normal mode");
3115+ seq_printf(s, "WA Patch Build Time: %.15s\n",
3116+ dev->ram_build_date[MT7996_RAM_TYPE_WA]);
3117+ seq_printf(s, "DSP Patch Build Time: %.15s\n",
3118+ dev->ram_build_date[MT7996_RAM_TYPE_DSP]);
3119+ for (adie_idx = 0; adie_idx < MAX_ADIE_NUM; adie_idx++) {
3120+ mt7996_mcu_rf_regval(dev, MT_ADIE_CHIP_ID(adie_idx), &regval, false);
3121+ adie_chip_id = FIELD_GET(MT_ADIE_CHIP_ID_MASK, regval);
3122+ adie_chip_ver = FIELD_GET(MT_ADIE_VERSION_MASK, regval);
3123+ if (adie_chip_id)
3124+ seq_printf(s, "Adie %d: ID = 0x%04x, Ver = 0x%04x\n",
3125+ adie_idx, adie_chip_id, adie_chip_ver);
3126+ else
3127+ seq_printf(s, "Adie %d: ID = N/A, Ver = N/A\n", adie_idx);
3128+ }
3129+ seq_printf(s, "FEM type: %s\n", fem_type[dev->fem_type]);
3130+
3131+ return 0;
3132+}
3133+
3134+/* fw wm call trace info dump */
3135+void mt7996_show_lp_history(struct seq_file *s, u32 type)
3136+{
3137+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
3138+ struct mt7996_crash_data *crash_data;
3139+ struct mt7996_coredump *dump;
3140+ u64 now = 0;
3141+ int i = 0;
3142+ u8 fw_type = !!type;
3143+
3144+ mutex_lock(&dev->dump_mutex);
3145+
3146+ crash_data = mt7996_coredump_new(dev, fw_type);
3147+ if (!crash_data) {
3148+ mutex_unlock(&dev->dump_mutex);
3149+ seq_printf(s, "the coredump is disable!\n");
3150+ return;
3151+ }
3152+ mutex_unlock(&dev->dump_mutex);
3153+
3154+ dump = mt7996_coredump_build(dev, fw_type, false);
3155+ if (!dump) {
3156+ seq_printf(s, "no call stack data found!\n");
3157+ return;
3158+ }
3159+
3160+ seq_printf(s, "\x1b[32m%s log output\x1b[0m\n", dump->fw_type);
3161+ seq_printf(s, "\x1b[32mfw status: %s\n", dump->fw_state);
3162+ mt7996_dump_version(s, NULL);
3163+ /* PC log */
3164+ now = jiffies;
3165+ for (i = 0; i < 10; i++)
3166+ seq_printf(s, "\tCurrent PC=%x\n", dump->pc_cur[i]);
3167+
3168+ seq_printf(s, "PC log contorl=0x%x(T=%llu)(latest PC index = 0x%x)\n",
3169+ dump->pc_dbg_ctrl, now, dump->pc_cur_idx);
3170+ for (i = 0; i < 32; i++)
3171+ seq_printf(s, "\tPC log(%d)=0x%08x\n", i, dump->pc_stack[i]);
3172+
3173+ /* LR log */
3174+ now = jiffies;
3175+ seq_printf(s, "\nLR log contorl=0x%x(T=%llu)(latest LR index = 0x%x)\n",
3176+ dump->lr_dbg_ctrl, now, dump->lr_cur_idx);
3177+ for (i = 0; i < 32; i++)
3178+ seq_printf(s, "\tLR log(%d)=0x%08x\n", i, dump->lr_stack[i]);
3179+
3180+ vfree(dump);
3181+}
3182+
3183+static int mt7996_fw_wa_info_read(struct seq_file *s, void *data)
3184+{
3185+ seq_printf(s, "======[ShowPcLpHistory]======\n");
3186+ mt7996_show_lp_history(s, MT7996_RAM_TYPE_WA);
3187+ seq_printf(s, "======[End ShowPcLpHistory]==\n");
3188+
3189+ return 0;
3190+}
3191+
3192+static int mt7996_fw_wm_info_read(struct seq_file *s, void *data)
3193+{
3194+ seq_printf(s, "======[ShowPcLpHistory]======\n");
3195+ mt7996_show_lp_history(s, MT7996_RAM_TYPE_WM);
3196+ seq_printf(s, "======[End ShowPcLpHistory]==\n");
3197+
3198+ return 0;
3199+}
3200+
3201+/* dma info dump */
3202+static void
3203+dump_dma_tx_ring_info(struct seq_file *s, struct mt7996_dev *dev, char *str1, char *str2, u32 ring_base)
3204+{
3205+ u32 base, cnt, cidx, didx, queue_cnt;
3206+
3207+ base= mt76_rr(dev, ring_base);
3208+ cnt = mt76_rr(dev, ring_base + 4);
3209+ cidx = mt76_rr(dev, ring_base + 8);
3210+ didx = mt76_rr(dev, ring_base + 12);
3211+ queue_cnt = (cidx >= didx) ? (cidx - didx) : (cidx - didx + cnt);
3212+
3213+ seq_printf(s, "%20s %6s %10x %15x %10x %10x %10x\n", str1, str2, base, cnt, cidx, didx, queue_cnt);
3214+}
3215+
3216+static void
3217+dump_dma_rx_ring_info(struct seq_file *s, struct mt7996_dev *dev, char *str1, char *str2, u32 ring_base)
3218+{
3219+ u32 base, ctrl1, cnt, cidx, didx, queue_cnt;
3220+
3221+ base= mt76_rr(dev, ring_base);
3222+ ctrl1 = mt76_rr(dev, ring_base + 4);
3223+ cidx = mt76_rr(dev, ring_base + 8) & 0xfff;
3224+ didx = mt76_rr(dev, ring_base + 12) & 0xfff;
3225+ cnt = ctrl1 & 0xfff;
3226+ queue_cnt = (didx > cidx) ? (didx - cidx - 1) : (didx - cidx + cnt - 1);
3227+
3228+ seq_printf(s, "%20s %6s %10x %10x(%3x) %10x %10x %10x\n",
3229+ str1, str2, base, ctrl1, cnt, cidx, didx, queue_cnt);
3230+}
3231+
3232+static void
3233+mt7996_show_dma_info(struct seq_file *s, struct mt7996_dev *dev)
3234+{
3235+ u32 sys_ctrl[10];
3236+
3237+ /* HOST DMA0 information */
3238+ sys_ctrl[0] = mt76_rr(dev, WF_WFDMA_HOST_DMA0_HOST_INT_STA_ADDR);
3239+ sys_ctrl[1] = mt76_rr(dev, WF_WFDMA_HOST_DMA0_HOST_INT_ENA_ADDR);
3240+ sys_ctrl[2] = mt76_rr(dev, WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_ADDR);
3241+
3242+ seq_printf(s, "HOST_DMA Configuration\n");
3243+ seq_printf(s, "%10s %10s %10s %10s %10s %10s\n",
3244+ "DMA", "IntCSR", "IntMask", "Glocfg", "Tx/RxEn", "Tx/RxBusy");
3245+ seq_printf(s, "%10s %10x %10x %10x %4x/%5x %4x/%5x\n",
3246+ "DMA0", sys_ctrl[0], sys_ctrl[1], sys_ctrl[2],
3247+ (sys_ctrl[2] & WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_TX_DMA_EN_MASK)
3248+ >> WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_TX_DMA_EN_SHFT,
3249+ (sys_ctrl[2] & WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_RX_DMA_EN_MASK)
3250+ >> WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_RX_DMA_EN_SHFT,
3251+ (sys_ctrl[2] & WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_TX_DMA_BUSY_MASK)
3252+ >> WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_TX_DMA_BUSY_SHFT,
3253+ (sys_ctrl[2] & WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_RX_DMA_BUSY_MASK)
3254+ >> WF_WFDMA_HOST_DMA0_WPDMA_GLO_CFG_RX_DMA_BUSY_SHFT);
3255+
3256+ if (dev->hif2) {
3257+ /* HOST DMA1 information */
3258+ sys_ctrl[0] = mt76_rr(dev, WF_WFDMA_HOST_DMA0_PCIE1_HOST_INT_STA_ADDR);
3259+ sys_ctrl[1] = mt76_rr(dev, WF_WFDMA_HOST_DMA0_PCIE1_HOST_INT_ENA_ADDR);
3260+ sys_ctrl[2] = mt76_rr(dev, WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_ADDR);
3261+
3262+ seq_printf(s, "%10s %10x %10x %10x %4x/%5x %4x/%5x\n",
3263+ "DMA0P1", sys_ctrl[0], sys_ctrl[1], sys_ctrl[2],
3264+ (sys_ctrl[2] & WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_TX_DMA_EN_MASK)
3265+ >> WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_TX_DMA_EN_SHFT,
3266+ (sys_ctrl[2] & WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_RX_DMA_EN_MASK)
3267+ >> WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_RX_DMA_EN_SHFT,
3268+ (sys_ctrl[2] & WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_TX_DMA_BUSY_MASK)
3269+ >> WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_TX_DMA_BUSY_SHFT,
3270+ (sys_ctrl[2] & WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_RX_DMA_BUSY_MASK)
3271+ >> WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_GLO_CFG_RX_DMA_BUSY_SHFT);
3272+ }
3273+
3274+ seq_printf(s, "HOST_DMA0 Ring Configuration\n");
3275+ seq_printf(s, "%20s %6s %10s %15s %10s %10s %10s\n",
3276+ "Name", "Used", "Base", "Ctrl1(Cnt)", "CIDX", "DIDX", "QCnt");
3277+ dump_dma_tx_ring_info(s, dev, "T0:TXD0(H2MAC)", "STA",
3278+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING0_CTRL0_ADDR);
3279+ dump_dma_tx_ring_info(s, dev, "T1:TXD1(H2MAC)", "STA",
3280+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING1_CTRL0_ADDR);
3281+ dump_dma_tx_ring_info(s, dev, "T2:TXD2(H2MAC)", "STA",
3282+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING2_CTRL0_ADDR);
3283+ dump_dma_tx_ring_info(s, dev, "T3:", "STA",
3284+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING3_CTRL0_ADDR);
3285+ dump_dma_tx_ring_info(s, dev, "T4:", "STA",
3286+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING4_CTRL0_ADDR);
3287+ dump_dma_tx_ring_info(s, dev, "T5:", "STA",
3288+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING5_CTRL0_ADDR);
3289+ dump_dma_tx_ring_info(s, dev, "T6:", "STA",
3290+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING6_CTRL0_ADDR);
3291+ dump_dma_tx_ring_info(s, dev, "T16:FWDL", "Both",
3292+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING16_CTRL0_ADDR);
3293+ dump_dma_tx_ring_info(s, dev, "T17:Cmd(H2WM)", "Both",
3294+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING17_CTRL0_ADDR);
3295+ dump_dma_tx_ring_info(s, dev, "T18:TXD0(H2WA)", "AP",
3296+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING18_CTRL0_ADDR);
3297+ dump_dma_tx_ring_info(s, dev, "T19:TXD1(H2WA)", "AP",
3298+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING19_CTRL0_ADDR);
3299+ dump_dma_tx_ring_info(s, dev, "T20:Cmd(H2WA)", "AP",
3300+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING20_CTRL0_ADDR);
3301+ dump_dma_tx_ring_info(s, dev, "T21:TXD2(H2WA)", "AP",
3302+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING21_CTRL0_ADDR);
3303+ dump_dma_tx_ring_info(s, dev, "T22:TXD3(H2WA)", "AP",
3304+ WF_WFDMA_HOST_DMA0_WPDMA_TX_RING22_CTRL0_ADDR);
3305+
3306+
3307+ dump_dma_rx_ring_info(s, dev, "R0:Event(WM2H)", "Both",
3308+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING0_CTRL0_ADDR);
3309+ dump_dma_rx_ring_info(s, dev, "R1:Event(WA2H)", "AP",
3310+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING1_CTRL0_ADDR);
3311+ dump_dma_rx_ring_info(s, dev, "R2:TxDone0(WA2H)", "AP",
3312+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING2_CTRL0_ADDR);
3313+ dump_dma_rx_ring_info(s, dev, "R3:TxDone1(WA2H)", "AP",
3314+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING3_CTRL0_ADDR);
3315+ dump_dma_rx_ring_info(s, dev, "R4:Data0(MAC2H)", "Both",
3316+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING4_CTRL0_ADDR);
3317+ dump_dma_rx_ring_info(s, dev, "R5:Data1(MAC2H)", "Both",
3318+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING5_CTRL0_ADDR);
3319+ dump_dma_rx_ring_info(s, dev, "R6:BUF1(MAC2H)", "Both",
3320+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING6_CTRL0_ADDR);
3321+ dump_dma_rx_ring_info(s, dev, "R7:TxDone1(MAC2H)", "Both",
3322+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING7_CTRL0_ADDR);
3323+ dump_dma_rx_ring_info(s, dev, "R8:BUF0(MAC2H)", "Both",
3324+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING8_CTRL0_ADDR);
3325+ dump_dma_rx_ring_info(s, dev, "R9:TxDone0(MAC2H)", "Both",
3326+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING9_CTRL0_ADDR);
3327+ dump_dma_rx_ring_info(s, dev, "R10:MSDU_PG0(MAC2H)", "Both",
3328+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING10_CTRL0_ADDR);
3329+ dump_dma_rx_ring_info(s, dev, "R11:MSDU_PG1(MAC2H)", "Both",
3330+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING11_CTRL0_ADDR);
3331+ dump_dma_rx_ring_info(s, dev, "R12:MSDU_PG2(MAC2H)", "Both",
3332+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING12_CTRL0_ADDR);
3333+ dump_dma_rx_ring_info(s, dev, "IND:IND_CMD(MAC2H)", "Both",
3334+ WF_RRO_TOP_IND_CMD_0_CTRL0_ADDR);
3335+
3336+ if (dev->hif2) {
3337+ seq_printf(s, "HOST_DMA0 PCIe1 Ring Configuration\n");
3338+ seq_printf(s, "%20s %6s %10s %15s %10s %10s %10s\n",
3339+ "Name", "Used", "Base", "Ctrl1(Cnt)", "CIDX", "DIDX", "QCnt");
3340+ dump_dma_tx_ring_info(s, dev, "T21:TXD2(H2WA)", "AP",
3341+ WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING21_CTRL0_ADDR);
3342+ dump_dma_tx_ring_info(s, dev, "T22:TXD?(H2WA)", "AP",
3343+ WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING22_CTRL0_ADDR);
3344+
3345+ dump_dma_rx_ring_info(s, dev, "R3:TxDone1(WA2H)", "AP",
3346+ WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING3_CTRL0_ADDR);
3347+ dump_dma_rx_ring_info(s, dev, "R5:Data1(MAC2H)", "Both",
3348+ WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING5_CTRL0_ADDR);
3349+ dump_dma_rx_ring_info(s, dev, "R6:BUF1(MAC2H)", "Both",
3350+ WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING6_CTRL0_ADDR);
3351+ dump_dma_rx_ring_info(s, dev, "R7:TxDone1(MAC2H)", "Both",
3352+ WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING7_CTRL0_ADDR);
3353+ }
3354+
3355+ /* MCU DMA information */
3356+ sys_ctrl[0] = mt76_rr(dev, WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_ADDR);
3357+ sys_ctrl[1] = mt76_rr(dev, WF_WFDMA_MCU_DMA0_HOST_INT_STA_ADDR);
3358+ sys_ctrl[2] = mt76_rr(dev, WF_WFDMA_MCU_DMA0_HOST_INT_ENA_ADDR);
3359+
3360+ seq_printf(s, "MCU_DMA Configuration\n");
3361+ seq_printf(s, "%10s %10s %10s %10s %10s %10s\n",
3362+ "DMA", "IntCSR", "IntMask", "Glocfg", "Tx/RxEn", "Tx/RxBusy");
3363+ seq_printf(s, "%10s %10x %10x %10x %4x/%5x %4x/%5x\n",
3364+ "DMA0", sys_ctrl[1], sys_ctrl[2], sys_ctrl[0],
3365+ (sys_ctrl[0] & WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_TX_DMA_EN_MASK)
3366+ >> WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_TX_DMA_EN_SHFT,
3367+ (sys_ctrl[0] & WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_RX_DMA_EN_MASK)
3368+ >> WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_RX_DMA_EN_SHFT,
3369+ (sys_ctrl[0] & WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_TX_DMA_BUSY_MASK)
3370+ >> WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_TX_DMA_BUSY_SHFT,
3371+ (sys_ctrl[0] & WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_RX_DMA_BUSY_MASK)
3372+ >> WF_WFDMA_MCU_DMA0_WPDMA_GLO_CFG_RX_DMA_BUSY_SHFT);
3373+
3374+ seq_printf(s, "MCU_DMA0 Ring Configuration\n");
3375+ seq_printf(s, "%20s %6s %10s %15s %10s %10s %10s\n",
3376+ "Name", "Used", "Base", "Cnt", "CIDX", "DIDX", "QCnt");
3377+ dump_dma_tx_ring_info(s, dev, "T0:Event(WM2H)", "Both",
3378+ WF_WFDMA_MCU_DMA0_WPDMA_TX_RING0_CTRL0_ADDR);
3379+ dump_dma_tx_ring_info(s, dev, "T1:Event(WA2H)", "AP",
3380+ WF_WFDMA_MCU_DMA0_WPDMA_TX_RING1_CTRL0_ADDR);
3381+ dump_dma_tx_ring_info(s, dev, "T2:TxDone0(WA2H)", "AP",
3382+ WF_WFDMA_MCU_DMA0_WPDMA_TX_RING2_CTRL0_ADDR);
3383+ dump_dma_tx_ring_info(s, dev, "T3:TxDone1(WA2H)", "AP",
3384+ WF_WFDMA_MCU_DMA0_WPDMA_TX_RING3_CTRL0_ADDR);
3385+ dump_dma_tx_ring_info(s, dev, "T4:TXD(WM2MAC)", "Both",
3386+ WF_WFDMA_MCU_DMA0_WPDMA_TX_RING4_CTRL0_ADDR);
3387+ dump_dma_tx_ring_info(s, dev, "T5:TXCMD(WM2MAC)", "Both",
3388+ WF_WFDMA_MCU_DMA0_WPDMA_TX_RING5_CTRL0_ADDR);
3389+ dump_dma_tx_ring_info(s, dev, "T6:TXD(WA2MAC)", "AP",
3390+ WF_WFDMA_MCU_DMA0_WPDMA_TX_RING6_CTRL0_ADDR);
3391+ dump_dma_rx_ring_info(s, dev, "R0:FWDL", "Both",
3392+ WF_WFDMA_MCU_DMA0_WPDMA_RX_RING0_CTRL0_ADDR);
3393+ dump_dma_rx_ring_info(s, dev, "R1:Cmd(H2WM)", "Both",
3394+ WF_WFDMA_MCU_DMA0_WPDMA_RX_RING1_CTRL0_ADDR);
3395+ dump_dma_rx_ring_info(s, dev, "R2:TXD0(H2WA)", "AP",
3396+ WF_WFDMA_MCU_DMA0_WPDMA_RX_RING2_CTRL0_ADDR);
3397+ dump_dma_rx_ring_info(s, dev, "R3:TXD1(H2WA)", "AP",
3398+ WF_WFDMA_MCU_DMA0_WPDMA_RX_RING3_CTRL0_ADDR);
3399+ dump_dma_rx_ring_info(s, dev, "R4:Cmd(H2WA)", "AP",
3400+ WF_WFDMA_MCU_DMA0_WPDMA_RX_RING4_CTRL0_ADDR);
3401+ dump_dma_rx_ring_info(s, dev, "R5:Data0(MAC2WM)", "Both",
3402+ WF_WFDMA_MCU_DMA0_WPDMA_RX_RING5_CTRL0_ADDR);
3403+ dump_dma_rx_ring_info(s, dev, "R6:TxDone(MAC2WM)", "Both",
3404+ WF_WFDMA_MCU_DMA0_WPDMA_RX_RING6_CTRL0_ADDR);
3405+ dump_dma_rx_ring_info(s, dev, "R7:SPL/RPT(MAC2WM)", "Both",
3406+ WF_WFDMA_MCU_DMA0_WPDMA_RX_RING7_CTRL0_ADDR);
3407+ dump_dma_rx_ring_info(s, dev, "R8:TxDone(MAC2WA)", "AP",
3408+ WF_WFDMA_MCU_DMA0_WPDMA_RX_RING8_CTRL0_ADDR);
3409+ dump_dma_rx_ring_info(s, dev, "R9:Data1(MAC2WM)", "Both",
3410+ WF_WFDMA_MCU_DMA0_WPDMA_RX_RING9_CTRL0_ADDR);
3411+ dump_dma_rx_ring_info(s, dev, "R10:TXD2(H2WA)", "AP",
3412+ WF_WFDMA_MCU_DMA0_WPDMA_RX_RING10_CTRL0_ADDR);
3413+
3414+ /* MEM DMA information */
3415+ sys_ctrl[0] = mt76_rr(dev, WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_ADDR);
3416+ sys_ctrl[1] = mt76_rr(dev, WF_WFDMA_MEM_DMA_HOST_INT_STA_ADDR);
3417+ sys_ctrl[2] = mt76_rr(dev, WF_WFDMA_MEM_DMA_HOST_INT_ENA_ADDR);
3418+
3419+ seq_printf(s, "MEM_DMA Configuration\n");
3420+ seq_printf(s, "%10s %10s %10s %10s %10s %10s\n",
3421+ "DMA", "IntCSR", "IntMask", "Glocfg", "Tx/RxEn", "Tx/RxBusy");
3422+ seq_printf(s, "%10s %10x %10x %10x %4x/%5x %4x/%5x\n",
3423+ "MEM", sys_ctrl[1], sys_ctrl[2], sys_ctrl[0],
3424+ (sys_ctrl[0] & WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_TX_DMA_EN_MASK)
3425+ >> WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_TX_DMA_EN_SHFT,
3426+ (sys_ctrl[0] & WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_RX_DMA_EN_MASK)
3427+ >> WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_RX_DMA_EN_SHFT,
3428+ (sys_ctrl[0] & WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_TX_DMA_BUSY_MASK)
3429+ >> WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_TX_DMA_BUSY_SHFT,
3430+ (sys_ctrl[0] & WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_RX_DMA_BUSY_MASK)
3431+ >> WF_WFDMA_MEM_DMA_WPDMA_GLO_CFG_RX_DMA_BUSY_SHFT);
3432+
3433+ seq_printf(s, "MEM_DMA Ring Configuration\n");
3434+ seq_printf(s, "%20s %6s %10s %10s %10s %10s %10s\n",
3435+ "Name", "Used", "Base", "Cnt", "CIDX", "DIDX", "QCnt");
3436+ dump_dma_tx_ring_info(s, dev, "T0:CmdEvent(WM2WA)", "AP",
3437+ WF_WFDMA_MEM_DMA_WPDMA_TX_RING0_CTRL0_ADDR);
3438+ dump_dma_tx_ring_info(s, dev, "T1:CmdEvent(WA2WM)", "AP",
3439+ WF_WFDMA_MEM_DMA_WPDMA_TX_RING1_CTRL0_ADDR);
3440+ dump_dma_rx_ring_info(s, dev, "R0:CmdEvent(WM2WA)", "AP",
3441+ WF_WFDMA_MEM_DMA_WPDMA_RX_RING0_CTRL0_ADDR);
3442+ dump_dma_rx_ring_info(s, dev, "R1:CmdEvent(WA2WM)", "AP",
3443+ WF_WFDMA_MEM_DMA_WPDMA_RX_RING1_CTRL0_ADDR);
3444+}
3445+
3446+static int mt7996_trinfo_read(struct seq_file *s, void *data)
3447+{
3448+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
3449+ mt7996_show_dma_info(s, dev);
3450+ return 0;
3451+}
3452+
3453+/* MIB INFO */
3454+static int mt7996_mibinfo_read_per_band(struct seq_file *s, int band_idx)
3455+{
3456+#define BSS_NUM 4
3457+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
3458+ u8 bss_nums = BSS_NUM;
3459+ u32 idx;
3460+ u32 mac_val, band_offset = 0, band_offset_umib = 0;
3461+ u32 msdr6, msdr9, msdr18;
3462+ u32 rvsr0, rscr26, rscr35, mctr5, mctr6, msr0, msr1, msr2;
3463+ u32 tbcr0, tbcr1, tbcr2, tbcr3, tbcr4;
3464+ u32 btscr[7];
3465+ u32 tdrcr[5];
3466+ u32 mbtocr[16], mbtbcr[16], mbrocr[16], mbrbcr[16];
3467+ u32 btcr, btbcr, brocr, brbcr, btdcr, brdcr;
3468+ u32 mu_cnt[5];
3469+ u32 ampdu_cnt[3];
3470+ u64 per;
3471+
3472+ switch (band_idx) {
3473+ case 0:
3474+ band_offset = 0;
3475+ band_offset_umib = 0;
3476+ break;
3477+ case 1:
3478+ band_offset = BN1_WF_MIB_TOP_BASE - BN0_WF_MIB_TOP_BASE;
3479+ band_offset_umib = WF_UMIB_TOP_B1BROCR_ADDR - WF_UMIB_TOP_B0BROCR_ADDR;
3480+ break;
3481+ case 2:
3482+ band_offset = IP1_BN0_WF_MIB_TOP_BASE - BN0_WF_MIB_TOP_BASE;
3483+ band_offset_umib = WF_UMIB_TOP_B2BROCR_ADDR - WF_UMIB_TOP_B0BROCR_ADDR;
3484+ break;
3485+ default:
3486+ return true;
3487+ }
3488+
3489+ seq_printf(s, "Band %d MIB Status\n", band_idx);
3490+ seq_printf(s, "===============================\n");
3491+ mac_val = mt76_rr(dev, BN0_WF_MIB_TOP_M0SCR0_ADDR + band_offset);
3492+ seq_printf(s, "MIB Status Control=0x%x\n", mac_val);
3493+
3494+ msdr6 = mt76_rr(dev, BN0_WF_MIB_TOP_M0SDR6_ADDR + band_offset);
3495+ rvsr0 = mt76_rr(dev, BN0_WF_MIB_TOP_RVSR0_ADDR + band_offset);
3496+ rscr35 = mt76_rr(dev, BN0_WF_MIB_TOP_RSCR35_ADDR + band_offset);
3497+ msdr9 = mt76_rr(dev, BN0_WF_MIB_TOP_M0SDR9_ADDR + band_offset);
3498+ rscr26 = mt76_rr(dev, BN0_WF_MIB_TOP_RSCR26_ADDR + band_offset);
3499+ mctr5 = mt76_rr(dev, BN0_WF_MIB_TOP_MCTR5_ADDR + band_offset);
3500+ mctr6 = mt76_rr(dev, BN0_WF_MIB_TOP_MCTR6_ADDR + band_offset);
3501+ msdr18 = mt76_rr(dev, BN0_WF_MIB_TOP_M0SDR18_ADDR + band_offset);
3502+ msr0 = mt76_rr(dev, BN0_WF_MIB_TOP_MSR0_ADDR + band_offset);
3503+ msr1 = mt76_rr(dev, BN0_WF_MIB_TOP_MSR1_ADDR + band_offset);
3504+ msr2 = mt76_rr(dev, BN0_WF_MIB_TOP_MSR2_ADDR + band_offset);
3505+ ampdu_cnt[0] = mt76_rr(dev, BN0_WF_MIB_TOP_TSCR0_ADDR + band_offset);
3506+ ampdu_cnt[1] = mt76_rr(dev, BN0_WF_MIB_TOP_TSCR3_ADDR + band_offset);
3507+ ampdu_cnt[2] = mt76_rr(dev, BN0_WF_MIB_TOP_TSCR4_ADDR + band_offset);
3508+ ampdu_cnt[1] &= BN0_WF_MIB_TOP_TSCR3_AMPDU_MPDU_COUNT_MASK;
3509+ ampdu_cnt[2] &= BN0_WF_MIB_TOP_TSCR4_AMPDU_ACKED_COUNT_MASK;
3510+
3511+ seq_printf(s, "===Phy/Timing Related Counters===\n");
3512+ seq_printf(s, "\tChannelIdleCnt=0x%x\n",
3513+ msdr6 & BN0_WF_MIB_TOP_M0SDR6_CHANNEL_IDLE_COUNT_MASK);
3514+ seq_printf(s, "\tCCA_NAV_Tx_Time=0x%x\n",
3515+ msdr9 & BN0_WF_MIB_TOP_M0SDR9_CCA_NAV_TX_TIME_MASK);
3516+ seq_printf(s, "\tRx_MDRDY_CNT=0x%x\n",
3517+ rscr26 & BN0_WF_MIB_TOP_RSCR26_RX_MDRDY_COUNT_MASK);
3518+ seq_printf(s, "\tCCK_MDRDY_TIME=0x%x, OFDM_MDRDY_TIME=0x%x",
3519+ msr0 & BN0_WF_MIB_TOP_MSR0_CCK_MDRDY_TIME_MASK,
3520+ msr1 & BN0_WF_MIB_TOP_MSR1_OFDM_LG_MIXED_VHT_MDRDY_TIME_MASK);
3521+ seq_printf(s, ", OFDM_GREEN_MDRDY_TIME=0x%x\n",
3522+ msr2 & BN0_WF_MIB_TOP_MSR2_OFDM_GREEN_MDRDY_TIME_MASK);
3523+ seq_printf(s, "\tPrim CCA Time=0x%x\n",
3524+ mctr5 & BN0_WF_MIB_TOP_MCTR5_P_CCA_TIME_MASK);
3525+ seq_printf(s, "\tSec CCA Time=0x%x\n",
3526+ mctr6 & BN0_WF_MIB_TOP_MCTR6_S_CCA_TIME_MASK);
3527+ seq_printf(s, "\tPrim ED Time=0x%x\n",
3528+ msdr18 & BN0_WF_MIB_TOP_M0SDR18_P_ED_TIME_MASK);
3529+
3530+ seq_printf(s, "===Tx Related Counters(Generic)===\n");
3531+ mac_val = mt76_rr(dev, BN0_WF_MIB_TOP_TSCR18_ADDR + band_offset);
3532+ dev->dbg.bcn_total_cnt[band_idx] +=
3533+ (mac_val & BN0_WF_MIB_TOP_TSCR18_BEACONTXCOUNT_MASK);
3534+ seq_printf(s, "\tBeaconTxCnt=0x%x\n", dev->dbg.bcn_total_cnt[band_idx]);
3535+ dev->dbg.bcn_total_cnt[band_idx] = 0;
3536+
3537+ tbcr0 = mt76_rr(dev, BN0_WF_MIB_TOP_TBCR0_ADDR + band_offset);
3538+ seq_printf(s, "\tTx 20MHz Cnt=0x%x\n",
3539+ tbcr0 & BN0_WF_MIB_TOP_TBCR0_TX_20MHZ_CNT_MASK);
3540+ tbcr1 = mt76_rr(dev, BN0_WF_MIB_TOP_TBCR1_ADDR + band_offset);
3541+ seq_printf(s, "\tTx 40MHz Cnt=0x%x\n",
3542+ tbcr1 & BN0_WF_MIB_TOP_TBCR1_TX_40MHZ_CNT_MASK);
3543+ tbcr2 = mt76_rr(dev, BN0_WF_MIB_TOP_TBCR2_ADDR + band_offset);
3544+ seq_printf(s, "\tTx 80MHz Cnt=0x%x\n",
3545+ tbcr2 & BN0_WF_MIB_TOP_TBCR2_TX_80MHZ_CNT_MASK);
3546+ tbcr3 = mt76_rr(dev, BN0_WF_MIB_TOP_TBCR3_ADDR + band_offset);
3547+ seq_printf(s, "\tTx 160MHz Cnt=0x%x\n",
3548+ tbcr3 & BN0_WF_MIB_TOP_TBCR3_TX_160MHZ_CNT_MASK);
3549+ tbcr4 = mt76_rr(dev, BN0_WF_MIB_TOP_TBCR4_ADDR + band_offset);
3550+ seq_printf(s, "\tTx 320MHz Cnt=0x%x\n",
3551+ tbcr4 & BN0_WF_MIB_TOP_TBCR4_TX_320MHZ_CNT_MASK);
3552+ seq_printf(s, "\tAMPDU Cnt=0x%x\n", ampdu_cnt[0]);
3553+ seq_printf(s, "\tAMPDU MPDU Cnt=0x%x\n", ampdu_cnt[1]);
3554+ seq_printf(s, "\tAMPDU MPDU Ack Cnt=0x%x\n", ampdu_cnt[2]);
3555+ per = (ampdu_cnt[2] == 0 ?
3556+ 0 : 1000 * (ampdu_cnt[1] - ampdu_cnt[2]) / ampdu_cnt[1]);
3557+ seq_printf(s, "\tAMPDU MPDU PER=%llu.%1llu%%\n", per / 10, per % 10);
3558+
3559+ seq_printf(s, "===MU Related Counters===\n");
3560+ mu_cnt[0] = mt76_rr(dev, BN0_WF_MIB_TOP_BSCR2_ADDR + band_offset);
3561+ mu_cnt[1] = mt76_rr(dev, BN0_WF_MIB_TOP_TSCR5_ADDR + band_offset);
3562+ mu_cnt[2] = mt76_rr(dev, BN0_WF_MIB_TOP_TSCR6_ADDR + band_offset);
3563+ mu_cnt[3] = mt76_rr(dev, BN0_WF_MIB_TOP_TSCR8_ADDR + band_offset);
3564+ mu_cnt[4] = mt76_rr(dev, BN0_WF_MIB_TOP_TSCR7_ADDR + band_offset);
3565+
3566+ seq_printf(s, "\tMUBF_TX_COUNT=0x%x\n",
3567+ mu_cnt[0] & BN0_WF_MIB_TOP_BSCR2_MUBF_TX_COUNT_MASK);
3568+ seq_printf(s, "\tMU_TX_MPDU_COUNT(Ok+Fail)=0x%x\n", mu_cnt[1]);
3569+ seq_printf(s, "\tMU_TX_OK_MPDU_COUNT=0x%x\n", mu_cnt[2]);
3570+ seq_printf(s, "\tMU_TO_MU_FAIL_PPDU_COUNT=0x%x\n", mu_cnt[3]);
3571+ seq_printf(s, "\tSU_TX_OK_MPDU_COUNT=0x%x\n", mu_cnt[4]);
3572+
3573+ seq_printf(s, "===Rx Related Counters(Generic)===\n");
3574+ seq_printf(s, "\tVector Mismacth Cnt=0x%x\n",
3575+ rvsr0 & BN0_WF_MIB_TOP_RVSR0_VEC_MISS_COUNT_MASK);
3576+ seq_printf(s, "\tDelimiter Fail Cnt=0x%x\n",
3577+ rscr35 & BN0_WF_MIB_TOP_RSCR35_DELIMITER_FAIL_COUNT_MASK);
3578+
3579+ mac_val = mt76_rr(dev, BN0_WF_MIB_TOP_RSCR1_ADDR + band_offset);
3580+ seq_printf(s, "\tRxFCSErrCnt=0x%x\n",
3581+ (mac_val & BN0_WF_MIB_TOP_RSCR1_RX_FCS_ERROR_COUNT_MASK));
3582+ mac_val = mt76_rr(dev, BN0_WF_MIB_TOP_RSCR33_ADDR + band_offset);
3583+ seq_printf(s, "\tRxFifoFullCnt=0x%x\n",
3584+ (mac_val & BN0_WF_MIB_TOP_RSCR33_RX_FIFO_FULL_COUNT_MASK));
3585+ mac_val = mt76_rr(dev, BN0_WF_MIB_TOP_RSCR36_ADDR + band_offset);
3586+ seq_printf(s, "\tRxLenMismatch=0x%x\n",
3587+ (mac_val & BN0_WF_MIB_TOP_RSCR36_RX_LEN_MISMATCH_MASK));
3588+ mac_val = mt76_rr(dev, BN0_WF_MIB_TOP_RSCR31_ADDR + band_offset);
3589+ seq_printf(s, "\tRxMPDUCnt=0x%x\n",
3590+ (mac_val & BN0_WF_MIB_TOP_RSCR31_RX_MPDU_COUNT_MASK));
3591+ mac_val = mt76_rr(dev, BN0_WF_MIB_TOP_RSCR27_ADDR + band_offset);
3592+ seq_printf(s, "\tRx AMPDU Cnt=0x%x\n", mac_val);
3593+ mac_val = mt76_rr(dev, BN0_WF_MIB_TOP_RSCR28_ADDR + band_offset);
3594+ seq_printf(s, "\tRx Total ByteCnt=0x%x\n", mac_val);
3595+
3596+
3597+ /* Per-BSS T/RX Counters */
3598+ seq_printf(s, "===Per-BSS Related Tx/Rx Counters===\n");
3599+ seq_printf(s, "BSS Idx TxCnt/DataCnt TxByteCnt RxOkCnt/DataCnt RxByteCnt\n");
3600+ for (idx = 0; idx < bss_nums; idx++) {
3601+ btcr = mt76_rr(dev, BN0_WF_MIB_TOP_BTCR_ADDR + band_offset + idx * 4);
3602+ btdcr = mt76_rr(dev, BN0_WF_MIB_TOP_BTDCR_ADDR + band_offset + idx * 4);
3603+ btbcr = mt76_rr(dev, BN0_WF_MIB_TOP_BTBCR_ADDR + band_offset + idx * 4);
3604+
3605+ brocr = mt76_rr(dev, WF_UMIB_TOP_B0BROCR_ADDR + band_offset_umib + idx * 4);
3606+ brdcr = mt76_rr(dev, WF_UMIB_TOP_B0BRDCR_ADDR + band_offset_umib + idx * 4);
3607+ brbcr = mt76_rr(dev, WF_UMIB_TOP_B0BRBCR_ADDR + band_offset_umib + idx * 4);
3608+
3609+ seq_printf(s, "%d\t 0x%x/0x%x\t 0x%x \t 0x%x/0x%x \t 0x%x\n",
3610+ idx, btcr, btdcr, btbcr, brocr, brdcr, brbcr);
3611+ }
3612+
3613+ seq_printf(s, "===Per-BSS Related MIB Counters===\n");
3614+ seq_printf(s, "BSS Idx RTSTx/RetryCnt BAMissCnt AckFailCnt FrmRetry1/2/3Cnt\n");
3615+
3616+ /* Per-BSS TX Status */
3617+ for (idx = 0; idx < bss_nums; idx++) {
3618+ btscr[0] = mt76_rr(dev, BN0_WF_MIB_TOP_BTSCR5_ADDR + band_offset + idx * 4);
3619+ btscr[1] = mt76_rr(dev, BN0_WF_MIB_TOP_BTSCR6_ADDR + band_offset + idx * 4);
3620+ btscr[2] = mt76_rr(dev, BN0_WF_MIB_TOP_BTSCR0_ADDR + band_offset + idx * 4);
3621+ btscr[3] = mt76_rr(dev, BN0_WF_MIB_TOP_BTSCR1_ADDR + band_offset + idx * 4);
3622+ btscr[4] = mt76_rr(dev, BN0_WF_MIB_TOP_BTSCR2_ADDR + band_offset + idx * 4);
3623+ btscr[5] = mt76_rr(dev, BN0_WF_MIB_TOP_BTSCR3_ADDR + band_offset + idx * 4);
3624+ btscr[6] = mt76_rr(dev, BN0_WF_MIB_TOP_BTSCR4_ADDR + band_offset + idx * 4);
3625+
3626+ seq_printf(s, "%d:\t0x%x/0x%x 0x%x \t 0x%x \t 0x%x/0x%x/0x%x\n",
3627+ idx, (btscr[0] & BN0_WF_MIB_TOP_BTSCR5_RTSTXCOUNTn_MASK),
3628+ (btscr[1] & BN0_WF_MIB_TOP_BTSCR6_RTSRETRYCOUNTn_MASK),
3629+ (btscr[2] & BN0_WF_MIB_TOP_BTSCR0_BAMISSCOUNTn_MASK),
3630+ (btscr[3] & BN0_WF_MIB_TOP_BTSCR1_ACKFAILCOUNTn_MASK),
3631+ (btscr[4] & BN0_WF_MIB_TOP_BTSCR2_FRAMERETRYCOUNTn_MASK),
3632+ (btscr[5] & BN0_WF_MIB_TOP_BTSCR3_FRAMERETRY2COUNTn_MASK),
3633+ (btscr[6] & BN0_WF_MIB_TOP_BTSCR4_FRAMERETRY3COUNTn_MASK));
3634+ }
3635+
3636+ /* Dummy delimiter insertion result */
3637+ seq_printf(s, "===Dummy delimiter insertion result===\n");
3638+ tdrcr[0] = mt76_rr(dev, BN0_WF_MIB_TOP_TDRCR0_ADDR + band_offset);
3639+ tdrcr[1] = mt76_rr(dev, BN0_WF_MIB_TOP_TDRCR1_ADDR + band_offset);
3640+ tdrcr[2] = mt76_rr(dev, BN0_WF_MIB_TOP_TDRCR2_ADDR + band_offset);
3641+ tdrcr[3] = mt76_rr(dev, BN0_WF_MIB_TOP_TDRCR3_ADDR + band_offset);
3642+ tdrcr[4] = mt76_rr(dev, BN0_WF_MIB_TOP_TDRCR4_ADDR + band_offset);
3643+
3644+ seq_printf(s, "Range0 = %d\t Range1 = %d\t Range2 = %d\t Range3 = %d\t Range4 = %d\n",
3645+ tdrcr[0],
3646+ tdrcr[1],
3647+ tdrcr[2],
3648+ tdrcr[3],
3649+ tdrcr[4]);
3650+
3651+ /* Per-MBSS T/RX Counters */
3652+ seq_printf(s, "===Per-MBSS Related Tx/Rx Counters===\n");
3653+ seq_printf(s, "MBSSIdx TxOkCnt TxByteCnt RxOkCnt RxByteCnt\n");
3654+
3655+ for (idx = 0; idx < 16; idx++) {
3656+ mbtocr[idx] = mt76_rr(dev, BN0_WF_MIB_TOP_BTOCR_ADDR + band_offset + (bss_nums + idx) * 4);
3657+ mbtbcr[idx] = mt76_rr(dev, BN0_WF_MIB_TOP_BTBCR_ADDR + band_offset + (bss_nums + idx) * 4);
3658+
3659+ mbrocr[idx] = mt76_rr(dev, WF_UMIB_TOP_B0BROCR_ADDR + band_offset_umib + (bss_nums + idx) * 4);
3660+ mbrbcr[idx] = mt76_rr(dev, WF_UMIB_TOP_B0BRBCR_ADDR + band_offset_umib + (bss_nums + idx) * 4);
3661+ }
3662+
3663+ for (idx = 0; idx < 16; idx++) {
3664+ seq_printf(s, "%d\t 0x%x\t 0x%x \t 0x%x \t 0x%x\n",
3665+ idx, mbtocr[idx], mbtbcr[idx], mbrocr[idx], mbrbcr[idx]);
3666+ }
3667+
3668+ return 0;
3669+}
3670+
3671+static int mt7996_mibinfo_band0(struct seq_file *s, void *data)
3672+{
3673+ mt7996_mibinfo_read_per_band(s, MT_BAND0);
3674+ return 0;
3675+}
3676+
3677+static int mt7996_mibinfo_band1(struct seq_file *s, void *data)
3678+{
3679+ mt7996_mibinfo_read_per_band(s, MT_BAND1);
3680+ return 0;
3681+}
3682+
3683+static int mt7996_mibinfo_band2(struct seq_file *s, void *data)
3684+{
3685+ mt7996_mibinfo_read_per_band(s, MT_BAND2);
3686+ return 0;
3687+}
3688+
3689+/* WTBL INFO */
3690+static int
3691+mt7996_wtbl_read_raw(struct mt7996_dev *dev, u16 idx,
3692+ enum mt7996_wtbl_type type, u16 start_dw,
3693+ u16 len, void *buf)
3694+{
3695+ u32 *dest_cpy = (u32 *)buf;
3696+ u32 size_dw = len;
3697+ u32 src = 0;
3698+
3699+ if (!buf)
3700+ return 0xFF;
3701+
3702+ if (type == WTBL_TYPE_LMAC) {
3703+ mt76_wr(dev, MT_DBG_WTBLON_TOP_WDUCR_ADDR,
3704+ FIELD_PREP(MT_DBG_WTBLON_TOP_WDUCR_GROUP, (idx >> 7)));
3705+ src = LWTBL_IDX2BASE(idx, start_dw);
3706+ } else if (type == WTBL_TYPE_UMAC) {
3707+ mt76_wr(dev, MT_DBG_UWTBL_TOP_WDUCR_ADDR,
3708+ FIELD_PREP(MT_DBG_UWTBL_TOP_WDUCR_GROUP, (idx >> 7)));
3709+ src = UWTBL_IDX2BASE(idx, start_dw);
3710+ } else if (type == WTBL_TYPE_KEY) {
3711+ mt76_wr(dev, MT_DBG_UWTBL_TOP_WDUCR_ADDR,
3712+ MT_DBG_UWTBL_TOP_WDUCR_TARGET |
3713+ FIELD_PREP(MT_DBG_UWTBL_TOP_WDUCR_GROUP, (idx >> 7)));
3714+ src = KEYTBL_IDX2BASE(idx, start_dw);
3715+ }
3716+
3717+ while (size_dw--) {
3718+ *dest_cpy++ = mt76_rr(dev, src);
3719+ src += 4;
3720+ };
3721+
3722+ return 0;
3723+}
3724+
3725+#if 0
3726+static int
3727+mt7996_wtbl_write_raw(struct mt7996_dev *dev, u16 idx,
3728+ enum mt7996_wtbl_type type, u16 start_dw,
3729+ u32 val)
3730+{
3731+ u32 addr = 0;
3732+
3733+ if (type == WTBL_TYPE_LMAC) {
3734+ mt76_wr(dev, MT_DBG_WTBLON_TOP_WDUCR_ADDR,
3735+ FIELD_PREP(MT_DBG_WTBLON_TOP_WDUCR_GROUP, (idx >> 7)));
3736+ addr = LWTBL_IDX2BASE(idx, start_dw);
3737+ } else if (type == WTBL_TYPE_UMAC) {
3738+ mt76_wr(dev, MT_DBG_UWTBL_TOP_WDUCR_ADDR,
3739+ FIELD_PREP(MT_DBG_UWTBL_TOP_WDUCR_GROUP, (idx >> 7)));
3740+ addr = UWTBL_IDX2BASE(idx, start_dw);
3741+ } else if (type == WTBL_TYPE_KEY) {
3742+ mt76_wr(dev, MT_DBG_UWTBL_TOP_WDUCR_ADDR,
3743+ MT_DBG_UWTBL_TOP_WDUCR_TARGET |
3744+ FIELD_PREP(MT_DBG_UWTBL_TOP_WDUCR_GROUP, (idx >> 7)));
3745+ addr = KEYTBL_IDX2BASE(idx, start_dw);
3746+ }
3747+
3748+ mt76_wr(dev, addr, val);
3749+
3750+ return 0;
3751+}
3752+#endif
3753+
3754+static const struct berse_wtbl_parse WTBL_LMAC_DW0[] = {
3755+ {"MUAR_IDX", WF_LWTBL_MUAR_MASK, WF_LWTBL_MUAR_SHIFT,false},
3756+ {"RCA1", WF_LWTBL_RCA1_MASK, NO_SHIFT_DEFINE, false},
3757+ {"KID", WF_LWTBL_KID_MASK, WF_LWTBL_KID_SHIFT, false},
3758+ {"RCID", WF_LWTBL_RCID_MASK, NO_SHIFT_DEFINE, false},
3759+ {"BAND", WF_LWTBL_BAND_MASK, WF_LWTBL_BAND_SHIFT,false},
3760+ {"RV", WF_LWTBL_RV_MASK, NO_SHIFT_DEFINE, false},
3761+ {"RCA2", WF_LWTBL_RCA2_MASK, NO_SHIFT_DEFINE, false},
3762+ {"WPI_FLAG", WF_LWTBL_WPI_FLAG_MASK, NO_SHIFT_DEFINE,true},
3763+ {NULL,}
3764+};
3765+
3766+static void parse_fmac_lwtbl_dw0_1(struct seq_file *s, u8 *lwtbl)
3767+{
3768+ u32 *addr = 0;
3769+ u32 dw_value = 0;
3770+ u16 i = 0;
3771+
3772+ seq_printf(s, "\t\n");
3773+ seq_printf(s, "LinkAddr: %02x:%02x:%02x:%02x:%02x:%02x(D0[B0~15], D1[B0~31])\n",
3774+ lwtbl[4], lwtbl[5], lwtbl[6], lwtbl[7], lwtbl[0], lwtbl[1]);
3775+
3776+ /* LMAC WTBL DW 0 */
3777+ seq_printf(s, "\t\n");
3778+ seq_printf(s, "LWTBL DW 0/1\n");
3779+ addr = (u32 *)&(lwtbl[WTBL_GROUP_PEER_INFO_DW_0*4]);
3780+ dw_value = *addr;
3781+
3782+ while (WTBL_LMAC_DW0[i].name) {
3783+
3784+ if (WTBL_LMAC_DW0[i].shift == NO_SHIFT_DEFINE)
3785+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW0[i].name,
3786+ (dw_value & WTBL_LMAC_DW0[i].mask) ? 1 : 0);
3787+ else
3788+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW0[i].name,
3789+ (dw_value & WTBL_LMAC_DW0[i].mask) >> WTBL_LMAC_DW0[i].shift);
3790+ i++;
3791+ }
3792+}
3793+
3794+static const struct berse_wtbl_parse *WTBL_LMAC_DW2;
3795+static const struct berse_wtbl_parse WTBL_LMAC_DW2_7996[] = {
3796+ {"AID", WF_LWTBL_AID_MASK, WF_LWTBL_AID_SHIFT, false},
3797+ {"GID_SU", WF_LWTBL_GID_SU_MASK, NO_SHIFT_DEFINE, false},
3798+ {"SPP_EN", WF_LWTBL_SPP_EN_MASK, NO_SHIFT_DEFINE, false},
3799+ {"WPI_EVEN", WF_LWTBL_WPI_EVEN_MASK, NO_SHIFT_DEFINE, false},
3800+ {"AAD_OM", WF_LWTBL_AAD_OM_MASK, NO_SHIFT_DEFINE, false},
3801+ {"CIPHER_PGTK",WF_LWTBL_CIPHER_SUIT_PGTK_MASK, WF_LWTBL_CIPHER_SUIT_PGTK_SHIFT, true},
3802+ {"FROM_DS", WF_LWTBL_FD_MASK, NO_SHIFT_DEFINE, false},
3803+ {"TO_DS", WF_LWTBL_TD_MASK, NO_SHIFT_DEFINE, false},
3804+ {"SW", WF_LWTBL_SW_MASK, NO_SHIFT_DEFINE, false},
3805+ {"UL", WF_LWTBL_UL_MASK, NO_SHIFT_DEFINE, false},
3806+ {"TX_POWER_SAVE", WF_LWTBL_TX_PS_MASK, NO_SHIFT_DEFINE, true},
3807+ {"QOS", WF_LWTBL_QOS_MASK, NO_SHIFT_DEFINE, false},
3808+ {"HT", WF_LWTBL_HT_MASK, NO_SHIFT_DEFINE, false},
3809+ {"VHT", WF_LWTBL_VHT_MASK, NO_SHIFT_DEFINE, false},
3810+ {"HE", WF_LWTBL_HE_MASK, NO_SHIFT_DEFINE, false},
3811+ {"EHT", WF_LWTBL_EHT_MASK, NO_SHIFT_DEFINE, false},
3812+ {"MESH", WF_LWTBL_MESH_MASK, NO_SHIFT_DEFINE, true},
3813+ {NULL,}
3814+};
3815+
3816+static const struct berse_wtbl_parse WTBL_LMAC_DW2_7992[] = {
3817+ {"AID", WF_LWTBL_AID_MASK, WF_LWTBL_AID_SHIFT, false},
3818+ {"GID_SU", WF_LWTBL_GID_SU_MASK, NO_SHIFT_DEFINE, false},
3819+ {"DUAL_PTEC_EN", WF_LWTBL_DUAL_PTEC_EN_MASK, NO_SHIFT_DEFINE, false},
3820+ {"DUAL_CTS_CAP", WF_LWTBL_DUAL_CTS_CAP_MASK, NO_SHIFT_DEFINE, false},
3821+ {"CIPHER_PGTK",WF_LWTBL_CIPHER_SUIT_PGTK_MASK, WF_LWTBL_CIPHER_SUIT_PGTK_SHIFT, true},
3822+ {"FROM_DS", WF_LWTBL_FD_MASK, NO_SHIFT_DEFINE, false},
3823+ {"TO_DS", WF_LWTBL_TD_MASK, NO_SHIFT_DEFINE, false},
3824+ {"SW", WF_LWTBL_SW_MASK, NO_SHIFT_DEFINE, false},
3825+ {"UL", WF_LWTBL_UL_MASK, NO_SHIFT_DEFINE, false},
3826+ {"TX_POWER_SAVE", WF_LWTBL_TX_PS_MASK, NO_SHIFT_DEFINE, true},
3827+ {"QOS", WF_LWTBL_QOS_MASK, NO_SHIFT_DEFINE, false},
3828+ {"HT", WF_LWTBL_HT_MASK, NO_SHIFT_DEFINE, false},
3829+ {"VHT", WF_LWTBL_VHT_MASK, NO_SHIFT_DEFINE, false},
3830+ {"HE", WF_LWTBL_HE_MASK, NO_SHIFT_DEFINE, false},
3831+ {"EHT", WF_LWTBL_EHT_MASK, NO_SHIFT_DEFINE, false},
3832+ {"MESH", WF_LWTBL_MESH_MASK, NO_SHIFT_DEFINE, true},
3833+ {NULL,}
3834+};
3835+
3836+static void parse_fmac_lwtbl_dw2(struct seq_file *s, u8 *lwtbl)
3837+{
3838+ u32 *addr = 0;
3839+ u32 dw_value = 0;
3840+ u16 i = 0;
3841+
3842+ /* LMAC WTBL DW 2 */
3843+ seq_printf(s, "\t\n");
3844+ seq_printf(s, "LWTBL DW 2\n");
3845+ addr = (u32 *)&(lwtbl[WTBL_GROUP_TRX_CAP_DW_2*4]);
3846+ dw_value = *addr;
3847+
3848+ while (WTBL_LMAC_DW2[i].name) {
3849+
3850+ if (WTBL_LMAC_DW2[i].shift == NO_SHIFT_DEFINE)
3851+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW2[i].name,
3852+ (dw_value & WTBL_LMAC_DW2[i].mask) ? 1 : 0);
3853+ else
3854+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW2[i].name,
3855+ (dw_value & WTBL_LMAC_DW2[i].mask) >> WTBL_LMAC_DW2[i].shift);
3856+ i++;
3857+ }
3858+}
3859+
3860+static const struct berse_wtbl_parse WTBL_LMAC_DW3[] = {
3861+ {"WMM_Q", WF_LWTBL_WMM_Q_MASK, WF_LWTBL_WMM_Q_SHIFT, false},
3862+ {"EHT_SIG_MCS", WF_LWTBL_EHT_SIG_MCS_MASK, WF_LWTBL_EHT_SIG_MCS_SHIFT, false},
3863+ {"HDRT_MODE", WF_LWTBL_HDRT_MODE_MASK, NO_SHIFT_DEFINE, false},
3864+ {"BEAM_CHG", WF_LWTBL_BEAM_CHG_MASK, NO_SHIFT_DEFINE, false},
3865+ {"EHT_LTF_SYM_NUM", WF_LWTBL_EHT_LTF_SYM_NUM_OPT_MASK, WF_LWTBL_EHT_LTF_SYM_NUM_OPT_SHIFT, true},
3866+ {"PFMU_IDX", WF_LWTBL_PFMU_IDX_MASK, WF_LWTBL_PFMU_IDX_SHIFT, false},
3867+ {"ULPF_IDX", WF_LWTBL_ULPF_IDX_MASK, WF_LWTBL_ULPF_IDX_SHIFT, false},
3868+ {"RIBF", WF_LWTBL_RIBF_MASK, NO_SHIFT_DEFINE, false},
3869+ {"ULPF", WF_LWTBL_ULPF_MASK, NO_SHIFT_DEFINE, false},
3870+ {"BYPASS_TXSMM", WF_LWTBL_BYPASS_TXSMM_MASK, NO_SHIFT_DEFINE, true},
3871+ {"TBF_HT", WF_LWTBL_TBF_HT_MASK, NO_SHIFT_DEFINE, false},
3872+ {"TBF_VHT", WF_LWTBL_TBF_VHT_MASK, NO_SHIFT_DEFINE, false},
3873+ {"TBF_HE", WF_LWTBL_TBF_HE_MASK, NO_SHIFT_DEFINE, false},
3874+ {"TBF_EHT", WF_LWTBL_TBF_EHT_MASK, NO_SHIFT_DEFINE, false},
3875+ {"IGN_FBK", WF_LWTBL_IGN_FBK_MASK, NO_SHIFT_DEFINE, true},
3876+ {NULL,}
3877+};
3878+
3879+static void parse_fmac_lwtbl_dw3(struct seq_file *s, u8 *lwtbl)
3880+{
3881+ u32 *addr = 0;
3882+ u32 dw_value = 0;
3883+ u16 i = 0;
3884+
3885+ /* LMAC WTBL DW 3 */
3886+ seq_printf(s, "\t\n");
3887+ seq_printf(s, "LWTBL DW 3\n");
3888+ addr = (u32 *)&(lwtbl[WTBL_GROUP_TRX_CAP_DW_3*4]);
3889+ dw_value = *addr;
3890+
3891+ while (WTBL_LMAC_DW3[i].name) {
3892+
3893+ if (WTBL_LMAC_DW3[i].shift == NO_SHIFT_DEFINE)
3894+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW3[i].name,
3895+ (dw_value & WTBL_LMAC_DW3[i].mask) ? 1 : 0);
3896+ else
3897+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW3[i].name,
3898+ (dw_value & WTBL_LMAC_DW3[i].mask) >> WTBL_LMAC_DW3[i].shift);
3899+ i++;
3900+ }
3901+}
3902+
3903+static const struct berse_wtbl_parse WTBL_LMAC_DW4[] = {
3904+ {"NEGOTIATED_WINSIZE0", WF_LWTBL_NEGOTIATED_WINSIZE0_MASK, WF_LWTBL_NEGOTIATED_WINSIZE0_SHIFT, false},
3905+ {"WINSIZE1", WF_LWTBL_NEGOTIATED_WINSIZE1_MASK, WF_LWTBL_NEGOTIATED_WINSIZE1_SHIFT, false},
3906+ {"WINSIZE2", WF_LWTBL_NEGOTIATED_WINSIZE2_MASK, WF_LWTBL_NEGOTIATED_WINSIZE2_SHIFT, false},
3907+ {"WINSIZE3", WF_LWTBL_NEGOTIATED_WINSIZE3_MASK, WF_LWTBL_NEGOTIATED_WINSIZE3_SHIFT, true},
3908+ {"WINSIZE4", WF_LWTBL_NEGOTIATED_WINSIZE4_MASK, WF_LWTBL_NEGOTIATED_WINSIZE4_SHIFT, false},
3909+ {"WINSIZE5", WF_LWTBL_NEGOTIATED_WINSIZE5_MASK, WF_LWTBL_NEGOTIATED_WINSIZE5_SHIFT, false},
3910+ {"WINSIZE6", WF_LWTBL_NEGOTIATED_WINSIZE6_MASK, WF_LWTBL_NEGOTIATED_WINSIZE6_SHIFT, false},
3911+ {"WINSIZE7", WF_LWTBL_NEGOTIATED_WINSIZE7_MASK, WF_LWTBL_NEGOTIATED_WINSIZE7_SHIFT, true},
3912+ {"PE", WF_LWTBL_PE_MASK, WF_LWTBL_PE_SHIFT, false},
3913+ {"DIS_RHTR", WF_LWTBL_DIS_RHTR_MASK, NO_SHIFT_DEFINE, false},
3914+ {"LDPC_HT", WF_LWTBL_LDPC_HT_MASK, NO_SHIFT_DEFINE, false},
3915+ {"LDPC_VHT", WF_LWTBL_LDPC_VHT_MASK, NO_SHIFT_DEFINE, false},
3916+ {"LDPC_HE", WF_LWTBL_LDPC_HE_MASK, NO_SHIFT_DEFINE, false},
3917+ {"LDPC_EHT", WF_LWTBL_LDPC_EHT_MASK, NO_SHIFT_DEFINE, true},
3918+ {"BA_MODE", WF_LWTBL_BA_MODE_MASK, NO_SHIFT_DEFINE, true},
3919+ {NULL,}
3920+};
3921+
3922+static void parse_fmac_lwtbl_dw4(struct seq_file *s, u8 *lwtbl)
3923+{
3924+ u32 *addr = 0;
3925+ u32 dw_value = 0;
3926+ u16 i = 0;
3927+
3928+ /* LMAC WTBL DW 4 */
3929+ seq_printf(s, "\t\n");
3930+ seq_printf(s, "LWTBL DW 4\n");
3931+ addr = (u32 *)&(lwtbl[WTBL_GROUP_TRX_CAP_DW_4*4]);
3932+ dw_value = *addr;
3933+
3934+ while (WTBL_LMAC_DW4[i].name) {
3935+ if (WTBL_LMAC_DW4[i].shift == NO_SHIFT_DEFINE)
3936+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW4[i].name,
3937+ (dw_value & WTBL_LMAC_DW4[i].mask) ? 1 : 0);
3938+ else
3939+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW4[i].name,
3940+ (dw_value & WTBL_LMAC_DW4[i].mask) >> WTBL_LMAC_DW4[i].shift);
3941+ i++;
3942+ }
3943+}
3944+
3945+static const struct berse_wtbl_parse *WTBL_LMAC_DW5;
3946+static const struct berse_wtbl_parse WTBL_LMAC_DW5_7996[] = {
3947+ {"AF", WF_LWTBL_AF_MASK, WF_LWTBL_AF_SHIFT, false},
3948+ {"AF_HE", WF_LWTBL_AF_HE_MASK, WF_LWTBL_AF_HE_SHIFT,false},
3949+ {"RTS", WF_LWTBL_RTS_MASK, NO_SHIFT_DEFINE, false},
3950+ {"SMPS", WF_LWTBL_SMPS_MASK, NO_SHIFT_DEFINE, false},
3951+ {"DYN_BW", WF_LWTBL_DYN_BW_MASK, NO_SHIFT_DEFINE, true},
3952+ {"MMSS", WF_LWTBL_MMSS_MASK, WF_LWTBL_MMSS_SHIFT,false},
3953+ {"USR", WF_LWTBL_USR_MASK, NO_SHIFT_DEFINE, false},
3954+ {"SR_RATE", WF_LWTBL_SR_R_MASK, WF_LWTBL_SR_R_SHIFT,false},
3955+ {"SR_ABORT", WF_LWTBL_SR_ABORT_MASK, NO_SHIFT_DEFINE, true},
3956+ {"TX_POWER_OFFSET", WF_LWTBL_TX_POWER_OFFSET_MASK, WF_LWTBL_TX_POWER_OFFSET_SHIFT, false},
3957+ {"LTF_EHT", WF_LWTBL_LTF_EHT_MASK, WF_LWTBL_LTF_EHT_SHIFT, false},
3958+ {"GI_EHT", WF_LWTBL_GI_EHT_MASK, WF_LWTBL_GI_EHT_SHIFT, false},
3959+ {"DOPPL", WF_LWTBL_DOPPL_MASK, NO_SHIFT_DEFINE, false},
3960+ {"TXOP_PS_CAP", WF_LWTBL_TXOP_PS_CAP_MASK, NO_SHIFT_DEFINE, false},
3961+ {"DONOT_UPDATE_I_PSM", WF_LWTBL_DU_I_PSM_MASK, NO_SHIFT_DEFINE, true},
3962+ {"I_PSM", WF_LWTBL_I_PSM_MASK, NO_SHIFT_DEFINE, false},
3963+ {"PSM", WF_LWTBL_PSM_MASK, NO_SHIFT_DEFINE, false},
3964+ {"SKIP_TX", WF_LWTBL_SKIP_TX_MASK, NO_SHIFT_DEFINE, true},
3965+ {NULL,}
3966+};
3967+
3968+static const struct berse_wtbl_parse WTBL_LMAC_DW5_7992[] = {
3969+ {"AF", WF_LWTBL_AF_MASK_7992, WF_LWTBL_AF_SHIFT, false},
3970+ {"RTS", WF_LWTBL_RTS_MASK, NO_SHIFT_DEFINE, false},
3971+ {"SMPS", WF_LWTBL_SMPS_MASK, NO_SHIFT_DEFINE, false},
3972+ {"DYN_BW", WF_LWTBL_DYN_BW_MASK, NO_SHIFT_DEFINE, true},
3973+ {"MMSS", WF_LWTBL_MMSS_MASK, WF_LWTBL_MMSS_SHIFT,false},
3974+ {"USR", WF_LWTBL_USR_MASK, NO_SHIFT_DEFINE, false},
3975+ {"SR_RATE", WF_LWTBL_SR_R_MASK, WF_LWTBL_SR_R_SHIFT,false},
3976+ {"SR_ABORT", WF_LWTBL_SR_ABORT_MASK, NO_SHIFT_DEFINE, true},
3977+ {"TX_POWER_OFFSET", WF_LWTBL_TX_POWER_OFFSET_MASK, WF_LWTBL_TX_POWER_OFFSET_SHIFT, false},
3978+ {"LTF_EHT", WF_LWTBL_LTF_EHT_MASK, WF_LWTBL_LTF_EHT_SHIFT, false},
3979+ {"GI_EHT", WF_LWTBL_GI_EHT_MASK, WF_LWTBL_GI_EHT_SHIFT, false},
3980+ {"DOPPL", WF_LWTBL_DOPPL_MASK, NO_SHIFT_DEFINE, false},
3981+ {"TXOP_PS_CAP", WF_LWTBL_TXOP_PS_CAP_MASK, NO_SHIFT_DEFINE, false},
3982+ {"DONOT_UPDATE_I_PSM", WF_LWTBL_DU_I_PSM_MASK, NO_SHIFT_DEFINE, true},
3983+ {"I_PSM", WF_LWTBL_I_PSM_MASK, NO_SHIFT_DEFINE, false},
3984+ {"PSM", WF_LWTBL_PSM_MASK, NO_SHIFT_DEFINE, false},
3985+ {"SKIP_TX", WF_LWTBL_SKIP_TX_MASK, NO_SHIFT_DEFINE, true},
3986+ {NULL,}
3987+};
3988+
3989+static void parse_fmac_lwtbl_dw5(struct seq_file *s, u8 *lwtbl)
3990+{
3991+ u32 *addr = 0;
3992+ u32 dw_value = 0;
3993+ u16 i = 0;
3994+
3995+ /* LMAC WTBL DW 5 */
3996+ seq_printf(s, "\t\n");
3997+ seq_printf(s, "LWTBL DW 5\n");
3998+ addr = (u32 *)&(lwtbl[WTBL_GROUP_TRX_CAP_DW_5*4]);
3999+ dw_value = *addr;
4000+
4001+ while (WTBL_LMAC_DW5[i].name) {
4002+ if (WTBL_LMAC_DW5[i].shift == NO_SHIFT_DEFINE)
4003+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW5[i].name,
4004+ (dw_value & WTBL_LMAC_DW5[i].mask) ? 1 : 0);
4005+ else
4006+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW5[i].name,
4007+ (dw_value & WTBL_LMAC_DW5[i].mask) >> WTBL_LMAC_DW5[i].shift);
4008+ i++;
4009+ }
4010+}
4011+
4012+static const struct berse_wtbl_parse WTBL_LMAC_DW6[] = {
4013+ {"CBRN", WF_LWTBL_CBRN_MASK, WF_LWTBL_CBRN_SHIFT, false},
4014+ {"DBNSS_EN", WF_LWTBL_DBNSS_EN_MASK, NO_SHIFT_DEFINE, false},
4015+ {"BAF_EN", WF_LWTBL_BAF_EN_MASK, NO_SHIFT_DEFINE, false},
4016+ {"RDGBA", WF_LWTBL_RDGBA_MASK, NO_SHIFT_DEFINE, false},
4017+ {"RDG", WF_LWTBL_R_MASK, NO_SHIFT_DEFINE, false},
4018+ {"SPE_IDX", WF_LWTBL_SPE_IDX_MASK, WF_LWTBL_SPE_IDX_SHIFT, true},
4019+ {"G2", WF_LWTBL_G2_MASK, NO_SHIFT_DEFINE, false},
4020+ {"G4", WF_LWTBL_G4_MASK, NO_SHIFT_DEFINE, false},
4021+ {"G8", WF_LWTBL_G8_MASK, NO_SHIFT_DEFINE, false},
4022+ {"G16", WF_LWTBL_G16_MASK, NO_SHIFT_DEFINE, true},
4023+ {"G2_LTF", WF_LWTBL_G2_LTF_MASK, WF_LWTBL_G2_LTF_SHIFT, false},
4024+ {"G4_LTF", WF_LWTBL_G4_LTF_MASK, WF_LWTBL_G4_LTF_SHIFT, false},
4025+ {"G8_LTF", WF_LWTBL_G8_LTF_MASK, WF_LWTBL_G8_LTF_SHIFT, false},
4026+ {"G16_LTF", WF_LWTBL_G16_LTF_MASK, WF_LWTBL_G16_LTF_SHIFT, true},
4027+ {"G2_HE", WF_LWTBL_G2_HE_MASK, WF_LWTBL_G2_HE_SHIFT, false},
4028+ {"G4_HE", WF_LWTBL_G4_HE_MASK, WF_LWTBL_G4_HE_SHIFT, false},
4029+ {"G8_HE", WF_LWTBL_G8_HE_MASK, WF_LWTBL_G8_HE_SHIFT, false},
4030+ {"G16_HE", WF_LWTBL_G16_HE_MASK, WF_LWTBL_G16_HE_SHIFT, true},
4031+ {NULL,}
4032+};
4033+
4034+static void parse_fmac_lwtbl_dw6(struct seq_file *s, u8 *lwtbl)
4035+{
4036+ u32 *addr = 0;
4037+ u32 dw_value = 0;
4038+ u16 i = 0;
4039+
4040+ /* LMAC WTBL DW 6 */
4041+ seq_printf(s, "\t\n");
4042+ seq_printf(s, "LWTBL DW 6\n");
4043+ addr = (u32 *)&(lwtbl[WTBL_GROUP_TRX_CAP_DW_6*4]);
4044+ dw_value = *addr;
4045+
4046+ while (WTBL_LMAC_DW6[i].name) {
4047+ if (WTBL_LMAC_DW6[i].shift == NO_SHIFT_DEFINE)
4048+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW6[i].name,
4049+ (dw_value & WTBL_LMAC_DW6[i].mask) ? 1 : 0);
4050+ else
4051+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW6[i].name,
4052+ (dw_value & WTBL_LMAC_DW6[i].mask) >> WTBL_LMAC_DW6[i].shift);
4053+ i++;
4054+ }
4055+}
4056+
4057+static void parse_fmac_lwtbl_dw7(struct seq_file *s, u8 *lwtbl)
4058+{
4059+ u32 *addr = 0;
4060+ u32 dw_value = 0;
4061+ int i = 0;
4062+
4063+ /* LMAC WTBL DW 7 */
4064+ seq_printf(s, "\t\n");
4065+ seq_printf(s, "LWTBL DW 7\n");
4066+ addr = (u32 *)&(lwtbl[WTBL_GROUP_TRX_CAP_DW_7*4]);
4067+ dw_value = *addr;
4068+
4069+ for (i = 0; i < 8; i++) {
4070+ seq_printf(s, "\tBA_WIN_SIZE%u:%lu\n", i, ((dw_value & BITS(i*4, i*4+3)) >> i*4));
4071+ }
4072+}
4073+
4074+static const struct berse_wtbl_parse WTBL_LMAC_DW8[] = {
4075+ {"RTS_FAIL_CNT_AC0", WF_LWTBL_AC0_RTS_FAIL_CNT_MASK, WF_LWTBL_AC0_RTS_FAIL_CNT_SHIFT, false},
4076+ {"AC1", WF_LWTBL_AC1_RTS_FAIL_CNT_MASK, WF_LWTBL_AC1_RTS_FAIL_CNT_SHIFT, false},
4077+ {"AC2", WF_LWTBL_AC2_RTS_FAIL_CNT_MASK, WF_LWTBL_AC2_RTS_FAIL_CNT_SHIFT, false},
4078+ {"AC3", WF_LWTBL_AC3_RTS_FAIL_CNT_MASK, WF_LWTBL_AC3_RTS_FAIL_CNT_SHIFT, true},
4079+ {"PARTIAL_AID", WF_LWTBL_PARTIAL_AID_MASK, WF_LWTBL_PARTIAL_AID_SHIFT, false},
4080+ {"CHK_PER", WF_LWTBL_CHK_PER_MASK, NO_SHIFT_DEFINE, true},
4081+ {NULL,}
4082+};
4083+
4084+static void parse_fmac_lwtbl_dw8(struct seq_file *s, u8 *lwtbl)
4085+{
4086+ u32 *addr = 0;
4087+ u32 dw_value = 0;
4088+ u16 i = 0;
4089+
4090+ /* LMAC WTBL DW 8 */
4091+ seq_printf(s, "\t\n");
4092+ seq_printf(s, "LWTBL DW 8\n");
4093+ addr = (u32 *)&(lwtbl[WTBL_GROUP_TRX_CAP_DW_8*4]);
4094+ dw_value = *addr;
4095+
4096+ while (WTBL_LMAC_DW8[i].name) {
4097+ if (WTBL_LMAC_DW8[i].shift == NO_SHIFT_DEFINE)
4098+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW8[i].name,
4099+ (dw_value & WTBL_LMAC_DW8[i].mask) ? 1 : 0);
4100+ else
4101+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW8[i].name,
4102+ (dw_value & WTBL_LMAC_DW8[i].mask) >> WTBL_LMAC_DW8[i].shift);
4103+ i++;
4104+ }
4105+}
4106+
4107+static const struct berse_wtbl_parse *WTBL_LMAC_DW9;
4108+static const struct berse_wtbl_parse WTBL_LMAC_DW9_7996[] = {
4109+ {"RX_AVG_MPDU_SIZE", WF_LWTBL_RX_AVG_MPDU_SIZE_MASK, WF_LWTBL_RX_AVG_MPDU_SIZE_SHIFT, false},
4110+ {"PRITX_SW_MODE", WF_LWTBL_PRITX_SW_MODE_MASK, NO_SHIFT_DEFINE, false},
4111+ {"PRITX_ERSU", WF_LWTBL_PRITX_ERSU_MASK, NO_SHIFT_DEFINE, false},
4112+ {"PRITX_PLR", WF_LWTBL_PRITX_PLR_MASK, NO_SHIFT_DEFINE, true},
4113+ {"PRITX_DCM", WF_LWTBL_PRITX_DCM_MASK, NO_SHIFT_DEFINE, false},
4114+ {"PRITX_ER106T", WF_LWTBL_PRITX_ER106T_MASK, NO_SHIFT_DEFINE, true},
4115+ /* {"FCAP(0:20 1:~40)", WTBL_FCAP_20_TO_160_MHZ, WTBL_FCAP_20_TO_160_MHZ_OFFSET}, */
4116+ {"MPDU_FAIL_CNT", WF_LWTBL_MPDU_FAIL_CNT_MASK, WF_LWTBL_MPDU_FAIL_CNT_SHIFT, false},
4117+ {"MPDU_OK_CNT", WF_LWTBL_MPDU_OK_CNT_MASK, WF_LWTBL_MPDU_OK_CNT_SHIFT, false},
4118+ {"RATE_IDX", WF_LWTBL_RATE_IDX_MASK, WF_LWTBL_RATE_IDX_SHIFT, true},
4119+ {NULL,}
4120+};
4121+
4122+static const struct berse_wtbl_parse WTBL_LMAC_DW9_7992[] = {
4123+ {"RX_AVG_MPDU_SIZE", WF_LWTBL_RX_AVG_MPDU_SIZE_MASK, WF_LWTBL_RX_AVG_MPDU_SIZE_SHIFT, false},
4124+ {"PRITX_SW_MODE", WF_LWTBL_PRITX_SW_MODE_MASK_7992, NO_SHIFT_DEFINE, false},
4125+ {"PRITX_ERSU", WF_LWTBL_PRITX_ERSU_MASK_7992, NO_SHIFT_DEFINE, false},
4126+ {"PRITX_PLR", WF_LWTBL_PRITX_PLR_MASK_7992, NO_SHIFT_DEFINE, true},
4127+ {"PRITX_DCM", WF_LWTBL_PRITX_DCM_MASK, NO_SHIFT_DEFINE, false},
4128+ {"PRITX_ER106T", WF_LWTBL_PRITX_ER106T_MASK, NO_SHIFT_DEFINE, true},
4129+ /* {"FCAP(0:20 1:~40)", WTBL_FCAP_20_TO_160_MHZ, WTBL_FCAP_20_TO_160_MHZ_OFFSET}, */
4130+ {"MPDU_FAIL_CNT", WF_LWTBL_MPDU_FAIL_CNT_MASK, WF_LWTBL_MPDU_FAIL_CNT_SHIFT, false},
4131+ {"MPDU_OK_CNT", WF_LWTBL_MPDU_OK_CNT_MASK, WF_LWTBL_MPDU_OK_CNT_SHIFT, false},
4132+ {"RATE_IDX", WF_LWTBL_RATE_IDX_MASK, WF_LWTBL_RATE_IDX_SHIFT, true},
4133+ {NULL,}
4134+};
4135+
4136+char *fcap_name[] = {"20MHz", "20/40MHz", "20/40/80MHz", "20/40/80/160/80+80MHz", "20/40/80/160/80+80/320MHz"};
4137+
4138+static void parse_fmac_lwtbl_dw9(struct seq_file *s, u8 *lwtbl)
4139+{
4140+ u32 *addr = 0;
4141+ u32 dw_value = 0;
4142+ u16 i = 0;
4143+
4144+ /* LMAC WTBL DW 9 */
4145+ seq_printf(s, "\t\n");
4146+ seq_printf(s, "LWTBL DW 9\n");
4147+ addr = (u32 *)&(lwtbl[WTBL_GROUP_TRX_CAP_DW_9*4]);
4148+ dw_value = *addr;
4149+
4150+ while (WTBL_LMAC_DW9[i].name) {
4151+ if (WTBL_LMAC_DW9[i].shift == NO_SHIFT_DEFINE)
4152+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW9[i].name,
4153+ (dw_value & WTBL_LMAC_DW9[i].mask) ? 1 : 0);
4154+ else
4155+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW9[i].name,
4156+ (dw_value & WTBL_LMAC_DW9[i].mask) >> WTBL_LMAC_DW9[i].shift);
4157+ i++;
4158+ }
4159+
4160+ /* FCAP parser */
4161+ seq_printf(s, "\t\n");
4162+ seq_printf(s, "FCAP:%s\n", fcap_name[(dw_value & WF_LWTBL_FCAP_MASK) >> WF_LWTBL_FCAP_SHIFT]);
4163+}
4164+
4165+#define HW_TX_RATE_TO_MODE(_x) (((_x) & WTBL_RATE_TX_MODE_MASK) >> WTBL_RATE_TX_MODE_OFFSET)
4166+#define HW_TX_RATE_TO_MCS(_x, _mode) ((_x) & WTBL_RATE_TX_RATE_MASK >> WTBL_RATE_TX_RATE_OFFSET)
4167+#define HW_TX_RATE_TO_NSS(_x) (((_x) & WTBL_RATE_NSTS_MASK) >> WTBL_RATE_NSTS_OFFSET)
4168+#define HW_TX_RATE_TO_STBC(_x) (((_x) & WTBL_RATE_STBC_MASK) >> WTBL_RATE_STBC_OFFSET)
4169+
4170+#define MAX_TX_MODE 16
4171+static char *HW_TX_MODE_STR[] = {"CCK", "OFDM", "HT-Mix", "HT-GF", "VHT",
4172+ "N/A", "N/A", "N/A",
4173+ "HE_SU", "HE_EXT_SU", "HE_TRIG", "HE_MU",
4174+ "N/A",
4175+ "EHT_EXT_SU", "EHT_TRIG", "EHT_MU",
4176+ "N/A"};
4177+static char *HW_TX_RATE_CCK_STR[] = {"1M", "2Mlong", "5.5Mlong", "11Mlong", "N/A", "2Mshort", "5.5Mshort", "11Mshort", "N/A"};
4178+static char *HW_TX_RATE_OFDM_STR[] = {"6M", "9M", "12M", "18M", "24M", "36M", "48M", "54M", "N/A"};
4179+
4180+static char *hw_rate_ofdm_str(uint16_t ofdm_idx)
4181+{
4182+ switch (ofdm_idx) {
4183+ case 11: /* 6M */
4184+ return HW_TX_RATE_OFDM_STR[0];
4185+
4186+ case 15: /* 9M */
4187+ return HW_TX_RATE_OFDM_STR[1];
4188+
4189+ case 10: /* 12M */
4190+ return HW_TX_RATE_OFDM_STR[2];
4191+
4192+ case 14: /* 18M */
4193+ return HW_TX_RATE_OFDM_STR[3];
4194+
4195+ case 9: /* 24M */
4196+ return HW_TX_RATE_OFDM_STR[4];
4197+
4198+ case 13: /* 36M */
4199+ return HW_TX_RATE_OFDM_STR[5];
4200+
4201+ case 8: /* 48M */
4202+ return HW_TX_RATE_OFDM_STR[6];
4203+
4204+ case 12: /* 54M */
4205+ return HW_TX_RATE_OFDM_STR[7];
4206+
4207+ default:
4208+ return HW_TX_RATE_OFDM_STR[8];
4209+ }
4210+}
4211+
4212+static char *hw_rate_str(u8 mode, uint16_t rate_idx)
4213+{
4214+ if (mode == 0)
4215+ return rate_idx < 8 ? HW_TX_RATE_CCK_STR[rate_idx] : HW_TX_RATE_CCK_STR[8];
4216+ else if (mode == 1)
4217+ return hw_rate_ofdm_str(rate_idx);
4218+ else
4219+ return "MCS";
4220+}
4221+
4222+static void
4223+parse_rate(struct seq_file *s, uint16_t rate_idx, uint16_t txrate)
4224+{
4225+ uint16_t txmode, mcs, nss, stbc;
4226+
4227+ txmode = HW_TX_RATE_TO_MODE(txrate);
4228+ mcs = HW_TX_RATE_TO_MCS(txrate, txmode);
4229+ nss = HW_TX_RATE_TO_NSS(txrate);
4230+ stbc = HW_TX_RATE_TO_STBC(txrate);
4231+
4232+ seq_printf(s, "\tRate%d(0x%x):TxMode=%d(%s), TxRate=%d(%s), Nsts=%d, STBC=%d\n",
4233+ rate_idx + 1, txrate,
4234+ txmode, (txmode < MAX_TX_MODE ? HW_TX_MODE_STR[txmode] : HW_TX_MODE_STR[MAX_TX_MODE]),
4235+ mcs, hw_rate_str(txmode, mcs), nss, stbc);
4236+}
4237+
4238+
4239+static const struct berse_wtbl_parse WTBL_LMAC_DW10[] = {
4240+ {"RATE1", WF_LWTBL_RATE1_MASK, WF_LWTBL_RATE1_SHIFT},
4241+ {"RATE2", WF_LWTBL_RATE2_MASK, WF_LWTBL_RATE2_SHIFT},
4242+ {NULL,}
4243+};
4244+
4245+static void parse_fmac_lwtbl_dw10(struct seq_file *s, u8 *lwtbl)
4246+{
4247+ u32 *addr = 0;
4248+ u32 dw_value = 0;
4249+ u16 i = 0;
4250+
4251+ /* LMAC WTBL DW 10 */
4252+ seq_printf(s, "\t\n");
4253+ seq_printf(s, "LWTBL DW 10\n");
4254+ addr = (u32 *)&(lwtbl[WTBL_GROUP_AUTO_RATE_1_2*4]);
4255+ dw_value = *addr;
4256+
4257+ while (WTBL_LMAC_DW10[i].name) {
4258+ parse_rate(s, i, (dw_value & WTBL_LMAC_DW10[i].mask) >> WTBL_LMAC_DW10[i].shift);
4259+ i++;
4260+ }
4261+}
4262+
4263+static const struct berse_wtbl_parse WTBL_LMAC_DW11[] = {
4264+ {"RATE3", WF_LWTBL_RATE3_MASK, WF_LWTBL_RATE3_SHIFT},
4265+ {"RATE4", WF_LWTBL_RATE4_MASK, WF_LWTBL_RATE4_SHIFT},
4266+ {NULL,}
4267+};
4268+
4269+static void parse_fmac_lwtbl_dw11(struct seq_file *s, u8 *lwtbl)
4270+{
4271+ u32 *addr = 0;
4272+ u32 dw_value = 0;
4273+ u16 i = 0;
4274+
4275+ /* LMAC WTBL DW 11 */
4276+ seq_printf(s, "\t\n");
4277+ seq_printf(s, "LWTBL DW 11\n");
4278+ addr = (u32 *)&(lwtbl[WTBL_GROUP_AUTO_RATE_3_4*4]);
4279+ dw_value = *addr;
4280+
4281+ while (WTBL_LMAC_DW11[i].name) {
4282+ parse_rate(s, i+2, (dw_value & WTBL_LMAC_DW11[i].mask) >> WTBL_LMAC_DW11[i].shift);
4283+ i++;
4284+ }
4285+}
4286+
4287+static const struct berse_wtbl_parse WTBL_LMAC_DW12[] = {
4288+ {"RATE5", WF_LWTBL_RATE5_MASK, WF_LWTBL_RATE5_SHIFT},
4289+ {"RATE6", WF_LWTBL_RATE6_MASK, WF_LWTBL_RATE6_SHIFT},
4290+ {NULL,}
4291+};
4292+
4293+static void parse_fmac_lwtbl_dw12(struct seq_file *s, u8 *lwtbl)
4294+{
4295+ u32 *addr = 0;
4296+ u32 dw_value = 0;
4297+ u16 i = 0;
4298+
4299+ /* LMAC WTBL DW 12 */
4300+ seq_printf(s, "\t\n");
4301+ seq_printf(s, "LWTBL DW 12\n");
4302+ addr = (u32 *)&(lwtbl[WTBL_GROUP_AUTO_RATE_5_6*4]);
4303+ dw_value = *addr;
4304+
4305+ while (WTBL_LMAC_DW12[i].name) {
4306+ parse_rate(s, i+4, (dw_value & WTBL_LMAC_DW12[i].mask) >> WTBL_LMAC_DW12[i].shift);
4307+ i++;
4308+ }
4309+}
4310+
4311+static const struct berse_wtbl_parse WTBL_LMAC_DW13[] = {
4312+ {"RATE7", WF_LWTBL_RATE7_MASK, WF_LWTBL_RATE7_SHIFT},
4313+ {"RATE8", WF_LWTBL_RATE8_MASK, WF_LWTBL_RATE8_SHIFT},
4314+ {NULL,}
4315+};
4316+
4317+static void parse_fmac_lwtbl_dw13(struct seq_file *s, u8 *lwtbl)
4318+{
4319+ u32 *addr = 0;
4320+ u32 dw_value = 0;
4321+ u16 i = 0;
4322+
4323+ /* LMAC WTBL DW 13 */
4324+ seq_printf(s, "\t\n");
4325+ seq_printf(s, "LWTBL DW 13\n");
4326+ addr = (u32 *)&(lwtbl[WTBL_GROUP_AUTO_RATE_7_8*4]);
4327+ dw_value = *addr;
4328+
4329+ while (WTBL_LMAC_DW13[i].name) {
4330+ parse_rate(s, i+6, (dw_value & WTBL_LMAC_DW13[i].mask) >> WTBL_LMAC_DW13[i].shift);
4331+ i++;
4332+ }
4333+}
4334+
4335+static const struct berse_wtbl_parse WTBL_LMAC_DW14_BMC[] = {
4336+ {"CIPHER_IGTK", WF_LWTBL_CIPHER_SUIT_IGTK_MASK, WF_LWTBL_CIPHER_SUIT_IGTK_SHIFT, false},
4337+ {"CIPHER_BIGTK", WF_LWTBL_CIPHER_SUIT_BIGTK_MASK, WF_LWTBL_CIPHER_SUIT_BIGTK_SHIFT, true},
4338+ {NULL,}
4339+};
4340+
4341+static const struct berse_wtbl_parse WTBL_LMAC_DW14[] = {
4342+ {"RATE1_TX_CNT", WF_LWTBL_RATE1_TX_CNT_MASK, WF_LWTBL_RATE1_TX_CNT_SHIFT, false},
4343+ {"RATE1_FAIL_CNT", WF_LWTBL_RATE1_FAIL_CNT_MASK, WF_LWTBL_RATE1_FAIL_CNT_SHIFT, true},
4344+ {NULL,}
4345+};
4346+
4347+static void parse_fmac_lwtbl_dw14(struct seq_file *s, u8 *lwtbl)
4348+{
4349+ u32 *addr, *muar_addr = 0;
4350+ u32 dw_value, muar_dw_value = 0;
4351+ u16 i = 0;
4352+
4353+ /* DUMP DW14 for BMC entry only */
4354+ muar_addr = (u32 *)&(lwtbl[WF_LWTBL_MUAR_DW*4]);
4355+ muar_dw_value = *muar_addr;
4356+ if (((muar_dw_value & WF_LWTBL_MUAR_MASK) >> WF_LWTBL_MUAR_SHIFT)
4357+ == MUAR_INDEX_OWN_MAC_ADDR_BC_MC) {
4358+ /* LMAC WTBL DW 14 */
4359+ seq_printf(s, "\t\n");
4360+ seq_printf(s, "LWTBL DW 14\n");
4361+ addr = (u32 *)&(lwtbl[WF_LWTBL_CIPHER_SUIT_IGTK_DW*4]);
4362+ dw_value = *addr;
4363+
4364+ while (WTBL_LMAC_DW14_BMC[i].name) {
4365+ if (WTBL_LMAC_DW14_BMC[i].shift == NO_SHIFT_DEFINE)
4366+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW14_BMC[i].name,
4367+ (dw_value & WTBL_LMAC_DW14_BMC[i].mask) ? 1 : 0);
4368+ else
4369+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW14_BMC[i].name,
4370+ (dw_value & WTBL_LMAC_DW14_BMC[i].mask) >> WTBL_LMAC_DW14_BMC[i].shift);
4371+ i++;
4372+ }
4373+ } else {
4374+ seq_printf(s, "\t\n");
4375+ seq_printf(s, "LWTBL DW 14\n");
4376+ addr = (u32 *)&(lwtbl[WF_LWTBL_CIPHER_SUIT_IGTK_DW*4]);
4377+ dw_value = *addr;
4378+
4379+ while (WTBL_LMAC_DW14[i].name) {
4380+ if (WTBL_LMAC_DW14[i].shift == NO_SHIFT_DEFINE)
4381+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW14[i].name,
4382+ (dw_value & WTBL_LMAC_DW14[i].mask) ? 1 : 0);
4383+ else
4384+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW14[i].name,
4385+ (dw_value & WTBL_LMAC_DW14[i].mask) >> WTBL_LMAC_DW14[i].shift);
4386+ i++;
4387+ }
4388+ }
4389+}
4390+
4391+static const struct berse_wtbl_parse WTBL_LMAC_DW28[] = {
4392+ {"RELATED_IDX0", WF_LWTBL_RELATED_IDX0_MASK, WF_LWTBL_RELATED_IDX0_SHIFT, false},
4393+ {"RELATED_BAND0", WF_LWTBL_RELATED_BAND0_MASK, WF_LWTBL_RELATED_BAND0_SHIFT, false},
4394+ {"PRI_MLD_BAND", WF_LWTBL_PRIMARY_MLD_BAND_MASK, WF_LWTBL_PRIMARY_MLD_BAND_SHIFT, true},
4395+ {"RELATED_IDX1", WF_LWTBL_RELATED_IDX1_MASK, WF_LWTBL_RELATED_IDX1_SHIFT, false},
4396+ {"RELATED_BAND1", WF_LWTBL_RELATED_BAND1_MASK, WF_LWTBL_RELATED_BAND1_SHIFT, false},
4397+ {"SEC_MLD_BAND", WF_LWTBL_SECONDARY_MLD_BAND_MASK, WF_LWTBL_SECONDARY_MLD_BAND_SHIFT, true},
4398+ {NULL,}
4399+};
4400+
4401+static void parse_fmac_lwtbl_dw28(struct seq_file *s, u8 *lwtbl)
4402+{
4403+ u32 *addr = 0;
4404+ u32 dw_value = 0;
4405+ u16 i = 0;
4406+
4407+ /* LMAC WTBL DW 28 */
4408+ seq_printf(s, "\t\n");
4409+ seq_printf(s, "LWTBL DW 28\n");
4410+ addr = (u32 *)&(lwtbl[WTBL_GROUP_MLO_INFO_LINE_1*4]);
4411+ dw_value = *addr;
4412+
4413+ while (WTBL_LMAC_DW28[i].name) {
4414+ if (WTBL_LMAC_DW28[i].shift == NO_SHIFT_DEFINE)
4415+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW28[i].name,
4416+ (dw_value & WTBL_LMAC_DW28[i].mask) ? 1 : 0);
4417+ else
4418+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW28[i].name,
4419+ (dw_value & WTBL_LMAC_DW28[i].mask) >>
4420+ WTBL_LMAC_DW28[i].shift);
4421+ i++;
4422+ }
4423+}
4424+
4425+static const struct berse_wtbl_parse WTBL_LMAC_DW29[] = {
4426+ {"DISPATCH_POLICY_MLD_TID0", WF_LWTBL_DISPATCH_POLICY0_MASK, WF_LWTBL_DISPATCH_POLICY0_SHIFT, false},
4427+ {"MLD_TID1", WF_LWTBL_DISPATCH_POLICY1_MASK, WF_LWTBL_DISPATCH_POLICY1_SHIFT, false},
4428+ {"MLD_TID2", WF_LWTBL_DISPATCH_POLICY2_MASK, WF_LWTBL_DISPATCH_POLICY2_SHIFT, false},
4429+ {"MLD_TID3", WF_LWTBL_DISPATCH_POLICY3_MASK, WF_LWTBL_DISPATCH_POLICY3_SHIFT, true},
4430+ {"MLD_TID4", WF_LWTBL_DISPATCH_POLICY4_MASK, WF_LWTBL_DISPATCH_POLICY4_SHIFT, false},
4431+ {"MLD_TID5", WF_LWTBL_DISPATCH_POLICY5_MASK, WF_LWTBL_DISPATCH_POLICY5_SHIFT, false},
4432+ {"MLD_TID6", WF_LWTBL_DISPATCH_POLICY6_MASK, WF_LWTBL_DISPATCH_POLICY6_SHIFT, false},
4433+ {"MLD_TID7", WF_LWTBL_DISPATCH_POLICY7_MASK, WF_LWTBL_DISPATCH_POLICY7_SHIFT, true},
4434+ {"OMLD_ID", WF_LWTBL_OWN_MLD_ID_MASK, WF_LWTBL_OWN_MLD_ID_SHIFT, false},
4435+ {"EMLSR0", WF_LWTBL_EMLSR0_MASK, NO_SHIFT_DEFINE, false},
4436+ {"EMLMR0", WF_LWTBL_EMLMR0_MASK, NO_SHIFT_DEFINE, false},
4437+ {"EMLSR1", WF_LWTBL_EMLSR1_MASK, NO_SHIFT_DEFINE, false},
4438+ {"EMLMR1", WF_LWTBL_EMLMR1_MASK, NO_SHIFT_DEFINE, true},
4439+ {"EMLSR2", WF_LWTBL_EMLSR2_MASK, NO_SHIFT_DEFINE, false},
4440+ {"EMLMR2", WF_LWTBL_EMLMR2_MASK, NO_SHIFT_DEFINE, false},
4441+ {"STR_BITMAP", WF_LWTBL_STR_BITMAP_MASK, WF_LWTBL_STR_BITMAP_SHIFT, true},
4442+ {NULL,}
4443+};
4444+
4445+static void parse_fmac_lwtbl_dw29(struct seq_file *s, u8 *lwtbl)
4446+{
4447+ u32 *addr = 0;
4448+ u32 dw_value = 0;
4449+ u16 i = 0;
4450+
4451+ /* LMAC WTBL DW 29 */
4452+ seq_printf(s, "\t\n");
4453+ seq_printf(s, "LWTBL DW 29\n");
4454+ addr = (u32 *)&(lwtbl[WTBL_GROUP_MLO_INFO_LINE_2*4]);
4455+ dw_value = *addr;
4456+
4457+ while (WTBL_LMAC_DW29[i].name) {
4458+ if (WTBL_LMAC_DW29[i].shift == NO_SHIFT_DEFINE)
4459+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW29[i].name,
4460+ (dw_value & WTBL_LMAC_DW29[i].mask) ? 1 : 0);
4461+ else
4462+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW29[i].name,
4463+ (dw_value & WTBL_LMAC_DW29[i].mask) >>
4464+ WTBL_LMAC_DW29[i].shift);
4465+ i++;
4466+ }
4467+}
4468+
4469+static const struct berse_wtbl_parse WTBL_LMAC_DW30[] = {
4470+ {"DISPATCH_ORDER", WF_LWTBL_DISPATCH_ORDER_MASK, WF_LWTBL_DISPATCH_ORDER_SHIFT, false},
4471+ {"DISPATCH_RATIO", WF_LWTBL_DISPATCH_RATIO_MASK, WF_LWTBL_DISPATCH_RATIO_SHIFT, false},
4472+ {"LINK_MGF", WF_LWTBL_LINK_MGF_MASK, WF_LWTBL_LINK_MGF_SHIFT, true},
4473+ {NULL,}
4474+};
4475+
4476+static void parse_fmac_lwtbl_dw30(struct seq_file *s, u8 *lwtbl)
4477+{
4478+ u32 *addr = 0;
4479+ u32 dw_value = 0;
4480+ u16 i = 0;
4481+
4482+ /* LMAC WTBL DW 30 */
4483+ seq_printf(s, "\t\n");
4484+ seq_printf(s, "LWTBL DW 30\n");
4485+ addr = (u32 *)&(lwtbl[WTBL_GROUP_MLO_INFO_LINE_3*4]);
4486+ dw_value = *addr;
4487+
4488+
4489+ while (WTBL_LMAC_DW30[i].name) {
4490+ if (WTBL_LMAC_DW30[i].shift == NO_SHIFT_DEFINE)
4491+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW30[i].name,
4492+ (dw_value & WTBL_LMAC_DW30[i].mask) ? 1 : 0);
4493+ else
4494+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW30[i].name,
4495+ (dw_value & WTBL_LMAC_DW30[i].mask) >> WTBL_LMAC_DW30[i].shift);
4496+ i++;
4497+ }
4498+}
4499+
4500+static const struct berse_wtbl_parse WTBL_LMAC_DW31[] = {
4501+ {"BFTX_TB", WF_LWTBL_BFTX_TB_MASK, NO_SHIFT_DEFINE, false},
4502+ {"DROP", WF_LWTBL_DROP_MASK, NO_SHIFT_DEFINE, false},
4503+ {"CASCAD", WF_LWTBL_CASCAD_MASK, NO_SHIFT_DEFINE, false},
4504+ {"ALL_ACK", WF_LWTBL_ALL_ACK_MASK, NO_SHIFT_DEFINE, false},
4505+ {"MPDU_SIZE", WF_LWTBL_MPDU_SIZE_MASK, WF_LWTBL_MPDU_SIZE_SHIFT, false},
4506+ {"RXD_DUP_MODE", WF_LWTBL_RXD_DUP_MODE_MASK, WF_LWTBL_RXD_DUP_MODE_SHIFT, true},
4507+ {"ACK_EN", WF_LWTBL_ACK_EN_MASK, NO_SHIFT_DEFINE, true},
4508+ {NULL,}
4509+};
4510+
4511+static void parse_fmac_lwtbl_dw31(struct seq_file *s, u8 *lwtbl)
4512+{
4513+ u32 *addr = 0;
4514+ u32 dw_value = 0;
4515+ u16 i = 0;
4516+
4517+ /* LMAC WTBL DW 31 */
4518+ seq_printf(s, "\t\n");
4519+ seq_printf(s, "LWTBL DW 31\n");
4520+ addr = (u32 *)&(lwtbl[WTBL_GROUP_RESP_INFO_DW_31*4]);
4521+ dw_value = *addr;
4522+
4523+ while (WTBL_LMAC_DW31[i].name) {
4524+ if (WTBL_LMAC_DW31[i].shift == NO_SHIFT_DEFINE)
4525+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW31[i].name,
4526+ (dw_value & WTBL_LMAC_DW31[i].mask) ? 1 : 0);
4527+ else
4528+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW31[i].name,
4529+ (dw_value & WTBL_LMAC_DW31[i].mask) >>
4530+ WTBL_LMAC_DW31[i].shift);
4531+ i++;
4532+ }
4533+}
4534+
4535+static const struct berse_wtbl_parse WTBL_LMAC_DW32[] = {
4536+ {"OM_INFO", WF_LWTBL_OM_INFO_MASK, WF_LWTBL_OM_INFO_SHIFT, false},
4537+ {"OM_INFO_EHT", WF_LWTBL_OM_INFO_EHT_MASK, WF_LWTBL_OM_INFO_EHT_SHIFT, false},
4538+ {"RXD_DUP_FOR_OM_CHG", WF_LWTBL_RXD_DUP_FOR_OM_CHG_MASK, NO_SHIFT_DEFINE, false},
4539+ {"RXD_DUP_WHITE_LIST", WF_LWTBL_RXD_DUP_WHITE_LIST_MASK, WF_LWTBL_RXD_DUP_WHITE_LIST_SHIFT, false},
4540+ {NULL,}
4541+};
4542+
4543+static void parse_fmac_lwtbl_dw32(struct seq_file *s, u8 *lwtbl)
4544+{
4545+ u32 *addr = 0;
4546+ u32 dw_value = 0;
4547+ u16 i = 0;
4548+
4549+ /* LMAC WTBL DW 32 */
4550+ seq_printf(s, "\t\n");
4551+ seq_printf(s, "LWTBL DW 32\n");
4552+ addr = (u32 *)&(lwtbl[WTBL_GROUP_RX_DUP_INFO_DW_32*4]);
4553+ dw_value = *addr;
4554+
4555+ while (WTBL_LMAC_DW32[i].name) {
4556+ if (WTBL_LMAC_DW32[i].shift == NO_SHIFT_DEFINE)
4557+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW32[i].name,
4558+ (dw_value & WTBL_LMAC_DW32[i].mask) ? 1 : 0);
4559+ else
4560+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW32[i].name,
4561+ (dw_value & WTBL_LMAC_DW32[i].mask) >>
4562+ WTBL_LMAC_DW32[i].shift);
4563+ i++;
4564+ }
4565+}
4566+
4567+static const struct berse_wtbl_parse WTBL_LMAC_DW33[] = {
4568+ {"USER_RSSI", WF_LWTBL_USER_RSSI_MASK, WF_LWTBL_USER_RSSI_SHIFT, false},
4569+ {"USER_SNR", WF_LWTBL_USER_SNR_MASK, WF_LWTBL_USER_SNR_SHIFT, false},
4570+ {"RAPID_REACTION_RATE", WF_LWTBL_RAPID_REACTION_RATE_MASK, WF_LWTBL_RAPID_REACTION_RATE_SHIFT, true},
4571+ {"HT_AMSDU(Read Only)", WF_LWTBL_HT_AMSDU_MASK, NO_SHIFT_DEFINE, false},
4572+ {"AMSDU_CROSS_LG(Read Only)", WF_LWTBL_AMSDU_CROSS_LG_MASK, NO_SHIFT_DEFINE, true},
4573+ {NULL,}
4574+};
4575+
4576+static void parse_fmac_lwtbl_dw33(struct seq_file *s, u8 *lwtbl)
4577+{
4578+ u32 *addr = 0;
4579+ u32 dw_value = 0;
4580+ u16 i = 0;
4581+
4582+ /* LMAC WTBL DW 33 */
4583+ seq_printf(s, "\t\n");
4584+ seq_printf(s, "LWTBL DW 33\n");
4585+ addr = (u32 *)&(lwtbl[WTBL_GROUP_RX_STAT_CNT_LINE_1*4]);
4586+ dw_value = *addr;
4587+
4588+ while (WTBL_LMAC_DW33[i].name) {
4589+ if (WTBL_LMAC_DW33[i].shift == NO_SHIFT_DEFINE)
4590+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW33[i].name,
4591+ (dw_value & WTBL_LMAC_DW33[i].mask) ? 1 : 0);
4592+ else
4593+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW33[i].name,
4594+ (dw_value & WTBL_LMAC_DW33[i].mask) >>
4595+ WTBL_LMAC_DW33[i].shift);
4596+ i++;
4597+ }
4598+}
4599+
4600+static const struct berse_wtbl_parse WTBL_LMAC_DW34[] = {
4601+ {"RESP_RCPI0", WF_LWTBL_RESP_RCPI0_MASK, WF_LWTBL_RESP_RCPI0_SHIFT, false},
4602+ {"RCPI1", WF_LWTBL_RESP_RCPI1_MASK, WF_LWTBL_RESP_RCPI1_SHIFT, false},
4603+ {"RCPI2", WF_LWTBL_RESP_RCPI2_MASK, WF_LWTBL_RESP_RCPI2_SHIFT, false},
4604+ {"RCPI3", WF_LWTBL_RESP_RCPI3_MASK, WF_LWTBL_RESP_RCPI3_SHIFT, true},
4605+ {NULL,}
4606+};
4607+
4608+static void parse_fmac_lwtbl_dw34(struct seq_file *s, u8 *lwtbl)
4609+{
4610+ u32 *addr = 0;
4611+ u32 dw_value = 0;
4612+ u16 i = 0;
4613+
4614+ /* LMAC WTBL DW 34 */
4615+ seq_printf(s, "\t\n");
4616+ seq_printf(s, "LWTBL DW 34\n");
4617+ addr = (u32 *)&(lwtbl[WTBL_GROUP_RX_STAT_CNT_LINE_2*4]);
4618+ dw_value = *addr;
4619+
4620+
4621+ while (WTBL_LMAC_DW34[i].name) {
4622+ if (WTBL_LMAC_DW34[i].shift == NO_SHIFT_DEFINE)
4623+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW34[i].name,
4624+ (dw_value & WTBL_LMAC_DW34[i].mask) ? 1 : 0);
4625+ else
4626+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW34[i].name,
4627+ (dw_value & WTBL_LMAC_DW34[i].mask) >>
4628+ WTBL_LMAC_DW34[i].shift);
4629+ i++;
4630+ }
4631+}
4632+
4633+static const struct berse_wtbl_parse WTBL_LMAC_DW35[] = {
4634+ {"SNR 0", WF_LWTBL_SNR_RX0_MASK, WF_LWTBL_SNR_RX0_SHIFT, false},
4635+ {"SNR 1", WF_LWTBL_SNR_RX1_MASK, WF_LWTBL_SNR_RX1_SHIFT, false},
4636+ {"SNR 2", WF_LWTBL_SNR_RX2_MASK, WF_LWTBL_SNR_RX2_SHIFT, false},
4637+ {"SNR 3", WF_LWTBL_SNR_RX3_MASK, WF_LWTBL_SNR_RX3_SHIFT, true},
4638+ {NULL,}
4639+};
4640+
4641+static void parse_fmac_lwtbl_dw35(struct seq_file *s, u8 *lwtbl)
4642+{
4643+ u32 *addr = 0;
4644+ u32 dw_value = 0;
4645+ u16 i = 0;
4646+
4647+ /* LMAC WTBL DW 35 */
4648+ seq_printf(s, "\t\n");
4649+ seq_printf(s, "LWTBL DW 35\n");
4650+ addr = (u32 *)&(lwtbl[WTBL_GROUP_RX_STAT_CNT_LINE_3*4]);
4651+ dw_value = *addr;
4652+
4653+
4654+ while (WTBL_LMAC_DW35[i].name) {
4655+ if (WTBL_LMAC_DW35[i].shift == NO_SHIFT_DEFINE)
4656+ seq_printf(s, "\t%s:%d\n", WTBL_LMAC_DW35[i].name,
4657+ (dw_value & WTBL_LMAC_DW35[i].mask) ? 1 : 0);
4658+ else
4659+ seq_printf(s, "\t%s:%u\n", WTBL_LMAC_DW35[i].name,
4660+ (dw_value & WTBL_LMAC_DW35[i].mask) >>
4661+ WTBL_LMAC_DW35[i].shift);
4662+ i++;
4663+ }
4664+}
4665+
4666+static void parse_fmac_lwtbl_rx_stats(struct seq_file *s, u8 *lwtbl)
4667+{
4668+ parse_fmac_lwtbl_dw33(s, lwtbl);
4669+ parse_fmac_lwtbl_dw34(s, lwtbl);
4670+ parse_fmac_lwtbl_dw35(s, lwtbl);
4671+}
4672+
4673+static void parse_fmac_lwtbl_mlo_info(struct seq_file *s, u8 *lwtbl)
4674+{
4675+ parse_fmac_lwtbl_dw28(s, lwtbl);
4676+ parse_fmac_lwtbl_dw29(s, lwtbl);
4677+ parse_fmac_lwtbl_dw30(s, lwtbl);
4678+}
4679+
4680+static const struct berse_wtbl_parse WTBL_UMAC_DW9[] = {
4681+ {"RELATED_IDX0", WF_UWTBL_RELATED_IDX0_MASK, WF_UWTBL_RELATED_IDX0_SHIFT, false},
4682+ {"RELATED_BAND0", WF_UWTBL_RELATED_BAND0_MASK, WF_UWTBL_RELATED_BAND0_SHIFT, false},
4683+ {"PRI_MLD_BAND", WF_UWTBL_PRIMARY_MLD_BAND_MASK, WF_UWTBL_PRIMARY_MLD_BAND_SHIFT, true},
4684+ {"RELATED_IDX1", WF_UWTBL_RELATED_IDX1_MASK, WF_UWTBL_RELATED_IDX1_SHIFT, false},
4685+ {"RELATED_BAND1", WF_UWTBL_RELATED_BAND1_MASK, WF_UWTBL_RELATED_BAND1_SHIFT, false},
4686+ {"SEC_MLD_BAND", WF_UWTBL_SECONDARY_MLD_BAND_MASK, WF_UWTBL_SECONDARY_MLD_BAND_SHIFT, true},
4687+ {NULL,}
4688+};
4689+
4690+static void parse_fmac_uwtbl_mlo_info(struct seq_file *s, u8 *uwtbl)
4691+{
4692+ u32 *addr = 0;
4693+ u32 dw_value = 0;
4694+ u16 i = 0;
4695+
4696+ seq_printf(s, "\t\n");
4697+ seq_printf(s, "MldAddr: %02x:%02x:%02x:%02x:%02x:%02x(D0[B0~15], D1[B0~31])\n",
4698+ uwtbl[4], uwtbl[5], uwtbl[6], uwtbl[7], uwtbl[0], uwtbl[1]);
4699+
4700+ /* UMAC WTBL DW 0 */
4701+ seq_printf(s, "\t\n");
4702+ seq_printf(s, "UWTBL DW 0\n");
4703+ addr = (u32 *)&(uwtbl[WF_UWTBL_OWN_MLD_ID_DW*4]);
4704+ dw_value = *addr;
4705+
4706+ seq_printf(s, "\t%s:%u\n", "OMLD_ID",
4707+ (dw_value & WF_UWTBL_OWN_MLD_ID_MASK) >> WF_UWTBL_OWN_MLD_ID_SHIFT);
4708+
4709+ /* UMAC WTBL DW 9 */
4710+ seq_printf(s, "\t\n");
4711+ seq_printf(s, "UWTBL DW 9\n");
4712+ addr = (u32 *)&(uwtbl[WF_UWTBL_RELATED_IDX0_DW*4]);
4713+ dw_value = *addr;
4714+
4715+ while (WTBL_UMAC_DW9[i].name) {
4716+
4717+ if (WTBL_UMAC_DW9[i].shift == NO_SHIFT_DEFINE)
4718+ seq_printf(s, "\t%s:%d\n", WTBL_UMAC_DW9[i].name,
4719+ (dw_value & WTBL_UMAC_DW9[i].mask) ? 1 : 0);
4720+ else
4721+ seq_printf(s, "\t%s:%u\n", WTBL_UMAC_DW9[i].name,
4722+ (dw_value & WTBL_UMAC_DW9[i].mask) >>
4723+ WTBL_UMAC_DW9[i].shift);
4724+ i++;
4725+ }
4726+}
4727+
4728+static bool
4729+is_wtbl_bigtk_exist(u8 *lwtbl)
4730+{
4731+ u32 *addr = 0;
4732+ u32 dw_value = 0;
4733+
4734+ addr = (u32 *)&(lwtbl[WF_LWTBL_MUAR_DW*4]);
4735+ dw_value = *addr;
4736+ if (((dw_value & WF_LWTBL_MUAR_MASK) >> WF_LWTBL_MUAR_SHIFT) ==
4737+ MUAR_INDEX_OWN_MAC_ADDR_BC_MC) {
4738+ addr = (u32 *)&(lwtbl[WF_LWTBL_CIPHER_SUIT_BIGTK_DW*4]);
4739+ dw_value = *addr;
4740+ if (((dw_value & WF_LWTBL_CIPHER_SUIT_BIGTK_MASK) >>
4741+ WF_LWTBL_CIPHER_SUIT_BIGTK_SHIFT) != IGTK_CIPHER_SUIT_NONE)
4742+ return true;
4743+ }
4744+
4745+ return false;
4746+}
4747+
4748+static const struct berse_wtbl_parse WTBL_UMAC_DW2[] = {
4749+ {"PN0", WTBL_PN0_MASK, WTBL_PN0_OFFSET, false},
4750+ {"PN1", WTBL_PN1_MASK, WTBL_PN1_OFFSET, false},
4751+ {"PN2", WTBL_PN2_MASK, WTBL_PN2_OFFSET, true},
4752+ {"PN3", WTBL_PN3_MASK, WTBL_PN3_OFFSET, false},
4753+ {NULL,}
4754+};
4755+
4756+static const struct berse_wtbl_parse WTBL_UMAC_DW3[] = {
4757+ {"PN4", WTBL_PN4_MASK, WTBL_PN4_OFFSET, false},
4758+ {"PN5", WTBL_PN5_MASK, WTBL_PN5_OFFSET, true},
4759+ {"COM_SN", WF_UWTBL_COM_SN_MASK, WF_UWTBL_COM_SN_SHIFT, true},
4760+ {NULL,}
4761+};
4762+
4763+static const struct berse_wtbl_parse WTBL_UMAC_DW4_BIPN[] = {
4764+ {"BIPN0", WTBL_BIPN0_MASK, WTBL_BIPN0_OFFSET, false},
4765+ {"BIPN1", WTBL_BIPN1_MASK, WTBL_BIPN1_OFFSET, false},
4766+ {"BIPN2", WTBL_BIPN2_MASK, WTBL_BIPN2_OFFSET, true},
4767+ {"BIPN3", WTBL_BIPN3_MASK, WTBL_BIPN3_OFFSET, false},
4768+ {NULL,}
4769+};
4770+
4771+static const struct berse_wtbl_parse WTBL_UMAC_DW5_BIPN[] = {
4772+ {"BIPN4", WTBL_BIPN4_MASK, WTBL_BIPN4_OFFSET, false},
4773+ {"BIPN5", WTBL_BIPN5_MASK, WTBL_BIPN5_OFFSET, true},
4774+ {NULL,}
4775+};
4776+
4777+static void parse_fmac_uwtbl_pn(struct seq_file *s, u8 *uwtbl, u8 *lwtbl)
4778+{
4779+ u32 *addr = 0;
4780+ u32 dw_value = 0;
4781+ u16 i = 0;
4782+
4783+ seq_printf(s, "\t\n");
4784+ seq_printf(s, "UWTBL PN\n");
4785+
4786+ /* UMAC WTBL DW 2/3 */
4787+ addr = (u32 *)&(uwtbl[WF_UWTBL_PN_31_0__DW*4]);
4788+ dw_value = *addr;
4789+
4790+ while (WTBL_UMAC_DW2[i].name) {
4791+ seq_printf(s, "\t%s:%u\n", WTBL_UMAC_DW2[i].name,
4792+ (dw_value & WTBL_UMAC_DW2[i].mask) >>
4793+ WTBL_UMAC_DW2[i].shift);
4794+ i++;
4795+ }
4796+
4797+ i = 0;
4798+ addr = (u32 *)&(uwtbl[WF_UWTBL_PN_47_32__DW*4]);
4799+ dw_value = *addr;
4800+
4801+ while (WTBL_UMAC_DW3[i].name) {
4802+ seq_printf(s, "\t%s:%u\n", WTBL_UMAC_DW3[i].name,
4803+ (dw_value & WTBL_UMAC_DW3[i].mask) >>
4804+ WTBL_UMAC_DW3[i].shift);
4805+ i++;
4806+ }
4807+
4808+
4809+ /* UMAC WTBL DW 4/5 for BIGTK */
4810+ if (is_wtbl_bigtk_exist(lwtbl) == true) {
4811+ i = 0;
4812+ addr = (u32 *)&(uwtbl[WF_UWTBL_RX_BIPN_31_0__DW*4]);
4813+ dw_value = *addr;
4814+
4815+ while (WTBL_UMAC_DW4_BIPN[i].name) {
4816+ seq_printf(s, "\t%s:%u\n", WTBL_UMAC_DW4_BIPN[i].name,
4817+ (dw_value & WTBL_UMAC_DW4_BIPN[i].mask) >>
4818+ WTBL_UMAC_DW4_BIPN[i].shift);
4819+ i++;
4820+ }
4821+
4822+ i = 0;
4823+ addr = (u32 *)&(uwtbl[WF_UWTBL_RX_BIPN_47_32__DW*4]);
4824+ dw_value = *addr;
4825+
4826+ while (WTBL_UMAC_DW5_BIPN[i].name) {
4827+ seq_printf(s, "\t%s:%u\n", WTBL_UMAC_DW5_BIPN[i].name,
4828+ (dw_value & WTBL_UMAC_DW5_BIPN[i].mask) >>
4829+ WTBL_UMAC_DW5_BIPN[i].shift);
4830+ i++;
4831+ }
4832+ }
4833+}
4834+
4835+static void parse_fmac_uwtbl_sn(struct seq_file *s, u8 *uwtbl)
4836+{
4837+ u32 *addr = 0;
4838+ u32 u2SN = 0;
4839+
4840+ /* UMAC WTBL DW SN part */
4841+ seq_printf(s, "\t\n");
4842+ seq_printf(s, "UWTBL SN\n");
4843+
4844+ addr = (u32 *)&(uwtbl[WF_UWTBL_TID0_SN_DW*4]);
4845+ u2SN = ((*addr) & WF_UWTBL_TID0_SN_MASK) >> WF_UWTBL_TID0_SN_SHIFT;
4846+ seq_printf(s, "\t%s:%u\n", "TID0_AC0_SN", u2SN);
4847+
4848+ addr = (u32 *)&(uwtbl[WF_UWTBL_TID1_SN_DW*4]);
4849+ u2SN = ((*addr) & WF_UWTBL_TID1_SN_MASK) >> WF_UWTBL_TID1_SN_SHIFT;
4850+ seq_printf(s, "\t%s:%u\n", "TID1_AC1_SN", u2SN);
4851+
4852+ addr = (u32 *)&(uwtbl[WF_UWTBL_TID2_SN_7_0__DW*4]);
4853+ u2SN = ((*addr) & WF_UWTBL_TID2_SN_7_0__MASK) >>
4854+ WF_UWTBL_TID2_SN_7_0__SHIFT;
4855+ addr = (u32 *)&(uwtbl[WF_UWTBL_TID2_SN_11_8__DW*4]);
4856+ u2SN |= (((*addr) & WF_UWTBL_TID2_SN_11_8__MASK) >>
4857+ WF_UWTBL_TID2_SN_11_8__SHIFT) << 8;
4858+ seq_printf(s, "\t%s:%u\n", "TID2_AC2_SN", u2SN);
4859+
4860+ addr = (u32 *)&(uwtbl[WF_UWTBL_TID3_SN_DW*4]);
4861+ u2SN = ((*addr) & WF_UWTBL_TID3_SN_MASK) >> WF_UWTBL_TID3_SN_SHIFT;
4862+ seq_printf(s, "\t%s:%u\n", "TID3_AC3_SN", u2SN);
4863+
4864+ addr = (u32 *)&(uwtbl[WF_UWTBL_TID4_SN_DW*4]);
4865+ u2SN = ((*addr) & WF_UWTBL_TID4_SN_MASK) >> WF_UWTBL_TID4_SN_SHIFT;
4866+ seq_printf(s, "\t%s:%u\n", "TID4_SN", u2SN);
4867+
4868+ addr = (u32 *)&(uwtbl[WF_UWTBL_TID5_SN_3_0__DW*4]);
4869+ u2SN = ((*addr) & WF_UWTBL_TID5_SN_3_0__MASK) >>
4870+ WF_UWTBL_TID5_SN_3_0__SHIFT;
4871+ addr = (u32 *)&(uwtbl[WF_UWTBL_TID5_SN_11_4__DW*4]);
4872+ u2SN |= (((*addr) & WF_UWTBL_TID5_SN_11_4__MASK) >>
4873+ WF_UWTBL_TID5_SN_11_4__SHIFT) << 4;
4874+ seq_printf(s, "\t%s:%u\n", "TID5_SN", u2SN);
4875+
4876+ addr = (u32 *)&(uwtbl[WF_UWTBL_TID6_SN_DW*4]);
4877+ u2SN = ((*addr) & WF_UWTBL_TID6_SN_MASK) >> WF_UWTBL_TID6_SN_SHIFT;
4878+ seq_printf(s, "\t%s:%u\n", "TID6_SN", u2SN);
4879+
4880+ addr = (u32 *)&(uwtbl[WF_UWTBL_TID7_SN_DW*4]);
4881+ u2SN = ((*addr) & WF_UWTBL_TID7_SN_MASK) >> WF_UWTBL_TID7_SN_SHIFT;
4882+ seq_printf(s, "\t%s:%u\n", "TID7_SN", u2SN);
4883+
4884+ addr = (u32 *)&(uwtbl[WF_UWTBL_COM_SN_DW*4]);
4885+ u2SN = ((*addr) & WF_UWTBL_COM_SN_MASK) >> WF_UWTBL_COM_SN_SHIFT;
4886+ seq_printf(s, "\t%s:%u\n", "COM_SN", u2SN);
4887+}
4888+
4889+static void dump_key_table(
4890+ struct seq_file *s,
4891+ uint16_t keyloc0,
4892+ uint16_t keyloc1,
4893+ uint16_t keyloc2
4894+)
4895+{
4896+#define ONE_KEY_ENTRY_LEN_IN_DW 8
4897+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
4898+ u8 keytbl[ONE_KEY_ENTRY_LEN_IN_DW*4] = {0};
4899+ uint16_t x;
4900+
4901+ seq_printf(s, "\t\n");
4902+ seq_printf(s, "\t%s:%d\n", "keyloc0", keyloc0);
4903+ if (keyloc0 != INVALID_KEY_ENTRY) {
4904+
4905+ /* Don't swap below two lines, halWtblReadRaw will
4906+ * write new value WF_WTBLON_TOP_WDUCR_ADDR
4907+ */
4908+ mt7996_wtbl_read_raw(dev, keyloc0,
4909+ WTBL_TYPE_KEY, 0, ONE_KEY_ENTRY_LEN_IN_DW, keytbl);
4910+ seq_printf(s, "\t\tKEY WTBL Addr: group:0x%x=0x%x addr: 0x%lx\n",
4911+ MT_DBG_UWTBL_TOP_WDUCR_ADDR,
4912+ mt76_rr(dev, MT_DBG_UWTBL_TOP_WDUCR_ADDR),
4913+ KEYTBL_IDX2BASE(keyloc0, 0));
4914+ for (x = 0; x < ONE_KEY_ENTRY_LEN_IN_DW; x++) {
4915+ seq_printf(s, "\t\tDW%02d: %02x %02x %02x %02x\n",
4916+ x,
4917+ keytbl[x * 4 + 3],
4918+ keytbl[x * 4 + 2],
4919+ keytbl[x * 4 + 1],
4920+ keytbl[x * 4]);
4921+ }
4922+ }
4923+
4924+ seq_printf(s, "\t%s:%d\n", "keyloc1", keyloc1);
4925+ if (keyloc1 != INVALID_KEY_ENTRY) {
4926+ /* Don't swap below two lines, halWtblReadRaw will
4927+ * write new value WF_WTBLON_TOP_WDUCR_ADDR
4928+ */
4929+ mt7996_wtbl_read_raw(dev, keyloc1,
4930+ WTBL_TYPE_KEY, 0, ONE_KEY_ENTRY_LEN_IN_DW, keytbl);
4931+ seq_printf(s, "\t\tKEY WTBL Addr: group:0x%x=0x%x addr: 0x%lx\n",
4932+ MT_DBG_UWTBL_TOP_WDUCR_ADDR,
4933+ mt76_rr(dev, MT_DBG_UWTBL_TOP_WDUCR_ADDR),
4934+ KEYTBL_IDX2BASE(keyloc1, 0));
4935+ for (x = 0; x < ONE_KEY_ENTRY_LEN_IN_DW; x++) {
4936+ seq_printf(s, "\t\tDW%02d: %02x %02x %02x %02x\n",
4937+ x,
4938+ keytbl[x * 4 + 3],
4939+ keytbl[x * 4 + 2],
4940+ keytbl[x * 4 + 1],
4941+ keytbl[x * 4]);
4942+ }
4943+ }
4944+
4945+ seq_printf(s, "\t%s:%d\n", "keyloc2", keyloc2);
4946+ if (keyloc2 != INVALID_KEY_ENTRY) {
4947+ /* Don't swap below two lines, halWtblReadRaw will
4948+ * write new value WF_WTBLON_TOP_WDUCR_ADDR
4949+ */
4950+ mt7996_wtbl_read_raw(dev, keyloc2,
4951+ WTBL_TYPE_KEY, 0, ONE_KEY_ENTRY_LEN_IN_DW, keytbl);
4952+ seq_printf(s, "\t\tKEY WTBL Addr: group:0x%x=0x%x addr: 0x%lx\n",
4953+ MT_DBG_UWTBL_TOP_WDUCR_ADDR,
4954+ mt76_rr(dev, MT_DBG_UWTBL_TOP_WDUCR_ADDR),
4955+ KEYTBL_IDX2BASE(keyloc2, 0));
4956+ for (x = 0; x < ONE_KEY_ENTRY_LEN_IN_DW; x++) {
4957+ seq_printf(s, "\t\tDW%02d: %02x %02x %02x %02x\n",
4958+ x,
4959+ keytbl[x * 4 + 3],
4960+ keytbl[x * 4 + 2],
4961+ keytbl[x * 4 + 1],
4962+ keytbl[x * 4]);
4963+ }
4964+ }
4965+}
4966+
4967+static void parse_fmac_uwtbl_key_info(struct seq_file *s, u8 *uwtbl, u8 *lwtbl)
4968+{
4969+ u32 *addr = 0;
4970+ u32 dw_value = 0;
4971+ uint16_t keyloc0 = INVALID_KEY_ENTRY;
4972+ uint16_t keyloc1 = INVALID_KEY_ENTRY;
4973+ uint16_t keyloc2 = INVALID_KEY_ENTRY;
4974+
4975+ /* UMAC WTBL DW 7 */
4976+ seq_printf(s, "\t\n");
4977+ seq_printf(s, "UWTBL key info\n");
4978+
4979+ addr = (u32 *)&(uwtbl[WF_UWTBL_KEY_LOC0_DW*4]);
4980+ dw_value = *addr;
4981+ keyloc0 = (dw_value & WF_UWTBL_KEY_LOC0_MASK) >> WF_UWTBL_KEY_LOC0_SHIFT;
4982+ keyloc1 = (dw_value & WF_UWTBL_KEY_LOC1_MASK) >> WF_UWTBL_KEY_LOC1_SHIFT;
4983+
4984+ seq_printf(s, "\t%s:%u/%u\n", "Key Loc 0/1", keyloc0, keyloc1);
4985+
4986+ /* UMAC WTBL DW 6 for BIGTK */
4987+ if (is_wtbl_bigtk_exist(lwtbl) == true) {
4988+ addr = (u32 *)&(uwtbl[WF_UWTBL_KEY_LOC2_DW*4]);
4989+ dw_value = *addr;
4990+ keyloc2 = (dw_value & WF_UWTBL_KEY_LOC2_MASK) >>
4991+ WF_UWTBL_KEY_LOC2_SHIFT;
4992+ seq_printf(s, "\t%s:%u\n", "Key Loc 2", keyloc2);
4993+ }
4994+
4995+ /* Parse KEY link */
4996+ dump_key_table(s, keyloc0, keyloc1, keyloc2);
4997+}
4998+
4999+static const struct berse_wtbl_parse WTBL_UMAC_DW8[] = {
5000+ {"UWTBL_WMM_Q", WF_UWTBL_WMM_Q_MASK, WF_UWTBL_WMM_Q_SHIFT, false},
5001+ {"UWTBL_QOS", WF_UWTBL_QOS_MASK, NO_SHIFT_DEFINE, false},
5002+ {"UWTBL_HT_VHT_HE", WF_UWTBL_HT_MASK, NO_SHIFT_DEFINE, false},
5003+ {"UWTBL_HDRT_MODE", WF_UWTBL_HDRT_MODE_MASK, NO_SHIFT_DEFINE, true},
5004+ {NULL,}
5005+};
5006+
5007+static void parse_fmac_uwtbl_msdu_info(struct seq_file *s, u8 *uwtbl)
5008+{
5009+ u32 *addr = 0;
5010+ u32 dw_value = 0;
5011+ u32 amsdu_len = 0;
5012+ u16 i = 0;
5013+
5014+ /* UMAC WTBL DW 8 */
5015+ seq_printf(s, "\t\n");
5016+ seq_printf(s, "UWTBL DW8\n");
5017+
5018+ addr = (u32 *)&(uwtbl[WF_UWTBL_AMSDU_CFG_DW*4]);
5019+ dw_value = *addr;
5020+
5021+ while (WTBL_UMAC_DW8[i].name) {
5022+
5023+ if (WTBL_UMAC_DW8[i].shift == NO_SHIFT_DEFINE)
5024+ seq_printf(s, "\t%s:%d\n", WTBL_UMAC_DW8[i].name,
5025+ (dw_value & WTBL_UMAC_DW8[i].mask) ? 1 : 0);
5026+ else
5027+ seq_printf(s, "\t%s:%u\n", WTBL_UMAC_DW8[i].name,
5028+ (dw_value & WTBL_UMAC_DW8[i].mask) >>
5029+ WTBL_UMAC_DW8[i].shift);
5030+ i++;
5031+ }
5032+
5033+ /* UMAC WTBL DW 8 - SEC_ADDR_MODE */
5034+ addr = (u32 *)&(uwtbl[WF_UWTBL_SEC_ADDR_MODE_DW*4]);
5035+ dw_value = *addr;
5036+ seq_printf(s, "\t%s:%lu\n", "SEC_ADDR_MODE",
5037+ (dw_value & WTBL_SEC_ADDR_MODE_MASK) >> WTBL_SEC_ADDR_MODE_OFFSET);
5038+
5039+ /* UMAC WTBL DW 8 - AMSDU_CFG */
5040+ seq_printf(s, "\t%s:%d\n", "HW AMSDU Enable",
5041+ (dw_value & WTBL_AMSDU_EN_MASK) ? 1 : 0);
5042+
5043+ amsdu_len = (dw_value & WTBL_AMSDU_LEN_MASK) >> WTBL_AMSDU_LEN_OFFSET;
5044+ if (amsdu_len == 0)
5045+ seq_printf(s, "\t%s:invalid (WTBL value=0x%x)\n", "HW AMSDU Len",
5046+ amsdu_len);
5047+ else if (amsdu_len == 1)
5048+ seq_printf(s, "\t%s:%d~%d (WTBL value=0x%x)\n", "HW AMSDU Len",
5049+ 1,
5050+ 255,
5051+ amsdu_len);
5052+ else if (amsdu_len == 2)
5053+ seq_printf(s, "\t%s:%d~%d (WTBL value=0x%x)\n", "HW AMSDU Len",
5054+ 256,
5055+ 511,
5056+ amsdu_len);
5057+ else if (amsdu_len == 3)
5058+ seq_printf(s, "\t%s:%d~%d (WTBL value=0x%x)\n", "HW AMSDU Len",
5059+ 512,
5060+ 767,
5061+ amsdu_len);
5062+ else
5063+ seq_printf(s, "\t%s:%d~%d (WTBL value=0x%x)\n", "HW AMSDU Len",
5064+ 256 * (amsdu_len - 1),
5065+ 256 * (amsdu_len - 1) + 255,
5066+ amsdu_len);
5067+
5068+ seq_printf(s, "\t%s:%lu (WTBL value=0x%lx)\n", "HW AMSDU Num",
5069+ ((dw_value & WTBL_AMSDU_NUM_MASK) >> WTBL_AMSDU_NUM_OFFSET) + 1,
5070+ (dw_value & WTBL_AMSDU_NUM_MASK) >> WTBL_AMSDU_NUM_OFFSET);
5071+}
5072+
5073+static int mt7996_wtbl_read(struct seq_file *s, void *data)
5074+{
5075+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
5076+ u8 lwtbl[LWTBL_LEN_IN_DW * 4] = {0};
5077+ u8 uwtbl[UWTBL_LEN_IN_DW * 4] = {0};
5078+ int x;
5079+
5080+ mt7996_wtbl_read_raw(dev, dev->wlan_idx, WTBL_TYPE_LMAC, 0,
5081+ LWTBL_LEN_IN_DW, lwtbl);
5082+ seq_printf(s, "Dump WTBL info of WLAN_IDX:%d\n", dev->wlan_idx);
5083+ seq_printf(s, "LMAC WTBL Addr: group:0x%x=0x%x addr: 0x%lx\n",
5084+ MT_DBG_WTBLON_TOP_WDUCR_ADDR,
5085+ mt76_rr(dev, MT_DBG_WTBLON_TOP_WDUCR_ADDR),
5086+ LWTBL_IDX2BASE(dev->wlan_idx, 0));
5087+ for (x = 0; x < LWTBL_LEN_IN_DW; x++) {
5088+ seq_printf(s, "DW%02d: %02x %02x %02x %02x\n",
5089+ x,
5090+ lwtbl[x * 4 + 3],
5091+ lwtbl[x * 4 + 2],
5092+ lwtbl[x * 4 + 1],
5093+ lwtbl[x * 4]);
5094+ }
5095+
5096+ /* Parse LWTBL */
5097+ parse_fmac_lwtbl_dw0_1(s, lwtbl);
5098+ parse_fmac_lwtbl_dw2(s, lwtbl);
5099+ parse_fmac_lwtbl_dw3(s, lwtbl);
5100+ parse_fmac_lwtbl_dw4(s, lwtbl);
5101+ parse_fmac_lwtbl_dw5(s, lwtbl);
5102+ parse_fmac_lwtbl_dw6(s, lwtbl);
5103+ parse_fmac_lwtbl_dw7(s, lwtbl);
5104+ parse_fmac_lwtbl_dw8(s, lwtbl);
5105+ parse_fmac_lwtbl_dw9(s, lwtbl);
5106+ parse_fmac_lwtbl_dw10(s, lwtbl);
5107+ parse_fmac_lwtbl_dw11(s, lwtbl);
5108+ parse_fmac_lwtbl_dw12(s, lwtbl);
5109+ parse_fmac_lwtbl_dw13(s, lwtbl);
5110+ parse_fmac_lwtbl_dw14(s, lwtbl);
5111+ parse_fmac_lwtbl_mlo_info(s, lwtbl);
5112+ parse_fmac_lwtbl_dw31(s, lwtbl);
5113+ parse_fmac_lwtbl_dw32(s, lwtbl);
5114+ parse_fmac_lwtbl_rx_stats(s, lwtbl);
5115+
5116+ mt7996_wtbl_read_raw(dev, dev->wlan_idx, WTBL_TYPE_UMAC, 0,
5117+ UWTBL_LEN_IN_DW, uwtbl);
5118+ seq_printf(s, "Dump WTBL info of WLAN_IDX:%d\n", dev->wlan_idx);
5119+ seq_printf(s, "UMAC WTBL Addr: group:0x%x=0x%x addr: 0x%lx\n",
5120+ MT_DBG_UWTBL_TOP_WDUCR_ADDR,
5121+ mt76_rr(dev, MT_DBG_UWTBL_TOP_WDUCR_ADDR),
5122+ UWTBL_IDX2BASE(dev->wlan_idx, 0));
5123+ for (x = 0; x < UWTBL_LEN_IN_DW; x++) {
5124+ seq_printf(s, "DW%02d: %02x %02x %02x %02x\n",
5125+ x,
5126+ uwtbl[x * 4 + 3],
5127+ uwtbl[x * 4 + 2],
5128+ uwtbl[x * 4 + 1],
5129+ uwtbl[x * 4]);
5130+ }
5131+
5132+ /* Parse UWTBL */
5133+ parse_fmac_uwtbl_mlo_info(s, uwtbl);
5134+ parse_fmac_uwtbl_pn(s, uwtbl, lwtbl);
5135+ parse_fmac_uwtbl_sn(s, uwtbl);
5136+ parse_fmac_uwtbl_key_info(s, uwtbl, lwtbl);
5137+ parse_fmac_uwtbl_msdu_info(s, uwtbl);
5138+
5139+ return 0;
5140+}
5141+
5142+static int mt7996_sta_info(struct seq_file *s, void *data)
5143+{
5144+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
5145+ u8 lwtbl[LWTBL_LEN_IN_DW*4] = {0};
5146+ u16 i = 0;
5147+
5148+ for (i=0; i < mt7996_wtbl_size(dev); i++) {
5149+ mt7996_wtbl_read_raw(dev, i, WTBL_TYPE_LMAC, 0,
5150+ LWTBL_LEN_IN_DW, lwtbl);
5151+
5152+ if (lwtbl[4] || lwtbl[5] || lwtbl[6] || lwtbl[7] || lwtbl[0] || lwtbl[1]) {
5153+ u32 *addr, dw_value;
5154+
5155+ seq_printf(s, "wcid:%d\tAddr: %02x:%02x:%02x:%02x:%02x:%02x",
5156+ i, lwtbl[4], lwtbl[5], lwtbl[6], lwtbl[7], lwtbl[0], lwtbl[1]);
5157+
5158+ addr = (u32 *)&(lwtbl[WTBL_GROUP_TRX_CAP_DW_2*4]);
5159+ dw_value = *addr;
5160+ seq_printf(s, "\t%s:%u", WTBL_LMAC_DW2[0].name,
5161+ (dw_value & WTBL_LMAC_DW2[0].mask) >> WTBL_LMAC_DW2[0].shift);
5162+
5163+ addr = (u32 *)&(lwtbl[WTBL_GROUP_TRX_CAP_DW_5*4]);
5164+ dw_value = *addr;
5165+ seq_printf(s, "\tPSM:%u\n", !!(dw_value & WF_LWTBL_PSM_MASK));
5166+ }
5167+ }
5168+
5169+ return 0;
5170+}
5171+
5172+static int mt7996_token_read(struct seq_file *s, void *data)
5173+{
5174+ struct mt7996_dev *dev = dev_get_drvdata(s->private);
5175+ int msdu_id;
5176+ struct mt76_txwi_cache *txwi;
5177+
5178+ seq_printf(s, "Token from host:\n");
5179+ spin_lock_bh(&dev->mt76.token_lock);
5180+ idr_for_each_entry(&dev->mt76.token, txwi, msdu_id) {
5181+ seq_printf(s, "%4d (pending time %u ms)\n", msdu_id,
5182+ jiffies_to_msecs(jiffies - txwi->jiffies));
5183+ }
5184+ spin_unlock_bh(&dev->mt76.token_lock);
5185+ seq_printf(s, "\n");
5186+
5187+ return 0;
5188+}
5189+
5190+int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
5191+{
5192+ struct mt7996_dev *dev = phy->dev;
5193+ u32 device_id = (dev->mt76.rev) >> 16;
5194+ int i = 0;
5195+ static const struct mt7996_dbg_reg_desc dbg_reg_s[] = {
5196+ { 0x7990, mt7996_dbg_offs },
5197+ { 0x7992, mt7992_dbg_offs },
5198+ };
5199+
5200+ for (i = 0; i < ARRAY_SIZE(dbg_reg_s); i++) {
5201+ if (device_id == dbg_reg_s[i].id) {
5202+ dev->dbg_reg = &dbg_reg_s[i];
5203+ break;
5204+ }
5205+ }
5206+
5207+ if (is_mt7996(&dev->mt76)) {
5208+ WTBL_LMAC_DW2 = WTBL_LMAC_DW2_7996;
5209+ WTBL_LMAC_DW5 = WTBL_LMAC_DW5_7996;
5210+ WTBL_LMAC_DW9 = WTBL_LMAC_DW9_7996;
5211+ } else {
5212+ WTBL_LMAC_DW2 = WTBL_LMAC_DW2_7992;
5213+ WTBL_LMAC_DW5 = WTBL_LMAC_DW5_7992;
5214+ WTBL_LMAC_DW9 = WTBL_LMAC_DW9_7992;
5215+ }
5216+
5217+ /* agg */
5218+ debugfs_create_devm_seqfile(dev->mt76.dev, "agg_info0", dir,
5219+ mt7996_agginfo_read_band0);
5220+ debugfs_create_devm_seqfile(dev->mt76.dev, "agg_info1", dir,
5221+ mt7996_agginfo_read_band1);
5222+ debugfs_create_devm_seqfile(dev->mt76.dev, "agg_info2", dir,
5223+ mt7996_agginfo_read_band2);
5224+ /* amsdu */
5225+ debugfs_create_devm_seqfile(dev->mt76.dev, "amsdu_info", dir,
5226+ mt7996_amsdu_result_read);
5227+
5228+ debugfs_create_file("fw_debug_module", 0600, dir, dev,
5229+ &fops_fw_debug_module);
5230+ debugfs_create_file("fw_debug_level", 0600, dir, dev,
5231+ &fops_fw_debug_level);
5232+ debugfs_create_file("fw_wa_query", 0600, dir, dev, &fops_wa_query);
5233+ debugfs_create_file("fw_wa_set", 0600, dir, dev, &fops_wa_set);
5234+ debugfs_create_devm_seqfile(dev->mt76.dev, "fw_version", dir,
5235+ mt7996_dump_version);
5236+ debugfs_create_devm_seqfile(dev->mt76.dev, "fw_wa_info", dir,
5237+ mt7996_fw_wa_info_read);
5238+ debugfs_create_devm_seqfile(dev->mt76.dev, "fw_wm_info", dir,
5239+ mt7996_fw_wm_info_read);
5240+
5241+ debugfs_create_devm_seqfile(dev->mt76.dev, "mib_info0", dir,
5242+ mt7996_mibinfo_band0);
5243+ debugfs_create_devm_seqfile(dev->mt76.dev, "mib_info1", dir,
5244+ mt7996_mibinfo_band1);
5245+ debugfs_create_devm_seqfile(dev->mt76.dev, "mib_info2", dir,
5246+ mt7996_mibinfo_band2);
5247+
5248+ debugfs_create_devm_seqfile(dev->mt76.dev, "sta_info", dir,
5249+ mt7996_sta_info);
5250+
5251+ debugfs_create_devm_seqfile(dev->mt76.dev, "tr_info", dir,
5252+ mt7996_trinfo_read);
5253+
5254+ debugfs_create_devm_seqfile(dev->mt76.dev, "wtbl_info", dir,
5255+ mt7996_wtbl_read);
5256+
5257+ debugfs_create_devm_seqfile(dev->mt76.dev, "token", dir, mt7996_token_read);
5258+
5259+ debugfs_create_u8("sku_disable", 0600, dir, &dev->dbg.sku_disable);
5260+
5261+ return 0;
5262+}
5263+
5264+#endif
5265diff --git a/mt7996/mtk_mcu.c b/mt7996/mtk_mcu.c
5266new file mode 100644
5267index 000000000..c16b25ab5
5268--- /dev/null
5269+++ b/mt7996/mtk_mcu.c
5270@@ -0,0 +1,39 @@
5271+// SPDX-License-Identifier: ISC
5272+/*
5273+ * Copyright (C) 2023 MediaTek Inc.
5274+ */
5275+
5276+#include <linux/firmware.h>
5277+#include <linux/fs.h>
5278+#include "mt7996.h"
5279+#include "mcu.h"
5280+#include "mac.h"
5281+#include "mtk_mcu.h"
5282+
5283+#ifdef CONFIG_MTK_DEBUG
5284+
5285+
5286+
5287+
5288+int mt7996_mcu_muru_dbg_info(struct mt7996_dev *dev, u16 item, u8 val)
5289+{
5290+ struct {
5291+ u8 __rsv1[4];
5292+
5293+ __le16 tag;
5294+ __le16 len;
5295+
5296+ __le16 item;
5297+ u8 __rsv2[2];
5298+ __le32 value;
5299+ } __packed req = {
5300+ .tag = cpu_to_le16(UNI_CMD_MURU_DBG_INFO),
5301+ .len = cpu_to_le16(sizeof(req) - 4),
5302+ .item = cpu_to_le16(item),
5303+ .value = cpu_to_le32(val),
5304+ };
5305+
5306+ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(MURU), &req,
5307+ sizeof(req), true);
5308+}
5309+#endif
5310diff --git a/mt7996/mtk_mcu.h b/mt7996/mtk_mcu.h
5311new file mode 100644
5312index 000000000..7f4d4e029
5313--- /dev/null
5314+++ b/mt7996/mtk_mcu.h
5315@@ -0,0 +1,19 @@
5316+/* SPDX-License-Identifier: ISC */
5317+/*
5318+ * Copyright (C) 2023 MediaTek Inc.
5319+ */
5320+
5321+#ifndef __MT7996_MTK_MCU_H
5322+#define __MT7996_MTK_MCU_H
5323+
5324+#include "../mt76_connac_mcu.h"
5325+
5326+#ifdef CONFIG_MTK_DEBUG
5327+
5328+enum {
5329+ UNI_CMD_MURU_DBG_INFO = 0x18,
5330+};
5331+
5332+#endif
5333+
5334+#endif
5335diff --git a/tools/fwlog.c b/tools/fwlog.c
5336index e5d4a1051..3c6a61d71 100644
5337--- a/tools/fwlog.c
5338+++ b/tools/fwlog.c
5339@@ -26,7 +26,7 @@ static const char *debugfs_path(const char *phyname, const char *file)
5340 return path;
5341 }
5342
5343-static int mt76_set_fwlog_en(const char *phyname, bool en)
5344+static int mt76_set_fwlog_en(const char *phyname, bool en, char *val)
5345 {
5346 FILE *f = fopen(debugfs_path(phyname, "fw_debug_bin"), "w");
5347
5348@@ -35,7 +35,13 @@ static int mt76_set_fwlog_en(const char *phyname, bool en)
5349 return 1;
5350 }
5351
5352- fprintf(f, "7");
5353+ if (en && val)
5354+ fprintf(f, "%s", val);
5355+ else if (en)
5356+ fprintf(f, "7");
5357+ else
5358+ fprintf(f, "0");
5359+
5360 fclose(f);
5361
5362 return 0;
5363@@ -76,6 +82,7 @@ static void handle_signal(int sig)
5364
5365 int mt76_fwlog(const char *phyname, int argc, char **argv)
5366 {
5367+#define BUF_SIZE 1504
5368 struct sockaddr_in local = {
5369 .sin_family = AF_INET,
5370 .sin_addr.s_addr = INADDR_ANY,
5371@@ -84,9 +91,9 @@ int mt76_fwlog(const char *phyname, int argc, char **argv)
5372 .sin_family = AF_INET,
5373 .sin_port = htons(55688),
5374 };
5375- char buf[1504];
5376+ char *buf = calloc(BUF_SIZE, sizeof(char));
5377 int ret = 0;
5378- int yes = 1;
5379+ /* int yes = 1; */
5380 int s, fd;
5381
5382 if (argc < 1) {
5383@@ -105,13 +112,13 @@ int mt76_fwlog(const char *phyname, int argc, char **argv)
5384 return 1;
5385 }
5386
5387- setsockopt(s, SOL_SOCKET, SO_BROADCAST, &yes, sizeof(yes));
5388+ /* setsockopt(s, SOL_SOCKET, SO_BROADCAST, &yes, sizeof(yes)); */
5389 if (bind(s, (struct sockaddr *)&local, sizeof(local)) < 0) {
5390 perror("bind");
5391 return 1;
5392 }
5393
5394- if (mt76_set_fwlog_en(phyname, true))
5395+ if (mt76_set_fwlog_en(phyname, true, argv[1]))
5396 return 1;
5397
5398 fd = open(debugfs_path(phyname, "fwlog_data"), O_RDONLY);
5399@@ -145,8 +152,8 @@ int mt76_fwlog(const char *phyname, int argc, char **argv)
5400 if (!r)
5401 continue;
5402
5403- if (len > sizeof(buf)) {
5404- fprintf(stderr, "Length error: %d > %d\n", len, (int)sizeof(buf));
5405+ if (len > BUF_SIZE) {
5406+ fprintf(stderr, "Length error: %d > %d\n", len, BUF_SIZE);
5407 ret = 1;
5408 break;
5409 }
5410@@ -171,7 +178,7 @@ int mt76_fwlog(const char *phyname, int argc, char **argv)
5411 close(fd);
5412
5413 out:
5414- mt76_set_fwlog_en(phyname, false);
5415+ mt76_set_fwlog_en(phyname, false, NULL);
5416
5417 return ret;
5418 }
5419--
54202.39.2
5421