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