xref: /linux/drivers/net/wireless/mediatek/mt76/mt7996/mcu.h (revision 91ec2035134982b98fab0609a9fd8480e8217dc1)
1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3  * Copyright (C) 2022 MediaTek Inc.
4  */
5 
6 #ifndef __MT7996_MCU_H
7 #define __MT7996_MCU_H
8 
9 #include "../mt76_connac_mcu.h"
10 
11 struct mt7996_mcu_rxd {
12 	__le32 rxd[8];
13 
14 	__le16 len;
15 	__le16 pkt_type_id;
16 
17 	u8 eid;
18 	u8 seq;
19 	u8 option;
20 	u8 __rsv;
21 
22 	u8 ext_eid;
23 	u8 __rsv1[2];
24 	u8 s2d_index;
25 };
26 
27 struct mt7996_mcu_uni_event {
28 	__le16 cid;
29 	u8 __rsv[2];
30 	__le32 status; /* 0: success, others: fail */
31 } __packed;
32 
33 struct mt7996_mcu_thermal_ctrl {
34 	u8 ctrl_id;
35 	u8 band_idx;
36 	union {
37 		struct {
38 			u8 protect_type; /* 1: duty admit, 2: radio off */
39 			u8 trigger_type; /* 0: low, 1: high */
40 		} __packed type;
41 		struct {
42 			u8 duty_level;	/* level 0~3 */
43 			u8 duty_cycle;
44 		} __packed duty;
45 	};
46 } __packed;
47 
48 struct mt7996_mcu_thermal_enable {
49 	__le32 trigger_temp;
50 	__le32 restore_temp;
51 	__le16 sustain_time;
52 	u8 rsv[2];
53 } __packed;
54 
55 struct mt7996_mcu_countdown_notify {
56 	u8 omac_idx;
57 	u8 count;
58 	u8 csa_failure_reason; /* 0: success, 1: beacon disabled */
59 	u8 rsv;
60 } __packed;
61 
62 struct mt7996_mcu_rdd_report {
63 	struct mt7996_mcu_rxd rxd;
64 
65 	u8 __rsv1[4];
66 
67 	__le16 tag;
68 	__le16 len;
69 
70 	u8 rdd_idx;
71 	u8 long_detected;
72 	u8 constant_prf_detected;
73 	u8 staggered_prf_detected;
74 	u8 radar_type_idx;
75 	u8 periodic_pulse_num;
76 	u8 long_pulse_num;
77 	u8 hw_pulse_num;
78 
79 	u8 out_lpn;
80 	u8 out_spn;
81 	u8 out_crpn;
82 	u8 out_crpw;
83 	u8 out_crbn;
84 	u8 out_stgpn;
85 	u8 out_stgpw;
86 
87 	u8 __rsv2;
88 
89 	__le32 out_pri_const;
90 	__le32 out_pri_stg[3];
91 	__le32 out_pri_stg_dmin;
92 
93 	struct {
94 		__le32 start;
95 		__le16 pulse_width;
96 		__le16 pulse_power;
97 		u8 mdrdy_flag;
98 		u8 rsv[3];
99 	} long_pulse[32];
100 
101 	struct {
102 		__le32 start;
103 		__le16 pulse_width;
104 		__le16 pulse_power;
105 		u8 mdrdy_flag;
106 		u8 rsv[3];
107 	} periodic_pulse[32];
108 
109 	struct {
110 		__le32 start;
111 		__le16 pulse_width;
112 		__le16 pulse_power;
113 		u8 sc_pass;
114 		u8 sw_reset;
115 		u8 mdrdy_flag;
116 		u8 tx_active;
117 	} hw_pulse[32];
118 } __packed;
119 
120 struct mt7996_mcu_background_chain_ctrl {
121 	u8 _rsv[4];
122 
123 	__le16 tag;
124 	__le16 len;
125 
126 	u8 chan;		/* primary channel */
127 	u8 central_chan;	/* central channel */
128 	u8 bw;
129 	u8 tx_stream;
130 	u8 rx_stream;
131 
132 	u8 monitor_chan;	/* monitor channel */
133 	u8 monitor_central_chan;/* monitor central channel */
134 	u8 monitor_bw;
135 	u8 monitor_tx_stream;
136 	u8 monitor_rx_stream;
137 
138 	u8 scan_mode;		/* 0: ScanStop
139 				 * 1: ScanStart
140 				 * 2: ScanRunning
141 				 */
142 	u8 band_idx;		/* DBDC */
143 	u8 monitor_scan_type;
144 	u8 band;		/* 0: 2.4GHz, 1: 5GHz */
145 	u8 rsv[2];
146 } __packed;
147 
148 struct mt7996_mcu_eeprom_update {
149 	u8 _rsv[4];
150 
151 	__le16 tag;
152 	__le16 len;
153 	u8 buffer_mode;
154 	u8 format;
155 	__le16 buf_len;
156 } __packed;
157 
158 union eeprom_data {
159 	struct {
160 		__le32 data_len;
161 		DECLARE_FLEX_ARRAY(u8, data);
162 	} ext_eeprom;
163 	DECLARE_FLEX_ARRAY(u8, efuse);
164 } __packed;
165 
166 struct mt7996_mcu_eeprom_info {
167 	u8 _rsv[4];
168 
169 	__le16 tag;
170 	__le16 len;
171 	__le32 addr;
172 	__le32 valid;
173 } __packed;
174 
175 struct mt7996_mcu_eeprom_access {
176 	struct mt7996_mcu_eeprom_info info;
177 	union eeprom_data eeprom;
178 } __packed;
179 
180 struct mt7996_mcu_eeprom_access_event {
181 	u8 _rsv[4];
182 
183 	__le16 tag;
184 	__le16 len;
185 	__le32 version;
186 	__le32 addr;
187 	__le32 valid;
188 	__le32 size;
189 	__le32 magic_no;
190 	__le32 type;
191 	__le32 rsv[4];
192 	union eeprom_data eeprom;
193 } __packed;
194 
195 struct mt7996_mcu_phy_rx_info {
196 	u8 category;
197 	u8 rate;
198 	u8 mode;
199 	u8 nsts;
200 	u8 gi;
201 	u8 coding;
202 	u8 stbc;
203 	u8 bw;
204 };
205 
206 struct mt7996_mcu_mib {
207 	__le16 tag;
208 	__le16 len;
209 	__le32 offs;
210 	__le64 data;
211 } __packed;
212 
213 struct all_sta_trx_rate {
214 	__le16 wlan_idx;
215 	u8 __rsv1[2];
216 	u8 tx_mode;
217 	u8 flags;
218 	u8 tx_stbc;
219 	u8 tx_gi;
220 	u8 tx_bw;
221 	u8 tx_ldpc;
222 	u8 tx_mcs;
223 	u8 tx_nss;
224 	u8 rx_rate;
225 	u8 rx_mode;
226 	u8 rx_nsts;
227 	u8 rx_gi;
228 	u8 rx_coding;
229 	u8 rx_stbc;
230 	u8 rx_bw;
231 	u8 __rsv2;
232 } __packed;
233 
234 struct mt7996_mcu_all_sta_info_event {
235 	u8 rsv[4];
236 	__le16 tag;
237 	__le16 len;
238 	u8 more;
239 	u8 rsv2;
240 	__le16 sta_num;
241 	u8 rsv3[4];
242 
243 	union {
244 		DECLARE_FLEX_ARRAY(struct all_sta_trx_rate, rate);
245 		DECLARE_FLEX_ARRAY(struct {
246 			__le16 wlan_idx;
247 			u8 rsv[2];
248 			__le32 tx_bytes[IEEE80211_NUM_ACS];
249 			__le32 rx_bytes[IEEE80211_NUM_ACS];
250 		} __packed, adm_stat);
251 
252 		DECLARE_FLEX_ARRAY(struct {
253 			__le16 wlan_idx;
254 			u8 rsv[2];
255 			__le32 tx_msdu_cnt;
256 			__le32 rx_msdu_cnt;
257 		} __packed, msdu_cnt);
258 	} __packed;
259 } __packed;
260 
261 struct mt7996_mcu_wed_rro_event {
262 	struct mt7996_mcu_rxd rxd;
263 
264 	u8 __rsv1[4];
265 
266 	__le16 tag;
267 	__le16 len;
268 } __packed;
269 
270 struct mt7996_mcu_wed_rro_ba_event {
271 	__le16 tag;
272 	__le16 len;
273 
274 	__le16 wlan_id;
275 	u8 tid;
276 	u8 __rsv1;
277 	__le32 status;
278 	__le16 id;
279 	u8 __rsv2[2];
280 } __packed;
281 
282 struct mt7996_mcu_wed_rro_ba_delete_event {
283 	__le16 tag;
284 	__le16 len;
285 
286 	__le16 session_id;
287 	u8 __rsv2[2];
288 } __packed;
289 
290 enum  {
291 	UNI_WED_RRO_BA_SESSION_STATUS,
292 	UNI_WED_RRO_BA_SESSION_TBL,
293 	UNI_WED_RRO_BA_SESSION_DELETE,
294 };
295 
296 struct mt7996_mcu_ps_sync_event {
297 	struct mt7996_mcu_rxd rxd;
298 
299 	u8 bss_idx;
300 	u8 __rsv[3];
301 } __packed;
302 
303 struct mt7996_mcu_ps_client_info {
304 	__le16 tag;
305 	__le16 len;
306 	u8 ps_bit;
307 	u8 __rsv;
308 	__le16 wlan_idx;
309 	u8 buffer_size;
310 	u8 __rsv2[3];
311 } __packed;
312 
313 struct mt7996_mcu_ps_multi_client_info {
314 	__le16 tag;
315 	__le16 len;
316 	__le16 sta_cnt;
317 	__le16 sta_ps_info[];
318 } __packed;
319 
320 #define MT7996_PS_MULTI_WCID	GENMASK(10, 0)
321 #define MT7996_PS_MULTI_PS_BIT	BIT(15)
322 
323 enum {
324 	UNI_PS_CLIENT_INFO = 0,
325 	UNI_PS_MULTI_CLIENT_INFO = 1,
326 	UNI_PS_MULTI_CLIENT_INFO_BITMAP = 2,
327 };
328 
329 struct mt7996_mcu_thermal_notify {
330 	struct mt7996_mcu_rxd rxd;
331 
332 	u8 __rsv1[4];
333 
334 	__le16 tag;
335 	__le16 len;
336 
337 	u8 event_id;
338 	u8 band_idx;
339 	u8 level_idx;
340 	u8 duty_percent;
341 	__le32 restore_temp;
342 	u8 __rsv2[4];
343 } __packed;
344 
345 enum mt7996_chan_mib_offs {
346 	UNI_MIB_OBSS_AIRTIME = 26,
347 	UNI_MIB_NON_WIFI_TIME = 27,
348 	UNI_MIB_TX_TIME = 28,
349 	UNI_MIB_RX_TIME = 29
350 };
351 
352 struct edca {
353 	__le16 tag;
354 	__le16 len;
355 
356 	u8 queue;
357 	u8 set;
358 	u8 cw_min;
359 	u8 cw_max;
360 	__le16 txop;
361 	u8 aifs;
362 	u8 __rsv;
363 };
364 
365 #define MCU_PQ_ID(p, q)			(((p) << 15) | ((q) << 10))
366 #define MCU_PKT_ID			0xa0
367 
368 enum {
369 	MCU_FW_LOG_WM,
370 	MCU_FW_LOG_WA,
371 	MCU_FW_LOG_TO_HOST,
372 	MCU_FW_LOG_RELAY = 16
373 };
374 
375 enum {
376 	MCU_TWT_AGRT_ADD,
377 	MCU_TWT_AGRT_MODIFY,
378 	MCU_TWT_AGRT_DELETE,
379 	MCU_TWT_AGRT_TEARDOWN,
380 	MCU_TWT_AGRT_GET_TSF,
381 };
382 
383 enum {
384 	MCU_WA_PARAM_CMD_QUERY,
385 	MCU_WA_PARAM_CMD_SET,
386 	MCU_WA_PARAM_CMD_CAPABILITY,
387 	MCU_WA_PARAM_CMD_DEBUG,
388 };
389 
390 enum {
391 	MCU_WA_PARAM_PDMA_RX = 0x04,
392 	MCU_WA_PARAM_CPU_UTIL = 0x0b,
393 	MCU_WA_PARAM_RED = 0x0e,
394 	MCU_WA_PARAM_HW_PATH_HIF_VER = 0x2f,
395 };
396 
397 enum mcu_mmps_mode {
398 	MCU_MMPS_STATIC,
399 	MCU_MMPS_DYNAMIC,
400 	MCU_MMPS_RSV,
401 	MCU_MMPS_DISABLE,
402 };
403 
404 struct bss_rate_tlv {
405 	__le16 tag;
406 	__le16 len;
407 	u8 __rsv1[4];
408 	__le16 bc_trans;
409 	__le16 mc_trans;
410 	u8 short_preamble;
411 	u8 bc_fixed_rate;
412 	u8 mc_fixed_rate;
413 	u8 __rsv2[9];
414 } __packed;
415 
416 enum {
417 	BP_DISABLE,
418 	BP_SW_MODE,
419 	BP_HW_MODE,
420 };
421 
422 struct bss_ra_tlv {
423 	__le16 tag;
424 	__le16 len;
425 	u8 short_preamble;
426 	u8 force_sgi;
427 	u8 force_gf;
428 	u8 ht_mode;
429 	u8 se_off;
430 	u8 antenna_idx;
431 	__le16 max_phyrate;
432 	u8 force_tx_streams;
433 	u8 __rsv[3];
434 } __packed;
435 
436 struct bss_rlm_tlv {
437 	__le16 tag;
438 	__le16 len;
439 	u8 control_channel;
440 	u8 center_chan;
441 	u8 center_chan2;
442 	u8 bw;
443 	u8 tx_streams;
444 	u8 rx_streams;
445 	u8 ht_op_info;
446 	u8 sco;
447 	u8 band;
448 	u8 __rsv[3];
449 } __packed;
450 
451 struct bss_color_tlv {
452 	__le16 tag;
453 	__le16 len;
454 	u8 enable;
455 	u8 color;
456 	u8 rsv[2];
457 } __packed;
458 
459 struct bss_inband_discovery_tlv {
460 	__le16 tag;
461 	__le16 len;
462 	u8 tx_type;
463 	u8 tx_mode;
464 	u8 tx_interval;
465 	u8 enable;
466 	__le16 wcid;
467 	__le16 prob_rsp_len;
468 } __packed;
469 
470 struct bss_bcn_content_tlv {
471 	__le16 tag;
472 	__le16 len;
473 	__le16 tim_ie_pos;
474 	__le16 csa_ie_pos;
475 	__le16 bcc_ie_pos;
476 	u8 enable;
477 	u8 type;
478 	__le16 pkt_len;
479 } __packed;
480 
481 struct bss_bcn_cntdwn_tlv {
482 	__le16 tag;
483 	__le16 len;
484 	u8 cnt;
485 	union {
486 		struct {
487 			bool static_pp;
488 			bool abort;
489 		} csa;
490 		struct {
491 			bool abort;
492 		} cca;
493 	};
494 	u8 rsv;
495 } __packed;
496 
497 struct bss_bcn_mbss_tlv {
498 	__le16 tag;
499 	__le16 len;
500 	__le32 bitmap;
501 #define MAX_BEACON_NUM	32
502 	__le16 offset[MAX_BEACON_NUM];
503 } __packed __aligned(4);
504 
505 struct bss_txcmd_tlv {
506 	__le16 tag;
507 	__le16 len;
508 	u8 txcmd_mode;
509 	u8 __rsv[3];
510 } __packed;
511 
512 struct bss_sec_tlv {
513 	__le16 tag;
514 	__le16 len;
515 	u8 __rsv1[2];
516 	u8 cipher;
517 	u8 __rsv2[1];
518 } __packed;
519 
520 struct bss_ifs_time_tlv {
521 	__le16 tag;
522 	__le16 len;
523 	u8 slot_valid;
524 	u8 sifs_valid;
525 	u8 rifs_valid;
526 	u8 eifs_valid;
527 	__le16 slot_time;
528 	__le16 sifs_time;
529 	__le16 rifs_time;
530 	__le16 eifs_time;
531 	u8 eifs_cck_valid;
532 	u8 rsv;
533 	__le16 eifs_cck_time;
534 } __packed;
535 
536 struct bss_power_save {
537 	__le16 tag;
538 	__le16 len;
539 	u8 profile;
540 	u8 _rsv[3];
541 } __packed;
542 
543 struct bss_mld_tlv {
544 	__le16 tag;
545 	__le16 len;
546 	u8 group_mld_id;
547 	u8 own_mld_id;
548 	u8 mac_addr[ETH_ALEN];
549 	u8 remap_idx;
550 	u8 link_id;
551 	u8 __rsv[2];
552 } __packed;
553 
554 struct bss_prot_tlv {
555 	__le16 tag;
556 	__le16 len;
557 	__le32 prot_mode;
558 } __packed;
559 
560 struct bss_mld_link_op_tlv {
561 	__le16 tag;
562 	__le16 len;
563 	u8 group_mld_id;
564 	u8 own_mld_id;
565 	u8 mac_addr[ETH_ALEN];
566 	u8 remap_idx;
567 	u8 link_operation;
568 	u8 link_id;
569 	u8 rsv[2];
570 } __packed;
571 
572 struct sta_rec_ht_uni {
573 	__le16 tag;
574 	__le16 len;
575 	__le16 ht_cap;
576 	__le16 ht_cap_ext;
577 	u8 ampdu_param;
578 	u8 _rsv[3];
579 } __packed;
580 
581 struct sta_rec_ba_uni {
582 	__le16 tag;
583 	__le16 len;
584 	u8 tid;
585 	u8 ba_type;
586 	u8 amsdu;
587 	u8 ba_en;
588 	__le16 ssn;
589 	__le16 winsize;
590 	u8 ba_rdd_rro;
591 	u8 __rsv[3];
592 } __packed;
593 
594 struct sta_rec_eht {
595 	__le16 tag;
596 	__le16 len;
597 	u8 tid_bitmap;
598 	u8 _rsv;
599 	__le16 mac_cap;
600 	__le64 phy_cap;
601 	__le64 phy_cap_ext;
602 	u8 mcs_map_bw20[4];
603 	u8 mcs_map_bw80[3];
604 	u8 mcs_map_bw160[3];
605 	u8 mcs_map_bw320[3];
606 	u8 _rsv2[3];
607 } __packed;
608 
609 struct sec_key_uni {
610 	__le16 wlan_idx;
611 	u8 mgmt_prot;
612 	u8 cipher_id;
613 	u8 cipher_len;
614 	u8 key_id;
615 	u8 key_len;
616 	u8 need_resp;
617 	u8 key[32];
618 	u8 pn[6];
619 	u8 bcn_mode;
620 	u8 _rsv;
621 } __packed;
622 
623 struct sta_rec_sec_uni {
624 	__le16 tag;
625 	__le16 len;
626 	u8 add;
627 	u8 n_cipher;
628 	u8 rsv[2];
629 
630 	struct sec_key_uni key[2];
631 } __packed;
632 
633 struct sta_phy_uni {
634 	u8 type;
635 	u8 flag;
636 	u8 stbc;
637 	u8 sgi;
638 	u8 bw;
639 	u8 ldpc;
640 	u8 mcs;
641 	u8 nss;
642 	u8 he_ltf;
643 	u8 rsv[3];
644 };
645 
646 struct sta_rec_ra_uni {
647 	__le16 tag;
648 	__le16 len;
649 
650 	u8 valid;
651 	u8 auto_rate;
652 	u8 phy_mode;
653 	u8 channel;
654 	u8 bw;
655 	u8 disable_cck;
656 	u8 ht_mcs32;
657 	u8 ht_gf;
658 	u8 ht_mcs[4];
659 	u8 mmps_mode;
660 	u8 gband_256;
661 	u8 af;
662 	u8 auth_wapi_mode;
663 	u8 rate_len;
664 
665 	u8 supp_mode;
666 	u8 supp_cck_rate;
667 	u8 supp_ofdm_rate;
668 	__le32 supp_ht_mcs;
669 	__le16 supp_vht_mcs[4];
670 
671 	u8 op_mode;
672 	u8 op_vht_chan_width;
673 	u8 op_vht_rx_nss;
674 	u8 op_vht_rx_nss_type;
675 
676 	__le32 sta_cap;
677 
678 	struct sta_phy_uni phy;
679 	u8 rx_rcpi[4];
680 } __packed;
681 
682 struct sta_rec_ra_fixed_uni {
683 	__le16 tag;
684 	__le16 len;
685 
686 	__le32 field;
687 	u8 op_mode;
688 	u8 op_vht_chan_width;
689 	u8 op_vht_rx_nss;
690 	u8 op_vht_rx_nss_type;
691 
692 	struct sta_phy_uni phy;
693 
694 	u8 spe_idx;
695 	u8 short_preamble;
696 	u8 is_5g;
697 	u8 mmps_mode;
698 } __packed;
699 
700 struct sta_rec_hdrt {
701 	__le16 tag;
702 	__le16 len;
703 	u8 hdrt_mode;
704 	u8 rsv[3];
705 } __packed;
706 
707 struct sta_rec_hdr_trans {
708 	__le16 tag;
709 	__le16 len;
710 	u8 from_ds;
711 	u8 to_ds;
712 	u8 dis_rx_hdr_tran;
713 	u8 mesh;
714 } __packed;
715 
716 struct sta_rec_ps_leave {
717 	__le16 tag;
718 	__le16 len;
719 	u8 __rsv[4];
720 } __packed;
721 
722 struct sta_rec_mld_setup {
723 	__le16 tag;
724 	__le16 len;
725 	u8 mld_addr[ETH_ALEN];
726 	__le16 primary_id;
727 	__le16 seconed_id;
728 	__le16 setup_wcid;
729 	u8 link_num;
730 	u8 info;
731 	u8 __rsv[2];
732 	u8 link_info[];
733 } __packed;
734 
735 struct sta_rec_eht_mld {
736 	__le16 tag;
737 	__le16 len;
738 	u8 nsep;
739 	u8 __rsv1[2];
740 	u8 str_cap[__MT_MAX_BAND];
741 	__le16 eml_cap;
742 	u8 __rsv2[4];
743 } __packed;
744 
745 struct mld_setup_link {
746 	__le16 wcid;
747 	u8 bss_idx;
748 	u8 __rsv;
749 } __packed;
750 
751 struct mld_req_hdr {
752 	u8 ver;
753 	u8 mld_addr[ETH_ALEN];
754 	u8 mld_idx;
755 	u8 flag;
756 	u8 rsv[3];
757 	u8 buf[];
758 } __packed;
759 
760 struct mld_reconf_stop_link {
761 	__le16 tag;
762 	__le16 len;
763 	__le16 link_bitmap;
764 	u8 rsv[2];
765 	u8 bss_idx[16];
766 } __packed;
767 
768 enum {
769 	UNI_CMD_MLD_RECONF_AP_REM_TIMER = 0x03,
770 	UNI_CMD_MLD_RECONF_STOP_LINK = 0x04,
771 };
772 
773 struct hdr_trans_en {
774 	__le16 tag;
775 	__le16 len;
776 	u8 enable;
777 	u8 check_bssid;
778 	u8 mode;
779 	u8 __rsv;
780 } __packed;
781 
782 struct hdr_trans_vlan {
783 	__le16 tag;
784 	__le16 len;
785 	u8 insert_vlan;
786 	u8 remove_vlan;
787 	u8 tid;
788 	u8 __rsv;
789 } __packed;
790 
791 struct hdr_trans_blacklist {
792 	__le16 tag;
793 	__le16 len;
794 	u8 idx;
795 	u8 enable;
796 	__le16 type;
797 } __packed;
798 
799 struct uni_header {
800 	u8 __rsv[4];
801 } __packed;
802 
803 struct vow_rx_airtime {
804 	__le16 tag;
805 	__le16 len;
806 
807 	u8 enable;
808 	u8 band;
809 	u8 __rsv[2];
810 } __packed;
811 
812 struct bf_sounding_on {
813 	__le16 tag;
814 	__le16 len;
815 
816 	u8 snd_mode;
817 	u8 sta_num;
818 	u8 __rsv[2];
819 	__le16 wlan_id[4];
820 	__le32 snd_period;
821 } __packed;
822 
823 struct bf_hw_en_status_update {
824 	__le16 tag;
825 	__le16 len;
826 
827 	bool ebf;
828 	bool ibf;
829 	u8 __rsv[2];
830 } __packed;
831 
832 struct bf_mod_en_ctrl {
833 	__le16 tag;
834 	__le16 len;
835 
836 	u8 bf_num;
837 	u8 bf_bitmap;
838 	u8 bf_sel[8];
839 	u8 __rsv[2];
840 } __packed;
841 
842 union bf_tag_tlv {
843 	struct bf_sounding_on bf_snd;
844 	struct bf_hw_en_status_update bf_hw_en;
845 	struct bf_mod_en_ctrl bf_mod_en;
846 };
847 
848 struct ra_rate {
849 	__le16 wlan_idx;
850 	u8 mode;
851 	u8 stbc;
852 	__le16 gi;
853 	u8 bw;
854 	u8 ldpc;
855 	u8 mcs;
856 	u8 nss;
857 	__le16 ltf;
858 	u8 spe;
859 	u8 preamble;
860 	u8 __rsv[2];
861 } __packed;
862 
863 struct ra_fixed_rate {
864 	__le16 tag;
865 	__le16 len;
866 
867 	__le16 version;
868 	struct ra_rate rate;
869 } __packed;
870 
871 enum {
872 	UNI_RA_FIXED_RATE = 0xf,
873 };
874 
875 #define MT7996_HDR_TRANS_MAX_SIZE	(sizeof(struct hdr_trans_en) +	 \
876 					 sizeof(struct hdr_trans_vlan) + \
877 					 sizeof(struct hdr_trans_blacklist))
878 
879 enum {
880 	UNI_HDR_TRANS_EN,
881 	UNI_HDR_TRANS_VLAN,
882 	UNI_HDR_TRANS_BLACKLIST,
883 };
884 
885 enum {
886 	RATE_PARAM_FIXED = 3,
887 	RATE_PARAM_MMPS_UPDATE = 5,
888 	RATE_PARAM_FIXED_HE_LTF = 7,
889 	RATE_PARAM_FIXED_MCS,
890 	RATE_PARAM_FIXED_GI = 11,
891 	RATE_PARAM_AUTO = 20,
892 };
893 
894 enum {
895 	BF_SOUNDING_ON = 1,
896 	BF_HW_EN_UPDATE = 17,
897 	BF_MOD_EN_CTRL = 20,
898 };
899 
900 enum {
901 	CMD_BAND_NONE,
902 	CMD_BAND_24G,
903 	CMD_BAND_5G,
904 	CMD_BAND_6G,
905 };
906 
907 struct bss_req_hdr {
908 	u8 bss_idx;
909 	u8 __rsv[3];
910 } __packed;
911 
912 enum {
913 	UNI_CHANNEL_SWITCH,
914 	UNI_CHANNEL_RX_PATH,
915 };
916 
917 enum {
918 	UNI_CHIP_CONFIG_NIC_CAPA = 3,
919 	UNI_CHIP_CONFIG_DUP_WTBL = 4,
920 };
921 
922 #define MT7996_BSS_UPDATE_MAX_SIZE	(sizeof(struct bss_req_hdr) +		\
923 					 sizeof(struct mt76_connac_bss_basic_tlv) +	\
924 					 sizeof(struct bss_rlm_tlv) +		\
925 					 sizeof(struct bss_ra_tlv) +		\
926 					 sizeof(struct bss_info_uni_he) +	\
927 					 sizeof(struct bss_rate_tlv) +		\
928 					 sizeof(struct bss_txcmd_tlv) +		\
929 					 sizeof(struct bss_power_save) +	\
930 					 sizeof(struct bss_sec_tlv) +		\
931 					 sizeof(struct bss_ifs_time_tlv) +	\
932 					 sizeof(struct bss_mld_tlv))
933 
934 #define MT7996_STA_UPDATE_MAX_SIZE	(sizeof(struct sta_req_hdr) +		\
935 					 sizeof(struct sta_rec_basic) +		\
936 					 sizeof(struct sta_rec_bf) +		\
937 					 sizeof(struct sta_rec_ht_uni) +	\
938 					 sizeof(struct sta_rec_he_v2) +		\
939 					 sizeof(struct sta_rec_ba_uni) +	\
940 					 sizeof(struct sta_rec_vht) +		\
941 					 sizeof(struct sta_rec_uapsd) + 	\
942 					 sizeof(struct sta_rec_amsdu) +		\
943 					 sizeof(struct sta_rec_bfee) +		\
944 					 sizeof(struct sta_rec_ra_uni) +	\
945 					 sizeof(struct sta_rec_sec) +		\
946 					 sizeof(struct sta_rec_ra_fixed_uni) +	\
947 					 sizeof(struct sta_rec_he_6g_capa) +	\
948 					 sizeof(struct sta_rec_eht) +		\
949 					 sizeof(struct sta_rec_hdrt) +		\
950 					 sizeof(struct sta_rec_hdr_trans) +	\
951 					 sizeof(struct sta_rec_mld_setup) +	\
952 					 sizeof(struct mld_setup_link) * 3 +	\
953 					 sizeof(struct sta_rec_eht_mld) +	\
954 					 sizeof(struct tlv))
955 
956 #define MT7996_BEACON_UPDATE_SIZE	(sizeof(struct bss_req_hdr) +		\
957 					 sizeof(struct bss_bcn_content_tlv) +	\
958 					 4 + MT_TXD_SIZE +			\
959 					 sizeof(struct bss_bcn_cntdwn_tlv) * 2 +	\
960 					 sizeof(struct bss_bcn_mbss_tlv))
961 #define MT7996_MAX_BSS_OFFLOAD_SIZE	2048
962 #define MT7996_MAX_BEACON_SIZE		(MT7996_MAX_BSS_OFFLOAD_SIZE - \
963 					 MT7996_BEACON_UPDATE_SIZE)
964 
965 enum {
966 	UNI_BAND_CONFIG_RADIO_ENABLE,
967 	UNI_BAND_CONFIG_RTS_THRESHOLD = 0x08,
968 	UNI_BAND_CONFIG_MAC_ENABLE_CTRL = 0x0c,
969 	UNI_BAND_CONFIG_BSSID_MAPPING_ADDR = 0x12,
970 };
971 
972 enum {
973 	UNI_WSYS_CONFIG_FW_LOG_CTRL,
974 	UNI_WSYS_CONFIG_FW_DBG_CTRL,
975 };
976 
977 enum {
978 	UNI_RDD_CTRL_PARM,
979 	UNI_RDD_CTRL_SET_TH = 0x3,
980 };
981 
982 enum {
983 	UNI_EFUSE_ACCESS = 1,
984 	UNI_EFUSE_BUFFER_MODE,
985 	UNI_EFUSE_FREE_BLOCK,
986 	UNI_EFUSE_BUFFER_RD,
987 };
988 
989 enum {
990 	UNI_EXT_EEPROM_ACCESS = 1,
991 };
992 
993 enum {
994 	UNI_VOW_DRR_CTRL,
995 	UNI_VOW_RX_AT_AIRTIME_EN = 0x0b,
996 	UNI_VOW_RX_AT_AIRTIME_CLR_EN = 0x0e,
997 };
998 
999 enum {
1000 	UNI_CMD_MIB_DATA,
1001 };
1002 
1003 enum {
1004 	UNI_POWER_OFF,
1005 };
1006 
1007 enum {
1008 	UNI_CMD_TWT_ARGT_UPDATE = 0x0,
1009 	UNI_CMD_TWT_MGMT_OFFLOAD,
1010 };
1011 
1012 enum {
1013 	UNI_RRO_DEL_ENTRY = 0x1,
1014 	UNI_RRO_SET_PLATFORM_TYPE,
1015 	UNI_RRO_GET_BA_SESSION_TABLE,
1016 	UNI_RRO_SET_BYPASS_MODE,
1017 	UNI_RRO_SET_TXFREE_PATH,
1018 	UNI_RRO_DEL_BA_SESSION,
1019 	UNI_RRO_SET_FLUSH_TIMEOUT
1020 };
1021 
1022 enum{
1023 	UNI_CMD_SR_ENABLE = 0x1,
1024 	UNI_CMD_SR_ENABLE_SD,
1025 	UNI_CMD_SR_ENABLE_MODE,
1026 	UNI_CMD_SR_ENABLE_DPD = 0x12,
1027 	UNI_CMD_SR_ENABLE_TX,
1028 	UNI_CMD_SR_SET_SRG_BITMAP = 0x80,
1029 	UNI_CMD_SR_SET_PARAM = 0xc1,
1030 	UNI_CMD_SR_SET_SIGA = 0xd0,
1031 };
1032 
1033 enum {
1034 	UNI_CMD_THERMAL_PROTECT_ENABLE = 0x6,
1035 	UNI_CMD_THERMAL_PROTECT_DISABLE,
1036 	UNI_CMD_THERMAL_PROTECT_DUTY_CONFIG,
1037 };
1038 
1039 enum {
1040 	UNI_TXPOWER_POWER_LIMIT_TABLE_CTRL = 4,
1041 };
1042 
1043 enum {
1044 	UNI_CMD_ACCESS_REG_BASIC = 0x0,
1045 	UNI_CMD_ACCESS_RF_REG_BASIC,
1046 };
1047 
1048 enum {
1049 	UNI_CMD_SER_QUERY,
1050 	/* recovery */
1051 	UNI_CMD_SER_SET_RECOVER_L1,
1052 	UNI_CMD_SER_SET_RECOVER_L2,
1053 	UNI_CMD_SER_SET_RECOVER_L3_RX_ABORT,
1054 	UNI_CMD_SER_SET_RECOVER_L3_TX_ABORT,
1055 	UNI_CMD_SER_SET_RECOVER_L3_TX_DISABLE,
1056 	UNI_CMD_SER_SET_RECOVER_L3_BF,
1057 	UNI_CMD_SER_SET_RECOVER_L4_MDP,
1058 	UNI_CMD_SER_SET_RECOVER_FROM_ETH,
1059 	UNI_CMD_SER_SET_RECOVER_FULL = 8,
1060 	UNI_CMD_SER_SET_SYSTEM_ASSERT,
1061 	/* action */
1062 	UNI_CMD_SER_ENABLE = 1,
1063 	UNI_CMD_SER_SET,
1064 	UNI_CMD_SER_TRIGGER
1065 };
1066 
1067 enum {
1068 	UNI_CMD_SDO_SET = 1,
1069 	UNI_CMD_SDO_QUERY,
1070 	UNI_CMD_SDO_CP_MODE = 6,
1071 };
1072 
1073 enum {
1074 	MT7996_SEC_MODE_PLAIN,
1075 	MT7996_SEC_MODE_AES,
1076 	MT7996_SEC_MODE_SCRAMBLE,
1077 	MT7996_SEC_MODE_MAX,
1078 };
1079 
1080 #define MT7996_PATCH_SEC		GENMASK(31, 24)
1081 #define MT7996_PATCH_SCRAMBLE_KEY	GENMASK(15, 8)
1082 #define MT7996_PATCH_AES_KEY		GENMASK(7, 0)
1083 
1084 #define MT7996_SEC_ENCRYPT		BIT(0)
1085 #define MT7996_SEC_KEY_IDX		GENMASK(2, 1)
1086 #define MT7996_SEC_IV			BIT(3)
1087 
1088 struct fixed_rate_table_ctrl {
1089 	u8 _rsv[4];
1090 
1091 	__le16 tag;
1092 	__le16 len;
1093 
1094 	u8 table_idx;
1095 	u8 antenna_idx;
1096 	__le16 rate_idx;
1097 	u8 spe_idx_sel;
1098 	u8 spe_idx;
1099 	u8 gi;
1100 	u8 he_ltf;
1101 	bool ldpc;
1102 	bool txbf;
1103 	bool dynamic_bw;
1104 
1105 	u8 _rsv2;
1106 } __packed;
1107 
1108 #endif
1109