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