-
Notifications
You must be signed in to change notification settings - Fork 165
/
fw.h
4669 lines (4108 loc) · 138 KB
/
fw.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/* Copyright(c) 2019-2020 Realtek Corporation
*/
#ifndef __RTW89_FW_H__
#define __RTW89_FW_H__
#include "core.h"
enum rtw89_fw_dl_status {
RTW89_FWDL_INITIAL_STATE = 0,
RTW89_FWDL_FWDL_ONGOING = 1,
RTW89_FWDL_CHECKSUM_FAIL = 2,
RTW89_FWDL_SECURITY_FAIL = 3,
RTW89_FWDL_CV_NOT_MATCH = 4,
RTW89_FWDL_RSVD0 = 5,
RTW89_FWDL_WCPU_FWDL_RDY = 6,
RTW89_FWDL_WCPU_FW_INIT_RDY = 7
};
struct rtw89_c2hreg_hdr {
u32 w0;
};
#define RTW89_C2HREG_HDR_FUNC_MASK GENMASK(6, 0)
#define RTW89_C2HREG_HDR_ACK BIT(7)
#define RTW89_C2HREG_HDR_LEN_MASK GENMASK(11, 8)
#define RTW89_C2HREG_HDR_SEQ_MASK GENMASK(15, 12)
struct rtw89_c2hreg_phycap {
u32 w0;
u32 w1;
u32 w2;
u32 w3;
} __packed;
#define RTW89_C2HREG_PHYCAP_W0_FUNC GENMASK(6, 0)
#define RTW89_C2HREG_PHYCAP_W0_ACK BIT(7)
#define RTW89_C2HREG_PHYCAP_W0_LEN GENMASK(11, 8)
#define RTW89_C2HREG_PHYCAP_W0_SEQ GENMASK(15, 12)
#define RTW89_C2HREG_PHYCAP_W0_RX_NSS GENMASK(23, 16)
#define RTW89_C2HREG_PHYCAP_W0_BW GENMASK(31, 24)
#define RTW89_C2HREG_PHYCAP_W1_TX_NSS GENMASK(7, 0)
#define RTW89_C2HREG_PHYCAP_W1_PROT GENMASK(15, 8)
#define RTW89_C2HREG_PHYCAP_W1_NIC GENMASK(23, 16)
#define RTW89_C2HREG_PHYCAP_W1_WL_FUNC GENMASK(31, 24)
#define RTW89_C2HREG_PHYCAP_W2_HW_TYPE GENMASK(7, 0)
#define RTW89_C2HREG_PHYCAP_W3_ANT_TX_NUM GENMASK(15, 8)
#define RTW89_C2HREG_PHYCAP_W3_ANT_RX_NUM GENMASK(23, 16)
#define RTW89_C2HREG_AOAC_RPT_1_W0_KEY_IDX GENMASK(23, 16)
#define RTW89_C2HREG_AOAC_RPT_1_W1_IV_0 GENMASK(7, 0)
#define RTW89_C2HREG_AOAC_RPT_1_W1_IV_1 GENMASK(15, 8)
#define RTW89_C2HREG_AOAC_RPT_1_W1_IV_2 GENMASK(23, 16)
#define RTW89_C2HREG_AOAC_RPT_1_W1_IV_3 GENMASK(31, 24)
#define RTW89_C2HREG_AOAC_RPT_1_W2_IV_4 GENMASK(7, 0)
#define RTW89_C2HREG_AOAC_RPT_1_W2_IV_5 GENMASK(15, 8)
#define RTW89_C2HREG_AOAC_RPT_1_W2_IV_6 GENMASK(23, 16)
#define RTW89_C2HREG_AOAC_RPT_1_W2_IV_7 GENMASK(31, 24)
#define RTW89_C2HREG_AOAC_RPT_1_W3_PTK_IV_0 GENMASK(7, 0)
#define RTW89_C2HREG_AOAC_RPT_1_W3_PTK_IV_1 GENMASK(15, 8)
#define RTW89_C2HREG_AOAC_RPT_1_W3_PTK_IV_2 GENMASK(23, 16)
#define RTW89_C2HREG_AOAC_RPT_1_W3_PTK_IV_3 GENMASK(31, 24)
#define RTW89_C2HREG_AOAC_RPT_2_W0_PTK_IV_4 GENMASK(23, 16)
#define RTW89_C2HREG_AOAC_RPT_2_W0_PTK_IV_5 GENMASK(31, 24)
#define RTW89_C2HREG_AOAC_RPT_2_W1_PTK_IV_6 GENMASK(7, 0)
#define RTW89_C2HREG_AOAC_RPT_2_W1_PTK_IV_7 GENMASK(15, 8)
#define RTW89_C2HREG_AOAC_RPT_2_W1_IGTK_IPN_IV_0 GENMASK(23, 16)
#define RTW89_C2HREG_AOAC_RPT_2_W1_IGTK_IPN_IV_1 GENMASK(31, 24)
#define RTW89_C2HREG_AOAC_RPT_2_W2_IGTK_IPN_IV_2 GENMASK(7, 0)
#define RTW89_C2HREG_AOAC_RPT_2_W2_IGTK_IPN_IV_3 GENMASK(15, 8)
#define RTW89_C2HREG_AOAC_RPT_2_W2_IGTK_IPN_IV_4 GENMASK(23, 16)
#define RTW89_C2HREG_AOAC_RPT_2_W2_IGTK_IPN_IV_5 GENMASK(31, 24)
#define RTW89_C2HREG_AOAC_RPT_2_W3_IGTK_IPN_IV_6 GENMASK(7, 0)
#define RTW89_C2HREG_AOAC_RPT_2_W3_IGTK_IPN_IV_7 GENMASK(15, 8)
struct rtw89_h2creg_hdr {
u32 w0;
};
#define RTW89_H2CREG_HDR_FUNC_MASK GENMASK(6, 0)
#define RTW89_H2CREG_HDR_LEN_MASK GENMASK(11, 8)
struct rtw89_h2creg_sch_tx_en {
u32 w0;
u32 w1;
} __packed;
#define RTW89_H2CREG_SCH_TX_EN_W0_EN GENMASK(31, 16)
#define RTW89_H2CREG_SCH_TX_EN_W1_MASK GENMASK(15, 0)
#define RTW89_H2CREG_SCH_TX_EN_W1_BAND BIT(16)
#define RTW89_H2CREG_WOW_CPUIO_RX_CTRL_EN GENMASK(23, 16)
#define RTW89_H2CREG_MAX 4
#define RTW89_C2HREG_MAX 4
#define RTW89_C2HREG_HDR_LEN 2
#define RTW89_H2CREG_HDR_LEN 2
#define RTW89_C2H_TIMEOUT 1000000
struct rtw89_mac_c2h_info {
u8 id;
u8 content_len;
union {
u32 c2hreg[RTW89_C2HREG_MAX];
struct rtw89_c2hreg_hdr hdr;
struct rtw89_c2hreg_phycap phycap;
} u;
};
struct rtw89_mac_h2c_info {
u8 id;
u8 content_len;
union {
u32 h2creg[RTW89_H2CREG_MAX];
struct rtw89_h2creg_hdr hdr;
struct rtw89_h2creg_sch_tx_en sch_tx_en;
} u;
};
enum rtw89_mac_h2c_type {
RTW89_FWCMD_H2CREG_FUNC_H2CREG_LB = 0,
RTW89_FWCMD_H2CREG_FUNC_CNSL_CMD,
RTW89_FWCMD_H2CREG_FUNC_FWERR,
RTW89_FWCMD_H2CREG_FUNC_GET_FEATURE,
RTW89_FWCMD_H2CREG_FUNC_GETPKT_INFORM,
RTW89_FWCMD_H2CREG_FUNC_SCH_TX_EN,
RTW89_FWCMD_H2CREG_FUNC_WOW_TRX_STOP,
RTW89_FWCMD_H2CREG_FUNC_AOAC_RPT_1,
RTW89_FWCMD_H2CREG_FUNC_AOAC_RPT_2,
RTW89_FWCMD_H2CREG_FUNC_AOAC_RPT_3_REQ,
RTW89_FWCMD_H2CREG_FUNC_WOW_CPUIO_RX_CTRL,
};
enum rtw89_mac_c2h_type {
RTW89_FWCMD_C2HREG_FUNC_C2HREG_LB = 0,
RTW89_FWCMD_C2HREG_FUNC_ERR_RPT,
RTW89_FWCMD_C2HREG_FUNC_ERR_MSG,
RTW89_FWCMD_C2HREG_FUNC_PHY_CAP,
RTW89_FWCMD_C2HREG_FUNC_TX_PAUSE_RPT,
RTW89_FWCMD_C2HREG_FUNC_WOW_CPUIO_RX_ACK = 0xA,
RTW89_FWCMD_C2HREG_FUNC_NULL = 0xFF,
};
enum rtw89_fw_c2h_category {
RTW89_C2H_CAT_TEST,
RTW89_C2H_CAT_MAC,
RTW89_C2H_CAT_OUTSRC,
};
enum rtw89_fw_log_level {
RTW89_FW_LOG_LEVEL_OFF,
RTW89_FW_LOG_LEVEL_CRT,
RTW89_FW_LOG_LEVEL_SER,
RTW89_FW_LOG_LEVEL_WARN,
RTW89_FW_LOG_LEVEL_LOUD,
RTW89_FW_LOG_LEVEL_TR,
};
enum rtw89_fw_log_path {
RTW89_FW_LOG_LEVEL_UART,
RTW89_FW_LOG_LEVEL_C2H,
RTW89_FW_LOG_LEVEL_SNI,
};
enum rtw89_fw_log_comp {
RTW89_FW_LOG_COMP_VER,
RTW89_FW_LOG_COMP_INIT,
RTW89_FW_LOG_COMP_TASK,
RTW89_FW_LOG_COMP_CNS,
RTW89_FW_LOG_COMP_H2C,
RTW89_FW_LOG_COMP_C2H,
RTW89_FW_LOG_COMP_TX,
RTW89_FW_LOG_COMP_RX,
RTW89_FW_LOG_COMP_IPSEC,
RTW89_FW_LOG_COMP_TIMER,
RTW89_FW_LOG_COMP_DBGPKT,
RTW89_FW_LOG_COMP_PS,
RTW89_FW_LOG_COMP_ERROR,
RTW89_FW_LOG_COMP_WOWLAN,
RTW89_FW_LOG_COMP_SECURE_BOOT,
RTW89_FW_LOG_COMP_BTC,
RTW89_FW_LOG_COMP_BB,
RTW89_FW_LOG_COMP_TWT,
RTW89_FW_LOG_COMP_RF,
RTW89_FW_LOG_COMP_MCC = 20,
RTW89_FW_LOG_COMP_SCAN = 28,
};
enum rtw89_pkt_offload_op {
RTW89_PKT_OFLD_OP_ADD,
RTW89_PKT_OFLD_OP_DEL,
RTW89_PKT_OFLD_OP_READ,
NUM_OF_RTW89_PKT_OFFLOAD_OP,
};
#define RTW89_PKT_OFLD_WAIT_TAG(pkt_id, pkt_op) \
((pkt_id) * NUM_OF_RTW89_PKT_OFFLOAD_OP + (pkt_op))
enum rtw89_scanofld_notify_reason {
RTW89_SCAN_DWELL_NOTIFY,
RTW89_SCAN_PRE_TX_NOTIFY,
RTW89_SCAN_POST_TX_NOTIFY,
RTW89_SCAN_ENTER_CH_NOTIFY,
RTW89_SCAN_LEAVE_CH_NOTIFY,
RTW89_SCAN_END_SCAN_NOTIFY,
RTW89_SCAN_REPORT_NOTIFY,
RTW89_SCAN_CHKPT_NOTIFY,
RTW89_SCAN_ENTER_OP_NOTIFY,
RTW89_SCAN_LEAVE_OP_NOTIFY,
};
enum rtw89_scanofld_status {
RTW89_SCAN_STATUS_NOTIFY,
RTW89_SCAN_STATUS_SUCCESS,
RTW89_SCAN_STATUS_FAIL,
};
enum rtw89_chan_type {
RTW89_CHAN_OPERATE = 0,
RTW89_CHAN_ACTIVE,
RTW89_CHAN_DFS,
};
enum rtw89_p2pps_action {
RTW89_P2P_ACT_INIT = 0,
RTW89_P2P_ACT_UPDATE = 1,
RTW89_P2P_ACT_REMOVE = 2,
RTW89_P2P_ACT_TERMINATE = 3,
};
#define RTW89_DEFAULT_CQM_HYST 4
#define RTW89_DEFAULT_CQM_THOLD -70
enum rtw89_bcn_fltr_offload_mode {
RTW89_BCN_FLTR_OFFLOAD_MODE_0 = 0,
RTW89_BCN_FLTR_OFFLOAD_MODE_1,
RTW89_BCN_FLTR_OFFLOAD_MODE_2,
RTW89_BCN_FLTR_OFFLOAD_MODE_3,
RTW89_BCN_FLTR_OFFLOAD_MODE_DEFAULT = RTW89_BCN_FLTR_OFFLOAD_MODE_0,
};
enum rtw89_bcn_fltr_type {
RTW89_BCN_FLTR_BEACON_LOSS,
RTW89_BCN_FLTR_RSSI,
RTW89_BCN_FLTR_NOTIFY,
};
enum rtw89_bcn_fltr_rssi_event {
RTW89_BCN_FLTR_RSSI_NOT_CHANGED,
RTW89_BCN_FLTR_RSSI_HIGH,
RTW89_BCN_FLTR_RSSI_LOW,
};
#define FWDL_SECTION_MAX_NUM 10
#define FWDL_SECTION_CHKSUM_LEN 8
#define FWDL_SECTION_PER_PKT_LEN 2020
struct rtw89_fw_hdr_section_info {
u8 redl;
const u8 *addr;
u32 len;
u32 dladdr;
u32 mssc;
u8 type;
bool ignore;
const u8 *key_addr;
u32 key_len;
u32 key_idx;
};
struct rtw89_fw_bin_info {
u8 section_num;
u32 hdr_len;
bool dynamic_hdr_en;
u32 dynamic_hdr_len;
bool dsp_checksum;
bool secure_section_exist;
struct rtw89_fw_hdr_section_info section_info[FWDL_SECTION_MAX_NUM];
};
struct rtw89_fw_macid_pause_grp {
__le32 pause_grp[4];
__le32 mask_grp[4];
} __packed;
struct rtw89_fw_macid_pause_sleep_grp {
struct {
__le32 pause_grp[4];
__le32 pause_mask_grp[4];
__le32 sleep_grp[4];
__le32 sleep_mask_grp[4];
} __packed n[4];
} __packed;
#define RTW89_H2C_MAX_SIZE 2048
#define RTW89_CHANNEL_TIME 45
#define RTW89_CHANNEL_TIME_6G 20
#define RTW89_DFS_CHAN_TIME 105
#define RTW89_OFF_CHAN_TIME 100
#define RTW89_DWELL_TIME 20
#define RTW89_DWELL_TIME_6G 10
#define RTW89_SCAN_WIDTH 0
#define RTW89_SCANOFLD_MAX_SSID 8
#define RTW89_SCANOFLD_MAX_IE_LEN 512
#define RTW89_SCANOFLD_PKT_NONE 0xFF
#define RTW89_SCANOFLD_DEBUG_MASK 0x1F
#define RTW89_CHAN_INVALID 0xFF
#define RTW89_MAC_CHINFO_SIZE 28
#define RTW89_SCAN_LIST_GUARD 4
#define RTW89_SCAN_LIST_LIMIT \
((RTW89_H2C_MAX_SIZE / RTW89_MAC_CHINFO_SIZE) - RTW89_SCAN_LIST_GUARD)
#define RTW89_BCN_LOSS_CNT 10
struct rtw89_mac_chinfo {
u8 period;
u8 dwell_time;
u8 central_ch;
u8 pri_ch;
u8 bw:3;
u8 notify_action:5;
u8 num_pkt:4;
u8 tx_pkt:1;
u8 pause_data:1;
u8 ch_band:2;
u8 probe_id;
u8 dfs_ch:1;
u8 tx_null:1;
u8 rand_seq_num:1;
u8 cfg_tx_pwr:1;
u8 rsvd0: 4;
u8 pkt_id[RTW89_SCANOFLD_MAX_SSID];
u16 tx_pwr_idx;
u8 rsvd1;
struct list_head list;
bool is_psc;
};
struct rtw89_mac_chinfo_be {
u8 period;
u8 dwell_time;
u8 central_ch;
u8 pri_ch;
u8 bw:3;
u8 ch_band:2;
u8 dfs_ch:1;
u8 pause_data:1;
u8 tx_null:1;
u8 rand_seq_num:1;
u8 notify_action:5;
u8 probe_id;
u8 leave_crit;
u8 chkpt_timer;
u8 leave_time;
u8 leave_th;
u16 tx_pkt_ctrl;
u8 pkt_id[RTW89_SCANOFLD_MAX_SSID];
u8 sw_def;
u16 fw_probe0_ssids;
u16 fw_probe0_shortssids;
u16 fw_probe0_bssids;
struct list_head list;
bool is_psc;
};
struct rtw89_pktofld_info {
struct list_head list;
u8 id;
bool wildcard_6ghz;
/* Below fields are for WiFi 6 chips 6 GHz RNR use only */
u8 ssid[IEEE80211_MAX_SSID_LEN];
u8 ssid_len;
u8 bssid[ETH_ALEN];
u16 channel_6ghz;
bool cancel;
};
struct rtw89_h2c_ra {
__le32 w0;
__le32 w1;
__le32 w2;
__le32 w3;
} __packed;
#define RTW89_H2C_RA_W0_IS_DIS BIT(0)
#define RTW89_H2C_RA_W0_MODE GENMASK(5, 1)
#define RTW89_H2C_RA_W0_BW_CAP GENMASK(7, 6)
#define RTW89_H2C_RA_W0_MACID GENMASK(15, 8)
#define RTW89_H2C_RA_W0_DCM BIT(16)
#define RTW89_H2C_RA_W0_ER BIT(17)
#define RTW89_H2C_RA_W0_INIT_RATE_LV GENMASK(19, 18)
#define RTW89_H2C_RA_W0_UPD_ALL BIT(20)
#define RTW89_H2C_RA_W0_SGI BIT(21)
#define RTW89_H2C_RA_W0_LDPC BIT(22)
#define RTW89_H2C_RA_W0_STBC BIT(23)
#define RTW89_H2C_RA_W0_SS_NUM GENMASK(26, 24)
#define RTW89_H2C_RA_W0_GILTF GENMASK(29, 27)
#define RTW89_H2C_RA_W0_UPD_BW_NSS_MASK BIT(30)
#define RTW89_H2C_RA_W0_UPD_MASK BIT(31)
#define RTW89_H2C_RA_W1_RAMASK_LO32 GENMASK(31, 0)
#define RTW89_H2C_RA_W2_RAMASK_HI32 GENMASK(30, 0)
#define RTW89_H2C_RA_W2_BFEE_CSI_CTL BIT(31)
#define RTW89_H2C_RA_W3_BAND_NUM GENMASK(7, 0)
#define RTW89_H2C_RA_W3_RA_CSI_RATE_EN BIT(8)
#define RTW89_H2C_RA_W3_FIXED_CSI_RATE_EN BIT(9)
#define RTW89_H2C_RA_W3_CR_TBL_SEL BIT(10)
#define RTW89_H2C_RA_W3_FIX_GILTF_EN BIT(11)
#define RTW89_H2C_RA_W3_FIX_GILTF GENMASK(14, 12)
#define RTW89_H2C_RA_W3_FIXED_CSI_MCS_SS_IDX GENMASK(23, 16)
#define RTW89_H2C_RA_W3_FIXED_CSI_MODE GENMASK(25, 24)
#define RTW89_H2C_RA_W3_FIXED_CSI_GI_LTF GENMASK(28, 26)
#define RTW89_H2C_RA_W3_FIXED_CSI_BW GENMASK(31, 29)
struct rtw89_h2c_ra_v1 {
struct rtw89_h2c_ra v0;
__le32 w4;
__le32 w5;
} __packed;
#define RTW89_H2C_RA_V1_W4_MODE_EHT GENMASK(6, 0)
#define RTW89_H2C_RA_V1_W4_BW_EHT GENMASK(10, 8)
#define RTW89_H2C_RA_V1_W4_RAMASK_UHL16 GENMASK(31, 16)
#define RTW89_H2C_RA_V1_W5_RAMASK_UHH16 GENMASK(15, 0)
static inline void RTW89_SET_FWCMD_SEC_IDX(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(7, 0));
}
static inline void RTW89_SET_FWCMD_SEC_OFFSET(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(15, 8));
}
static inline void RTW89_SET_FWCMD_SEC_LEN(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(23, 16));
}
static inline void RTW89_SET_FWCMD_SEC_TYPE(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x01, val, GENMASK(3, 0));
}
static inline void RTW89_SET_FWCMD_SEC_EXT_KEY(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x01, val, BIT(4));
}
static inline void RTW89_SET_FWCMD_SEC_SPP_MODE(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x01, val, BIT(5));
}
static inline void RTW89_SET_FWCMD_SEC_KEY0(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x02, val, GENMASK(31, 0));
}
static inline void RTW89_SET_FWCMD_SEC_KEY1(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x03, val, GENMASK(31, 0));
}
static inline void RTW89_SET_FWCMD_SEC_KEY2(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x04, val, GENMASK(31, 0));
}
static inline void RTW89_SET_FWCMD_SEC_KEY3(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x05, val, GENMASK(31, 0));
}
static inline void RTW89_SET_EDCA_SEL(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(1, 0));
}
static inline void RTW89_SET_EDCA_BAND(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x00, val, BIT(3));
}
static inline void RTW89_SET_EDCA_WMM(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x00, val, BIT(4));
}
static inline void RTW89_SET_EDCA_AC(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(6, 5));
}
static inline void RTW89_SET_EDCA_PARAM(void *cmd, u32 val)
{
le32p_replace_bits((__le32 *)(cmd) + 0x01, val, GENMASK(31, 0));
}
#define FW_EDCA_PARAM_TXOPLMT_MSK GENMASK(26, 16)
#define FW_EDCA_PARAM_CWMAX_MSK GENMASK(15, 12)
#define FW_EDCA_PARAM_CWMIN_MSK GENMASK(11, 8)
#define FW_EDCA_PARAM_AIFS_MSK GENMASK(7, 0)
#define FWDL_SECURITY_SECTION_TYPE 9
#define FWDL_SECURITY_SIGLEN 512
#define FWDL_SECURITY_CHKSUM_LEN 8
struct rtw89_fw_dynhdr_sec {
__le32 w0;
u8 content[];
} __packed;
struct rtw89_fw_dynhdr_hdr {
__le32 hdr_len;
__le32 setcion_count;
/* struct rtw89_fw_dynhdr_sec (nested flexible structures) */
} __packed;
struct rtw89_fw_hdr_section {
__le32 w0;
__le32 w1;
__le32 w2;
__le32 w3;
} __packed;
#define FWSECTION_HDR_W0_DL_ADDR GENMASK(31, 0)
#define FWSECTION_HDR_W1_METADATA GENMASK(31, 24)
#define FWSECTION_HDR_W1_SECTIONTYPE GENMASK(27, 24)
#define FWSECTION_HDR_W1_SEC_SIZE GENMASK(23, 0)
#define FWSECTION_HDR_W1_CHECKSUM BIT(28)
#define FWSECTION_HDR_W1_REDL BIT(29)
#define FWSECTION_HDR_W2_MSSC GENMASK(31, 0)
struct rtw89_fw_hdr {
__le32 w0;
__le32 w1;
__le32 w2;
__le32 w3;
__le32 w4;
__le32 w5;
__le32 w6;
__le32 w7;
struct rtw89_fw_hdr_section sections[];
/* struct rtw89_fw_dynhdr_hdr (optional) */
} __packed;
#define FW_HDR_W1_MAJOR_VERSION GENMASK(7, 0)
#define FW_HDR_W1_MINOR_VERSION GENMASK(15, 8)
#define FW_HDR_W1_SUBVERSION GENMASK(23, 16)
#define FW_HDR_W1_SUBINDEX GENMASK(31, 24)
#define FW_HDR_W2_COMMITID GENMASK(31, 0)
#define FW_HDR_W3_LEN GENMASK(23, 16)
#define FW_HDR_W3_HDR_VER GENMASK(31, 24)
#define FW_HDR_W4_MONTH GENMASK(7, 0)
#define FW_HDR_W4_DATE GENMASK(15, 8)
#define FW_HDR_W4_HOUR GENMASK(23, 16)
#define FW_HDR_W4_MIN GENMASK(31, 24)
#define FW_HDR_W5_YEAR GENMASK(31, 0)
#define FW_HDR_W6_SEC_NUM GENMASK(15, 8)
#define FW_HDR_W7_PART_SIZE GENMASK(15, 0)
#define FW_HDR_W7_DYN_HDR BIT(16)
#define FW_HDR_W7_CMD_VERSERION GENMASK(31, 24)
struct rtw89_fw_hdr_section_v1 {
__le32 w0;
__le32 w1;
__le32 w2;
__le32 w3;
} __packed;
#define FWSECTION_HDR_V1_W0_DL_ADDR GENMASK(31, 0)
#define FWSECTION_HDR_V1_W1_METADATA GENMASK(31, 24)
#define FWSECTION_HDR_V1_W1_SECTIONTYPE GENMASK(27, 24)
#define FWSECTION_HDR_V1_W1_SEC_SIZE GENMASK(23, 0)
#define FWSECTION_HDR_V1_W1_CHECKSUM BIT(28)
#define FWSECTION_HDR_V1_W1_REDL BIT(29)
#define FWSECTION_HDR_V1_W2_MSSC GENMASK(7, 0)
#define FORMATTED_MSSC 0xFF
#define FWSECTION_HDR_V1_W2_BBMCU_IDX GENMASK(27, 24)
struct rtw89_fw_hdr_v1 {
__le32 w0;
__le32 w1;
__le32 w2;
__le32 w3;
__le32 w4;
__le32 w5;
__le32 w6;
__le32 w7;
__le32 w8;
__le32 w9;
__le32 w10;
__le32 w11;
struct rtw89_fw_hdr_section_v1 sections[];
} __packed;
#define FW_HDR_V1_W1_MAJOR_VERSION GENMASK(7, 0)
#define FW_HDR_V1_W1_MINOR_VERSION GENMASK(15, 8)
#define FW_HDR_V1_W1_SUBVERSION GENMASK(23, 16)
#define FW_HDR_V1_W1_SUBINDEX GENMASK(31, 24)
#define FW_HDR_V1_W2_COMMITID GENMASK(31, 0)
#define FW_HDR_V1_W3_CMD_VERSERION GENMASK(23, 16)
#define FW_HDR_V1_W3_HDR_VER GENMASK(31, 24)
#define FW_HDR_V1_W4_MONTH GENMASK(7, 0)
#define FW_HDR_V1_W4_DATE GENMASK(15, 8)
#define FW_HDR_V1_W4_HOUR GENMASK(23, 16)
#define FW_HDR_V1_W4_MIN GENMASK(31, 24)
#define FW_HDR_V1_W5_YEAR GENMASK(15, 0)
#define FW_HDR_V1_W5_HDR_SIZE GENMASK(31, 16)
#define FW_HDR_V1_W6_SEC_NUM GENMASK(15, 8)
#define FW_HDR_V1_W6_DSP_CHKSUM BIT(24)
#define FW_HDR_V1_W7_PART_SIZE GENMASK(15, 0)
#define FW_HDR_V1_W7_DYN_HDR BIT(16)
enum rtw89_fw_mss_pool_rmp_tbl_type {
MSS_POOL_RMP_TBL_BITMASK = 0x0,
MSS_POOL_RMP_TBL_RECORD = 0x1,
};
#define FWDL_MSS_POOL_DEFKEYSETS_SIZE 8
struct rtw89_fw_mss_pool_hdr {
u8 signature[8]; /* equal to mss_signature[] */
__le32 rmp_tbl_offset;
__le32 key_raw_offset;
u8 defen;
u8 rsvd[3];
u8 rmpfmt; /* enum rtw89_fw_mss_pool_rmp_tbl_type */
u8 mssdev_max;
__le16 keypair_num;
__le16 msscust_max;
__le16 msskey_num_max;
__le32 rsvd3;
u8 rmp_tbl[];
} __packed;
union rtw89_fw_section_mssc_content {
struct {
u8 pad[58];
__le32 v;
} __packed sb_sel_ver;
struct {
u8 pad[60];
__le16 v;
} __packed key_sign_len;
} __packed;
static inline void SET_CTRL_INFO_MACID(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 0, val, GENMASK(6, 0));
}
static inline void SET_CTRL_INFO_OPERATION(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 0, val, BIT(7));
}
#define SET_CMC_TBL_MASK_DATARATE GENMASK(8, 0)
static inline void SET_CMC_TBL_DATARATE(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(8, 0));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DATARATE,
GENMASK(8, 0));
}
#define SET_CMC_TBL_MASK_FORCE_TXOP BIT(0)
static inline void SET_CMC_TBL_FORCE_TXOP(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, BIT(9));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_FORCE_TXOP,
BIT(9));
}
#define SET_CMC_TBL_MASK_DATA_BW GENMASK(1, 0)
static inline void SET_CMC_TBL_DATA_BW(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(11, 10));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DATA_BW,
GENMASK(11, 10));
}
#define SET_CMC_TBL_MASK_DATA_GI_LTF GENMASK(2, 0)
static inline void SET_CMC_TBL_DATA_GI_LTF(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(14, 12));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DATA_GI_LTF,
GENMASK(14, 12));
}
#define SET_CMC_TBL_MASK_DARF_TC_INDEX BIT(0)
static inline void SET_CMC_TBL_DARF_TC_INDEX(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, BIT(15));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DARF_TC_INDEX,
BIT(15));
}
#define SET_CMC_TBL_MASK_ARFR_CTRL GENMASK(3, 0)
static inline void SET_CMC_TBL_ARFR_CTRL(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(19, 16));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_ARFR_CTRL,
GENMASK(19, 16));
}
#define SET_CMC_TBL_MASK_ACQ_RPT_EN BIT(0)
static inline void SET_CMC_TBL_ACQ_RPT_EN(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, BIT(20));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_ACQ_RPT_EN,
BIT(20));
}
#define SET_CMC_TBL_MASK_MGQ_RPT_EN BIT(0)
static inline void SET_CMC_TBL_MGQ_RPT_EN(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, BIT(21));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_MGQ_RPT_EN,
BIT(21));
}
#define SET_CMC_TBL_MASK_ULQ_RPT_EN BIT(0)
static inline void SET_CMC_TBL_ULQ_RPT_EN(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, BIT(22));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_ULQ_RPT_EN,
BIT(22));
}
#define SET_CMC_TBL_MASK_TWTQ_RPT_EN BIT(0)
static inline void SET_CMC_TBL_TWTQ_RPT_EN(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, BIT(23));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_TWTQ_RPT_EN,
BIT(23));
}
#define SET_CMC_TBL_MASK_DISRTSFB BIT(0)
static inline void SET_CMC_TBL_DISRTSFB(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, BIT(25));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DISRTSFB,
BIT(25));
}
#define SET_CMC_TBL_MASK_DISDATAFB BIT(0)
static inline void SET_CMC_TBL_DISDATAFB(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, BIT(26));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DISDATAFB,
BIT(26));
}
#define SET_CMC_TBL_MASK_TRYRATE BIT(0)
static inline void SET_CMC_TBL_TRYRATE(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, BIT(27));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_TRYRATE,
BIT(27));
}
#define SET_CMC_TBL_MASK_AMPDU_DENSITY GENMASK(3, 0)
static inline void SET_CMC_TBL_AMPDU_DENSITY(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(31, 28));
le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_AMPDU_DENSITY,
GENMASK(31, 28));
}
#define SET_CMC_TBL_MASK_DATA_RTY_LOWEST_RATE GENMASK(8, 0)
static inline void SET_CMC_TBL_DATA_RTY_LOWEST_RATE(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(8, 0));
le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_DATA_RTY_LOWEST_RATE,
GENMASK(8, 0));
}
#define SET_CMC_TBL_MASK_AMPDU_TIME_SEL BIT(0)
static inline void SET_CMC_TBL_AMPDU_TIME_SEL(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 2, val, BIT(9));
le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_AMPDU_TIME_SEL,
BIT(9));
}
#define SET_CMC_TBL_MASK_AMPDU_LEN_SEL BIT(0)
static inline void SET_CMC_TBL_AMPDU_LEN_SEL(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 2, val, BIT(10));
le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_AMPDU_LEN_SEL,
BIT(10));
}
#define SET_CMC_TBL_MASK_RTS_TXCNT_LMT_SEL BIT(0)
static inline void SET_CMC_TBL_RTS_TXCNT_LMT_SEL(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 2, val, BIT(11));
le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_RTS_TXCNT_LMT_SEL,
BIT(11));
}
#define SET_CMC_TBL_MASK_RTS_TXCNT_LMT GENMASK(3, 0)
static inline void SET_CMC_TBL_RTS_TXCNT_LMT(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(15, 12));
le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_RTS_TXCNT_LMT,
GENMASK(15, 12));
}
#define SET_CMC_TBL_MASK_RTSRATE GENMASK(8, 0)
static inline void SET_CMC_TBL_RTSRATE(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(24, 16));
le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_RTSRATE,
GENMASK(24, 16));
}
#define SET_CMC_TBL_MASK_VCS_STBC BIT(0)
static inline void SET_CMC_TBL_VCS_STBC(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 2, val, BIT(27));
le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_VCS_STBC,
BIT(27));
}
#define SET_CMC_TBL_MASK_RTS_RTY_LOWEST_RATE GENMASK(3, 0)
static inline void SET_CMC_TBL_RTS_RTY_LOWEST_RATE(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(31, 28));
le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_RTS_RTY_LOWEST_RATE,
GENMASK(31, 28));
}
#define SET_CMC_TBL_MASK_DATA_TX_CNT_LMT GENMASK(5, 0)
static inline void SET_CMC_TBL_DATA_TX_CNT_LMT(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(5, 0));
le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_DATA_TX_CNT_LMT,
GENMASK(5, 0));
}
#define SET_CMC_TBL_MASK_DATA_TXCNT_LMT_SEL BIT(0)
static inline void SET_CMC_TBL_DATA_TXCNT_LMT_SEL(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 3, val, BIT(6));
le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_DATA_TXCNT_LMT_SEL,
BIT(6));
}
#define SET_CMC_TBL_MASK_MAX_AGG_NUM_SEL BIT(0)
static inline void SET_CMC_TBL_MAX_AGG_NUM_SEL(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 3, val, BIT(7));
le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_MAX_AGG_NUM_SEL,
BIT(7));
}
#define SET_CMC_TBL_MASK_RTS_EN BIT(0)
static inline void SET_CMC_TBL_RTS_EN(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 3, val, BIT(8));
le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_RTS_EN,
BIT(8));
}
#define SET_CMC_TBL_MASK_CTS2SELF_EN BIT(0)
static inline void SET_CMC_TBL_CTS2SELF_EN(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 3, val, BIT(9));
le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_CTS2SELF_EN,
BIT(9));
}
#define SET_CMC_TBL_MASK_CCA_RTS GENMASK(1, 0)
static inline void SET_CMC_TBL_CCA_RTS(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(11, 10));
le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_CCA_RTS,
GENMASK(11, 10));
}
#define SET_CMC_TBL_MASK_HW_RTS_EN BIT(0)
static inline void SET_CMC_TBL_HW_RTS_EN(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 3, val, BIT(12));
le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_HW_RTS_EN,
BIT(12));
}
#define SET_CMC_TBL_MASK_RTS_DROP_DATA_MODE GENMASK(1, 0)
static inline void SET_CMC_TBL_RTS_DROP_DATA_MODE(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(14, 13));
le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_RTS_DROP_DATA_MODE,
GENMASK(14, 13));
}
#define SET_CMC_TBL_MASK_AMPDU_MAX_LEN GENMASK(10, 0)
static inline void SET_CMC_TBL_AMPDU_MAX_LEN(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(26, 16));
le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_AMPDU_MAX_LEN,
GENMASK(26, 16));
}
#define SET_CMC_TBL_MASK_UL_MU_DIS BIT(0)
static inline void SET_CMC_TBL_UL_MU_DIS(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 3, val, BIT(27));
le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_UL_MU_DIS,
BIT(27));
}
#define SET_CMC_TBL_MASK_AMPDU_MAX_TIME GENMASK(3, 0)
static inline void SET_CMC_TBL_AMPDU_MAX_TIME(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(31, 28));
le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_AMPDU_MAX_TIME,
GENMASK(31, 28));
}
#define SET_CMC_TBL_MASK_MAX_AGG_NUM GENMASK(7, 0)
static inline void SET_CMC_TBL_MAX_AGG_NUM(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(7, 0));
le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_MAX_AGG_NUM,
GENMASK(7, 0));
}
#define SET_CMC_TBL_MASK_BA_BMAP GENMASK(1, 0)
static inline void SET_CMC_TBL_BA_BMAP(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(9, 8));
le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_BA_BMAP,
GENMASK(9, 8));
}
#define SET_CMC_TBL_MASK_VO_LFTIME_SEL GENMASK(2, 0)
static inline void SET_CMC_TBL_VO_LFTIME_SEL(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(18, 16));
le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_VO_LFTIME_SEL,
GENMASK(18, 16));
}
#define SET_CMC_TBL_MASK_VI_LFTIME_SEL GENMASK(2, 0)
static inline void SET_CMC_TBL_VI_LFTIME_SEL(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(21, 19));
le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_VI_LFTIME_SEL,
GENMASK(21, 19));
}
#define SET_CMC_TBL_MASK_BE_LFTIME_SEL GENMASK(2, 0)
static inline void SET_CMC_TBL_BE_LFTIME_SEL(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(24, 22));
le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_BE_LFTIME_SEL,
GENMASK(24, 22));
}
#define SET_CMC_TBL_MASK_BK_LFTIME_SEL GENMASK(2, 0)
static inline void SET_CMC_TBL_BK_LFTIME_SEL(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(27, 25));
le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_BK_LFTIME_SEL,
GENMASK(27, 25));
}
#define SET_CMC_TBL_MASK_SECTYPE GENMASK(3, 0)
static inline void SET_CMC_TBL_SECTYPE(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(31, 28));
le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_SECTYPE,
GENMASK(31, 28));
}
#define SET_CMC_TBL_MASK_MULTI_PORT_ID GENMASK(2, 0)
static inline void SET_CMC_TBL_MULTI_PORT_ID(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(2, 0));
le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_MULTI_PORT_ID,
GENMASK(2, 0));
}
#define SET_CMC_TBL_MASK_BMC BIT(0)
static inline void SET_CMC_TBL_BMC(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 5, val, BIT(3));
le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_BMC,
BIT(3));
}
#define SET_CMC_TBL_MASK_MBSSID GENMASK(3, 0)
static inline void SET_CMC_TBL_MBSSID(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(7, 4));
le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_MBSSID,
GENMASK(7, 4));
}
#define SET_CMC_TBL_MASK_NAVUSEHDR BIT(0)
static inline void SET_CMC_TBL_NAVUSEHDR(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 5, val, BIT(8));
le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_NAVUSEHDR,
BIT(8));
}
#define SET_CMC_TBL_MASK_TXPWR_MODE GENMASK(2, 0)
static inline void SET_CMC_TBL_TXPWR_MODE(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(11, 9));
le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_TXPWR_MODE,
GENMASK(11, 9));
}
#define SET_CMC_TBL_MASK_DATA_DCM BIT(0)
static inline void SET_CMC_TBL_DATA_DCM(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 5, val, BIT(12));
le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_DCM,
BIT(12));
}
#define SET_CMC_TBL_MASK_DATA_ER BIT(0)
static inline void SET_CMC_TBL_DATA_ER(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 5, val, BIT(13));
le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_ER,
BIT(13));
}
#define SET_CMC_TBL_MASK_DATA_LDPC BIT(0)
static inline void SET_CMC_TBL_DATA_LDPC(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 5, val, BIT(14));
le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_LDPC,
BIT(14));
}
#define SET_CMC_TBL_MASK_DATA_STBC BIT(0)
static inline void SET_CMC_TBL_DATA_STBC(void *table, u32 val)
{
le32p_replace_bits((__le32 *)(table) + 5, val, BIT(15));