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