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_thermal_notify { 297 struct mt7996_mcu_rxd rxd; 298 299 u8 __rsv1[4]; 300 301 __le16 tag; 302 __le16 len; 303 304 u8 event_id; 305 u8 band_idx; 306 u8 level_idx; 307 u8 duty_percent; 308 __le32 restore_temp; 309 u8 __rsv2[4]; 310 } __packed; 311 312 enum mt7996_chan_mib_offs { 313 UNI_MIB_OBSS_AIRTIME = 26, 314 UNI_MIB_NON_WIFI_TIME = 27, 315 UNI_MIB_TX_TIME = 28, 316 UNI_MIB_RX_TIME = 29 317 }; 318 319 struct edca { 320 __le16 tag; 321 __le16 len; 322 323 u8 queue; 324 u8 set; 325 u8 cw_min; 326 u8 cw_max; 327 __le16 txop; 328 u8 aifs; 329 u8 __rsv; 330 }; 331 332 #define MCU_PQ_ID(p, q) (((p) << 15) | ((q) << 10)) 333 #define MCU_PKT_ID 0xa0 334 335 enum { 336 MCU_FW_LOG_WM, 337 MCU_FW_LOG_WA, 338 MCU_FW_LOG_TO_HOST, 339 MCU_FW_LOG_RELAY = 16 340 }; 341 342 enum { 343 MCU_TWT_AGRT_ADD, 344 MCU_TWT_AGRT_MODIFY, 345 MCU_TWT_AGRT_DELETE, 346 MCU_TWT_AGRT_TEARDOWN, 347 MCU_TWT_AGRT_GET_TSF, 348 }; 349 350 enum { 351 MCU_WA_PARAM_CMD_QUERY, 352 MCU_WA_PARAM_CMD_SET, 353 MCU_WA_PARAM_CMD_CAPABILITY, 354 MCU_WA_PARAM_CMD_DEBUG, 355 }; 356 357 enum { 358 MCU_WA_PARAM_PDMA_RX = 0x04, 359 MCU_WA_PARAM_CPU_UTIL = 0x0b, 360 MCU_WA_PARAM_RED = 0x0e, 361 MCU_WA_PARAM_HW_PATH_HIF_VER = 0x2f, 362 }; 363 364 enum mcu_mmps_mode { 365 MCU_MMPS_STATIC, 366 MCU_MMPS_DYNAMIC, 367 MCU_MMPS_RSV, 368 MCU_MMPS_DISABLE, 369 }; 370 371 struct bss_rate_tlv { 372 __le16 tag; 373 __le16 len; 374 u8 __rsv1[4]; 375 __le16 bc_trans; 376 __le16 mc_trans; 377 u8 short_preamble; 378 u8 bc_fixed_rate; 379 u8 mc_fixed_rate; 380 u8 __rsv2[9]; 381 } __packed; 382 383 enum { 384 BP_DISABLE, 385 BP_SW_MODE, 386 BP_HW_MODE, 387 }; 388 389 struct bss_ra_tlv { 390 __le16 tag; 391 __le16 len; 392 u8 short_preamble; 393 u8 force_sgi; 394 u8 force_gf; 395 u8 ht_mode; 396 u8 se_off; 397 u8 antenna_idx; 398 __le16 max_phyrate; 399 u8 force_tx_streams; 400 u8 __rsv[3]; 401 } __packed; 402 403 struct bss_rlm_tlv { 404 __le16 tag; 405 __le16 len; 406 u8 control_channel; 407 u8 center_chan; 408 u8 center_chan2; 409 u8 bw; 410 u8 tx_streams; 411 u8 rx_streams; 412 u8 ht_op_info; 413 u8 sco; 414 u8 band; 415 u8 __rsv[3]; 416 } __packed; 417 418 struct bss_color_tlv { 419 __le16 tag; 420 __le16 len; 421 u8 enable; 422 u8 color; 423 u8 rsv[2]; 424 } __packed; 425 426 struct bss_inband_discovery_tlv { 427 __le16 tag; 428 __le16 len; 429 u8 tx_type; 430 u8 tx_mode; 431 u8 tx_interval; 432 u8 enable; 433 __le16 wcid; 434 __le16 prob_rsp_len; 435 } __packed; 436 437 struct bss_bcn_content_tlv { 438 __le16 tag; 439 __le16 len; 440 __le16 tim_ie_pos; 441 __le16 csa_ie_pos; 442 __le16 bcc_ie_pos; 443 u8 enable; 444 u8 type; 445 __le16 pkt_len; 446 } __packed; 447 448 struct bss_bcn_cntdwn_tlv { 449 __le16 tag; 450 __le16 len; 451 u8 cnt; 452 union { 453 struct { 454 bool static_pp; 455 bool abort; 456 } csa; 457 struct { 458 bool abort; 459 } cca; 460 }; 461 u8 rsv; 462 } __packed; 463 464 struct bss_bcn_mbss_tlv { 465 __le16 tag; 466 __le16 len; 467 __le32 bitmap; 468 #define MAX_BEACON_NUM 32 469 __le16 offset[MAX_BEACON_NUM]; 470 } __packed __aligned(4); 471 472 struct bss_txcmd_tlv { 473 __le16 tag; 474 __le16 len; 475 u8 txcmd_mode; 476 u8 __rsv[3]; 477 } __packed; 478 479 struct bss_sec_tlv { 480 __le16 tag; 481 __le16 len; 482 u8 __rsv1[2]; 483 u8 cipher; 484 u8 __rsv2[1]; 485 } __packed; 486 487 struct bss_ifs_time_tlv { 488 __le16 tag; 489 __le16 len; 490 u8 slot_valid; 491 u8 sifs_valid; 492 u8 rifs_valid; 493 u8 eifs_valid; 494 __le16 slot_time; 495 __le16 sifs_time; 496 __le16 rifs_time; 497 __le16 eifs_time; 498 u8 eifs_cck_valid; 499 u8 rsv; 500 __le16 eifs_cck_time; 501 } __packed; 502 503 struct bss_power_save { 504 __le16 tag; 505 __le16 len; 506 u8 profile; 507 u8 _rsv[3]; 508 } __packed; 509 510 struct bss_mld_tlv { 511 __le16 tag; 512 __le16 len; 513 u8 group_mld_id; 514 u8 own_mld_id; 515 u8 mac_addr[ETH_ALEN]; 516 u8 remap_idx; 517 u8 link_id; 518 u8 __rsv[2]; 519 } __packed; 520 521 struct bss_prot_tlv { 522 __le16 tag; 523 __le16 len; 524 __le32 prot_mode; 525 } __packed; 526 527 struct bss_mld_link_op_tlv { 528 __le16 tag; 529 __le16 len; 530 u8 group_mld_id; 531 u8 own_mld_id; 532 u8 mac_addr[ETH_ALEN]; 533 u8 remap_idx; 534 u8 link_operation; 535 u8 link_id; 536 u8 rsv[2]; 537 } __packed; 538 539 struct sta_rec_ht_uni { 540 __le16 tag; 541 __le16 len; 542 __le16 ht_cap; 543 __le16 ht_cap_ext; 544 u8 ampdu_param; 545 u8 _rsv[3]; 546 } __packed; 547 548 struct sta_rec_ba_uni { 549 __le16 tag; 550 __le16 len; 551 u8 tid; 552 u8 ba_type; 553 u8 amsdu; 554 u8 ba_en; 555 __le16 ssn; 556 __le16 winsize; 557 u8 ba_rdd_rro; 558 u8 __rsv[3]; 559 } __packed; 560 561 struct sta_rec_eht { 562 __le16 tag; 563 __le16 len; 564 u8 tid_bitmap; 565 u8 _rsv; 566 __le16 mac_cap; 567 __le64 phy_cap; 568 __le64 phy_cap_ext; 569 u8 mcs_map_bw20[4]; 570 u8 mcs_map_bw80[3]; 571 u8 mcs_map_bw160[3]; 572 u8 mcs_map_bw320[3]; 573 u8 _rsv2[3]; 574 } __packed; 575 576 struct sec_key_uni { 577 __le16 wlan_idx; 578 u8 mgmt_prot; 579 u8 cipher_id; 580 u8 cipher_len; 581 u8 key_id; 582 u8 key_len; 583 u8 need_resp; 584 u8 key[32]; 585 u8 pn[6]; 586 u8 bcn_mode; 587 u8 _rsv; 588 } __packed; 589 590 struct sta_rec_sec_uni { 591 __le16 tag; 592 __le16 len; 593 u8 add; 594 u8 n_cipher; 595 u8 rsv[2]; 596 597 struct sec_key_uni key[2]; 598 } __packed; 599 600 struct sta_phy_uni { 601 u8 type; 602 u8 flag; 603 u8 stbc; 604 u8 sgi; 605 u8 bw; 606 u8 ldpc; 607 u8 mcs; 608 u8 nss; 609 u8 he_ltf; 610 u8 rsv[3]; 611 }; 612 613 struct sta_rec_ra_uni { 614 __le16 tag; 615 __le16 len; 616 617 u8 valid; 618 u8 auto_rate; 619 u8 phy_mode; 620 u8 channel; 621 u8 bw; 622 u8 disable_cck; 623 u8 ht_mcs32; 624 u8 ht_gf; 625 u8 ht_mcs[4]; 626 u8 mmps_mode; 627 u8 gband_256; 628 u8 af; 629 u8 auth_wapi_mode; 630 u8 rate_len; 631 632 u8 supp_mode; 633 u8 supp_cck_rate; 634 u8 supp_ofdm_rate; 635 __le32 supp_ht_mcs; 636 __le16 supp_vht_mcs[4]; 637 638 u8 op_mode; 639 u8 op_vht_chan_width; 640 u8 op_vht_rx_nss; 641 u8 op_vht_rx_nss_type; 642 643 __le32 sta_cap; 644 645 struct sta_phy_uni phy; 646 u8 rx_rcpi[4]; 647 } __packed; 648 649 struct sta_rec_ra_fixed_uni { 650 __le16 tag; 651 __le16 len; 652 653 __le32 field; 654 u8 op_mode; 655 u8 op_vht_chan_width; 656 u8 op_vht_rx_nss; 657 u8 op_vht_rx_nss_type; 658 659 struct sta_phy_uni phy; 660 661 u8 spe_idx; 662 u8 short_preamble; 663 u8 is_5g; 664 u8 mmps_mode; 665 } __packed; 666 667 struct sta_rec_hdrt { 668 __le16 tag; 669 __le16 len; 670 u8 hdrt_mode; 671 u8 rsv[3]; 672 } __packed; 673 674 struct sta_rec_hdr_trans { 675 __le16 tag; 676 __le16 len; 677 u8 from_ds; 678 u8 to_ds; 679 u8 dis_rx_hdr_tran; 680 u8 mesh; 681 } __packed; 682 683 struct sta_rec_mld_setup { 684 __le16 tag; 685 __le16 len; 686 u8 mld_addr[ETH_ALEN]; 687 __le16 primary_id; 688 __le16 seconed_id; 689 __le16 setup_wcid; 690 u8 link_num; 691 u8 info; 692 u8 __rsv[2]; 693 u8 link_info[]; 694 } __packed; 695 696 struct sta_rec_eht_mld { 697 __le16 tag; 698 __le16 len; 699 u8 nsep; 700 u8 __rsv1[2]; 701 u8 str_cap[__MT_MAX_BAND]; 702 __le16 eml_cap; 703 u8 __rsv2[4]; 704 } __packed; 705 706 struct mld_setup_link { 707 __le16 wcid; 708 u8 bss_idx; 709 u8 __rsv; 710 } __packed; 711 712 struct mld_req_hdr { 713 u8 ver; 714 u8 mld_addr[ETH_ALEN]; 715 u8 mld_idx; 716 u8 flag; 717 u8 rsv[3]; 718 u8 buf[]; 719 } __packed; 720 721 struct mld_reconf_stop_link { 722 __le16 tag; 723 __le16 len; 724 __le16 link_bitmap; 725 u8 rsv[2]; 726 u8 bss_idx[16]; 727 } __packed; 728 729 enum { 730 UNI_CMD_MLD_RECONF_AP_REM_TIMER = 0x03, 731 UNI_CMD_MLD_RECONF_STOP_LINK = 0x04, 732 }; 733 734 struct hdr_trans_en { 735 __le16 tag; 736 __le16 len; 737 u8 enable; 738 u8 check_bssid; 739 u8 mode; 740 u8 __rsv; 741 } __packed; 742 743 struct hdr_trans_vlan { 744 __le16 tag; 745 __le16 len; 746 u8 insert_vlan; 747 u8 remove_vlan; 748 u8 tid; 749 u8 __rsv; 750 } __packed; 751 752 struct hdr_trans_blacklist { 753 __le16 tag; 754 __le16 len; 755 u8 idx; 756 u8 enable; 757 __le16 type; 758 } __packed; 759 760 struct uni_header { 761 u8 __rsv[4]; 762 } __packed; 763 764 struct vow_rx_airtime { 765 __le16 tag; 766 __le16 len; 767 768 u8 enable; 769 u8 band; 770 u8 __rsv[2]; 771 } __packed; 772 773 struct bf_sounding_on { 774 __le16 tag; 775 __le16 len; 776 777 u8 snd_mode; 778 u8 sta_num; 779 u8 __rsv[2]; 780 __le16 wlan_id[4]; 781 __le32 snd_period; 782 } __packed; 783 784 struct bf_hw_en_status_update { 785 __le16 tag; 786 __le16 len; 787 788 bool ebf; 789 bool ibf; 790 u8 __rsv[2]; 791 } __packed; 792 793 struct bf_mod_en_ctrl { 794 __le16 tag; 795 __le16 len; 796 797 u8 bf_num; 798 u8 bf_bitmap; 799 u8 bf_sel[8]; 800 u8 __rsv[2]; 801 } __packed; 802 803 union bf_tag_tlv { 804 struct bf_sounding_on bf_snd; 805 struct bf_hw_en_status_update bf_hw_en; 806 struct bf_mod_en_ctrl bf_mod_en; 807 }; 808 809 struct ra_rate { 810 __le16 wlan_idx; 811 u8 mode; 812 u8 stbc; 813 __le16 gi; 814 u8 bw; 815 u8 ldpc; 816 u8 mcs; 817 u8 nss; 818 __le16 ltf; 819 u8 spe; 820 u8 preamble; 821 u8 __rsv[2]; 822 } __packed; 823 824 struct ra_fixed_rate { 825 __le16 tag; 826 __le16 len; 827 828 __le16 version; 829 struct ra_rate rate; 830 } __packed; 831 832 enum { 833 UNI_RA_FIXED_RATE = 0xf, 834 }; 835 836 #define MT7996_HDR_TRANS_MAX_SIZE (sizeof(struct hdr_trans_en) + \ 837 sizeof(struct hdr_trans_vlan) + \ 838 sizeof(struct hdr_trans_blacklist)) 839 840 enum { 841 UNI_HDR_TRANS_EN, 842 UNI_HDR_TRANS_VLAN, 843 UNI_HDR_TRANS_BLACKLIST, 844 }; 845 846 enum { 847 RATE_PARAM_FIXED = 3, 848 RATE_PARAM_MMPS_UPDATE = 5, 849 RATE_PARAM_FIXED_HE_LTF = 7, 850 RATE_PARAM_FIXED_MCS, 851 RATE_PARAM_FIXED_GI = 11, 852 RATE_PARAM_AUTO = 20, 853 }; 854 855 enum { 856 BF_SOUNDING_ON = 1, 857 BF_HW_EN_UPDATE = 17, 858 BF_MOD_EN_CTRL = 20, 859 }; 860 861 enum { 862 CMD_BAND_NONE, 863 CMD_BAND_24G, 864 CMD_BAND_5G, 865 CMD_BAND_6G, 866 }; 867 868 struct bss_req_hdr { 869 u8 bss_idx; 870 u8 __rsv[3]; 871 } __packed; 872 873 enum { 874 UNI_CHANNEL_SWITCH, 875 UNI_CHANNEL_RX_PATH, 876 }; 877 878 enum { 879 UNI_CHIP_CONFIG_NIC_CAPA = 3, 880 UNI_CHIP_CONFIG_DUP_WTBL = 4, 881 }; 882 883 #define MT7996_BSS_UPDATE_MAX_SIZE (sizeof(struct bss_req_hdr) + \ 884 sizeof(struct mt76_connac_bss_basic_tlv) + \ 885 sizeof(struct bss_rlm_tlv) + \ 886 sizeof(struct bss_ra_tlv) + \ 887 sizeof(struct bss_info_uni_he) + \ 888 sizeof(struct bss_rate_tlv) + \ 889 sizeof(struct bss_txcmd_tlv) + \ 890 sizeof(struct bss_power_save) + \ 891 sizeof(struct bss_sec_tlv) + \ 892 sizeof(struct bss_ifs_time_tlv) + \ 893 sizeof(struct bss_mld_tlv)) 894 895 #define MT7996_STA_UPDATE_MAX_SIZE (sizeof(struct sta_req_hdr) + \ 896 sizeof(struct sta_rec_basic) + \ 897 sizeof(struct sta_rec_bf) + \ 898 sizeof(struct sta_rec_ht_uni) + \ 899 sizeof(struct sta_rec_he_v2) + \ 900 sizeof(struct sta_rec_ba_uni) + \ 901 sizeof(struct sta_rec_vht) + \ 902 sizeof(struct sta_rec_uapsd) + \ 903 sizeof(struct sta_rec_amsdu) + \ 904 sizeof(struct sta_rec_bfee) + \ 905 sizeof(struct sta_rec_ra_uni) + \ 906 sizeof(struct sta_rec_sec) + \ 907 sizeof(struct sta_rec_ra_fixed_uni) + \ 908 sizeof(struct sta_rec_he_6g_capa) + \ 909 sizeof(struct sta_rec_eht) + \ 910 sizeof(struct sta_rec_hdrt) + \ 911 sizeof(struct sta_rec_hdr_trans) + \ 912 sizeof(struct sta_rec_mld_setup) + \ 913 sizeof(struct mld_setup_link) * 3 + \ 914 sizeof(struct sta_rec_eht_mld) + \ 915 sizeof(struct tlv)) 916 917 #define MT7996_BEACON_UPDATE_SIZE (sizeof(struct bss_req_hdr) + \ 918 sizeof(struct bss_bcn_content_tlv) + \ 919 4 + MT_TXD_SIZE + \ 920 sizeof(struct bss_bcn_cntdwn_tlv) + \ 921 sizeof(struct bss_bcn_mbss_tlv)) 922 #define MT7996_MAX_BSS_OFFLOAD_SIZE 2048 923 #define MT7996_MAX_BEACON_SIZE (MT7996_MAX_BSS_OFFLOAD_SIZE - \ 924 MT7996_BEACON_UPDATE_SIZE) 925 926 enum { 927 UNI_BAND_CONFIG_RADIO_ENABLE, 928 UNI_BAND_CONFIG_RTS_THRESHOLD = 0x08, 929 UNI_BAND_CONFIG_MAC_ENABLE_CTRL = 0x0c, 930 }; 931 932 enum { 933 UNI_WSYS_CONFIG_FW_LOG_CTRL, 934 UNI_WSYS_CONFIG_FW_DBG_CTRL, 935 }; 936 937 enum { 938 UNI_RDD_CTRL_PARM, 939 UNI_RDD_CTRL_SET_TH = 0x3, 940 }; 941 942 enum { 943 UNI_EFUSE_ACCESS = 1, 944 UNI_EFUSE_BUFFER_MODE, 945 UNI_EFUSE_FREE_BLOCK, 946 UNI_EFUSE_BUFFER_RD, 947 }; 948 949 enum { 950 UNI_EXT_EEPROM_ACCESS = 1, 951 }; 952 953 enum { 954 UNI_VOW_DRR_CTRL, 955 UNI_VOW_RX_AT_AIRTIME_EN = 0x0b, 956 UNI_VOW_RX_AT_AIRTIME_CLR_EN = 0x0e, 957 }; 958 959 enum { 960 UNI_CMD_MIB_DATA, 961 }; 962 963 enum { 964 UNI_POWER_OFF, 965 }; 966 967 enum { 968 UNI_CMD_TWT_ARGT_UPDATE = 0x0, 969 UNI_CMD_TWT_MGMT_OFFLOAD, 970 }; 971 972 enum { 973 UNI_RRO_DEL_ENTRY = 0x1, 974 UNI_RRO_SET_PLATFORM_TYPE, 975 UNI_RRO_GET_BA_SESSION_TABLE, 976 UNI_RRO_SET_BYPASS_MODE, 977 UNI_RRO_SET_TXFREE_PATH, 978 UNI_RRO_DEL_BA_SESSION, 979 UNI_RRO_SET_FLUSH_TIMEOUT 980 }; 981 982 enum{ 983 UNI_CMD_SR_ENABLE = 0x1, 984 UNI_CMD_SR_ENABLE_SD, 985 UNI_CMD_SR_ENABLE_MODE, 986 UNI_CMD_SR_ENABLE_DPD = 0x12, 987 UNI_CMD_SR_ENABLE_TX, 988 UNI_CMD_SR_SET_SRG_BITMAP = 0x80, 989 UNI_CMD_SR_SET_PARAM = 0xc1, 990 UNI_CMD_SR_SET_SIGA = 0xd0, 991 }; 992 993 enum { 994 UNI_CMD_THERMAL_PROTECT_ENABLE = 0x6, 995 UNI_CMD_THERMAL_PROTECT_DISABLE, 996 UNI_CMD_THERMAL_PROTECT_DUTY_CONFIG, 997 }; 998 999 enum { 1000 UNI_TXPOWER_POWER_LIMIT_TABLE_CTRL = 4, 1001 }; 1002 1003 enum { 1004 UNI_CMD_ACCESS_REG_BASIC = 0x0, 1005 UNI_CMD_ACCESS_RF_REG_BASIC, 1006 }; 1007 1008 enum { 1009 UNI_CMD_SER_QUERY, 1010 /* recovery */ 1011 UNI_CMD_SER_SET_RECOVER_L1, 1012 UNI_CMD_SER_SET_RECOVER_L2, 1013 UNI_CMD_SER_SET_RECOVER_L3_RX_ABORT, 1014 UNI_CMD_SER_SET_RECOVER_L3_TX_ABORT, 1015 UNI_CMD_SER_SET_RECOVER_L3_TX_DISABLE, 1016 UNI_CMD_SER_SET_RECOVER_L3_BF, 1017 UNI_CMD_SER_SET_RECOVER_L4_MDP, 1018 UNI_CMD_SER_SET_RECOVER_FROM_ETH, 1019 UNI_CMD_SER_SET_RECOVER_FULL = 8, 1020 UNI_CMD_SER_SET_SYSTEM_ASSERT, 1021 /* action */ 1022 UNI_CMD_SER_ENABLE = 1, 1023 UNI_CMD_SER_SET, 1024 UNI_CMD_SER_TRIGGER 1025 }; 1026 1027 enum { 1028 UNI_CMD_SDO_SET = 1, 1029 UNI_CMD_SDO_QUERY, 1030 UNI_CMD_SDO_CP_MODE = 6, 1031 }; 1032 1033 enum { 1034 MT7996_SEC_MODE_PLAIN, 1035 MT7996_SEC_MODE_AES, 1036 MT7996_SEC_MODE_SCRAMBLE, 1037 MT7996_SEC_MODE_MAX, 1038 }; 1039 1040 #define MT7996_PATCH_SEC GENMASK(31, 24) 1041 #define MT7996_PATCH_SCRAMBLE_KEY GENMASK(15, 8) 1042 #define MT7996_PATCH_AES_KEY GENMASK(7, 0) 1043 1044 #define MT7996_SEC_ENCRYPT BIT(0) 1045 #define MT7996_SEC_KEY_IDX GENMASK(2, 1) 1046 #define MT7996_SEC_IV BIT(3) 1047 1048 struct fixed_rate_table_ctrl { 1049 u8 _rsv[4]; 1050 1051 __le16 tag; 1052 __le16 len; 1053 1054 u8 table_idx; 1055 u8 antenna_idx; 1056 __le16 rate_idx; 1057 u8 spe_idx_sel; 1058 u8 spe_idx; 1059 u8 gi; 1060 u8 he_ltf; 1061 bool ldpc; 1062 bool txbf; 1063 bool dynamic_bw; 1064 1065 u8 _rsv2; 1066 } __packed; 1067 1068 #endif 1069