162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
262306a36Sopenharmony_ci/* Copyright(c) 2019-2020  Realtek Corporation
362306a36Sopenharmony_ci */
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#ifndef __RTW89_FW_H__
662306a36Sopenharmony_ci#define __RTW89_FW_H__
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include "core.h"
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cienum rtw89_fw_dl_status {
1162306a36Sopenharmony_ci	RTW89_FWDL_INITIAL_STATE = 0,
1262306a36Sopenharmony_ci	RTW89_FWDL_FWDL_ONGOING = 1,
1362306a36Sopenharmony_ci	RTW89_FWDL_CHECKSUM_FAIL = 2,
1462306a36Sopenharmony_ci	RTW89_FWDL_SECURITY_FAIL = 3,
1562306a36Sopenharmony_ci	RTW89_FWDL_CV_NOT_MATCH = 4,
1662306a36Sopenharmony_ci	RTW89_FWDL_RSVD0 = 5,
1762306a36Sopenharmony_ci	RTW89_FWDL_WCPU_FWDL_RDY = 6,
1862306a36Sopenharmony_ci	RTW89_FWDL_WCPU_FW_INIT_RDY = 7
1962306a36Sopenharmony_ci};
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_cistruct rtw89_c2hreg_hdr {
2262306a36Sopenharmony_ci	u32 w0;
2362306a36Sopenharmony_ci};
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define RTW89_C2HREG_HDR_FUNC_MASK GENMASK(6, 0)
2662306a36Sopenharmony_ci#define RTW89_C2HREG_HDR_ACK BIT(7)
2762306a36Sopenharmony_ci#define RTW89_C2HREG_HDR_LEN_MASK GENMASK(11, 8)
2862306a36Sopenharmony_ci#define RTW89_C2HREG_HDR_SEQ_MASK GENMASK(15, 12)
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cistruct rtw89_c2hreg_phycap {
3162306a36Sopenharmony_ci	u32 w0;
3262306a36Sopenharmony_ci	u32 w1;
3362306a36Sopenharmony_ci	u32 w2;
3462306a36Sopenharmony_ci	u32 w3;
3562306a36Sopenharmony_ci} __packed;
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W0_FUNC GENMASK(6, 0)
3862306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W0_ACK BIT(7)
3962306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W0_LEN GENMASK(11, 8)
4062306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W0_SEQ GENMASK(15, 12)
4162306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W0_RX_NSS GENMASK(23, 16)
4262306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W0_BW GENMASK(31, 24)
4362306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W1_TX_NSS GENMASK(7, 0)
4462306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W1_PROT GENMASK(15, 8)
4562306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W1_NIC GENMASK(23, 16)
4662306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W1_WL_FUNC GENMASK(31, 24)
4762306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W2_HW_TYPE GENMASK(7, 0)
4862306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W3_ANT_TX_NUM GENMASK(15, 8)
4962306a36Sopenharmony_ci#define RTW89_C2HREG_PHYCAP_W3_ANT_RX_NUM GENMASK(23, 16)
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_cistruct rtw89_h2creg_hdr {
5262306a36Sopenharmony_ci	u32 w0;
5362306a36Sopenharmony_ci};
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci#define RTW89_H2CREG_HDR_FUNC_MASK GENMASK(6, 0)
5662306a36Sopenharmony_ci#define RTW89_H2CREG_HDR_LEN_MASK GENMASK(11, 8)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_cistruct rtw89_h2creg_sch_tx_en {
5962306a36Sopenharmony_ci	u32 w0;
6062306a36Sopenharmony_ci	u32 w1;
6162306a36Sopenharmony_ci} __packed;
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#define RTW89_H2CREG_SCH_TX_EN_W0_EN GENMASK(31, 16)
6462306a36Sopenharmony_ci#define RTW89_H2CREG_SCH_TX_EN_W1_MASK GENMASK(15, 0)
6562306a36Sopenharmony_ci#define RTW89_H2CREG_SCH_TX_EN_W1_BAND BIT(16)
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci#define RTW89_H2CREG_MAX 4
6862306a36Sopenharmony_ci#define RTW89_C2HREG_MAX 4
6962306a36Sopenharmony_ci#define RTW89_C2HREG_HDR_LEN 2
7062306a36Sopenharmony_ci#define RTW89_H2CREG_HDR_LEN 2
7162306a36Sopenharmony_ci#define RTW89_C2H_TIMEOUT 1000000
7262306a36Sopenharmony_cistruct rtw89_mac_c2h_info {
7362306a36Sopenharmony_ci	u8 id;
7462306a36Sopenharmony_ci	u8 content_len;
7562306a36Sopenharmony_ci	union {
7662306a36Sopenharmony_ci		u32 c2hreg[RTW89_C2HREG_MAX];
7762306a36Sopenharmony_ci		struct rtw89_c2hreg_hdr hdr;
7862306a36Sopenharmony_ci		struct rtw89_c2hreg_phycap phycap;
7962306a36Sopenharmony_ci	} u;
8062306a36Sopenharmony_ci};
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_cistruct rtw89_mac_h2c_info {
8362306a36Sopenharmony_ci	u8 id;
8462306a36Sopenharmony_ci	u8 content_len;
8562306a36Sopenharmony_ci	union {
8662306a36Sopenharmony_ci		u32 h2creg[RTW89_H2CREG_MAX];
8762306a36Sopenharmony_ci		struct rtw89_h2creg_hdr hdr;
8862306a36Sopenharmony_ci		struct rtw89_h2creg_sch_tx_en sch_tx_en;
8962306a36Sopenharmony_ci	} u;
9062306a36Sopenharmony_ci};
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_cienum rtw89_mac_h2c_type {
9362306a36Sopenharmony_ci	RTW89_FWCMD_H2CREG_FUNC_H2CREG_LB = 0,
9462306a36Sopenharmony_ci	RTW89_FWCMD_H2CREG_FUNC_CNSL_CMD,
9562306a36Sopenharmony_ci	RTW89_FWCMD_H2CREG_FUNC_FWERR,
9662306a36Sopenharmony_ci	RTW89_FWCMD_H2CREG_FUNC_GET_FEATURE,
9762306a36Sopenharmony_ci	RTW89_FWCMD_H2CREG_FUNC_GETPKT_INFORM,
9862306a36Sopenharmony_ci	RTW89_FWCMD_H2CREG_FUNC_SCH_TX_EN
9962306a36Sopenharmony_ci};
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_cienum rtw89_mac_c2h_type {
10262306a36Sopenharmony_ci	RTW89_FWCMD_C2HREG_FUNC_C2HREG_LB = 0,
10362306a36Sopenharmony_ci	RTW89_FWCMD_C2HREG_FUNC_ERR_RPT,
10462306a36Sopenharmony_ci	RTW89_FWCMD_C2HREG_FUNC_ERR_MSG,
10562306a36Sopenharmony_ci	RTW89_FWCMD_C2HREG_FUNC_PHY_CAP,
10662306a36Sopenharmony_ci	RTW89_FWCMD_C2HREG_FUNC_TX_PAUSE_RPT,
10762306a36Sopenharmony_ci	RTW89_FWCMD_C2HREG_FUNC_NULL = 0xFF
10862306a36Sopenharmony_ci};
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_cienum rtw89_fw_c2h_category {
11162306a36Sopenharmony_ci	RTW89_C2H_CAT_TEST,
11262306a36Sopenharmony_ci	RTW89_C2H_CAT_MAC,
11362306a36Sopenharmony_ci	RTW89_C2H_CAT_OUTSRC,
11462306a36Sopenharmony_ci};
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_cienum rtw89_fw_log_level {
11762306a36Sopenharmony_ci	RTW89_FW_LOG_LEVEL_OFF,
11862306a36Sopenharmony_ci	RTW89_FW_LOG_LEVEL_CRT,
11962306a36Sopenharmony_ci	RTW89_FW_LOG_LEVEL_SER,
12062306a36Sopenharmony_ci	RTW89_FW_LOG_LEVEL_WARN,
12162306a36Sopenharmony_ci	RTW89_FW_LOG_LEVEL_LOUD,
12262306a36Sopenharmony_ci	RTW89_FW_LOG_LEVEL_TR,
12362306a36Sopenharmony_ci};
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_cienum rtw89_fw_log_path {
12662306a36Sopenharmony_ci	RTW89_FW_LOG_LEVEL_UART,
12762306a36Sopenharmony_ci	RTW89_FW_LOG_LEVEL_C2H,
12862306a36Sopenharmony_ci	RTW89_FW_LOG_LEVEL_SNI,
12962306a36Sopenharmony_ci};
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_cienum rtw89_fw_log_comp {
13262306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_VER,
13362306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_INIT,
13462306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_TASK,
13562306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_CNS,
13662306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_H2C,
13762306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_C2H,
13862306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_TX,
13962306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_RX,
14062306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_IPSEC,
14162306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_TIMER,
14262306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_DBGPKT,
14362306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_PS,
14462306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_ERROR,
14562306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_WOWLAN,
14662306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_SECURE_BOOT,
14762306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_BTC,
14862306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_BB,
14962306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_TWT,
15062306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_RF,
15162306a36Sopenharmony_ci	RTW89_FW_LOG_COMP_MCC = 20,
15262306a36Sopenharmony_ci};
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_cienum rtw89_pkt_offload_op {
15562306a36Sopenharmony_ci	RTW89_PKT_OFLD_OP_ADD,
15662306a36Sopenharmony_ci	RTW89_PKT_OFLD_OP_DEL,
15762306a36Sopenharmony_ci	RTW89_PKT_OFLD_OP_READ,
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci	NUM_OF_RTW89_PKT_OFFLOAD_OP,
16062306a36Sopenharmony_ci};
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci#define RTW89_PKT_OFLD_WAIT_TAG(pkt_id, pkt_op) \
16362306a36Sopenharmony_ci	((pkt_id) * NUM_OF_RTW89_PKT_OFFLOAD_OP + (pkt_op))
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_cienum rtw89_scanofld_notify_reason {
16662306a36Sopenharmony_ci	RTW89_SCAN_DWELL_NOTIFY,
16762306a36Sopenharmony_ci	RTW89_SCAN_PRE_TX_NOTIFY,
16862306a36Sopenharmony_ci	RTW89_SCAN_POST_TX_NOTIFY,
16962306a36Sopenharmony_ci	RTW89_SCAN_ENTER_CH_NOTIFY,
17062306a36Sopenharmony_ci	RTW89_SCAN_LEAVE_CH_NOTIFY,
17162306a36Sopenharmony_ci	RTW89_SCAN_END_SCAN_NOTIFY,
17262306a36Sopenharmony_ci};
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_cienum rtw89_chan_type {
17562306a36Sopenharmony_ci	RTW89_CHAN_OPERATE = 0,
17662306a36Sopenharmony_ci	RTW89_CHAN_ACTIVE,
17762306a36Sopenharmony_ci	RTW89_CHAN_DFS,
17862306a36Sopenharmony_ci};
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_cienum rtw89_p2pps_action {
18162306a36Sopenharmony_ci	RTW89_P2P_ACT_INIT = 0,
18262306a36Sopenharmony_ci	RTW89_P2P_ACT_UPDATE = 1,
18362306a36Sopenharmony_ci	RTW89_P2P_ACT_REMOVE = 2,
18462306a36Sopenharmony_ci	RTW89_P2P_ACT_TERMINATE = 3,
18562306a36Sopenharmony_ci};
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_cienum rtw89_bcn_fltr_offload_mode {
18862306a36Sopenharmony_ci	RTW89_BCN_FLTR_OFFLOAD_MODE_0 = 0,
18962306a36Sopenharmony_ci	RTW89_BCN_FLTR_OFFLOAD_MODE_1,
19062306a36Sopenharmony_ci	RTW89_BCN_FLTR_OFFLOAD_MODE_2,
19162306a36Sopenharmony_ci	RTW89_BCN_FLTR_OFFLOAD_MODE_3,
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci	RTW89_BCN_FLTR_OFFLOAD_MODE_DEFAULT = RTW89_BCN_FLTR_OFFLOAD_MODE_0,
19462306a36Sopenharmony_ci};
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_cienum rtw89_bcn_fltr_type {
19762306a36Sopenharmony_ci	RTW89_BCN_FLTR_BEACON_LOSS,
19862306a36Sopenharmony_ci	RTW89_BCN_FLTR_RSSI,
19962306a36Sopenharmony_ci	RTW89_BCN_FLTR_NOTIFY,
20062306a36Sopenharmony_ci};
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_cienum rtw89_bcn_fltr_rssi_event {
20362306a36Sopenharmony_ci	RTW89_BCN_FLTR_RSSI_NOT_CHANGED,
20462306a36Sopenharmony_ci	RTW89_BCN_FLTR_RSSI_HIGH,
20562306a36Sopenharmony_ci	RTW89_BCN_FLTR_RSSI_LOW,
20662306a36Sopenharmony_ci};
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci#define FWDL_SECTION_MAX_NUM 10
20962306a36Sopenharmony_ci#define FWDL_SECTION_CHKSUM_LEN	8
21062306a36Sopenharmony_ci#define FWDL_SECTION_PER_PKT_LEN 2020
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_cistruct rtw89_fw_hdr_section_info {
21362306a36Sopenharmony_ci	u8 redl;
21462306a36Sopenharmony_ci	const u8 *addr;
21562306a36Sopenharmony_ci	u32 len;
21662306a36Sopenharmony_ci	u32 dladdr;
21762306a36Sopenharmony_ci	u32 mssc;
21862306a36Sopenharmony_ci	u8 type;
21962306a36Sopenharmony_ci};
22062306a36Sopenharmony_ci
22162306a36Sopenharmony_cistruct rtw89_fw_bin_info {
22262306a36Sopenharmony_ci	u8 section_num;
22362306a36Sopenharmony_ci	u32 hdr_len;
22462306a36Sopenharmony_ci	bool dynamic_hdr_en;
22562306a36Sopenharmony_ci	u32 dynamic_hdr_len;
22662306a36Sopenharmony_ci	struct rtw89_fw_hdr_section_info section_info[FWDL_SECTION_MAX_NUM];
22762306a36Sopenharmony_ci};
22862306a36Sopenharmony_ci
22962306a36Sopenharmony_cistruct rtw89_fw_macid_pause_grp {
23062306a36Sopenharmony_ci	__le32 pause_grp[4];
23162306a36Sopenharmony_ci	__le32 mask_grp[4];
23262306a36Sopenharmony_ci} __packed;
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ci#define RTW89_H2C_MAX_SIZE 2048
23562306a36Sopenharmony_ci#define RTW89_CHANNEL_TIME 45
23662306a36Sopenharmony_ci#define RTW89_CHANNEL_TIME_6G 20
23762306a36Sopenharmony_ci#define RTW89_DFS_CHAN_TIME 105
23862306a36Sopenharmony_ci#define RTW89_OFF_CHAN_TIME 100
23962306a36Sopenharmony_ci#define RTW89_DWELL_TIME 20
24062306a36Sopenharmony_ci#define RTW89_DWELL_TIME_6G 10
24162306a36Sopenharmony_ci#define RTW89_SCAN_WIDTH 0
24262306a36Sopenharmony_ci#define RTW89_SCANOFLD_MAX_SSID 8
24362306a36Sopenharmony_ci#define RTW89_SCANOFLD_MAX_IE_LEN 512
24462306a36Sopenharmony_ci#define RTW89_SCANOFLD_PKT_NONE 0xFF
24562306a36Sopenharmony_ci#define RTW89_SCANOFLD_DEBUG_MASK 0x1F
24662306a36Sopenharmony_ci#define RTW89_MAC_CHINFO_SIZE 28
24762306a36Sopenharmony_ci#define RTW89_SCAN_LIST_GUARD 4
24862306a36Sopenharmony_ci#define RTW89_SCAN_LIST_LIMIT \
24962306a36Sopenharmony_ci		((RTW89_H2C_MAX_SIZE / RTW89_MAC_CHINFO_SIZE) - RTW89_SCAN_LIST_GUARD)
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci#define RTW89_BCN_LOSS_CNT 10
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_cistruct rtw89_mac_chinfo {
25462306a36Sopenharmony_ci	u8 period;
25562306a36Sopenharmony_ci	u8 dwell_time;
25662306a36Sopenharmony_ci	u8 central_ch;
25762306a36Sopenharmony_ci	u8 pri_ch;
25862306a36Sopenharmony_ci	u8 bw:3;
25962306a36Sopenharmony_ci	u8 notify_action:5;
26062306a36Sopenharmony_ci	u8 num_pkt:4;
26162306a36Sopenharmony_ci	u8 tx_pkt:1;
26262306a36Sopenharmony_ci	u8 pause_data:1;
26362306a36Sopenharmony_ci	u8 ch_band:2;
26462306a36Sopenharmony_ci	u8 probe_id;
26562306a36Sopenharmony_ci	u8 dfs_ch:1;
26662306a36Sopenharmony_ci	u8 tx_null:1;
26762306a36Sopenharmony_ci	u8 rand_seq_num:1;
26862306a36Sopenharmony_ci	u8 cfg_tx_pwr:1;
26962306a36Sopenharmony_ci	u8 rsvd0: 4;
27062306a36Sopenharmony_ci	u8 pkt_id[RTW89_SCANOFLD_MAX_SSID];
27162306a36Sopenharmony_ci	u16 tx_pwr_idx;
27262306a36Sopenharmony_ci	u8 rsvd1;
27362306a36Sopenharmony_ci	struct list_head list;
27462306a36Sopenharmony_ci	bool is_psc;
27562306a36Sopenharmony_ci};
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_cistruct rtw89_scan_option {
27862306a36Sopenharmony_ci	bool enable;
27962306a36Sopenharmony_ci	bool target_ch_mode;
28062306a36Sopenharmony_ci};
28162306a36Sopenharmony_ci
28262306a36Sopenharmony_cistruct rtw89_pktofld_info {
28362306a36Sopenharmony_ci	struct list_head list;
28462306a36Sopenharmony_ci	u8 id;
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci	/* Below fields are for 6 GHz RNR use only */
28762306a36Sopenharmony_ci	u8 ssid[IEEE80211_MAX_SSID_LEN];
28862306a36Sopenharmony_ci	u8 ssid_len;
28962306a36Sopenharmony_ci	u8 bssid[ETH_ALEN];
29062306a36Sopenharmony_ci	u16 channel_6ghz;
29162306a36Sopenharmony_ci	bool cancel;
29262306a36Sopenharmony_ci};
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_cistruct rtw89_h2c_ra {
29562306a36Sopenharmony_ci	__le32 w0;
29662306a36Sopenharmony_ci	__le32 w1;
29762306a36Sopenharmony_ci	__le32 w2;
29862306a36Sopenharmony_ci	__le32 w3;
29962306a36Sopenharmony_ci} __packed;
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_IS_DIS BIT(0)
30262306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_MODE GENMASK(5, 1)
30362306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_BW_CAP GENMASK(7, 6)
30462306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_MACID GENMASK(15, 8)
30562306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_DCM BIT(16)
30662306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_ER BIT(17)
30762306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_INIT_RATE_LV GENMASK(19, 18)
30862306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_UPD_ALL BIT(20)
30962306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_SGI BIT(21)
31062306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_LDPC BIT(22)
31162306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_STBC BIT(23)
31262306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_SS_NUM GENMASK(26, 24)
31362306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_GILTF GENMASK(29, 27)
31462306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_UPD_BW_NSS_MASK BIT(30)
31562306a36Sopenharmony_ci#define RTW89_H2C_RA_W0_UPD_MASK BIT(31)
31662306a36Sopenharmony_ci#define RTW89_H2C_RA_W1_RAMASK_LO32 GENMASK(31, 0)
31762306a36Sopenharmony_ci#define RTW89_H2C_RA_W2_RAMASK_HI32 GENMASK(30, 0)
31862306a36Sopenharmony_ci#define RTW89_H2C_RA_W2_BFEE_CSI_CTL BIT(31)
31962306a36Sopenharmony_ci#define RTW89_H2C_RA_W3_BAND_NUM GENMASK(7, 0)
32062306a36Sopenharmony_ci#define RTW89_H2C_RA_W3_RA_CSI_RATE_EN BIT(8)
32162306a36Sopenharmony_ci#define RTW89_H2C_RA_W3_FIXED_CSI_RATE_EN BIT(9)
32262306a36Sopenharmony_ci#define RTW89_H2C_RA_W3_CR_TBL_SEL BIT(10)
32362306a36Sopenharmony_ci#define RTW89_H2C_RA_W3_FIX_GILTF_EN BIT(11)
32462306a36Sopenharmony_ci#define RTW89_H2C_RA_W3_FIX_GILTF GENMASK(14, 12)
32562306a36Sopenharmony_ci#define RTW89_H2C_RA_W3_FIXED_CSI_MCS_SS_IDX GENMASK(23, 16)
32662306a36Sopenharmony_ci#define RTW89_H2C_RA_W3_FIXED_CSI_MODE GENMASK(25, 24)
32762306a36Sopenharmony_ci#define RTW89_H2C_RA_W3_FIXED_CSI_GI_LTF GENMASK(28, 26)
32862306a36Sopenharmony_ci#define RTW89_H2C_RA_W3_FIXED_CSI_BW GENMASK(31, 29)
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_cistruct rtw89_h2c_ra_v1 {
33162306a36Sopenharmony_ci	struct rtw89_h2c_ra v0;
33262306a36Sopenharmony_ci	__le32 w4;
33362306a36Sopenharmony_ci	__le32 w5;
33462306a36Sopenharmony_ci} __packed;
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci#define RTW89_H2C_RA_V1_W4_MODE_EHT GENMASK(6, 0)
33762306a36Sopenharmony_ci#define RTW89_H2C_RA_V1_W4_BW_EHT GENMASK(10, 8)
33862306a36Sopenharmony_ci#define RTW89_H2C_RA_V1_W4_RAMASK_UHL16 GENMASK(31, 16)
33962306a36Sopenharmony_ci#define RTW89_H2C_RA_V1_W5_RAMASK_UHH16 GENMASK(15, 0)
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_SEC_IDX(void *cmd, u32 val)
34262306a36Sopenharmony_ci{
34362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(7, 0));
34462306a36Sopenharmony_ci}
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_SEC_OFFSET(void *cmd, u32 val)
34762306a36Sopenharmony_ci{
34862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(15, 8));
34962306a36Sopenharmony_ci}
35062306a36Sopenharmony_ci
35162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_SEC_LEN(void *cmd, u32 val)
35262306a36Sopenharmony_ci{
35362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(23, 16));
35462306a36Sopenharmony_ci}
35562306a36Sopenharmony_ci
35662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_SEC_TYPE(void *cmd, u32 val)
35762306a36Sopenharmony_ci{
35862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x01, val, GENMASK(3, 0));
35962306a36Sopenharmony_ci}
36062306a36Sopenharmony_ci
36162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_SEC_EXT_KEY(void *cmd, u32 val)
36262306a36Sopenharmony_ci{
36362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x01, val, BIT(4));
36462306a36Sopenharmony_ci}
36562306a36Sopenharmony_ci
36662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_SEC_SPP_MODE(void *cmd, u32 val)
36762306a36Sopenharmony_ci{
36862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x01, val, BIT(5));
36962306a36Sopenharmony_ci}
37062306a36Sopenharmony_ci
37162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_SEC_KEY0(void *cmd, u32 val)
37262306a36Sopenharmony_ci{
37362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x02, val, GENMASK(31, 0));
37462306a36Sopenharmony_ci}
37562306a36Sopenharmony_ci
37662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_SEC_KEY1(void *cmd, u32 val)
37762306a36Sopenharmony_ci{
37862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x03, val, GENMASK(31, 0));
37962306a36Sopenharmony_ci}
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_SEC_KEY2(void *cmd, u32 val)
38262306a36Sopenharmony_ci{
38362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x04, val, GENMASK(31, 0));
38462306a36Sopenharmony_ci}
38562306a36Sopenharmony_ci
38662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_SEC_KEY3(void *cmd, u32 val)
38762306a36Sopenharmony_ci{
38862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x05, val, GENMASK(31, 0));
38962306a36Sopenharmony_ci}
39062306a36Sopenharmony_ci
39162306a36Sopenharmony_cistatic inline void RTW89_SET_EDCA_SEL(void *cmd, u32 val)
39262306a36Sopenharmony_ci{
39362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(1, 0));
39462306a36Sopenharmony_ci}
39562306a36Sopenharmony_ci
39662306a36Sopenharmony_cistatic inline void RTW89_SET_EDCA_BAND(void *cmd, u32 val)
39762306a36Sopenharmony_ci{
39862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x00, val, BIT(3));
39962306a36Sopenharmony_ci}
40062306a36Sopenharmony_ci
40162306a36Sopenharmony_cistatic inline void RTW89_SET_EDCA_WMM(void *cmd, u32 val)
40262306a36Sopenharmony_ci{
40362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x00, val, BIT(4));
40462306a36Sopenharmony_ci}
40562306a36Sopenharmony_ci
40662306a36Sopenharmony_cistatic inline void RTW89_SET_EDCA_AC(void *cmd, u32 val)
40762306a36Sopenharmony_ci{
40862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x00, val, GENMASK(6, 5));
40962306a36Sopenharmony_ci}
41062306a36Sopenharmony_ci
41162306a36Sopenharmony_cistatic inline void RTW89_SET_EDCA_PARAM(void *cmd, u32 val)
41262306a36Sopenharmony_ci{
41362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 0x01, val, GENMASK(31, 0));
41462306a36Sopenharmony_ci}
41562306a36Sopenharmony_ci#define FW_EDCA_PARAM_TXOPLMT_MSK GENMASK(26, 16)
41662306a36Sopenharmony_ci#define FW_EDCA_PARAM_CWMAX_MSK GENMASK(15, 12)
41762306a36Sopenharmony_ci#define FW_EDCA_PARAM_CWMIN_MSK GENMASK(11, 8)
41862306a36Sopenharmony_ci#define FW_EDCA_PARAM_AIFS_MSK GENMASK(7, 0)
41962306a36Sopenharmony_ci
42062306a36Sopenharmony_ci#define FWDL_SECURITY_SECTION_TYPE 9
42162306a36Sopenharmony_ci#define FWDL_SECURITY_SIGLEN 512
42262306a36Sopenharmony_ci
42362306a36Sopenharmony_cistruct rtw89_fw_dynhdr_sec {
42462306a36Sopenharmony_ci	__le32 w0;
42562306a36Sopenharmony_ci	u8 content[];
42662306a36Sopenharmony_ci} __packed;
42762306a36Sopenharmony_ci
42862306a36Sopenharmony_cistruct rtw89_fw_dynhdr_hdr {
42962306a36Sopenharmony_ci	__le32 hdr_len;
43062306a36Sopenharmony_ci	__le32 setcion_count;
43162306a36Sopenharmony_ci	/* struct rtw89_fw_dynhdr_sec (nested flexible structures) */
43262306a36Sopenharmony_ci} __packed;
43362306a36Sopenharmony_ci
43462306a36Sopenharmony_cistruct rtw89_fw_hdr_section {
43562306a36Sopenharmony_ci	__le32 w0;
43662306a36Sopenharmony_ci	__le32 w1;
43762306a36Sopenharmony_ci	__le32 w2;
43862306a36Sopenharmony_ci	__le32 w3;
43962306a36Sopenharmony_ci} __packed;
44062306a36Sopenharmony_ci
44162306a36Sopenharmony_ci#define FWSECTION_HDR_W0_DL_ADDR GENMASK(31, 0)
44262306a36Sopenharmony_ci#define FWSECTION_HDR_W1_METADATA GENMASK(31, 24)
44362306a36Sopenharmony_ci#define FWSECTION_HDR_W1_SECTIONTYPE GENMASK(27, 24)
44462306a36Sopenharmony_ci#define FWSECTION_HDR_W1_SEC_SIZE GENMASK(23, 0)
44562306a36Sopenharmony_ci#define FWSECTION_HDR_W1_CHECKSUM BIT(28)
44662306a36Sopenharmony_ci#define FWSECTION_HDR_W1_REDL BIT(29)
44762306a36Sopenharmony_ci#define FWSECTION_HDR_W2_MSSC GENMASK(31, 0)
44862306a36Sopenharmony_ci
44962306a36Sopenharmony_cistruct rtw89_fw_hdr {
45062306a36Sopenharmony_ci	__le32 w0;
45162306a36Sopenharmony_ci	__le32 w1;
45262306a36Sopenharmony_ci	__le32 w2;
45362306a36Sopenharmony_ci	__le32 w3;
45462306a36Sopenharmony_ci	__le32 w4;
45562306a36Sopenharmony_ci	__le32 w5;
45662306a36Sopenharmony_ci	__le32 w6;
45762306a36Sopenharmony_ci	__le32 w7;
45862306a36Sopenharmony_ci	struct rtw89_fw_hdr_section sections[];
45962306a36Sopenharmony_ci	/* struct rtw89_fw_dynhdr_hdr (optional) */
46062306a36Sopenharmony_ci} __packed;
46162306a36Sopenharmony_ci
46262306a36Sopenharmony_ci#define FW_HDR_W1_MAJOR_VERSION GENMASK(7, 0)
46362306a36Sopenharmony_ci#define FW_HDR_W1_MINOR_VERSION GENMASK(15, 8)
46462306a36Sopenharmony_ci#define FW_HDR_W1_SUBVERSION GENMASK(23, 16)
46562306a36Sopenharmony_ci#define FW_HDR_W1_SUBINDEX GENMASK(31, 24)
46662306a36Sopenharmony_ci#define FW_HDR_W2_COMMITID GENMASK(31, 0)
46762306a36Sopenharmony_ci#define FW_HDR_W3_LEN GENMASK(23, 16)
46862306a36Sopenharmony_ci#define FW_HDR_W3_HDR_VER GENMASK(31, 24)
46962306a36Sopenharmony_ci#define FW_HDR_W4_MONTH GENMASK(7, 0)
47062306a36Sopenharmony_ci#define FW_HDR_W4_DATE GENMASK(15, 8)
47162306a36Sopenharmony_ci#define FW_HDR_W4_HOUR GENMASK(23, 16)
47262306a36Sopenharmony_ci#define FW_HDR_W4_MIN GENMASK(31, 24)
47362306a36Sopenharmony_ci#define FW_HDR_W5_YEAR GENMASK(31, 0)
47462306a36Sopenharmony_ci#define FW_HDR_W6_SEC_NUM GENMASK(15, 8)
47562306a36Sopenharmony_ci#define FW_HDR_W7_DYN_HDR BIT(16)
47662306a36Sopenharmony_ci#define FW_HDR_W7_CMD_VERSERION GENMASK(31, 24)
47762306a36Sopenharmony_ci
47862306a36Sopenharmony_cistruct rtw89_fw_hdr_section_v1 {
47962306a36Sopenharmony_ci	__le32 w0;
48062306a36Sopenharmony_ci	__le32 w1;
48162306a36Sopenharmony_ci	__le32 w2;
48262306a36Sopenharmony_ci	__le32 w3;
48362306a36Sopenharmony_ci} __packed;
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_ci#define FWSECTION_HDR_V1_W0_DL_ADDR GENMASK(31, 0)
48662306a36Sopenharmony_ci#define FWSECTION_HDR_V1_W1_METADATA GENMASK(31, 24)
48762306a36Sopenharmony_ci#define FWSECTION_HDR_V1_W1_SECTIONTYPE GENMASK(27, 24)
48862306a36Sopenharmony_ci#define FWSECTION_HDR_V1_W1_SEC_SIZE GENMASK(23, 0)
48962306a36Sopenharmony_ci#define FWSECTION_HDR_V1_W1_CHECKSUM BIT(28)
49062306a36Sopenharmony_ci#define FWSECTION_HDR_V1_W1_REDL BIT(29)
49162306a36Sopenharmony_ci#define FWSECTION_HDR_V1_W2_MSSC GENMASK(7, 0)
49262306a36Sopenharmony_ci#define FWSECTION_HDR_V1_W2_BBMCU_IDX GENMASK(27, 24)
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_cistruct rtw89_fw_hdr_v1 {
49562306a36Sopenharmony_ci	__le32 w0;
49662306a36Sopenharmony_ci	__le32 w1;
49762306a36Sopenharmony_ci	__le32 w2;
49862306a36Sopenharmony_ci	__le32 w3;
49962306a36Sopenharmony_ci	__le32 w4;
50062306a36Sopenharmony_ci	__le32 w5;
50162306a36Sopenharmony_ci	__le32 w6;
50262306a36Sopenharmony_ci	__le32 w7;
50362306a36Sopenharmony_ci	__le32 w8;
50462306a36Sopenharmony_ci	__le32 w9;
50562306a36Sopenharmony_ci	__le32 w10;
50662306a36Sopenharmony_ci	__le32 w11;
50762306a36Sopenharmony_ci	struct rtw89_fw_hdr_section_v1 sections[];
50862306a36Sopenharmony_ci} __packed;
50962306a36Sopenharmony_ci
51062306a36Sopenharmony_ci#define FW_HDR_V1_W1_MAJOR_VERSION GENMASK(7, 0)
51162306a36Sopenharmony_ci#define FW_HDR_V1_W1_MINOR_VERSION GENMASK(15, 8)
51262306a36Sopenharmony_ci#define FW_HDR_V1_W1_SUBVERSION GENMASK(23, 16)
51362306a36Sopenharmony_ci#define FW_HDR_V1_W1_SUBINDEX GENMASK(31, 24)
51462306a36Sopenharmony_ci#define FW_HDR_V1_W2_COMMITID GENMASK(31, 0)
51562306a36Sopenharmony_ci#define FW_HDR_V1_W3_CMD_VERSERION GENMASK(23, 16)
51662306a36Sopenharmony_ci#define FW_HDR_V1_W3_HDR_VER GENMASK(31, 24)
51762306a36Sopenharmony_ci#define FW_HDR_V1_W4_MONTH GENMASK(7, 0)
51862306a36Sopenharmony_ci#define FW_HDR_V1_W4_DATE GENMASK(15, 8)
51962306a36Sopenharmony_ci#define FW_HDR_V1_W4_HOUR GENMASK(23, 16)
52062306a36Sopenharmony_ci#define FW_HDR_V1_W4_MIN GENMASK(31, 24)
52162306a36Sopenharmony_ci#define FW_HDR_V1_W5_YEAR GENMASK(15, 0)
52262306a36Sopenharmony_ci#define FW_HDR_V1_W5_HDR_SIZE GENMASK(31, 16)
52362306a36Sopenharmony_ci#define FW_HDR_V1_W6_SEC_NUM GENMASK(15, 8)
52462306a36Sopenharmony_ci#define FW_HDR_V1_W7_DYN_HDR BIT(16)
52562306a36Sopenharmony_ci
52662306a36Sopenharmony_cistatic inline void SET_FW_HDR_PART_SIZE(void *fwhdr, u32 val)
52762306a36Sopenharmony_ci{
52862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)fwhdr + 7, val, GENMASK(15, 0));
52962306a36Sopenharmony_ci}
53062306a36Sopenharmony_ci
53162306a36Sopenharmony_cistatic inline void SET_CTRL_INFO_MACID(void *table, u32 val)
53262306a36Sopenharmony_ci{
53362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 0, val, GENMASK(6, 0));
53462306a36Sopenharmony_ci}
53562306a36Sopenharmony_ci
53662306a36Sopenharmony_cistatic inline void SET_CTRL_INFO_OPERATION(void *table, u32 val)
53762306a36Sopenharmony_ci{
53862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 0, val, BIT(7));
53962306a36Sopenharmony_ci}
54062306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DATARATE GENMASK(8, 0)
54162306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DATARATE(void *table, u32 val)
54262306a36Sopenharmony_ci{
54362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(8, 0));
54462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DATARATE,
54562306a36Sopenharmony_ci			   GENMASK(8, 0));
54662306a36Sopenharmony_ci}
54762306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_FORCE_TXOP BIT(0)
54862306a36Sopenharmony_cistatic inline void SET_CMC_TBL_FORCE_TXOP(void *table, u32 val)
54962306a36Sopenharmony_ci{
55062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, BIT(9));
55162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_FORCE_TXOP,
55262306a36Sopenharmony_ci			   BIT(9));
55362306a36Sopenharmony_ci}
55462306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DATA_BW GENMASK(1, 0)
55562306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DATA_BW(void *table, u32 val)
55662306a36Sopenharmony_ci{
55762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(11, 10));
55862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DATA_BW,
55962306a36Sopenharmony_ci			   GENMASK(11, 10));
56062306a36Sopenharmony_ci}
56162306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DATA_GI_LTF GENMASK(2, 0)
56262306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DATA_GI_LTF(void *table, u32 val)
56362306a36Sopenharmony_ci{
56462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(14, 12));
56562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DATA_GI_LTF,
56662306a36Sopenharmony_ci			   GENMASK(14, 12));
56762306a36Sopenharmony_ci}
56862306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DARF_TC_INDEX BIT(0)
56962306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DARF_TC_INDEX(void *table, u32 val)
57062306a36Sopenharmony_ci{
57162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, BIT(15));
57262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DARF_TC_INDEX,
57362306a36Sopenharmony_ci			   BIT(15));
57462306a36Sopenharmony_ci}
57562306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_ARFR_CTRL GENMASK(3, 0)
57662306a36Sopenharmony_cistatic inline void SET_CMC_TBL_ARFR_CTRL(void *table, u32 val)
57762306a36Sopenharmony_ci{
57862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(19, 16));
57962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_ARFR_CTRL,
58062306a36Sopenharmony_ci			   GENMASK(19, 16));
58162306a36Sopenharmony_ci}
58262306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_ACQ_RPT_EN BIT(0)
58362306a36Sopenharmony_cistatic inline void SET_CMC_TBL_ACQ_RPT_EN(void *table, u32 val)
58462306a36Sopenharmony_ci{
58562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, BIT(20));
58662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_ACQ_RPT_EN,
58762306a36Sopenharmony_ci			   BIT(20));
58862306a36Sopenharmony_ci}
58962306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_MGQ_RPT_EN BIT(0)
59062306a36Sopenharmony_cistatic inline void SET_CMC_TBL_MGQ_RPT_EN(void *table, u32 val)
59162306a36Sopenharmony_ci{
59262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, BIT(21));
59362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_MGQ_RPT_EN,
59462306a36Sopenharmony_ci			   BIT(21));
59562306a36Sopenharmony_ci}
59662306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_ULQ_RPT_EN BIT(0)
59762306a36Sopenharmony_cistatic inline void SET_CMC_TBL_ULQ_RPT_EN(void *table, u32 val)
59862306a36Sopenharmony_ci{
59962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, BIT(22));
60062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_ULQ_RPT_EN,
60162306a36Sopenharmony_ci			   BIT(22));
60262306a36Sopenharmony_ci}
60362306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_TWTQ_RPT_EN BIT(0)
60462306a36Sopenharmony_cistatic inline void SET_CMC_TBL_TWTQ_RPT_EN(void *table, u32 val)
60562306a36Sopenharmony_ci{
60662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, BIT(23));
60762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_TWTQ_RPT_EN,
60862306a36Sopenharmony_ci			   BIT(23));
60962306a36Sopenharmony_ci}
61062306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DISRTSFB BIT(0)
61162306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DISRTSFB(void *table, u32 val)
61262306a36Sopenharmony_ci{
61362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, BIT(25));
61462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DISRTSFB,
61562306a36Sopenharmony_ci			   BIT(25));
61662306a36Sopenharmony_ci}
61762306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DISDATAFB BIT(0)
61862306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DISDATAFB(void *table, u32 val)
61962306a36Sopenharmony_ci{
62062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, BIT(26));
62162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_DISDATAFB,
62262306a36Sopenharmony_ci			   BIT(26));
62362306a36Sopenharmony_ci}
62462306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_TRYRATE BIT(0)
62562306a36Sopenharmony_cistatic inline void SET_CMC_TBL_TRYRATE(void *table, u32 val)
62662306a36Sopenharmony_ci{
62762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, BIT(27));
62862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_TRYRATE,
62962306a36Sopenharmony_ci			   BIT(27));
63062306a36Sopenharmony_ci}
63162306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_AMPDU_DENSITY GENMASK(3, 0)
63262306a36Sopenharmony_cistatic inline void SET_CMC_TBL_AMPDU_DENSITY(void *table, u32 val)
63362306a36Sopenharmony_ci{
63462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(31, 28));
63562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_CMC_TBL_MASK_AMPDU_DENSITY,
63662306a36Sopenharmony_ci			   GENMASK(31, 28));
63762306a36Sopenharmony_ci}
63862306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DATA_RTY_LOWEST_RATE GENMASK(8, 0)
63962306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DATA_RTY_LOWEST_RATE(void *table, u32 val)
64062306a36Sopenharmony_ci{
64162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(8, 0));
64262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_DATA_RTY_LOWEST_RATE,
64362306a36Sopenharmony_ci			   GENMASK(8, 0));
64462306a36Sopenharmony_ci}
64562306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_AMPDU_TIME_SEL BIT(0)
64662306a36Sopenharmony_cistatic inline void SET_CMC_TBL_AMPDU_TIME_SEL(void *table, u32 val)
64762306a36Sopenharmony_ci{
64862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 2, val, BIT(9));
64962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_AMPDU_TIME_SEL,
65062306a36Sopenharmony_ci			   BIT(9));
65162306a36Sopenharmony_ci}
65262306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_AMPDU_LEN_SEL BIT(0)
65362306a36Sopenharmony_cistatic inline void SET_CMC_TBL_AMPDU_LEN_SEL(void *table, u32 val)
65462306a36Sopenharmony_ci{
65562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 2, val, BIT(10));
65662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_AMPDU_LEN_SEL,
65762306a36Sopenharmony_ci			   BIT(10));
65862306a36Sopenharmony_ci}
65962306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_RTS_TXCNT_LMT_SEL BIT(0)
66062306a36Sopenharmony_cistatic inline void SET_CMC_TBL_RTS_TXCNT_LMT_SEL(void *table, u32 val)
66162306a36Sopenharmony_ci{
66262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 2, val, BIT(11));
66362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_RTS_TXCNT_LMT_SEL,
66462306a36Sopenharmony_ci			   BIT(11));
66562306a36Sopenharmony_ci}
66662306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_RTS_TXCNT_LMT GENMASK(3, 0)
66762306a36Sopenharmony_cistatic inline void SET_CMC_TBL_RTS_TXCNT_LMT(void *table, u32 val)
66862306a36Sopenharmony_ci{
66962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(15, 12));
67062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_RTS_TXCNT_LMT,
67162306a36Sopenharmony_ci			   GENMASK(15, 12));
67262306a36Sopenharmony_ci}
67362306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_RTSRATE GENMASK(8, 0)
67462306a36Sopenharmony_cistatic inline void SET_CMC_TBL_RTSRATE(void *table, u32 val)
67562306a36Sopenharmony_ci{
67662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(24, 16));
67762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_RTSRATE,
67862306a36Sopenharmony_ci			   GENMASK(24, 16));
67962306a36Sopenharmony_ci}
68062306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_VCS_STBC BIT(0)
68162306a36Sopenharmony_cistatic inline void SET_CMC_TBL_VCS_STBC(void *table, u32 val)
68262306a36Sopenharmony_ci{
68362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 2, val, BIT(27));
68462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_VCS_STBC,
68562306a36Sopenharmony_ci			   BIT(27));
68662306a36Sopenharmony_ci}
68762306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_RTS_RTY_LOWEST_RATE GENMASK(3, 0)
68862306a36Sopenharmony_cistatic inline void SET_CMC_TBL_RTS_RTY_LOWEST_RATE(void *table, u32 val)
68962306a36Sopenharmony_ci{
69062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(31, 28));
69162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 10, SET_CMC_TBL_MASK_RTS_RTY_LOWEST_RATE,
69262306a36Sopenharmony_ci			   GENMASK(31, 28));
69362306a36Sopenharmony_ci}
69462306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DATA_TX_CNT_LMT GENMASK(5, 0)
69562306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DATA_TX_CNT_LMT(void *table, u32 val)
69662306a36Sopenharmony_ci{
69762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(5, 0));
69862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_DATA_TX_CNT_LMT,
69962306a36Sopenharmony_ci			   GENMASK(5, 0));
70062306a36Sopenharmony_ci}
70162306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DATA_TXCNT_LMT_SEL BIT(0)
70262306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DATA_TXCNT_LMT_SEL(void *table, u32 val)
70362306a36Sopenharmony_ci{
70462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, BIT(6));
70562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_DATA_TXCNT_LMT_SEL,
70662306a36Sopenharmony_ci			   BIT(6));
70762306a36Sopenharmony_ci}
70862306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_MAX_AGG_NUM_SEL BIT(0)
70962306a36Sopenharmony_cistatic inline void SET_CMC_TBL_MAX_AGG_NUM_SEL(void *table, u32 val)
71062306a36Sopenharmony_ci{
71162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, BIT(7));
71262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_MAX_AGG_NUM_SEL,
71362306a36Sopenharmony_ci			   BIT(7));
71462306a36Sopenharmony_ci}
71562306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_RTS_EN BIT(0)
71662306a36Sopenharmony_cistatic inline void SET_CMC_TBL_RTS_EN(void *table, u32 val)
71762306a36Sopenharmony_ci{
71862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, BIT(8));
71962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_RTS_EN,
72062306a36Sopenharmony_ci			   BIT(8));
72162306a36Sopenharmony_ci}
72262306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CTS2SELF_EN BIT(0)
72362306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CTS2SELF_EN(void *table, u32 val)
72462306a36Sopenharmony_ci{
72562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, BIT(9));
72662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_CTS2SELF_EN,
72762306a36Sopenharmony_ci			   BIT(9));
72862306a36Sopenharmony_ci}
72962306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CCA_RTS GENMASK(1, 0)
73062306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CCA_RTS(void *table, u32 val)
73162306a36Sopenharmony_ci{
73262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(11, 10));
73362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_CCA_RTS,
73462306a36Sopenharmony_ci			   GENMASK(11, 10));
73562306a36Sopenharmony_ci}
73662306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_HW_RTS_EN BIT(0)
73762306a36Sopenharmony_cistatic inline void SET_CMC_TBL_HW_RTS_EN(void *table, u32 val)
73862306a36Sopenharmony_ci{
73962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, BIT(12));
74062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_HW_RTS_EN,
74162306a36Sopenharmony_ci			   BIT(12));
74262306a36Sopenharmony_ci}
74362306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_RTS_DROP_DATA_MODE GENMASK(1, 0)
74462306a36Sopenharmony_cistatic inline void SET_CMC_TBL_RTS_DROP_DATA_MODE(void *table, u32 val)
74562306a36Sopenharmony_ci{
74662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(14, 13));
74762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_RTS_DROP_DATA_MODE,
74862306a36Sopenharmony_ci			   GENMASK(14, 13));
74962306a36Sopenharmony_ci}
75062306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_AMPDU_MAX_LEN GENMASK(10, 0)
75162306a36Sopenharmony_cistatic inline void SET_CMC_TBL_AMPDU_MAX_LEN(void *table, u32 val)
75262306a36Sopenharmony_ci{
75362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(26, 16));
75462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_AMPDU_MAX_LEN,
75562306a36Sopenharmony_ci			   GENMASK(26, 16));
75662306a36Sopenharmony_ci}
75762306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_UL_MU_DIS BIT(0)
75862306a36Sopenharmony_cistatic inline void SET_CMC_TBL_UL_MU_DIS(void *table, u32 val)
75962306a36Sopenharmony_ci{
76062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, BIT(27));
76162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_UL_MU_DIS,
76262306a36Sopenharmony_ci			   BIT(27));
76362306a36Sopenharmony_ci}
76462306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_AMPDU_MAX_TIME GENMASK(3, 0)
76562306a36Sopenharmony_cistatic inline void SET_CMC_TBL_AMPDU_MAX_TIME(void *table, u32 val)
76662306a36Sopenharmony_ci{
76762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(31, 28));
76862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_CMC_TBL_MASK_AMPDU_MAX_TIME,
76962306a36Sopenharmony_ci			   GENMASK(31, 28));
77062306a36Sopenharmony_ci}
77162306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_MAX_AGG_NUM GENMASK(7, 0)
77262306a36Sopenharmony_cistatic inline void SET_CMC_TBL_MAX_AGG_NUM(void *table, u32 val)
77362306a36Sopenharmony_ci{
77462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(7, 0));
77562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_MAX_AGG_NUM,
77662306a36Sopenharmony_ci			   GENMASK(7, 0));
77762306a36Sopenharmony_ci}
77862306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_BA_BMAP GENMASK(1, 0)
77962306a36Sopenharmony_cistatic inline void SET_CMC_TBL_BA_BMAP(void *table, u32 val)
78062306a36Sopenharmony_ci{
78162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(9, 8));
78262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_BA_BMAP,
78362306a36Sopenharmony_ci			   GENMASK(9, 8));
78462306a36Sopenharmony_ci}
78562306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_VO_LFTIME_SEL GENMASK(2, 0)
78662306a36Sopenharmony_cistatic inline void SET_CMC_TBL_VO_LFTIME_SEL(void *table, u32 val)
78762306a36Sopenharmony_ci{
78862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(18, 16));
78962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_VO_LFTIME_SEL,
79062306a36Sopenharmony_ci			   GENMASK(18, 16));
79162306a36Sopenharmony_ci}
79262306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_VI_LFTIME_SEL GENMASK(2, 0)
79362306a36Sopenharmony_cistatic inline void SET_CMC_TBL_VI_LFTIME_SEL(void *table, u32 val)
79462306a36Sopenharmony_ci{
79562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(21, 19));
79662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_VI_LFTIME_SEL,
79762306a36Sopenharmony_ci			   GENMASK(21, 19));
79862306a36Sopenharmony_ci}
79962306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_BE_LFTIME_SEL GENMASK(2, 0)
80062306a36Sopenharmony_cistatic inline void SET_CMC_TBL_BE_LFTIME_SEL(void *table, u32 val)
80162306a36Sopenharmony_ci{
80262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(24, 22));
80362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_BE_LFTIME_SEL,
80462306a36Sopenharmony_ci			   GENMASK(24, 22));
80562306a36Sopenharmony_ci}
80662306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_BK_LFTIME_SEL GENMASK(2, 0)
80762306a36Sopenharmony_cistatic inline void SET_CMC_TBL_BK_LFTIME_SEL(void *table, u32 val)
80862306a36Sopenharmony_ci{
80962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(27, 25));
81062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_BK_LFTIME_SEL,
81162306a36Sopenharmony_ci			   GENMASK(27, 25));
81262306a36Sopenharmony_ci}
81362306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_SECTYPE GENMASK(3, 0)
81462306a36Sopenharmony_cistatic inline void SET_CMC_TBL_SECTYPE(void *table, u32 val)
81562306a36Sopenharmony_ci{
81662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(31, 28));
81762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 12, SET_CMC_TBL_MASK_SECTYPE,
81862306a36Sopenharmony_ci			   GENMASK(31, 28));
81962306a36Sopenharmony_ci}
82062306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_MULTI_PORT_ID GENMASK(2, 0)
82162306a36Sopenharmony_cistatic inline void SET_CMC_TBL_MULTI_PORT_ID(void *table, u32 val)
82262306a36Sopenharmony_ci{
82362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(2, 0));
82462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_MULTI_PORT_ID,
82562306a36Sopenharmony_ci			   GENMASK(2, 0));
82662306a36Sopenharmony_ci}
82762306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_BMC BIT(0)
82862306a36Sopenharmony_cistatic inline void SET_CMC_TBL_BMC(void *table, u32 val)
82962306a36Sopenharmony_ci{
83062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(3));
83162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_BMC,
83262306a36Sopenharmony_ci			   BIT(3));
83362306a36Sopenharmony_ci}
83462306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_MBSSID GENMASK(3, 0)
83562306a36Sopenharmony_cistatic inline void SET_CMC_TBL_MBSSID(void *table, u32 val)
83662306a36Sopenharmony_ci{
83762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(7, 4));
83862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_MBSSID,
83962306a36Sopenharmony_ci			   GENMASK(7, 4));
84062306a36Sopenharmony_ci}
84162306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_NAVUSEHDR BIT(0)
84262306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NAVUSEHDR(void *table, u32 val)
84362306a36Sopenharmony_ci{
84462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(8));
84562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_NAVUSEHDR,
84662306a36Sopenharmony_ci			   BIT(8));
84762306a36Sopenharmony_ci}
84862306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_TXPWR_MODE GENMASK(2, 0)
84962306a36Sopenharmony_cistatic inline void SET_CMC_TBL_TXPWR_MODE(void *table, u32 val)
85062306a36Sopenharmony_ci{
85162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(11, 9));
85262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_TXPWR_MODE,
85362306a36Sopenharmony_ci			   GENMASK(11, 9));
85462306a36Sopenharmony_ci}
85562306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DATA_DCM BIT(0)
85662306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DATA_DCM(void *table, u32 val)
85762306a36Sopenharmony_ci{
85862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(12));
85962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_DCM,
86062306a36Sopenharmony_ci			   BIT(12));
86162306a36Sopenharmony_ci}
86262306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DATA_ER BIT(0)
86362306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DATA_ER(void *table, u32 val)
86462306a36Sopenharmony_ci{
86562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(13));
86662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_ER,
86762306a36Sopenharmony_ci			   BIT(13));
86862306a36Sopenharmony_ci}
86962306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DATA_LDPC BIT(0)
87062306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DATA_LDPC(void *table, u32 val)
87162306a36Sopenharmony_ci{
87262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(14));
87362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_LDPC,
87462306a36Sopenharmony_ci			   BIT(14));
87562306a36Sopenharmony_ci}
87662306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DATA_STBC BIT(0)
87762306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DATA_STBC(void *table, u32 val)
87862306a36Sopenharmony_ci{
87962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(15));
88062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_STBC,
88162306a36Sopenharmony_ci			   BIT(15));
88262306a36Sopenharmony_ci}
88362306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_A_CTRL_BQR BIT(0)
88462306a36Sopenharmony_cistatic inline void SET_CMC_TBL_A_CTRL_BQR(void *table, u32 val)
88562306a36Sopenharmony_ci{
88662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(16));
88762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_A_CTRL_BQR,
88862306a36Sopenharmony_ci			   BIT(16));
88962306a36Sopenharmony_ci}
89062306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_A_CTRL_UPH BIT(0)
89162306a36Sopenharmony_cistatic inline void SET_CMC_TBL_A_CTRL_UPH(void *table, u32 val)
89262306a36Sopenharmony_ci{
89362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(17));
89462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_A_CTRL_UPH,
89562306a36Sopenharmony_ci			   BIT(17));
89662306a36Sopenharmony_ci}
89762306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_A_CTRL_BSR BIT(0)
89862306a36Sopenharmony_cistatic inline void SET_CMC_TBL_A_CTRL_BSR(void *table, u32 val)
89962306a36Sopenharmony_ci{
90062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(18));
90162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_A_CTRL_BSR,
90262306a36Sopenharmony_ci			   BIT(18));
90362306a36Sopenharmony_ci}
90462306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_A_CTRL_CAS BIT(0)
90562306a36Sopenharmony_cistatic inline void SET_CMC_TBL_A_CTRL_CAS(void *table, u32 val)
90662306a36Sopenharmony_ci{
90762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(19));
90862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_A_CTRL_CAS,
90962306a36Sopenharmony_ci			   BIT(19));
91062306a36Sopenharmony_ci}
91162306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DATA_BW_ER BIT(0)
91262306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DATA_BW_ER(void *table, u32 val)
91362306a36Sopenharmony_ci{
91462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(20));
91562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_DATA_BW_ER,
91662306a36Sopenharmony_ci			   BIT(20));
91762306a36Sopenharmony_ci}
91862306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_LSIG_TXOP_EN BIT(0)
91962306a36Sopenharmony_cistatic inline void SET_CMC_TBL_LSIG_TXOP_EN(void *table, u32 val)
92062306a36Sopenharmony_ci{
92162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(21));
92262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_LSIG_TXOP_EN,
92362306a36Sopenharmony_ci			   BIT(21));
92462306a36Sopenharmony_ci}
92562306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CTRL_CNT_VLD BIT(0)
92662306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CTRL_CNT_VLD(void *table, u32 val)
92762306a36Sopenharmony_ci{
92862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(27));
92962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_CTRL_CNT_VLD,
93062306a36Sopenharmony_ci			   BIT(27));
93162306a36Sopenharmony_ci}
93262306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CTRL_CNT GENMASK(3, 0)
93362306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CTRL_CNT(void *table, u32 val)
93462306a36Sopenharmony_ci{
93562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(31, 28));
93662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_CMC_TBL_MASK_CTRL_CNT,
93762306a36Sopenharmony_ci			   GENMASK(31, 28));
93862306a36Sopenharmony_ci}
93962306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_RESP_REF_RATE GENMASK(8, 0)
94062306a36Sopenharmony_cistatic inline void SET_CMC_TBL_RESP_REF_RATE(void *table, u32 val)
94162306a36Sopenharmony_ci{
94262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(8, 0));
94362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_RESP_REF_RATE,
94462306a36Sopenharmony_ci			   GENMASK(8, 0));
94562306a36Sopenharmony_ci}
94662306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_ALL_ACK_SUPPORT BIT(0)
94762306a36Sopenharmony_cistatic inline void SET_CMC_TBL_ALL_ACK_SUPPORT(void *table, u32 val)
94862306a36Sopenharmony_ci{
94962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, BIT(12));
95062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_ALL_ACK_SUPPORT,
95162306a36Sopenharmony_ci			   BIT(12));
95262306a36Sopenharmony_ci}
95362306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_BSR_QUEUE_SIZE_FORMAT BIT(0)
95462306a36Sopenharmony_cistatic inline void SET_CMC_TBL_BSR_QUEUE_SIZE_FORMAT(void *table, u32 val)
95562306a36Sopenharmony_ci{
95662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, BIT(13));
95762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_BSR_QUEUE_SIZE_FORMAT,
95862306a36Sopenharmony_ci			   BIT(13));
95962306a36Sopenharmony_ci}
96062306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_NTX_PATH_EN GENMASK(3, 0)
96162306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NTX_PATH_EN(void *table, u32 val)
96262306a36Sopenharmony_ci{
96362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(19, 16));
96462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_NTX_PATH_EN,
96562306a36Sopenharmony_ci			   GENMASK(19, 16));
96662306a36Sopenharmony_ci}
96762306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_PATH_MAP_A GENMASK(1, 0)
96862306a36Sopenharmony_cistatic inline void SET_CMC_TBL_PATH_MAP_A(void *table, u32 val)
96962306a36Sopenharmony_ci{
97062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(21, 20));
97162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_PATH_MAP_A,
97262306a36Sopenharmony_ci			   GENMASK(21, 20));
97362306a36Sopenharmony_ci}
97462306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_PATH_MAP_B GENMASK(1, 0)
97562306a36Sopenharmony_cistatic inline void SET_CMC_TBL_PATH_MAP_B(void *table, u32 val)
97662306a36Sopenharmony_ci{
97762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(23, 22));
97862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_PATH_MAP_B,
97962306a36Sopenharmony_ci			   GENMASK(23, 22));
98062306a36Sopenharmony_ci}
98162306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_PATH_MAP_C GENMASK(1, 0)
98262306a36Sopenharmony_cistatic inline void SET_CMC_TBL_PATH_MAP_C(void *table, u32 val)
98362306a36Sopenharmony_ci{
98462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(25, 24));
98562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_PATH_MAP_C,
98662306a36Sopenharmony_ci			   GENMASK(25, 24));
98762306a36Sopenharmony_ci}
98862306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_PATH_MAP_D GENMASK(1, 0)
98962306a36Sopenharmony_cistatic inline void SET_CMC_TBL_PATH_MAP_D(void *table, u32 val)
99062306a36Sopenharmony_ci{
99162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(27, 26));
99262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_PATH_MAP_D,
99362306a36Sopenharmony_ci			   GENMASK(27, 26));
99462306a36Sopenharmony_ci}
99562306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_ANTSEL_A BIT(0)
99662306a36Sopenharmony_cistatic inline void SET_CMC_TBL_ANTSEL_A(void *table, u32 val)
99762306a36Sopenharmony_ci{
99862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, BIT(28));
99962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_ANTSEL_A,
100062306a36Sopenharmony_ci			   BIT(28));
100162306a36Sopenharmony_ci}
100262306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_ANTSEL_B BIT(0)
100362306a36Sopenharmony_cistatic inline void SET_CMC_TBL_ANTSEL_B(void *table, u32 val)
100462306a36Sopenharmony_ci{
100562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, BIT(29));
100662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_ANTSEL_B,
100762306a36Sopenharmony_ci			   BIT(29));
100862306a36Sopenharmony_ci}
100962306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_ANTSEL_C BIT(0)
101062306a36Sopenharmony_cistatic inline void SET_CMC_TBL_ANTSEL_C(void *table, u32 val)
101162306a36Sopenharmony_ci{
101262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, BIT(30));
101362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_ANTSEL_C,
101462306a36Sopenharmony_ci			   BIT(30));
101562306a36Sopenharmony_ci}
101662306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_ANTSEL_D BIT(0)
101762306a36Sopenharmony_cistatic inline void SET_CMC_TBL_ANTSEL_D(void *table, u32 val)
101862306a36Sopenharmony_ci{
101962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, BIT(31));
102062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_CMC_TBL_MASK_ANTSEL_D,
102162306a36Sopenharmony_ci			   BIT(31));
102262306a36Sopenharmony_ci}
102362306a36Sopenharmony_ci
102462306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING GENMASK(1, 0)
102562306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NOMINAL_PKT_PADDING_V1(void *table, u32 val)
102662306a36Sopenharmony_ci{
102762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(1, 0));
102862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
102962306a36Sopenharmony_ci			   GENMASK(1, 0));
103062306a36Sopenharmony_ci}
103162306a36Sopenharmony_ci
103262306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NOMINAL_PKT_PADDING40_V1(void *table, u32 val)
103362306a36Sopenharmony_ci{
103462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(3, 2));
103562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
103662306a36Sopenharmony_ci			   GENMASK(3, 2));
103762306a36Sopenharmony_ci}
103862306a36Sopenharmony_ci
103962306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NOMINAL_PKT_PADDING80_V1(void *table, u32 val)
104062306a36Sopenharmony_ci{
104162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(5, 4));
104262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
104362306a36Sopenharmony_ci			   GENMASK(5, 4));
104462306a36Sopenharmony_ci}
104562306a36Sopenharmony_ci
104662306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NOMINAL_PKT_PADDING160_V1(void *table, u32 val)
104762306a36Sopenharmony_ci{
104862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(7, 6));
104962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
105062306a36Sopenharmony_ci			   GENMASK(7, 6));
105162306a36Sopenharmony_ci}
105262306a36Sopenharmony_ci
105362306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_ADDR_CAM_INDEX GENMASK(7, 0)
105462306a36Sopenharmony_cistatic inline void SET_CMC_TBL_ADDR_CAM_INDEX(void *table, u32 val)
105562306a36Sopenharmony_ci{
105662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(7, 0));
105762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_ADDR_CAM_INDEX,
105862306a36Sopenharmony_ci			   GENMASK(7, 0));
105962306a36Sopenharmony_ci}
106062306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_PAID GENMASK(8, 0)
106162306a36Sopenharmony_cistatic inline void SET_CMC_TBL_PAID(void *table, u32 val)
106262306a36Sopenharmony_ci{
106362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(16, 8));
106462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_PAID,
106562306a36Sopenharmony_ci			   GENMASK(16, 8));
106662306a36Sopenharmony_ci}
106762306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_ULDL BIT(0)
106862306a36Sopenharmony_cistatic inline void SET_CMC_TBL_ULDL(void *table, u32 val)
106962306a36Sopenharmony_ci{
107062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, BIT(17));
107162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_ULDL,
107262306a36Sopenharmony_ci			   BIT(17));
107362306a36Sopenharmony_ci}
107462306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_DOPPLER_CTRL GENMASK(1, 0)
107562306a36Sopenharmony_cistatic inline void SET_CMC_TBL_DOPPLER_CTRL(void *table, u32 val)
107662306a36Sopenharmony_ci{
107762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(19, 18));
107862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_DOPPLER_CTRL,
107962306a36Sopenharmony_ci			   GENMASK(19, 18));
108062306a36Sopenharmony_ci}
108162306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NOMINAL_PKT_PADDING(void *table, u32 val)
108262306a36Sopenharmony_ci{
108362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(21, 20));
108462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
108562306a36Sopenharmony_ci			   GENMASK(21, 20));
108662306a36Sopenharmony_ci}
108762306a36Sopenharmony_ci
108862306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NOMINAL_PKT_PADDING40(void *table, u32 val)
108962306a36Sopenharmony_ci{
109062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(23, 22));
109162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
109262306a36Sopenharmony_ci			   GENMASK(23, 22));
109362306a36Sopenharmony_ci}
109462306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_TXPWR_TOLERENCE GENMASK(3, 0)
109562306a36Sopenharmony_cistatic inline void SET_CMC_TBL_TXPWR_TOLERENCE(void *table, u32 val)
109662306a36Sopenharmony_ci{
109762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(27, 24));
109862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_TXPWR_TOLERENCE,
109962306a36Sopenharmony_ci			   GENMASK(27, 24));
110062306a36Sopenharmony_ci}
110162306a36Sopenharmony_ci
110262306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NOMINAL_PKT_PADDING80(void *table, u32 val)
110362306a36Sopenharmony_ci{
110462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(31, 30));
110562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
110662306a36Sopenharmony_ci			   GENMASK(31, 30));
110762306a36Sopenharmony_ci}
110862306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_NC GENMASK(2, 0)
110962306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NC(void *table, u32 val)
111062306a36Sopenharmony_ci{
111162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(2, 0));
111262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_NC,
111362306a36Sopenharmony_ci			   GENMASK(2, 0));
111462306a36Sopenharmony_ci}
111562306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_NR GENMASK(2, 0)
111662306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NR(void *table, u32 val)
111762306a36Sopenharmony_ci{
111862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(5, 3));
111962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_NR,
112062306a36Sopenharmony_ci			   GENMASK(5, 3));
112162306a36Sopenharmony_ci}
112262306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_NG GENMASK(1, 0)
112362306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NG(void *table, u32 val)
112462306a36Sopenharmony_ci{
112562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(7, 6));
112662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_NG,
112762306a36Sopenharmony_ci			   GENMASK(7, 6));
112862306a36Sopenharmony_ci}
112962306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CB GENMASK(1, 0)
113062306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CB(void *table, u32 val)
113162306a36Sopenharmony_ci{
113262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(9, 8));
113362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CB,
113462306a36Sopenharmony_ci			   GENMASK(9, 8));
113562306a36Sopenharmony_ci}
113662306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CS GENMASK(1, 0)
113762306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CS(void *table, u32 val)
113862306a36Sopenharmony_ci{
113962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(11, 10));
114062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CS,
114162306a36Sopenharmony_ci			   GENMASK(11, 10));
114262306a36Sopenharmony_ci}
114362306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CSI_TXBF_EN BIT(0)
114462306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CSI_TXBF_EN(void *table, u32 val)
114562306a36Sopenharmony_ci{
114662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, BIT(12));
114762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_TXBF_EN,
114862306a36Sopenharmony_ci			   BIT(12));
114962306a36Sopenharmony_ci}
115062306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CSI_STBC_EN BIT(0)
115162306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CSI_STBC_EN(void *table, u32 val)
115262306a36Sopenharmony_ci{
115362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, BIT(13));
115462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_STBC_EN,
115562306a36Sopenharmony_ci			   BIT(13));
115662306a36Sopenharmony_ci}
115762306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CSI_LDPC_EN BIT(0)
115862306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CSI_LDPC_EN(void *table, u32 val)
115962306a36Sopenharmony_ci{
116062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, BIT(14));
116162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_LDPC_EN,
116262306a36Sopenharmony_ci			   BIT(14));
116362306a36Sopenharmony_ci}
116462306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CSI_PARA_EN BIT(0)
116562306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CSI_PARA_EN(void *table, u32 val)
116662306a36Sopenharmony_ci{
116762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, BIT(15));
116862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_PARA_EN,
116962306a36Sopenharmony_ci			   BIT(15));
117062306a36Sopenharmony_ci}
117162306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CSI_FIX_RATE GENMASK(8, 0)
117262306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CSI_FIX_RATE(void *table, u32 val)
117362306a36Sopenharmony_ci{
117462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(24, 16));
117562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_FIX_RATE,
117662306a36Sopenharmony_ci			   GENMASK(24, 16));
117762306a36Sopenharmony_ci}
117862306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CSI_GI_LTF GENMASK(2, 0)
117962306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CSI_GI_LTF(void *table, u32 val)
118062306a36Sopenharmony_ci{
118162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(27, 25));
118262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_GI_LTF,
118362306a36Sopenharmony_ci			   GENMASK(27, 25));
118462306a36Sopenharmony_ci}
118562306a36Sopenharmony_ci
118662306a36Sopenharmony_cistatic inline void SET_CMC_TBL_NOMINAL_PKT_PADDING160(void *table, u32 val)
118762306a36Sopenharmony_ci{
118862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(29, 28));
118962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_NOMINAL_PKT_PADDING,
119062306a36Sopenharmony_ci			   GENMASK(29, 28));
119162306a36Sopenharmony_ci}
119262306a36Sopenharmony_ci
119362306a36Sopenharmony_ci#define SET_CMC_TBL_MASK_CSI_BW GENMASK(1, 0)
119462306a36Sopenharmony_cistatic inline void SET_CMC_TBL_CSI_BW(void *table, u32 val)
119562306a36Sopenharmony_ci{
119662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 8, val, GENMASK(31, 30));
119762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 16, SET_CMC_TBL_MASK_CSI_BW,
119862306a36Sopenharmony_ci			   GENMASK(31, 30));
119962306a36Sopenharmony_ci}
120062306a36Sopenharmony_ci
120162306a36Sopenharmony_cistatic inline void SET_DCTL_MACID_V1(void *table, u32 val)
120262306a36Sopenharmony_ci{
120362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 0, val, GENMASK(6, 0));
120462306a36Sopenharmony_ci}
120562306a36Sopenharmony_ci
120662306a36Sopenharmony_cistatic inline void SET_DCTL_OPERATION_V1(void *table, u32 val)
120762306a36Sopenharmony_ci{
120862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 0, val, BIT(7));
120962306a36Sopenharmony_ci}
121062306a36Sopenharmony_ci
121162306a36Sopenharmony_ci#define SET_DCTL_MASK_QOS_FIELD_V1 GENMASK(7, 0)
121262306a36Sopenharmony_cistatic inline void SET_DCTL_QOS_FIELD_V1(void *table, u32 val)
121362306a36Sopenharmony_ci{
121462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(7, 0));
121562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_DCTL_MASK_QOS_FIELD_V1,
121662306a36Sopenharmony_ci			   GENMASK(7, 0));
121762306a36Sopenharmony_ci}
121862306a36Sopenharmony_ci
121962306a36Sopenharmony_ci#define SET_DCTL_MASK_SET_DCTL_HW_EXSEQ_MACID GENMASK(6, 0)
122062306a36Sopenharmony_cistatic inline void SET_DCTL_HW_EXSEQ_MACID_V1(void *table, u32 val)
122162306a36Sopenharmony_ci{
122262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(14, 8));
122362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_DCTL_MASK_SET_DCTL_HW_EXSEQ_MACID,
122462306a36Sopenharmony_ci			   GENMASK(14, 8));
122562306a36Sopenharmony_ci}
122662306a36Sopenharmony_ci
122762306a36Sopenharmony_ci#define SET_DCTL_MASK_QOS_DATA BIT(0)
122862306a36Sopenharmony_cistatic inline void SET_DCTL_QOS_DATA_V1(void *table, u32 val)
122962306a36Sopenharmony_ci{
123062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, BIT(15));
123162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_DCTL_MASK_QOS_DATA,
123262306a36Sopenharmony_ci			   BIT(15));
123362306a36Sopenharmony_ci}
123462306a36Sopenharmony_ci
123562306a36Sopenharmony_ci#define SET_DCTL_MASK_AES_IV_L GENMASK(15, 0)
123662306a36Sopenharmony_cistatic inline void SET_DCTL_AES_IV_L_V1(void *table, u32 val)
123762306a36Sopenharmony_ci{
123862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 1, val, GENMASK(31, 16));
123962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 9, SET_DCTL_MASK_AES_IV_L,
124062306a36Sopenharmony_ci			   GENMASK(31, 16));
124162306a36Sopenharmony_ci}
124262306a36Sopenharmony_ci
124362306a36Sopenharmony_ci#define SET_DCTL_MASK_AES_IV_H GENMASK(31, 0)
124462306a36Sopenharmony_cistatic inline void SET_DCTL_AES_IV_H_V1(void *table, u32 val)
124562306a36Sopenharmony_ci{
124662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 2, val, GENMASK(31, 0));
124762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 10, SET_DCTL_MASK_AES_IV_H,
124862306a36Sopenharmony_ci			   GENMASK(31, 0));
124962306a36Sopenharmony_ci}
125062306a36Sopenharmony_ci
125162306a36Sopenharmony_ci#define SET_DCTL_MASK_SEQ0 GENMASK(11, 0)
125262306a36Sopenharmony_cistatic inline void SET_DCTL_SEQ0_V1(void *table, u32 val)
125362306a36Sopenharmony_ci{
125462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(11, 0));
125562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_DCTL_MASK_SEQ0,
125662306a36Sopenharmony_ci			   GENMASK(11, 0));
125762306a36Sopenharmony_ci}
125862306a36Sopenharmony_ci
125962306a36Sopenharmony_ci#define SET_DCTL_MASK_SEQ1 GENMASK(11, 0)
126062306a36Sopenharmony_cistatic inline void SET_DCTL_SEQ1_V1(void *table, u32 val)
126162306a36Sopenharmony_ci{
126262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(23, 12));
126362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_DCTL_MASK_SEQ1,
126462306a36Sopenharmony_ci			   GENMASK(23, 12));
126562306a36Sopenharmony_ci}
126662306a36Sopenharmony_ci
126762306a36Sopenharmony_ci#define SET_DCTL_MASK_AMSDU_MAX_LEN GENMASK(2, 0)
126862306a36Sopenharmony_cistatic inline void SET_DCTL_AMSDU_MAX_LEN_V1(void *table, u32 val)
126962306a36Sopenharmony_ci{
127062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, GENMASK(26, 24));
127162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_DCTL_MASK_AMSDU_MAX_LEN,
127262306a36Sopenharmony_ci			   GENMASK(26, 24));
127362306a36Sopenharmony_ci}
127462306a36Sopenharmony_ci
127562306a36Sopenharmony_ci#define SET_DCTL_MASK_STA_AMSDU_EN BIT(0)
127662306a36Sopenharmony_cistatic inline void SET_DCTL_STA_AMSDU_EN_V1(void *table, u32 val)
127762306a36Sopenharmony_ci{
127862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, BIT(27));
127962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_DCTL_MASK_STA_AMSDU_EN,
128062306a36Sopenharmony_ci			   BIT(27));
128162306a36Sopenharmony_ci}
128262306a36Sopenharmony_ci
128362306a36Sopenharmony_ci#define SET_DCTL_MASK_CHKSUM_OFLD_EN BIT(0)
128462306a36Sopenharmony_cistatic inline void SET_DCTL_CHKSUM_OFLD_EN_V1(void *table, u32 val)
128562306a36Sopenharmony_ci{
128662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, BIT(28));
128762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_DCTL_MASK_CHKSUM_OFLD_EN,
128862306a36Sopenharmony_ci			   BIT(28));
128962306a36Sopenharmony_ci}
129062306a36Sopenharmony_ci
129162306a36Sopenharmony_ci#define SET_DCTL_MASK_WITH_LLC BIT(0)
129262306a36Sopenharmony_cistatic inline void SET_DCTL_WITH_LLC_V1(void *table, u32 val)
129362306a36Sopenharmony_ci{
129462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 3, val, BIT(29));
129562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 11, SET_DCTL_MASK_WITH_LLC,
129662306a36Sopenharmony_ci			   BIT(29));
129762306a36Sopenharmony_ci}
129862306a36Sopenharmony_ci
129962306a36Sopenharmony_ci#define SET_DCTL_MASK_SEQ2 GENMASK(11, 0)
130062306a36Sopenharmony_cistatic inline void SET_DCTL_SEQ2_V1(void *table, u32 val)
130162306a36Sopenharmony_ci{
130262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(11, 0));
130362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 12, SET_DCTL_MASK_SEQ2,
130462306a36Sopenharmony_ci			   GENMASK(11, 0));
130562306a36Sopenharmony_ci}
130662306a36Sopenharmony_ci
130762306a36Sopenharmony_ci#define SET_DCTL_MASK_SEQ3 GENMASK(11, 0)
130862306a36Sopenharmony_cistatic inline void SET_DCTL_SEQ3_V1(void *table, u32 val)
130962306a36Sopenharmony_ci{
131062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(23, 12));
131162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 12, SET_DCTL_MASK_SEQ3,
131262306a36Sopenharmony_ci			   GENMASK(23, 12));
131362306a36Sopenharmony_ci}
131462306a36Sopenharmony_ci
131562306a36Sopenharmony_ci#define SET_DCTL_MASK_TGT_IND GENMASK(3, 0)
131662306a36Sopenharmony_cistatic inline void SET_DCTL_TGT_IND_V1(void *table, u32 val)
131762306a36Sopenharmony_ci{
131862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(27, 24));
131962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 12, SET_DCTL_MASK_TGT_IND,
132062306a36Sopenharmony_ci			   GENMASK(27, 24));
132162306a36Sopenharmony_ci}
132262306a36Sopenharmony_ci
132362306a36Sopenharmony_ci#define SET_DCTL_MASK_TGT_IND_EN BIT(0)
132462306a36Sopenharmony_cistatic inline void SET_DCTL_TGT_IND_EN_V1(void *table, u32 val)
132562306a36Sopenharmony_ci{
132662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 4, val, BIT(28));
132762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 12, SET_DCTL_MASK_TGT_IND_EN,
132862306a36Sopenharmony_ci			   BIT(28));
132962306a36Sopenharmony_ci}
133062306a36Sopenharmony_ci
133162306a36Sopenharmony_ci#define SET_DCTL_MASK_HTC_LB GENMASK(2, 0)
133262306a36Sopenharmony_cistatic inline void SET_DCTL_HTC_LB_V1(void *table, u32 val)
133362306a36Sopenharmony_ci{
133462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 4, val, GENMASK(31, 29));
133562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 12, SET_DCTL_MASK_HTC_LB,
133662306a36Sopenharmony_ci			   GENMASK(31, 29));
133762306a36Sopenharmony_ci}
133862306a36Sopenharmony_ci
133962306a36Sopenharmony_ci#define SET_DCTL_MASK_MHDR_LEN GENMASK(4, 0)
134062306a36Sopenharmony_cistatic inline void SET_DCTL_MHDR_LEN_V1(void *table, u32 val)
134162306a36Sopenharmony_ci{
134262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(4, 0));
134362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_MHDR_LEN,
134462306a36Sopenharmony_ci			   GENMASK(4, 0));
134562306a36Sopenharmony_ci}
134662306a36Sopenharmony_ci
134762306a36Sopenharmony_ci#define SET_DCTL_MASK_VLAN_TAG_VALID BIT(0)
134862306a36Sopenharmony_cistatic inline void SET_DCTL_VLAN_TAG_VALID_V1(void *table, u32 val)
134962306a36Sopenharmony_ci{
135062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(5));
135162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_VLAN_TAG_VALID,
135262306a36Sopenharmony_ci			   BIT(5));
135362306a36Sopenharmony_ci}
135462306a36Sopenharmony_ci
135562306a36Sopenharmony_ci#define SET_DCTL_MASK_VLAN_TAG_SEL GENMASK(1, 0)
135662306a36Sopenharmony_cistatic inline void SET_DCTL_VLAN_TAG_SEL_V1(void *table, u32 val)
135762306a36Sopenharmony_ci{
135862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(7, 6));
135962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_VLAN_TAG_SEL,
136062306a36Sopenharmony_ci			   GENMASK(7, 6));
136162306a36Sopenharmony_ci}
136262306a36Sopenharmony_ci
136362306a36Sopenharmony_ci#define SET_DCTL_MASK_HTC_ORDER BIT(0)
136462306a36Sopenharmony_cistatic inline void SET_DCTL_HTC_ORDER_V1(void *table, u32 val)
136562306a36Sopenharmony_ci{
136662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(8));
136762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_HTC_ORDER,
136862306a36Sopenharmony_ci			   BIT(8));
136962306a36Sopenharmony_ci}
137062306a36Sopenharmony_ci
137162306a36Sopenharmony_ci#define SET_DCTL_MASK_SEC_KEY_ID GENMASK(1, 0)
137262306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_KEY_ID_V1(void *table, u32 val)
137362306a36Sopenharmony_ci{
137462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(10, 9));
137562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_KEY_ID,
137662306a36Sopenharmony_ci			   GENMASK(10, 9));
137762306a36Sopenharmony_ci}
137862306a36Sopenharmony_ci
137962306a36Sopenharmony_ci#define SET_DCTL_MASK_WAPI BIT(0)
138062306a36Sopenharmony_cistatic inline void SET_DCTL_WAPI_V1(void *table, u32 val)
138162306a36Sopenharmony_ci{
138262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, BIT(15));
138362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_WAPI,
138462306a36Sopenharmony_ci			   BIT(15));
138562306a36Sopenharmony_ci}
138662306a36Sopenharmony_ci
138762306a36Sopenharmony_ci#define SET_DCTL_MASK_SEC_ENT_MODE GENMASK(1, 0)
138862306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT_MODE_V1(void *table, u32 val)
138962306a36Sopenharmony_ci{
139062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(17, 16));
139162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENT_MODE,
139262306a36Sopenharmony_ci			   GENMASK(17, 16));
139362306a36Sopenharmony_ci}
139462306a36Sopenharmony_ci
139562306a36Sopenharmony_ci#define SET_DCTL_MASK_SEC_ENTX_KEYID GENMASK(1, 0)
139662306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT0_KEYID_V1(void *table, u32 val)
139762306a36Sopenharmony_ci{
139862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(19, 18));
139962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
140062306a36Sopenharmony_ci			   GENMASK(19, 18));
140162306a36Sopenharmony_ci}
140262306a36Sopenharmony_ci
140362306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT1_KEYID_V1(void *table, u32 val)
140462306a36Sopenharmony_ci{
140562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(21, 20));
140662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
140762306a36Sopenharmony_ci			   GENMASK(21, 20));
140862306a36Sopenharmony_ci}
140962306a36Sopenharmony_ci
141062306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT2_KEYID_V1(void *table, u32 val)
141162306a36Sopenharmony_ci{
141262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(23, 22));
141362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
141462306a36Sopenharmony_ci			   GENMASK(23, 22));
141562306a36Sopenharmony_ci}
141662306a36Sopenharmony_ci
141762306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT3_KEYID_V1(void *table, u32 val)
141862306a36Sopenharmony_ci{
141962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(25, 24));
142062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
142162306a36Sopenharmony_ci			   GENMASK(25, 24));
142262306a36Sopenharmony_ci}
142362306a36Sopenharmony_ci
142462306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT4_KEYID_V1(void *table, u32 val)
142562306a36Sopenharmony_ci{
142662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(27, 26));
142762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
142862306a36Sopenharmony_ci			   GENMASK(27, 26));
142962306a36Sopenharmony_ci}
143062306a36Sopenharmony_ci
143162306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT5_KEYID_V1(void *table, u32 val)
143262306a36Sopenharmony_ci{
143362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(29, 28));
143462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
143562306a36Sopenharmony_ci			   GENMASK(29, 28));
143662306a36Sopenharmony_ci}
143762306a36Sopenharmony_ci
143862306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT6_KEYID_V1(void *table, u32 val)
143962306a36Sopenharmony_ci{
144062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 5, val, GENMASK(31, 30));
144162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 13, SET_DCTL_MASK_SEC_ENTX_KEYID,
144262306a36Sopenharmony_ci			   GENMASK(31, 30));
144362306a36Sopenharmony_ci}
144462306a36Sopenharmony_ci
144562306a36Sopenharmony_ci#define SET_DCTL_MASK_SEC_ENT_VALID GENMASK(7, 0)
144662306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT_VALID_V1(void *table, u32 val)
144762306a36Sopenharmony_ci{
144862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(7, 0));
144962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_DCTL_MASK_SEC_ENT_VALID,
145062306a36Sopenharmony_ci			   GENMASK(7, 0));
145162306a36Sopenharmony_ci}
145262306a36Sopenharmony_ci
145362306a36Sopenharmony_ci#define SET_DCTL_MASK_SEC_ENTX GENMASK(7, 0)
145462306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT0_V1(void *table, u32 val)
145562306a36Sopenharmony_ci{
145662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(15, 8));
145762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_DCTL_MASK_SEC_ENTX,
145862306a36Sopenharmony_ci			   GENMASK(15, 8));
145962306a36Sopenharmony_ci}
146062306a36Sopenharmony_ci
146162306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT1_V1(void *table, u32 val)
146262306a36Sopenharmony_ci{
146362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(23, 16));
146462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_DCTL_MASK_SEC_ENTX,
146562306a36Sopenharmony_ci			   GENMASK(23, 16));
146662306a36Sopenharmony_ci}
146762306a36Sopenharmony_ci
146862306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT2_V1(void *table, u32 val)
146962306a36Sopenharmony_ci{
147062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 6, val, GENMASK(31, 24));
147162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 14, SET_DCTL_MASK_SEC_ENTX,
147262306a36Sopenharmony_ci			   GENMASK(31, 24));
147362306a36Sopenharmony_ci}
147462306a36Sopenharmony_ci
147562306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT3_V1(void *table, u32 val)
147662306a36Sopenharmony_ci{
147762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(7, 0));
147862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_DCTL_MASK_SEC_ENTX,
147962306a36Sopenharmony_ci			   GENMASK(7, 0));
148062306a36Sopenharmony_ci}
148162306a36Sopenharmony_ci
148262306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT4_V1(void *table, u32 val)
148362306a36Sopenharmony_ci{
148462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(15, 8));
148562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_DCTL_MASK_SEC_ENTX,
148662306a36Sopenharmony_ci			   GENMASK(15, 8));
148762306a36Sopenharmony_ci}
148862306a36Sopenharmony_ci
148962306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT5_V1(void *table, u32 val)
149062306a36Sopenharmony_ci{
149162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(23, 16));
149262306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_DCTL_MASK_SEC_ENTX,
149362306a36Sopenharmony_ci			   GENMASK(23, 16));
149462306a36Sopenharmony_ci}
149562306a36Sopenharmony_ci
149662306a36Sopenharmony_cistatic inline void SET_DCTL_SEC_ENT6_V1(void *table, u32 val)
149762306a36Sopenharmony_ci{
149862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 7, val, GENMASK(31, 24));
149962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(table) + 15, SET_DCTL_MASK_SEC_ENTX,
150062306a36Sopenharmony_ci			   GENMASK(31, 24));
150162306a36Sopenharmony_ci}
150262306a36Sopenharmony_ci
150362306a36Sopenharmony_cistatic inline void SET_BCN_UPD_PORT(void *h2c, u32 val)
150462306a36Sopenharmony_ci{
150562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 0));
150662306a36Sopenharmony_ci}
150762306a36Sopenharmony_ci
150862306a36Sopenharmony_cistatic inline void SET_BCN_UPD_MBSSID(void *h2c, u32 val)
150962306a36Sopenharmony_ci{
151062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
151162306a36Sopenharmony_ci}
151262306a36Sopenharmony_ci
151362306a36Sopenharmony_cistatic inline void SET_BCN_UPD_BAND(void *h2c, u32 val)
151462306a36Sopenharmony_ci{
151562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 16));
151662306a36Sopenharmony_ci}
151762306a36Sopenharmony_ci
151862306a36Sopenharmony_cistatic inline void SET_BCN_UPD_GRP_IE_OFST(void *h2c, u32 val)
151962306a36Sopenharmony_ci{
152062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, (val - 24) | BIT(7), GENMASK(31, 24));
152162306a36Sopenharmony_ci}
152262306a36Sopenharmony_ci
152362306a36Sopenharmony_cistatic inline void SET_BCN_UPD_MACID(void *h2c, u32 val)
152462306a36Sopenharmony_ci{
152562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(7, 0));
152662306a36Sopenharmony_ci}
152762306a36Sopenharmony_ci
152862306a36Sopenharmony_cistatic inline void SET_BCN_UPD_SSN_SEL(void *h2c, u32 val)
152962306a36Sopenharmony_ci{
153062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(9, 8));
153162306a36Sopenharmony_ci}
153262306a36Sopenharmony_ci
153362306a36Sopenharmony_cistatic inline void SET_BCN_UPD_SSN_MODE(void *h2c, u32 val)
153462306a36Sopenharmony_ci{
153562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(11, 10));
153662306a36Sopenharmony_ci}
153762306a36Sopenharmony_ci
153862306a36Sopenharmony_cistatic inline void SET_BCN_UPD_RATE(void *h2c, u32 val)
153962306a36Sopenharmony_ci{
154062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(20, 12));
154162306a36Sopenharmony_ci}
154262306a36Sopenharmony_ci
154362306a36Sopenharmony_cistatic inline void SET_BCN_UPD_TXPWR(void *h2c, u32 val)
154462306a36Sopenharmony_ci{
154562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(23, 21));
154662306a36Sopenharmony_ci}
154762306a36Sopenharmony_ci
154862306a36Sopenharmony_cistatic inline void SET_BCN_UPD_TXINFO_CTRL_EN(void *h2c, u32 val)
154962306a36Sopenharmony_ci{
155062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 2, val, BIT(0));
155162306a36Sopenharmony_ci}
155262306a36Sopenharmony_ci
155362306a36Sopenharmony_cistatic inline void SET_BCN_UPD_NTX_PATH_EN(void *h2c, u32 val)
155462306a36Sopenharmony_ci{
155562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 2, val,  GENMASK(4, 1));
155662306a36Sopenharmony_ci}
155762306a36Sopenharmony_ci
155862306a36Sopenharmony_cistatic inline void SET_BCN_UPD_PATH_MAP_A(void *h2c, u32 val)
155962306a36Sopenharmony_ci{
156062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 2, val,  GENMASK(6, 5));
156162306a36Sopenharmony_ci}
156262306a36Sopenharmony_ci
156362306a36Sopenharmony_cistatic inline void SET_BCN_UPD_PATH_MAP_B(void *h2c, u32 val)
156462306a36Sopenharmony_ci{
156562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 2, val,  GENMASK(8, 7));
156662306a36Sopenharmony_ci}
156762306a36Sopenharmony_ci
156862306a36Sopenharmony_cistatic inline void SET_BCN_UPD_PATH_MAP_C(void *h2c, u32 val)
156962306a36Sopenharmony_ci{
157062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 2, val,  GENMASK(10, 9));
157162306a36Sopenharmony_ci}
157262306a36Sopenharmony_ci
157362306a36Sopenharmony_cistatic inline void SET_BCN_UPD_PATH_MAP_D(void *h2c, u32 val)
157462306a36Sopenharmony_ci{
157562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 2, val,  GENMASK(12, 11));
157662306a36Sopenharmony_ci}
157762306a36Sopenharmony_ci
157862306a36Sopenharmony_cistatic inline void SET_BCN_UPD_PATH_ANTSEL_A(void *h2c, u32 val)
157962306a36Sopenharmony_ci{
158062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 2, val,  BIT(13));
158162306a36Sopenharmony_ci}
158262306a36Sopenharmony_ci
158362306a36Sopenharmony_cistatic inline void SET_BCN_UPD_PATH_ANTSEL_B(void *h2c, u32 val)
158462306a36Sopenharmony_ci{
158562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 2, val,  BIT(14));
158662306a36Sopenharmony_ci}
158762306a36Sopenharmony_ci
158862306a36Sopenharmony_cistatic inline void SET_BCN_UPD_PATH_ANTSEL_C(void *h2c, u32 val)
158962306a36Sopenharmony_ci{
159062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 2, val,  BIT(15));
159162306a36Sopenharmony_ci}
159262306a36Sopenharmony_ci
159362306a36Sopenharmony_cistatic inline void SET_BCN_UPD_PATH_ANTSEL_D(void *h2c, u32 val)
159462306a36Sopenharmony_ci{
159562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 2, val,  BIT(16));
159662306a36Sopenharmony_ci}
159762306a36Sopenharmony_ci
159862306a36Sopenharmony_cistatic inline void SET_BCN_UPD_CSA_OFST(void *h2c, u32 val)
159962306a36Sopenharmony_ci{
160062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 2, val,  GENMASK(31, 17));
160162306a36Sopenharmony_ci}
160262306a36Sopenharmony_ci
160362306a36Sopenharmony_cistatic inline void SET_FWROLE_MAINTAIN_MACID(void *h2c, u32 val)
160462306a36Sopenharmony_ci{
160562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 0));
160662306a36Sopenharmony_ci}
160762306a36Sopenharmony_ci
160862306a36Sopenharmony_cistatic inline void SET_FWROLE_MAINTAIN_SELF_ROLE(void *h2c, u32 val)
160962306a36Sopenharmony_ci{
161062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(9, 8));
161162306a36Sopenharmony_ci}
161262306a36Sopenharmony_ci
161362306a36Sopenharmony_cistatic inline void SET_FWROLE_MAINTAIN_UPD_MODE(void *h2c, u32 val)
161462306a36Sopenharmony_ci{
161562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(12, 10));
161662306a36Sopenharmony_ci}
161762306a36Sopenharmony_ci
161862306a36Sopenharmony_cistatic inline void SET_FWROLE_MAINTAIN_WIFI_ROLE(void *h2c, u32 val)
161962306a36Sopenharmony_ci{
162062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(16, 13));
162162306a36Sopenharmony_ci}
162262306a36Sopenharmony_ci
162362306a36Sopenharmony_cistatic inline void SET_JOININFO_MACID(void *h2c, u32 val)
162462306a36Sopenharmony_ci{
162562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 0));
162662306a36Sopenharmony_ci}
162762306a36Sopenharmony_ci
162862306a36Sopenharmony_cistatic inline void SET_JOININFO_OP(void *h2c, u32 val)
162962306a36Sopenharmony_ci{
163062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(8));
163162306a36Sopenharmony_ci}
163262306a36Sopenharmony_ci
163362306a36Sopenharmony_cistatic inline void SET_JOININFO_BAND(void *h2c, u32 val)
163462306a36Sopenharmony_ci{
163562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(9));
163662306a36Sopenharmony_ci}
163762306a36Sopenharmony_ci
163862306a36Sopenharmony_cistatic inline void SET_JOININFO_WMM(void *h2c, u32 val)
163962306a36Sopenharmony_ci{
164062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(11, 10));
164162306a36Sopenharmony_ci}
164262306a36Sopenharmony_ci
164362306a36Sopenharmony_cistatic inline void SET_JOININFO_TGR(void *h2c, u32 val)
164462306a36Sopenharmony_ci{
164562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(12));
164662306a36Sopenharmony_ci}
164762306a36Sopenharmony_ci
164862306a36Sopenharmony_cistatic inline void SET_JOININFO_ISHESTA(void *h2c, u32 val)
164962306a36Sopenharmony_ci{
165062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(13));
165162306a36Sopenharmony_ci}
165262306a36Sopenharmony_ci
165362306a36Sopenharmony_cistatic inline void SET_JOININFO_DLBW(void *h2c, u32 val)
165462306a36Sopenharmony_ci{
165562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 14));
165662306a36Sopenharmony_ci}
165762306a36Sopenharmony_ci
165862306a36Sopenharmony_cistatic inline void SET_JOININFO_TF_MAC_PAD(void *h2c, u32 val)
165962306a36Sopenharmony_ci{
166062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(17, 16));
166162306a36Sopenharmony_ci}
166262306a36Sopenharmony_ci
166362306a36Sopenharmony_cistatic inline void SET_JOININFO_DL_T_PE(void *h2c, u32 val)
166462306a36Sopenharmony_ci{
166562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(20, 18));
166662306a36Sopenharmony_ci}
166762306a36Sopenharmony_ci
166862306a36Sopenharmony_cistatic inline void SET_JOININFO_PORT_ID(void *h2c, u32 val)
166962306a36Sopenharmony_ci{
167062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 21));
167162306a36Sopenharmony_ci}
167262306a36Sopenharmony_ci
167362306a36Sopenharmony_cistatic inline void SET_JOININFO_NET_TYPE(void *h2c, u32 val)
167462306a36Sopenharmony_ci{
167562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(25, 24));
167662306a36Sopenharmony_ci}
167762306a36Sopenharmony_ci
167862306a36Sopenharmony_cistatic inline void SET_JOININFO_WIFI_ROLE(void *h2c, u32 val)
167962306a36Sopenharmony_ci{
168062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(29, 26));
168162306a36Sopenharmony_ci}
168262306a36Sopenharmony_ci
168362306a36Sopenharmony_cistatic inline void SET_JOININFO_SELF_ROLE(void *h2c, u32 val)
168462306a36Sopenharmony_ci{
168562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 30));
168662306a36Sopenharmony_ci}
168762306a36Sopenharmony_ci
168862306a36Sopenharmony_cistatic inline void SET_GENERAL_PKT_MACID(void *h2c, u32 val)
168962306a36Sopenharmony_ci{
169062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 0));
169162306a36Sopenharmony_ci}
169262306a36Sopenharmony_ci
169362306a36Sopenharmony_cistatic inline void SET_GENERAL_PKT_PROBRSP_ID(void *h2c, u32 val)
169462306a36Sopenharmony_ci{
169562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
169662306a36Sopenharmony_ci}
169762306a36Sopenharmony_ci
169862306a36Sopenharmony_cistatic inline void SET_GENERAL_PKT_PSPOLL_ID(void *h2c, u32 val)
169962306a36Sopenharmony_ci{
170062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 16));
170162306a36Sopenharmony_ci}
170262306a36Sopenharmony_ci
170362306a36Sopenharmony_cistatic inline void SET_GENERAL_PKT_NULL_ID(void *h2c, u32 val)
170462306a36Sopenharmony_ci{
170562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
170662306a36Sopenharmony_ci}
170762306a36Sopenharmony_ci
170862306a36Sopenharmony_cistatic inline void SET_GENERAL_PKT_QOS_NULL_ID(void *h2c, u32 val)
170962306a36Sopenharmony_ci{
171062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(7, 0));
171162306a36Sopenharmony_ci}
171262306a36Sopenharmony_ci
171362306a36Sopenharmony_cistatic inline void SET_GENERAL_PKT_CTS2SELF_ID(void *h2c, u32 val)
171462306a36Sopenharmony_ci{
171562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(15, 8));
171662306a36Sopenharmony_ci}
171762306a36Sopenharmony_ci
171862306a36Sopenharmony_cistatic inline void SET_LOG_CFG_LEVEL(void *h2c, u32 val)
171962306a36Sopenharmony_ci{
172062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 0));
172162306a36Sopenharmony_ci}
172262306a36Sopenharmony_ci
172362306a36Sopenharmony_cistatic inline void SET_LOG_CFG_PATH(void *h2c, u32 val)
172462306a36Sopenharmony_ci{
172562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
172662306a36Sopenharmony_ci}
172762306a36Sopenharmony_ci
172862306a36Sopenharmony_cistatic inline void SET_LOG_CFG_COMP(void *h2c, u32 val)
172962306a36Sopenharmony_ci{
173062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(31, 0));
173162306a36Sopenharmony_ci}
173262306a36Sopenharmony_ci
173362306a36Sopenharmony_cistatic inline void SET_LOG_CFG_COMP_EXT(void *h2c, u32 val)
173462306a36Sopenharmony_ci{
173562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 2, val, GENMASK(31, 0));
173662306a36Sopenharmony_ci}
173762306a36Sopenharmony_ci
173862306a36Sopenharmony_cistatic inline void SET_BA_CAM_VALID(void *h2c, u32 val)
173962306a36Sopenharmony_ci{
174062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(0));
174162306a36Sopenharmony_ci}
174262306a36Sopenharmony_ci
174362306a36Sopenharmony_cistatic inline void SET_BA_CAM_INIT_REQ(void *h2c, u32 val)
174462306a36Sopenharmony_ci{
174562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(1));
174662306a36Sopenharmony_ci}
174762306a36Sopenharmony_ci
174862306a36Sopenharmony_cistatic inline void SET_BA_CAM_ENTRY_IDX(void *h2c, u32 val)
174962306a36Sopenharmony_ci{
175062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(3, 2));
175162306a36Sopenharmony_ci}
175262306a36Sopenharmony_ci
175362306a36Sopenharmony_cistatic inline void SET_BA_CAM_TID(void *h2c, u32 val)
175462306a36Sopenharmony_ci{
175562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 4));
175662306a36Sopenharmony_ci}
175762306a36Sopenharmony_ci
175862306a36Sopenharmony_cistatic inline void SET_BA_CAM_MACID(void *h2c, u32 val)
175962306a36Sopenharmony_ci{
176062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
176162306a36Sopenharmony_ci}
176262306a36Sopenharmony_ci
176362306a36Sopenharmony_cistatic inline void SET_BA_CAM_BMAP_SIZE(void *h2c, u32 val)
176462306a36Sopenharmony_ci{
176562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(19, 16));
176662306a36Sopenharmony_ci}
176762306a36Sopenharmony_ci
176862306a36Sopenharmony_cistatic inline void SET_BA_CAM_SSN(void *h2c, u32 val)
176962306a36Sopenharmony_ci{
177062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 20));
177162306a36Sopenharmony_ci}
177262306a36Sopenharmony_ci
177362306a36Sopenharmony_cistatic inline void SET_BA_CAM_UID(void *h2c, u32 val)
177462306a36Sopenharmony_ci{
177562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 1, val, GENMASK(7, 0));
177662306a36Sopenharmony_ci}
177762306a36Sopenharmony_ci
177862306a36Sopenharmony_cistatic inline void SET_BA_CAM_STD_EN(void *h2c, u32 val)
177962306a36Sopenharmony_ci{
178062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 1, val, BIT(8));
178162306a36Sopenharmony_ci}
178262306a36Sopenharmony_ci
178362306a36Sopenharmony_cistatic inline void SET_BA_CAM_BAND(void *h2c, u32 val)
178462306a36Sopenharmony_ci{
178562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 1, val, BIT(9));
178662306a36Sopenharmony_ci}
178762306a36Sopenharmony_ci
178862306a36Sopenharmony_cistatic inline void SET_BA_CAM_ENTRY_IDX_V1(void *h2c, u32 val)
178962306a36Sopenharmony_ci{
179062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 1, val, GENMASK(31, 28));
179162306a36Sopenharmony_ci}
179262306a36Sopenharmony_ci
179362306a36Sopenharmony_cistatic inline void SET_LPS_PARM_MACID(void *h2c, u32 val)
179462306a36Sopenharmony_ci{
179562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 0));
179662306a36Sopenharmony_ci}
179762306a36Sopenharmony_ci
179862306a36Sopenharmony_cistatic inline void SET_LPS_PARM_PSMODE(void *h2c, u32 val)
179962306a36Sopenharmony_ci{
180062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
180162306a36Sopenharmony_ci}
180262306a36Sopenharmony_ci
180362306a36Sopenharmony_cistatic inline void SET_LPS_PARM_RLBM(void *h2c, u32 val)
180462306a36Sopenharmony_ci{
180562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(19, 16));
180662306a36Sopenharmony_ci}
180762306a36Sopenharmony_ci
180862306a36Sopenharmony_cistatic inline void SET_LPS_PARM_SMARTPS(void *h2c, u32 val)
180962306a36Sopenharmony_ci{
181062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 20));
181162306a36Sopenharmony_ci}
181262306a36Sopenharmony_ci
181362306a36Sopenharmony_cistatic inline void SET_LPS_PARM_AWAKEINTERVAL(void *h2c, u32 val)
181462306a36Sopenharmony_ci{
181562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
181662306a36Sopenharmony_ci}
181762306a36Sopenharmony_ci
181862306a36Sopenharmony_cistatic inline void SET_LPS_PARM_VOUAPSD(void *h2c, u32 val)
181962306a36Sopenharmony_ci{
182062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, BIT(0));
182162306a36Sopenharmony_ci}
182262306a36Sopenharmony_ci
182362306a36Sopenharmony_cistatic inline void SET_LPS_PARM_VIUAPSD(void *h2c, u32 val)
182462306a36Sopenharmony_ci{
182562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, BIT(1));
182662306a36Sopenharmony_ci}
182762306a36Sopenharmony_ci
182862306a36Sopenharmony_cistatic inline void SET_LPS_PARM_BEUAPSD(void *h2c, u32 val)
182962306a36Sopenharmony_ci{
183062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, BIT(2));
183162306a36Sopenharmony_ci}
183262306a36Sopenharmony_ci
183362306a36Sopenharmony_cistatic inline void SET_LPS_PARM_BKUAPSD(void *h2c, u32 val)
183462306a36Sopenharmony_ci{
183562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, BIT(3));
183662306a36Sopenharmony_ci}
183762306a36Sopenharmony_ci
183862306a36Sopenharmony_cistatic inline void SET_LPS_PARM_LASTRPWM(void *h2c, u32 val)
183962306a36Sopenharmony_ci{
184062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(15, 8));
184162306a36Sopenharmony_ci}
184262306a36Sopenharmony_ci
184362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CPU_EXCEPTION_TYPE(void *cmd, u32 val)
184462306a36Sopenharmony_ci{
184562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 0));
184662306a36Sopenharmony_ci}
184762306a36Sopenharmony_ci
184862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PKT_DROP_SEL(void *cmd, u32 val)
184962306a36Sopenharmony_ci{
185062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(7, 0));
185162306a36Sopenharmony_ci}
185262306a36Sopenharmony_ci
185362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PKT_DROP_MACID(void *cmd, u32 val)
185462306a36Sopenharmony_ci{
185562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
185662306a36Sopenharmony_ci}
185762306a36Sopenharmony_ci
185862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PKT_DROP_BAND(void *cmd, u32 val)
185962306a36Sopenharmony_ci{
186062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
186162306a36Sopenharmony_ci}
186262306a36Sopenharmony_ci
186362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PKT_DROP_PORT(void *cmd, u32 val)
186462306a36Sopenharmony_ci{
186562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
186662306a36Sopenharmony_ci}
186762306a36Sopenharmony_ci
186862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PKT_DROP_MBSSID(void *cmd, u32 val)
186962306a36Sopenharmony_ci{
187062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(7, 0));
187162306a36Sopenharmony_ci}
187262306a36Sopenharmony_ci
187362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PKT_DROP_ROLE_A_INFO_TF_TRS(void *cmd, u32 val)
187462306a36Sopenharmony_ci{
187562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(15, 8));
187662306a36Sopenharmony_ci}
187762306a36Sopenharmony_ci
187862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_0(void *cmd, u32 val)
187962306a36Sopenharmony_ci{
188062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 2, val, GENMASK(31, 0));
188162306a36Sopenharmony_ci}
188262306a36Sopenharmony_ci
188362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_1(void *cmd, u32 val)
188462306a36Sopenharmony_ci{
188562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 3, val, GENMASK(31, 0));
188662306a36Sopenharmony_ci}
188762306a36Sopenharmony_ci
188862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_2(void *cmd, u32 val)
188962306a36Sopenharmony_ci{
189062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 4, val, GENMASK(31, 0));
189162306a36Sopenharmony_ci}
189262306a36Sopenharmony_ci
189362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PKT_DROP_MACID_BAND_SEL_3(void *cmd, u32 val)
189462306a36Sopenharmony_ci{
189562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 5, val, GENMASK(31, 0));
189662306a36Sopenharmony_ci}
189762306a36Sopenharmony_ci
189862306a36Sopenharmony_cistatic inline void RTW89_SET_KEEP_ALIVE_ENABLE(void *h2c, u32 val)
189962306a36Sopenharmony_ci{
190062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(1, 0));
190162306a36Sopenharmony_ci}
190262306a36Sopenharmony_ci
190362306a36Sopenharmony_cistatic inline void RTW89_SET_KEEP_ALIVE_PKT_NULL_ID(void *h2c, u32 val)
190462306a36Sopenharmony_ci{
190562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
190662306a36Sopenharmony_ci}
190762306a36Sopenharmony_ci
190862306a36Sopenharmony_cistatic inline void RTW89_SET_KEEP_ALIVE_PERIOD(void *h2c, u32 val)
190962306a36Sopenharmony_ci{
191062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(24, 16));
191162306a36Sopenharmony_ci}
191262306a36Sopenharmony_ci
191362306a36Sopenharmony_cistatic inline void RTW89_SET_KEEP_ALIVE_MACID(void *h2c, u32 val)
191462306a36Sopenharmony_ci{
191562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
191662306a36Sopenharmony_ci}
191762306a36Sopenharmony_ci
191862306a36Sopenharmony_cistatic inline void RTW89_SET_DISCONNECT_DETECT_ENABLE(void *h2c, u32 val)
191962306a36Sopenharmony_ci{
192062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(0));
192162306a36Sopenharmony_ci}
192262306a36Sopenharmony_ci
192362306a36Sopenharmony_cistatic inline void RTW89_SET_DISCONNECT_DETECT_TRYOK_BCNFAIL_COUNT_EN(void *h2c, u32 val)
192462306a36Sopenharmony_ci{
192562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(1));
192662306a36Sopenharmony_ci}
192762306a36Sopenharmony_ci
192862306a36Sopenharmony_cistatic inline void RTW89_SET_DISCONNECT_DETECT_DISCONNECT(void *h2c, u32 val)
192962306a36Sopenharmony_ci{
193062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(2));
193162306a36Sopenharmony_ci}
193262306a36Sopenharmony_ci
193362306a36Sopenharmony_cistatic inline void RTW89_SET_DISCONNECT_DETECT_MAC_ID(void *h2c, u32 val)
193462306a36Sopenharmony_ci{
193562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
193662306a36Sopenharmony_ci}
193762306a36Sopenharmony_ci
193862306a36Sopenharmony_cistatic inline void RTW89_SET_DISCONNECT_DETECT_CHECK_PERIOD(void *h2c, u32 val)
193962306a36Sopenharmony_ci{
194062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 16));
194162306a36Sopenharmony_ci}
194262306a36Sopenharmony_ci
194362306a36Sopenharmony_cistatic inline void RTW89_SET_DISCONNECT_DETECT_TRY_PKT_COUNT(void *h2c, u32 val)
194462306a36Sopenharmony_ci{
194562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
194662306a36Sopenharmony_ci}
194762306a36Sopenharmony_ci
194862306a36Sopenharmony_cistatic inline void RTW89_SET_DISCONNECT_DETECT_TRYOK_BCNFAIL_COUNT_LIMIT(void *h2c, u32 val)
194962306a36Sopenharmony_ci{
195062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(7, 0));
195162306a36Sopenharmony_ci}
195262306a36Sopenharmony_ci
195362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_GLOBAL_ENABLE(void *h2c, u32 val)
195462306a36Sopenharmony_ci{
195562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(0));
195662306a36Sopenharmony_ci}
195762306a36Sopenharmony_ci
195862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_GLOBAL_DROP_ALL_PKT(void *h2c, u32 val)
195962306a36Sopenharmony_ci{
196062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(1));
196162306a36Sopenharmony_ci}
196262306a36Sopenharmony_ci
196362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_GLOBAL_RX_PARSE_AFTER_WAKE(void *h2c, u32 val)
196462306a36Sopenharmony_ci{
196562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(2));
196662306a36Sopenharmony_ci}
196762306a36Sopenharmony_ci
196862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_GLOBAL_WAKE_BAR_PULLED(void *h2c, u32 val)
196962306a36Sopenharmony_ci{
197062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(3));
197162306a36Sopenharmony_ci}
197262306a36Sopenharmony_ci
197362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_GLOBAL_MAC_ID(void *h2c, u32 val)
197462306a36Sopenharmony_ci{
197562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
197662306a36Sopenharmony_ci}
197762306a36Sopenharmony_ci
197862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_GLOBAL_PAIRWISE_SEC_ALGO(void *h2c, u32 val)
197962306a36Sopenharmony_ci{
198062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 16));
198162306a36Sopenharmony_ci}
198262306a36Sopenharmony_ci
198362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_GLOBAL_GROUP_SEC_ALGO(void *h2c, u32 val)
198462306a36Sopenharmony_ci{
198562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
198662306a36Sopenharmony_ci}
198762306a36Sopenharmony_ci
198862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_GLOBAL_REMOTECTRL_INFO_CONTENT(void *h2c, u32 val)
198962306a36Sopenharmony_ci{
199062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(31, 0));
199162306a36Sopenharmony_ci}
199262306a36Sopenharmony_ci
199362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_WAKEUP_CTRL_PATTERN_MATCH_ENABLE(void *h2c, u32 val)
199462306a36Sopenharmony_ci{
199562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(0));
199662306a36Sopenharmony_ci}
199762306a36Sopenharmony_ci
199862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_WAKEUP_CTRL_MAGIC_ENABLE(void *h2c, u32 val)
199962306a36Sopenharmony_ci{
200062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(1));
200162306a36Sopenharmony_ci}
200262306a36Sopenharmony_ci
200362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_WAKEUP_CTRL_HW_UNICAST_ENABLE(void *h2c, u32 val)
200462306a36Sopenharmony_ci{
200562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(2));
200662306a36Sopenharmony_ci}
200762306a36Sopenharmony_ci
200862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_WAKEUP_CTRL_FW_UNICAST_ENABLE(void *h2c, u32 val)
200962306a36Sopenharmony_ci{
201062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(3));
201162306a36Sopenharmony_ci}
201262306a36Sopenharmony_ci
201362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_WAKEUP_CTRL_DEAUTH_ENABLE(void *h2c, u32 val)
201462306a36Sopenharmony_ci{
201562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(4));
201662306a36Sopenharmony_ci}
201762306a36Sopenharmony_ci
201862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_WAKEUP_CTRL_REKEYP_ENABLE(void *h2c, u32 val)
201962306a36Sopenharmony_ci{
202062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(5));
202162306a36Sopenharmony_ci}
202262306a36Sopenharmony_ci
202362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_WAKEUP_CTRL_EAP_ENABLE(void *h2c, u32 val)
202462306a36Sopenharmony_ci{
202562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(6));
202662306a36Sopenharmony_ci}
202762306a36Sopenharmony_ci
202862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_WAKEUP_CTRL_ALL_DATA_ENABLE(void *h2c, u32 val)
202962306a36Sopenharmony_ci{
203062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(7));
203162306a36Sopenharmony_ci}
203262306a36Sopenharmony_ci
203362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_WAKEUP_CTRL_MAC_ID(void *h2c, u32 val)
203462306a36Sopenharmony_ci{
203562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
203662306a36Sopenharmony_ci}
203762306a36Sopenharmony_ci
203862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_R_W(void *h2c, u32 val)
203962306a36Sopenharmony_ci{
204062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, BIT(0));
204162306a36Sopenharmony_ci}
204262306a36Sopenharmony_ci
204362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_IDX(void *h2c, u32 val)
204462306a36Sopenharmony_ci{
204562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c, val, GENMASK(7, 1));
204662306a36Sopenharmony_ci}
204762306a36Sopenharmony_ci
204862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_WKFM1(void *h2c, u32 val)
204962306a36Sopenharmony_ci{
205062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 1, val, GENMASK(31, 0));
205162306a36Sopenharmony_ci}
205262306a36Sopenharmony_ci
205362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_WKFM2(void *h2c, u32 val)
205462306a36Sopenharmony_ci{
205562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 2, val, GENMASK(31, 0));
205662306a36Sopenharmony_ci}
205762306a36Sopenharmony_ci
205862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_WKFM3(void *h2c, u32 val)
205962306a36Sopenharmony_ci{
206062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 3, val, GENMASK(31, 0));
206162306a36Sopenharmony_ci}
206262306a36Sopenharmony_ci
206362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_WKFM4(void *h2c, u32 val)
206462306a36Sopenharmony_ci{
206562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 4, val, GENMASK(31, 0));
206662306a36Sopenharmony_ci}
206762306a36Sopenharmony_ci
206862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_CRC(void *h2c, u32 val)
206962306a36Sopenharmony_ci{
207062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 5, val, GENMASK(15, 0));
207162306a36Sopenharmony_ci}
207262306a36Sopenharmony_ci
207362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_NEGATIVE_PATTERN_MATCH(void *h2c, u32 val)
207462306a36Sopenharmony_ci{
207562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 5, val, BIT(22));
207662306a36Sopenharmony_ci}
207762306a36Sopenharmony_ci
207862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_SKIP_MAC_HDR(void *h2c, u32 val)
207962306a36Sopenharmony_ci{
208062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 5, val, BIT(23));
208162306a36Sopenharmony_ci}
208262306a36Sopenharmony_ci
208362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_UC(void *h2c, u32 val)
208462306a36Sopenharmony_ci{
208562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 5, val, BIT(24));
208662306a36Sopenharmony_ci}
208762306a36Sopenharmony_ci
208862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_MC(void *h2c, u32 val)
208962306a36Sopenharmony_ci{
209062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 5, val, BIT(25));
209162306a36Sopenharmony_ci}
209262306a36Sopenharmony_ci
209362306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_BC(void *h2c, u32 val)
209462306a36Sopenharmony_ci{
209562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 5, val, BIT(26));
209662306a36Sopenharmony_ci}
209762306a36Sopenharmony_ci
209862306a36Sopenharmony_cistatic inline void RTW89_SET_WOW_CAM_UPD_VALID(void *h2c, u32 val)
209962306a36Sopenharmony_ci{
210062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)h2c + 5, val, BIT(31));
210162306a36Sopenharmony_ci}
210262306a36Sopenharmony_ci
210362306a36Sopenharmony_cienum rtw89_btc_btf_h2c_class {
210462306a36Sopenharmony_ci	BTFC_SET = 0x10,
210562306a36Sopenharmony_ci	BTFC_GET = 0x11,
210662306a36Sopenharmony_ci	BTFC_FW_EVENT = 0x12,
210762306a36Sopenharmony_ci};
210862306a36Sopenharmony_ci
210962306a36Sopenharmony_cienum rtw89_btc_btf_set {
211062306a36Sopenharmony_ci	SET_REPORT_EN = 0x0,
211162306a36Sopenharmony_ci	SET_SLOT_TABLE,
211262306a36Sopenharmony_ci	SET_MREG_TABLE,
211362306a36Sopenharmony_ci	SET_CX_POLICY,
211462306a36Sopenharmony_ci	SET_GPIO_DBG,
211562306a36Sopenharmony_ci	SET_DRV_INFO,
211662306a36Sopenharmony_ci	SET_DRV_EVENT,
211762306a36Sopenharmony_ci	SET_BT_WREG_ADDR,
211862306a36Sopenharmony_ci	SET_BT_WREG_VAL,
211962306a36Sopenharmony_ci	SET_BT_RREG_ADDR,
212062306a36Sopenharmony_ci	SET_BT_WL_CH_INFO,
212162306a36Sopenharmony_ci	SET_BT_INFO_REPORT,
212262306a36Sopenharmony_ci	SET_BT_IGNORE_WLAN_ACT,
212362306a36Sopenharmony_ci	SET_BT_TX_PWR,
212462306a36Sopenharmony_ci	SET_BT_LNA_CONSTRAIN,
212562306a36Sopenharmony_ci	SET_BT_GOLDEN_RX_RANGE,
212662306a36Sopenharmony_ci	SET_BT_PSD_REPORT,
212762306a36Sopenharmony_ci	SET_H2C_TEST,
212862306a36Sopenharmony_ci	SET_MAX1,
212962306a36Sopenharmony_ci};
213062306a36Sopenharmony_ci
213162306a36Sopenharmony_cienum rtw89_btc_cxdrvinfo {
213262306a36Sopenharmony_ci	CXDRVINFO_INIT = 0,
213362306a36Sopenharmony_ci	CXDRVINFO_ROLE,
213462306a36Sopenharmony_ci	CXDRVINFO_DBCC,
213562306a36Sopenharmony_ci	CXDRVINFO_SMAP,
213662306a36Sopenharmony_ci	CXDRVINFO_RFK,
213762306a36Sopenharmony_ci	CXDRVINFO_RUN,
213862306a36Sopenharmony_ci	CXDRVINFO_CTRL,
213962306a36Sopenharmony_ci	CXDRVINFO_SCAN,
214062306a36Sopenharmony_ci	CXDRVINFO_TRX,  /* WL traffic to WL fw */
214162306a36Sopenharmony_ci	CXDRVINFO_MAX,
214262306a36Sopenharmony_ci};
214362306a36Sopenharmony_ci
214462306a36Sopenharmony_cienum rtw89_scan_mode {
214562306a36Sopenharmony_ci	RTW89_SCAN_IMMEDIATE,
214662306a36Sopenharmony_ci};
214762306a36Sopenharmony_ci
214862306a36Sopenharmony_cienum rtw89_scan_type {
214962306a36Sopenharmony_ci	RTW89_SCAN_ONCE,
215062306a36Sopenharmony_ci};
215162306a36Sopenharmony_ci
215262306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXHDR_TYPE(void *cmd, u8 val)
215362306a36Sopenharmony_ci{
215462306a36Sopenharmony_ci	u8p_replace_bits((u8 *)(cmd) + 0, val, GENMASK(7, 0));
215562306a36Sopenharmony_ci}
215662306a36Sopenharmony_ci
215762306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXHDR_LEN(void *cmd, u8 val)
215862306a36Sopenharmony_ci{
215962306a36Sopenharmony_ci	u8p_replace_bits((u8 *)(cmd) + 1, val, GENMASK(7, 0));
216062306a36Sopenharmony_ci}
216162306a36Sopenharmony_ci
216262306a36Sopenharmony_cistruct rtw89_h2c_cxhdr {
216362306a36Sopenharmony_ci	u8 type;
216462306a36Sopenharmony_ci	u8 len;
216562306a36Sopenharmony_ci} __packed;
216662306a36Sopenharmony_ci
216762306a36Sopenharmony_ci#define H2C_LEN_CXDRVHDR sizeof(struct rtw89_h2c_cxhdr)
216862306a36Sopenharmony_ci
216962306a36Sopenharmony_cistruct rtw89_h2c_cxinit {
217062306a36Sopenharmony_ci	struct rtw89_h2c_cxhdr hdr;
217162306a36Sopenharmony_ci	u8 ant_type;
217262306a36Sopenharmony_ci	u8 ant_num;
217362306a36Sopenharmony_ci	u8 ant_iso;
217462306a36Sopenharmony_ci	u8 ant_info;
217562306a36Sopenharmony_ci	u8 mod_rfe;
217662306a36Sopenharmony_ci	u8 mod_cv;
217762306a36Sopenharmony_ci	u8 mod_info;
217862306a36Sopenharmony_ci	u8 mod_adie_kt;
217962306a36Sopenharmony_ci	u8 wl_gch;
218062306a36Sopenharmony_ci	u8 info;
218162306a36Sopenharmony_ci	u8 rsvd;
218262306a36Sopenharmony_ci	u8 rsvd1;
218362306a36Sopenharmony_ci} __packed;
218462306a36Sopenharmony_ci
218562306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_ANT_INFO_POS BIT(0)
218662306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_ANT_INFO_DIVERSITY BIT(1)
218762306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_ANT_INFO_BTG_POS GENMASK(3, 2)
218862306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_ANT_INFO_STREAM_CNT GENMASK(7, 4)
218962306a36Sopenharmony_ci
219062306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_MOD_INFO_BT_SOLO BIT(0)
219162306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_MOD_INFO_BT_POS BIT(1)
219262306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_MOD_INFO_SW_TYPE BIT(2)
219362306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_MOD_INFO_WA_TYPE GENMASK(5, 3)
219462306a36Sopenharmony_ci
219562306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_INFO_WL_ONLY BIT(0)
219662306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_INFO_WL_INITOK BIT(1)
219762306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_INFO_DBCC_EN BIT(2)
219862306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_INFO_CX_OTHER BIT(3)
219962306a36Sopenharmony_ci#define RTW89_H2C_CXINIT_INFO_BT_ONLY BIT(4)
220062306a36Sopenharmony_ci
220162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_CONNECT_CNT(void *cmd, u8 val)
220262306a36Sopenharmony_ci{
220362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)(cmd) + 2, val, GENMASK(7, 0));
220462306a36Sopenharmony_ci}
220562306a36Sopenharmony_ci
220662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_LINK_MODE(void *cmd, u8 val)
220762306a36Sopenharmony_ci{
220862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)(cmd) + 3, val, GENMASK(7, 0));
220962306a36Sopenharmony_ci}
221062306a36Sopenharmony_ci
221162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ROLE_NONE(void *cmd, u16 val)
221262306a36Sopenharmony_ci{
221362306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(0));
221462306a36Sopenharmony_ci}
221562306a36Sopenharmony_ci
221662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ROLE_STA(void *cmd, u16 val)
221762306a36Sopenharmony_ci{
221862306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(1));
221962306a36Sopenharmony_ci}
222062306a36Sopenharmony_ci
222162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ROLE_AP(void *cmd, u16 val)
222262306a36Sopenharmony_ci{
222362306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(2));
222462306a36Sopenharmony_ci}
222562306a36Sopenharmony_ci
222662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ROLE_VAP(void *cmd, u16 val)
222762306a36Sopenharmony_ci{
222862306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(3));
222962306a36Sopenharmony_ci}
223062306a36Sopenharmony_ci
223162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ROLE_ADHOC(void *cmd, u16 val)
223262306a36Sopenharmony_ci{
223362306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(4));
223462306a36Sopenharmony_ci}
223562306a36Sopenharmony_ci
223662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ROLE_ADHOC_MASTER(void *cmd, u16 val)
223762306a36Sopenharmony_ci{
223862306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(5));
223962306a36Sopenharmony_ci}
224062306a36Sopenharmony_ci
224162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ROLE_MESH(void *cmd, u16 val)
224262306a36Sopenharmony_ci{
224362306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(6));
224462306a36Sopenharmony_ci}
224562306a36Sopenharmony_ci
224662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ROLE_MONITOR(void *cmd, u16 val)
224762306a36Sopenharmony_ci{
224862306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(7));
224962306a36Sopenharmony_ci}
225062306a36Sopenharmony_ci
225162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ROLE_P2P_DEV(void *cmd, u16 val)
225262306a36Sopenharmony_ci{
225362306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(8));
225462306a36Sopenharmony_ci}
225562306a36Sopenharmony_ci
225662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ROLE_P2P_GC(void *cmd, u16 val)
225762306a36Sopenharmony_ci{
225862306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(9));
225962306a36Sopenharmony_ci}
226062306a36Sopenharmony_ci
226162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ROLE_P2P_GO(void *cmd, u16 val)
226262306a36Sopenharmony_ci{
226362306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(10));
226462306a36Sopenharmony_ci}
226562306a36Sopenharmony_ci
226662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ROLE_NAN(void *cmd, u16 val)
226762306a36Sopenharmony_ci{
226862306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)(cmd) + 4), val, BIT(11));
226962306a36Sopenharmony_ci}
227062306a36Sopenharmony_ci
227162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_CONNECTED(void *cmd, u8 val, int n, u8 offset)
227262306a36Sopenharmony_ci{
227362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, BIT(0));
227462306a36Sopenharmony_ci}
227562306a36Sopenharmony_ci
227662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_PID(void *cmd, u8 val, int n, u8 offset)
227762306a36Sopenharmony_ci{
227862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, GENMASK(3, 1));
227962306a36Sopenharmony_ci}
228062306a36Sopenharmony_ci
228162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_PHY(void *cmd, u8 val, int n, u8 offset)
228262306a36Sopenharmony_ci{
228362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, BIT(4));
228462306a36Sopenharmony_ci}
228562306a36Sopenharmony_ci
228662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_NOA(void *cmd, u8 val, int n, u8 offset)
228762306a36Sopenharmony_ci{
228862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, BIT(5));
228962306a36Sopenharmony_ci}
229062306a36Sopenharmony_ci
229162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_BAND(void *cmd, u8 val, int n, u8 offset)
229262306a36Sopenharmony_ci{
229362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, GENMASK(7, 6));
229462306a36Sopenharmony_ci}
229562306a36Sopenharmony_ci
229662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_CLIENT_PS(void *cmd, u8 val, int n, u8 offset)
229762306a36Sopenharmony_ci{
229862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (7 + (12 + offset) * n), val, BIT(0));
229962306a36Sopenharmony_ci}
230062306a36Sopenharmony_ci
230162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_BW(void *cmd, u8 val, int n, u8 offset)
230262306a36Sopenharmony_ci{
230362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (7 + (12 + offset) * n), val, GENMASK(7, 1));
230462306a36Sopenharmony_ci}
230562306a36Sopenharmony_ci
230662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_ROLE(void *cmd, u8 val, int n, u8 offset)
230762306a36Sopenharmony_ci{
230862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (8 + (12 + offset) * n), val, GENMASK(7, 0));
230962306a36Sopenharmony_ci}
231062306a36Sopenharmony_ci
231162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_CH(void *cmd, u8 val, int n, u8 offset)
231262306a36Sopenharmony_ci{
231362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (9 + (12 + offset) * n), val, GENMASK(7, 0));
231462306a36Sopenharmony_ci}
231562306a36Sopenharmony_ci
231662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_TX_LVL(void *cmd, u16 val, int n, u8 offset)
231762306a36Sopenharmony_ci{
231862306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)cmd + (10 + (12 + offset) * n)), val, GENMASK(15, 0));
231962306a36Sopenharmony_ci}
232062306a36Sopenharmony_ci
232162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_RX_LVL(void *cmd, u16 val, int n, u8 offset)
232262306a36Sopenharmony_ci{
232362306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)cmd + (12 + (12 + offset) * n)), val, GENMASK(15, 0));
232462306a36Sopenharmony_ci}
232562306a36Sopenharmony_ci
232662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_TX_RATE(void *cmd, u16 val, int n, u8 offset)
232762306a36Sopenharmony_ci{
232862306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)cmd + (14 + (12 + offset) * n)), val, GENMASK(15, 0));
232962306a36Sopenharmony_ci}
233062306a36Sopenharmony_ci
233162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_RX_RATE(void *cmd, u16 val, int n, u8 offset)
233262306a36Sopenharmony_ci{
233362306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)cmd + (16 + (12 + offset) * n)), val, GENMASK(15, 0));
233462306a36Sopenharmony_ci}
233562306a36Sopenharmony_ci
233662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_NOA_DUR(void *cmd, u32 val, int n, u8 offset)
233762306a36Sopenharmony_ci{
233862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)cmd + (20 + (12 + offset) * n)), val, GENMASK(31, 0));
233962306a36Sopenharmony_ci}
234062306a36Sopenharmony_ci
234162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_CONNECTED_V2(void *cmd, u8 val, int n, u8 offset)
234262306a36Sopenharmony_ci{
234362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, BIT(0));
234462306a36Sopenharmony_ci}
234562306a36Sopenharmony_ci
234662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_PID_V2(void *cmd, u8 val, int n, u8 offset)
234762306a36Sopenharmony_ci{
234862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, GENMASK(3, 1));
234962306a36Sopenharmony_ci}
235062306a36Sopenharmony_ci
235162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_PHY_V2(void *cmd, u8 val, int n, u8 offset)
235262306a36Sopenharmony_ci{
235362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, BIT(4));
235462306a36Sopenharmony_ci}
235562306a36Sopenharmony_ci
235662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_NOA_V2(void *cmd, u8 val, int n, u8 offset)
235762306a36Sopenharmony_ci{
235862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, BIT(5));
235962306a36Sopenharmony_ci}
236062306a36Sopenharmony_ci
236162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_BAND_V2(void *cmd, u8 val, int n, u8 offset)
236262306a36Sopenharmony_ci{
236362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (6 + (12 + offset) * n), val, GENMASK(7, 6));
236462306a36Sopenharmony_ci}
236562306a36Sopenharmony_ci
236662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_CLIENT_PS_V2(void *cmd, u8 val, int n, u8 offset)
236762306a36Sopenharmony_ci{
236862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (7 + (12 + offset) * n), val, BIT(0));
236962306a36Sopenharmony_ci}
237062306a36Sopenharmony_ci
237162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_BW_V2(void *cmd, u8 val, int n, u8 offset)
237262306a36Sopenharmony_ci{
237362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (7 + (12 + offset) * n), val, GENMASK(7, 1));
237462306a36Sopenharmony_ci}
237562306a36Sopenharmony_ci
237662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_ROLE_V2(void *cmd, u8 val, int n, u8 offset)
237762306a36Sopenharmony_ci{
237862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (8 + (12 + offset) * n), val, GENMASK(7, 0));
237962306a36Sopenharmony_ci}
238062306a36Sopenharmony_ci
238162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_CH_V2(void *cmd, u8 val, int n, u8 offset)
238262306a36Sopenharmony_ci{
238362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + (9 + (12 + offset) * n), val, GENMASK(7, 0));
238462306a36Sopenharmony_ci}
238562306a36Sopenharmony_ci
238662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_ACT_NOA_DUR_V2(void *cmd, u32 val, int n, u8 offset)
238762306a36Sopenharmony_ci{
238862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)cmd + (10 + (12 + offset) * n)), val, GENMASK(31, 0));
238962306a36Sopenharmony_ci}
239062306a36Sopenharmony_ci
239162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_MROLE_TYPE(void *cmd, u32 val, u8 offset)
239262306a36Sopenharmony_ci{
239362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)cmd + offset), val, GENMASK(31, 0));
239462306a36Sopenharmony_ci}
239562306a36Sopenharmony_ci
239662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_MROLE_NOA(void *cmd, u32 val, u8 offset)
239762306a36Sopenharmony_ci{
239862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)cmd + offset + 4), val, GENMASK(31, 0));
239962306a36Sopenharmony_ci}
240062306a36Sopenharmony_ci
240162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_DBCC_EN(void *cmd, u32 val, u8 offset)
240262306a36Sopenharmony_ci{
240362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)cmd + offset + 8), val, BIT(0));
240462306a36Sopenharmony_ci}
240562306a36Sopenharmony_ci
240662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_DBCC_CHG(void *cmd, u32 val, u8 offset)
240762306a36Sopenharmony_ci{
240862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)cmd + offset + 8), val, BIT(1));
240962306a36Sopenharmony_ci}
241062306a36Sopenharmony_ci
241162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_DBCC_2G_PHY(void *cmd, u32 val, u8 offset)
241262306a36Sopenharmony_ci{
241362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)cmd + offset + 8), val, GENMASK(3, 2));
241462306a36Sopenharmony_ci}
241562306a36Sopenharmony_ci
241662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXROLE_LINK_MODE_CHG(void *cmd, u32 val, u8 offset)
241762306a36Sopenharmony_ci{
241862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)cmd + offset + 8), val, BIT(4));
241962306a36Sopenharmony_ci}
242062306a36Sopenharmony_ci
242162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXCTRL_MANUAL(void *cmd, u32 val)
242262306a36Sopenharmony_ci{
242362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, BIT(0));
242462306a36Sopenharmony_ci}
242562306a36Sopenharmony_ci
242662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXCTRL_IGNORE_BT(void *cmd, u32 val)
242762306a36Sopenharmony_ci{
242862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, BIT(1));
242962306a36Sopenharmony_ci}
243062306a36Sopenharmony_ci
243162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXCTRL_ALWAYS_FREERUN(void *cmd, u32 val)
243262306a36Sopenharmony_ci{
243362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, BIT(2));
243462306a36Sopenharmony_ci}
243562306a36Sopenharmony_ci
243662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXCTRL_TRACE_STEP(void *cmd, u32 val)
243762306a36Sopenharmony_ci{
243862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(18, 3));
243962306a36Sopenharmony_ci}
244062306a36Sopenharmony_ci
244162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_TXLV(void *cmd, u8 val)
244262306a36Sopenharmony_ci{
244362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + 2, val, GENMASK(7, 0));
244462306a36Sopenharmony_ci}
244562306a36Sopenharmony_ci
244662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_RXLV(void *cmd, u8 val)
244762306a36Sopenharmony_ci{
244862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + 3, val, GENMASK(7, 0));
244962306a36Sopenharmony_ci}
245062306a36Sopenharmony_ci
245162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_WLRSSI(void *cmd, u8 val)
245262306a36Sopenharmony_ci{
245362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + 4, val, GENMASK(7, 0));
245462306a36Sopenharmony_ci}
245562306a36Sopenharmony_ci
245662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_BTRSSI(void *cmd, u8 val)
245762306a36Sopenharmony_ci{
245862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + 5, val, GENMASK(7, 0));
245962306a36Sopenharmony_ci}
246062306a36Sopenharmony_ci
246162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_TXPWR(void *cmd, s8 val)
246262306a36Sopenharmony_ci{
246362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + 6, val, GENMASK(7, 0));
246462306a36Sopenharmony_ci}
246562306a36Sopenharmony_ci
246662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_RXGAIN(void *cmd, s8 val)
246762306a36Sopenharmony_ci{
246862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + 7, val, GENMASK(7, 0));
246962306a36Sopenharmony_ci}
247062306a36Sopenharmony_ci
247162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_BTTXPWR(void *cmd, s8 val)
247262306a36Sopenharmony_ci{
247362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + 8, val, GENMASK(7, 0));
247462306a36Sopenharmony_ci}
247562306a36Sopenharmony_ci
247662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_BTRXGAIN(void *cmd, s8 val)
247762306a36Sopenharmony_ci{
247862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + 9, val, GENMASK(7, 0));
247962306a36Sopenharmony_ci}
248062306a36Sopenharmony_ci
248162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_CN(void *cmd, u8 val)
248262306a36Sopenharmony_ci{
248362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + 10, val, GENMASK(7, 0));
248462306a36Sopenharmony_ci}
248562306a36Sopenharmony_ci
248662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_NHM(void *cmd, s8 val)
248762306a36Sopenharmony_ci{
248862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + 11, val, GENMASK(7, 0));
248962306a36Sopenharmony_ci}
249062306a36Sopenharmony_ci
249162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_BTPROFILE(void *cmd, u8 val)
249262306a36Sopenharmony_ci{
249362306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + 12, val, GENMASK(7, 0));
249462306a36Sopenharmony_ci}
249562306a36Sopenharmony_ci
249662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_RSVD2(void *cmd, u8 val)
249762306a36Sopenharmony_ci{
249862306a36Sopenharmony_ci	u8p_replace_bits((u8 *)cmd + 13, val, GENMASK(7, 0));
249962306a36Sopenharmony_ci}
250062306a36Sopenharmony_ci
250162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_TXRATE(void *cmd, u16 val)
250262306a36Sopenharmony_ci{
250362306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)cmd + 14), val, GENMASK(15, 0));
250462306a36Sopenharmony_ci}
250562306a36Sopenharmony_ci
250662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_RXRATE(void *cmd, u16 val)
250762306a36Sopenharmony_ci{
250862306a36Sopenharmony_ci	le16p_replace_bits((__le16 *)((u8 *)cmd + 16), val, GENMASK(15, 0));
250962306a36Sopenharmony_ci}
251062306a36Sopenharmony_ci
251162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_TXTP(void *cmd, u32 val)
251262306a36Sopenharmony_ci{
251362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)cmd + 18), val, GENMASK(31, 0));
251462306a36Sopenharmony_ci}
251562306a36Sopenharmony_ci
251662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_RXTP(void *cmd, u32 val)
251762306a36Sopenharmony_ci{
251862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)cmd + 22), val, GENMASK(31, 0));
251962306a36Sopenharmony_ci}
252062306a36Sopenharmony_ci
252162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXTRX_RXERRRA(void *cmd, u32 val)
252262306a36Sopenharmony_ci{
252362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)cmd + 26), val, GENMASK(31, 0));
252462306a36Sopenharmony_ci}
252562306a36Sopenharmony_ci
252662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXRFK_STATE(void *cmd, u32 val)
252762306a36Sopenharmony_ci{
252862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(1, 0));
252962306a36Sopenharmony_ci}
253062306a36Sopenharmony_ci
253162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXRFK_PATH_MAP(void *cmd, u32 val)
253262306a36Sopenharmony_ci{
253362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(5, 2));
253462306a36Sopenharmony_ci}
253562306a36Sopenharmony_ci
253662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXRFK_PHY_MAP(void *cmd, u32 val)
253762306a36Sopenharmony_ci{
253862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(7, 6));
253962306a36Sopenharmony_ci}
254062306a36Sopenharmony_ci
254162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXRFK_BAND(void *cmd, u32 val)
254262306a36Sopenharmony_ci{
254362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(9, 8));
254462306a36Sopenharmony_ci}
254562306a36Sopenharmony_ci
254662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CXRFK_TYPE(void *cmd, u32 val)
254762306a36Sopenharmony_ci{
254862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 2), val, GENMASK(17, 10));
254962306a36Sopenharmony_ci}
255062306a36Sopenharmony_ci
255162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PACKET_OFLD_PKT_IDX(void *cmd, u32 val)
255262306a36Sopenharmony_ci{
255362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(7, 0));
255462306a36Sopenharmony_ci}
255562306a36Sopenharmony_ci
255662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PACKET_OFLD_PKT_OP(void *cmd, u32 val)
255762306a36Sopenharmony_ci{
255862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(10, 8));
255962306a36Sopenharmony_ci}
256062306a36Sopenharmony_ci
256162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_PACKET_OFLD_PKT_LENGTH(void *cmd, u32 val)
256262306a36Sopenharmony_ci{
256362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(31, 16));
256462306a36Sopenharmony_ci}
256562306a36Sopenharmony_ci
256662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_SCANOFLD_CH_NUM(void *cmd, u32 val)
256762306a36Sopenharmony_ci{
256862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(7, 0));
256962306a36Sopenharmony_ci}
257062306a36Sopenharmony_ci
257162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_SCANOFLD_CH_SIZE(void *cmd, u32 val)
257262306a36Sopenharmony_ci{
257362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(15, 8));
257462306a36Sopenharmony_ci}
257562306a36Sopenharmony_ci
257662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_PERIOD(void *cmd, u32 val)
257762306a36Sopenharmony_ci{
257862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(7, 0));
257962306a36Sopenharmony_ci}
258062306a36Sopenharmony_ci
258162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_DWELL(void *cmd, u32 val)
258262306a36Sopenharmony_ci{
258362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(15, 8));
258462306a36Sopenharmony_ci}
258562306a36Sopenharmony_ci
258662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_CENTER_CH(void *cmd, u32 val)
258762306a36Sopenharmony_ci{
258862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(23, 16));
258962306a36Sopenharmony_ci}
259062306a36Sopenharmony_ci
259162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_PRI_CH(void *cmd, u32 val)
259262306a36Sopenharmony_ci{
259362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd)), val, GENMASK(31, 24));
259462306a36Sopenharmony_ci}
259562306a36Sopenharmony_ci
259662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_BW(void *cmd, u32 val)
259762306a36Sopenharmony_ci{
259862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, GENMASK(2, 0));
259962306a36Sopenharmony_ci}
260062306a36Sopenharmony_ci
260162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_ACTION(void *cmd, u32 val)
260262306a36Sopenharmony_ci{
260362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, GENMASK(7, 3));
260462306a36Sopenharmony_ci}
260562306a36Sopenharmony_ci
260662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_NUM_PKT(void *cmd, u32 val)
260762306a36Sopenharmony_ci{
260862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, GENMASK(11, 8));
260962306a36Sopenharmony_ci}
261062306a36Sopenharmony_ci
261162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_TX(void *cmd, u32 val)
261262306a36Sopenharmony_ci{
261362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, BIT(12));
261462306a36Sopenharmony_ci}
261562306a36Sopenharmony_ci
261662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_PAUSE_DATA(void *cmd, u32 val)
261762306a36Sopenharmony_ci{
261862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, BIT(13));
261962306a36Sopenharmony_ci}
262062306a36Sopenharmony_ci
262162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_BAND(void *cmd, u32 val)
262262306a36Sopenharmony_ci{
262362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, GENMASK(15, 14));
262462306a36Sopenharmony_ci}
262562306a36Sopenharmony_ci
262662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_PKT_ID(void *cmd, u32 val)
262762306a36Sopenharmony_ci{
262862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, GENMASK(23, 16));
262962306a36Sopenharmony_ci}
263062306a36Sopenharmony_ci
263162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_DFS(void *cmd, u32 val)
263262306a36Sopenharmony_ci{
263362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, BIT(24));
263462306a36Sopenharmony_ci}
263562306a36Sopenharmony_ci
263662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_TX_NULL(void *cmd, u32 val)
263762306a36Sopenharmony_ci{
263862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, BIT(25));
263962306a36Sopenharmony_ci}
264062306a36Sopenharmony_ci
264162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_RANDOM(void *cmd, u32 val)
264262306a36Sopenharmony_ci{
264362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, BIT(26));
264462306a36Sopenharmony_ci}
264562306a36Sopenharmony_ci
264662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_CFG_TX(void *cmd, u32 val)
264762306a36Sopenharmony_ci{
264862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 4), val, BIT(27));
264962306a36Sopenharmony_ci}
265062306a36Sopenharmony_ci
265162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_PKT0(void *cmd, u32 val)
265262306a36Sopenharmony_ci{
265362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 8), val, GENMASK(7, 0));
265462306a36Sopenharmony_ci}
265562306a36Sopenharmony_ci
265662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_PKT1(void *cmd, u32 val)
265762306a36Sopenharmony_ci{
265862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 8), val, GENMASK(15, 8));
265962306a36Sopenharmony_ci}
266062306a36Sopenharmony_ci
266162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_PKT2(void *cmd, u32 val)
266262306a36Sopenharmony_ci{
266362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 8), val, GENMASK(23, 16));
266462306a36Sopenharmony_ci}
266562306a36Sopenharmony_ci
266662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_PKT3(void *cmd, u32 val)
266762306a36Sopenharmony_ci{
266862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 8), val, GENMASK(31, 24));
266962306a36Sopenharmony_ci}
267062306a36Sopenharmony_ci
267162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_PKT4(void *cmd, u32 val)
267262306a36Sopenharmony_ci{
267362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 12), val, GENMASK(7, 0));
267462306a36Sopenharmony_ci}
267562306a36Sopenharmony_ci
267662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_PKT5(void *cmd, u32 val)
267762306a36Sopenharmony_ci{
267862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 12), val, GENMASK(15, 8));
267962306a36Sopenharmony_ci}
268062306a36Sopenharmony_ci
268162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_PKT6(void *cmd, u32 val)
268262306a36Sopenharmony_ci{
268362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 12), val, GENMASK(23, 16));
268462306a36Sopenharmony_ci}
268562306a36Sopenharmony_ci
268662306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_PKT7(void *cmd, u32 val)
268762306a36Sopenharmony_ci{
268862306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 12), val, GENMASK(31, 24));
268962306a36Sopenharmony_ci}
269062306a36Sopenharmony_ci
269162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_CHINFO_POWER_IDX(void *cmd, u32 val)
269262306a36Sopenharmony_ci{
269362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)((u8 *)(cmd) + 16), val, GENMASK(15, 0));
269462306a36Sopenharmony_ci}
269562306a36Sopenharmony_ci
269662306a36Sopenharmony_cistruct rtw89_h2c_scanofld {
269762306a36Sopenharmony_ci	__le32 w0;
269862306a36Sopenharmony_ci	__le32 w1;
269962306a36Sopenharmony_ci	__le32 w2;
270062306a36Sopenharmony_ci	__le32 tsf_high;
270162306a36Sopenharmony_ci	__le32 tsf_low;
270262306a36Sopenharmony_ci	__le32 w5;
270362306a36Sopenharmony_ci	__le32 w6;
270462306a36Sopenharmony_ci} __packed;
270562306a36Sopenharmony_ci
270662306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W0_MACID GENMASK(7, 0)
270762306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W0_NORM_CY GENMASK(15, 8)
270862306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W0_PORT_ID GENMASK(18, 16)
270962306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W0_BAND BIT(19)
271062306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W0_OPERATION GENMASK(21, 20)
271162306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W0_TARGET_CH_BAND GENMASK(23, 22)
271262306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W1_NOTIFY_END BIT(0)
271362306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W1_TARGET_CH_MODE BIT(1)
271462306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W1_START_MODE BIT(2)
271562306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W1_SCAN_TYPE GENMASK(4, 3)
271662306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W1_TARGET_CH_BW GENMASK(7, 5)
271762306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W1_TARGET_PRI_CH GENMASK(15, 8)
271862306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W1_TARGET_CENTRAL_CH GENMASK(23, 16)
271962306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W1_PROBE_REQ_PKT_ID GENMASK(31, 24)
272062306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W2_NORM_PD GENMASK(15, 0)
272162306a36Sopenharmony_ci#define RTW89_H2C_SCANOFLD_W2_SLOW_PD GENMASK(23, 16)
272262306a36Sopenharmony_ci
272362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_P2P_MACID(void *cmd, u32 val)
272462306a36Sopenharmony_ci{
272562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(7, 0));
272662306a36Sopenharmony_ci}
272762306a36Sopenharmony_ci
272862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_P2P_P2PID(void *cmd, u32 val)
272962306a36Sopenharmony_ci{
273062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(11, 8));
273162306a36Sopenharmony_ci}
273262306a36Sopenharmony_ci
273362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_P2P_NOAID(void *cmd, u32 val)
273462306a36Sopenharmony_ci{
273562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 12));
273662306a36Sopenharmony_ci}
273762306a36Sopenharmony_ci
273862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_P2P_ACT(void *cmd, u32 val)
273962306a36Sopenharmony_ci{
274062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(19, 16));
274162306a36Sopenharmony_ci}
274262306a36Sopenharmony_ci
274362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_P2P_TYPE(void *cmd, u32 val)
274462306a36Sopenharmony_ci{
274562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, BIT(20));
274662306a36Sopenharmony_ci}
274762306a36Sopenharmony_ci
274862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_P2P_ALL_SLEP(void *cmd, u32 val)
274962306a36Sopenharmony_ci{
275062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, BIT(21));
275162306a36Sopenharmony_ci}
275262306a36Sopenharmony_ci
275362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_NOA_START_TIME(void *cmd, __le32 val)
275462306a36Sopenharmony_ci{
275562306a36Sopenharmony_ci	*((__le32 *)cmd + 1) = val;
275662306a36Sopenharmony_ci}
275762306a36Sopenharmony_ci
275862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_NOA_INTERVAL(void *cmd, __le32 val)
275962306a36Sopenharmony_ci{
276062306a36Sopenharmony_ci	*((__le32 *)cmd + 2) = val;
276162306a36Sopenharmony_ci}
276262306a36Sopenharmony_ci
276362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_NOA_DURATION(void *cmd, __le32 val)
276462306a36Sopenharmony_ci{
276562306a36Sopenharmony_ci	*((__le32 *)cmd + 3) = val;
276662306a36Sopenharmony_ci}
276762306a36Sopenharmony_ci
276862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_NOA_COUNT(void *cmd, u32 val)
276962306a36Sopenharmony_ci{
277062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 4, val, GENMASK(7, 0));
277162306a36Sopenharmony_ci}
277262306a36Sopenharmony_ci
277362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_NOA_CTWINDOW(void *cmd, u32 val)
277462306a36Sopenharmony_ci{
277562306a36Sopenharmony_ci	u8 ctwnd;
277662306a36Sopenharmony_ci
277762306a36Sopenharmony_ci	if (!(val & IEEE80211_P2P_OPPPS_ENABLE_BIT))
277862306a36Sopenharmony_ci		return;
277962306a36Sopenharmony_ci	ctwnd = FIELD_GET(IEEE80211_P2P_OPPPS_CTWINDOW_MASK, val);
278062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)(cmd) + 4, ctwnd, GENMASK(23, 8));
278162306a36Sopenharmony_ci}
278262306a36Sopenharmony_ci
278362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_TSF32_TOGL_BAND(void *cmd, u32 val)
278462306a36Sopenharmony_ci{
278562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, BIT(0));
278662306a36Sopenharmony_ci}
278762306a36Sopenharmony_ci
278862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_TSF32_TOGL_EN(void *cmd, u32 val)
278962306a36Sopenharmony_ci{
279062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, BIT(1));
279162306a36Sopenharmony_ci}
279262306a36Sopenharmony_ci
279362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_TSF32_TOGL_PORT(void *cmd, u32 val)
279462306a36Sopenharmony_ci{
279562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(4, 2));
279662306a36Sopenharmony_ci}
279762306a36Sopenharmony_ci
279862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_TSF32_TOGL_EARLY(void *cmd, u32 val)
279962306a36Sopenharmony_ci{
280062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 16));
280162306a36Sopenharmony_ci}
280262306a36Sopenharmony_ci
280362306a36Sopenharmony_cienum rtw89_fw_mcc_c2h_rpt_cfg {
280462306a36Sopenharmony_ci	RTW89_FW_MCC_C2H_RPT_OFF	= 0,
280562306a36Sopenharmony_ci	RTW89_FW_MCC_C2H_RPT_FAIL_ONLY	= 1,
280662306a36Sopenharmony_ci	RTW89_FW_MCC_C2H_RPT_ALL	= 2,
280762306a36Sopenharmony_ci};
280862306a36Sopenharmony_ci
280962306a36Sopenharmony_cistruct rtw89_fw_mcc_add_req {
281062306a36Sopenharmony_ci	u8 macid;
281162306a36Sopenharmony_ci	u8 central_ch_seg0;
281262306a36Sopenharmony_ci	u8 central_ch_seg1;
281362306a36Sopenharmony_ci	u8 primary_ch;
281462306a36Sopenharmony_ci	enum rtw89_bandwidth bandwidth: 4;
281562306a36Sopenharmony_ci	u32 group: 2;
281662306a36Sopenharmony_ci	u32 c2h_rpt: 2;
281762306a36Sopenharmony_ci	u32 dis_tx_null: 1;
281862306a36Sopenharmony_ci	u32 dis_sw_retry: 1;
281962306a36Sopenharmony_ci	u32 in_curr_ch: 1;
282062306a36Sopenharmony_ci	u32 sw_retry_count: 3;
282162306a36Sopenharmony_ci	u32 tx_null_early: 4;
282262306a36Sopenharmony_ci	u32 btc_in_2g: 1;
282362306a36Sopenharmony_ci	u32 pta_en: 1;
282462306a36Sopenharmony_ci	u32 rfk_by_pass: 1;
282562306a36Sopenharmony_ci	u32 ch_band_type: 2;
282662306a36Sopenharmony_ci	u32 rsvd0: 9;
282762306a36Sopenharmony_ci	u32 duration;
282862306a36Sopenharmony_ci	u8 courtesy_en;
282962306a36Sopenharmony_ci	u8 courtesy_num;
283062306a36Sopenharmony_ci	u8 courtesy_target;
283162306a36Sopenharmony_ci	u8 rsvd1;
283262306a36Sopenharmony_ci};
283362306a36Sopenharmony_ci
283462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_MACID(void *cmd, u32 val)
283562306a36Sopenharmony_ci{
283662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(7, 0));
283762306a36Sopenharmony_ci}
283862306a36Sopenharmony_ci
283962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_CENTRAL_CH_SEG0(void *cmd, u32 val)
284062306a36Sopenharmony_ci{
284162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
284262306a36Sopenharmony_ci}
284362306a36Sopenharmony_ci
284462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_CENTRAL_CH_SEG1(void *cmd, u32 val)
284562306a36Sopenharmony_ci{
284662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
284762306a36Sopenharmony_ci}
284862306a36Sopenharmony_ci
284962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_PRIMARY_CH(void *cmd, u32 val)
285062306a36Sopenharmony_ci{
285162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
285262306a36Sopenharmony_ci}
285362306a36Sopenharmony_ci
285462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_BANDWIDTH(void *cmd, u32 val)
285562306a36Sopenharmony_ci{
285662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(3, 0));
285762306a36Sopenharmony_ci}
285862306a36Sopenharmony_ci
285962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_GROUP(void *cmd, u32 val)
286062306a36Sopenharmony_ci{
286162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(5, 4));
286262306a36Sopenharmony_ci}
286362306a36Sopenharmony_ci
286462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_C2H_RPT(void *cmd, u32 val)
286562306a36Sopenharmony_ci{
286662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(7, 6));
286762306a36Sopenharmony_ci}
286862306a36Sopenharmony_ci
286962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_DIS_TX_NULL(void *cmd, u32 val)
287062306a36Sopenharmony_ci{
287162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, BIT(8));
287262306a36Sopenharmony_ci}
287362306a36Sopenharmony_ci
287462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_DIS_SW_RETRY(void *cmd, u32 val)
287562306a36Sopenharmony_ci{
287662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, BIT(9));
287762306a36Sopenharmony_ci}
287862306a36Sopenharmony_ci
287962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_IN_CURR_CH(void *cmd, u32 val)
288062306a36Sopenharmony_ci{
288162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, BIT(10));
288262306a36Sopenharmony_ci}
288362306a36Sopenharmony_ci
288462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_SW_RETRY_COUNT(void *cmd, u32 val)
288562306a36Sopenharmony_ci{
288662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(13, 11));
288762306a36Sopenharmony_ci}
288862306a36Sopenharmony_ci
288962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_TX_NULL_EARLY(void *cmd, u32 val)
289062306a36Sopenharmony_ci{
289162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(17, 14));
289262306a36Sopenharmony_ci}
289362306a36Sopenharmony_ci
289462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_BTC_IN_2G(void *cmd, u32 val)
289562306a36Sopenharmony_ci{
289662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, BIT(18));
289762306a36Sopenharmony_ci}
289862306a36Sopenharmony_ci
289962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_PTA_EN(void *cmd, u32 val)
290062306a36Sopenharmony_ci{
290162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, BIT(19));
290262306a36Sopenharmony_ci}
290362306a36Sopenharmony_ci
290462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_RFK_BY_PASS(void *cmd, u32 val)
290562306a36Sopenharmony_ci{
290662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, BIT(20));
290762306a36Sopenharmony_ci}
290862306a36Sopenharmony_ci
290962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_CH_BAND_TYPE(void *cmd, u32 val)
291062306a36Sopenharmony_ci{
291162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(22, 21));
291262306a36Sopenharmony_ci}
291362306a36Sopenharmony_ci
291462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_DURATION(void *cmd, u32 val)
291562306a36Sopenharmony_ci{
291662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 2, val, GENMASK(31, 0));
291762306a36Sopenharmony_ci}
291862306a36Sopenharmony_ci
291962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_COURTESY_EN(void *cmd, u32 val)
292062306a36Sopenharmony_ci{
292162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 3, val, BIT(0));
292262306a36Sopenharmony_ci}
292362306a36Sopenharmony_ci
292462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_COURTESY_NUM(void *cmd, u32 val)
292562306a36Sopenharmony_ci{
292662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 3, val, GENMASK(15, 8));
292762306a36Sopenharmony_ci}
292862306a36Sopenharmony_ci
292962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_ADD_MCC_COURTESY_TARGET(void *cmd, u32 val)
293062306a36Sopenharmony_ci{
293162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 3, val, GENMASK(23, 16));
293262306a36Sopenharmony_ci}
293362306a36Sopenharmony_ci
293462306a36Sopenharmony_cistruct rtw89_fw_mcc_start_req {
293562306a36Sopenharmony_ci	u32 group: 2;
293662306a36Sopenharmony_ci	u32 btc_in_group: 1;
293762306a36Sopenharmony_ci	u32 old_group_action: 2;
293862306a36Sopenharmony_ci	u32 old_group: 2;
293962306a36Sopenharmony_ci	u32 rsvd0: 9;
294062306a36Sopenharmony_ci	u32 notify_cnt: 3;
294162306a36Sopenharmony_ci	u32 rsvd1: 2;
294262306a36Sopenharmony_ci	u32 notify_rxdbg_en: 1;
294362306a36Sopenharmony_ci	u32 rsvd2: 2;
294462306a36Sopenharmony_ci	u32 macid: 8;
294562306a36Sopenharmony_ci	u32 tsf_low;
294662306a36Sopenharmony_ci	u32 tsf_high;
294762306a36Sopenharmony_ci};
294862306a36Sopenharmony_ci
294962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_START_MCC_GROUP(void *cmd, u32 val)
295062306a36Sopenharmony_ci{
295162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
295262306a36Sopenharmony_ci}
295362306a36Sopenharmony_ci
295462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_START_MCC_BTC_IN_GROUP(void *cmd, u32 val)
295562306a36Sopenharmony_ci{
295662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, BIT(2));
295762306a36Sopenharmony_ci}
295862306a36Sopenharmony_ci
295962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_START_MCC_OLD_GROUP_ACTION(void *cmd, u32 val)
296062306a36Sopenharmony_ci{
296162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(4, 3));
296262306a36Sopenharmony_ci}
296362306a36Sopenharmony_ci
296462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_START_MCC_OLD_GROUP(void *cmd, u32 val)
296562306a36Sopenharmony_ci{
296662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(6, 5));
296762306a36Sopenharmony_ci}
296862306a36Sopenharmony_ci
296962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_START_MCC_NOTIFY_CNT(void *cmd, u32 val)
297062306a36Sopenharmony_ci{
297162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(18, 16));
297262306a36Sopenharmony_ci}
297362306a36Sopenharmony_ci
297462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_START_MCC_NOTIFY_RXDBG_EN(void *cmd, u32 val)
297562306a36Sopenharmony_ci{
297662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, BIT(21));
297762306a36Sopenharmony_ci}
297862306a36Sopenharmony_ci
297962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_START_MCC_MACID(void *cmd, u32 val)
298062306a36Sopenharmony_ci{
298162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
298262306a36Sopenharmony_ci}
298362306a36Sopenharmony_ci
298462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_START_MCC_TSF_LOW(void *cmd, u32 val)
298562306a36Sopenharmony_ci{
298662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(31, 0));
298762306a36Sopenharmony_ci}
298862306a36Sopenharmony_ci
298962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_START_MCC_TSF_HIGH(void *cmd, u32 val)
299062306a36Sopenharmony_ci{
299162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 2, val, GENMASK(31, 0));
299262306a36Sopenharmony_ci}
299362306a36Sopenharmony_ci
299462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_STOP_MCC_MACID(void *cmd, u32 val)
299562306a36Sopenharmony_ci{
299662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(7, 0));
299762306a36Sopenharmony_ci}
299862306a36Sopenharmony_ci
299962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_STOP_MCC_GROUP(void *cmd, u32 val)
300062306a36Sopenharmony_ci{
300162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(9, 8));
300262306a36Sopenharmony_ci}
300362306a36Sopenharmony_ci
300462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_STOP_MCC_PREV_GROUPS(void *cmd, u32 val)
300562306a36Sopenharmony_ci{
300662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, BIT(10));
300762306a36Sopenharmony_ci}
300862306a36Sopenharmony_ci
300962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_DEL_MCC_GROUP_GROUP(void *cmd, u32 val)
301062306a36Sopenharmony_ci{
301162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
301262306a36Sopenharmony_ci}
301362306a36Sopenharmony_ci
301462306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_DEL_MCC_GROUP_PREV_GROUPS(void *cmd, u32 val)
301562306a36Sopenharmony_ci{
301662306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, BIT(2));
301762306a36Sopenharmony_ci}
301862306a36Sopenharmony_ci
301962306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_RESET_MCC_GROUP_GROUP(void *cmd, u32 val)
302062306a36Sopenharmony_ci{
302162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
302262306a36Sopenharmony_ci}
302362306a36Sopenharmony_ci
302462306a36Sopenharmony_cistruct rtw89_fw_mcc_tsf_req {
302562306a36Sopenharmony_ci	u8 group: 2;
302662306a36Sopenharmony_ci	u8 rsvd0: 6;
302762306a36Sopenharmony_ci	u8 macid_x;
302862306a36Sopenharmony_ci	u8 macid_y;
302962306a36Sopenharmony_ci	u8 rsvd1;
303062306a36Sopenharmony_ci};
303162306a36Sopenharmony_ci
303262306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_REQ_TSF_GROUP(void *cmd, u32 val)
303362306a36Sopenharmony_ci{
303462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
303562306a36Sopenharmony_ci}
303662306a36Sopenharmony_ci
303762306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_REQ_TSF_MACID_X(void *cmd, u32 val)
303862306a36Sopenharmony_ci{
303962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
304062306a36Sopenharmony_ci}
304162306a36Sopenharmony_ci
304262306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_REQ_TSF_MACID_Y(void *cmd, u32 val)
304362306a36Sopenharmony_ci{
304462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
304562306a36Sopenharmony_ci}
304662306a36Sopenharmony_ci
304762306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_MACID_BITMAP_GROUP(void *cmd, u32 val)
304862306a36Sopenharmony_ci{
304962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
305062306a36Sopenharmony_ci}
305162306a36Sopenharmony_ci
305262306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_MACID_BITMAP_MACID(void *cmd, u32 val)
305362306a36Sopenharmony_ci{
305462306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
305562306a36Sopenharmony_ci}
305662306a36Sopenharmony_ci
305762306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_MACID_BITMAP_BITMAP_LENGTH(void *cmd, u32 val)
305862306a36Sopenharmony_ci{
305962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
306062306a36Sopenharmony_ci}
306162306a36Sopenharmony_ci
306262306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_MACID_BITMAP_BITMAP(void *cmd,
306362306a36Sopenharmony_ci							   u8 *bitmap, u8 len)
306462306a36Sopenharmony_ci{
306562306a36Sopenharmony_ci	memcpy((__le32 *)cmd + 1, bitmap, len);
306662306a36Sopenharmony_ci}
306762306a36Sopenharmony_ci
306862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_SYNC_GROUP(void *cmd, u32 val)
306962306a36Sopenharmony_ci{
307062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
307162306a36Sopenharmony_ci}
307262306a36Sopenharmony_ci
307362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_SYNC_MACID_SOURCE(void *cmd, u32 val)
307462306a36Sopenharmony_ci{
307562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
307662306a36Sopenharmony_ci}
307762306a36Sopenharmony_ci
307862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_SYNC_MACID_TARGET(void *cmd, u32 val)
307962306a36Sopenharmony_ci{
308062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
308162306a36Sopenharmony_ci}
308262306a36Sopenharmony_ci
308362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_SYNC_SYNC_OFFSET(void *cmd, u32 val)
308462306a36Sopenharmony_ci{
308562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
308662306a36Sopenharmony_ci}
308762306a36Sopenharmony_ci
308862306a36Sopenharmony_cistruct rtw89_fw_mcc_duration {
308962306a36Sopenharmony_ci	u32 group: 2;
309062306a36Sopenharmony_ci	u32 btc_in_group: 1;
309162306a36Sopenharmony_ci	u32 rsvd0: 5;
309262306a36Sopenharmony_ci	u32 start_macid: 8;
309362306a36Sopenharmony_ci	u32 macid_x: 8;
309462306a36Sopenharmony_ci	u32 macid_y: 8;
309562306a36Sopenharmony_ci	u32 start_tsf_low;
309662306a36Sopenharmony_ci	u32 start_tsf_high;
309762306a36Sopenharmony_ci	u32 duration_x;
309862306a36Sopenharmony_ci	u32 duration_y;
309962306a36Sopenharmony_ci};
310062306a36Sopenharmony_ci
310162306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_SET_DURATION_GROUP(void *cmd, u32 val)
310262306a36Sopenharmony_ci{
310362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(1, 0));
310462306a36Sopenharmony_ci}
310562306a36Sopenharmony_ci
310662306a36Sopenharmony_cistatic
310762306a36Sopenharmony_ciinline void RTW89_SET_FWCMD_MCC_SET_DURATION_BTC_IN_GROUP(void *cmd, u32 val)
310862306a36Sopenharmony_ci{
310962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, BIT(2));
311062306a36Sopenharmony_ci}
311162306a36Sopenharmony_ci
311262306a36Sopenharmony_cistatic
311362306a36Sopenharmony_ciinline void RTW89_SET_FWCMD_MCC_SET_DURATION_START_MACID(void *cmd, u32 val)
311462306a36Sopenharmony_ci{
311562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(15, 8));
311662306a36Sopenharmony_ci}
311762306a36Sopenharmony_ci
311862306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_SET_DURATION_MACID_X(void *cmd, u32 val)
311962306a36Sopenharmony_ci{
312062306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(23, 16));
312162306a36Sopenharmony_ci}
312262306a36Sopenharmony_ci
312362306a36Sopenharmony_cistatic inline void RTW89_SET_FWCMD_MCC_SET_DURATION_MACID_Y(void *cmd, u32 val)
312462306a36Sopenharmony_ci{
312562306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd, val, GENMASK(31, 24));
312662306a36Sopenharmony_ci}
312762306a36Sopenharmony_ci
312862306a36Sopenharmony_cistatic
312962306a36Sopenharmony_ciinline void RTW89_SET_FWCMD_MCC_SET_DURATION_START_TSF_LOW(void *cmd, u32 val)
313062306a36Sopenharmony_ci{
313162306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 1, val, GENMASK(31, 0));
313262306a36Sopenharmony_ci}
313362306a36Sopenharmony_ci
313462306a36Sopenharmony_cistatic
313562306a36Sopenharmony_ciinline void RTW89_SET_FWCMD_MCC_SET_DURATION_START_TSF_HIGH(void *cmd, u32 val)
313662306a36Sopenharmony_ci{
313762306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 2, val, GENMASK(31, 0));
313862306a36Sopenharmony_ci}
313962306a36Sopenharmony_ci
314062306a36Sopenharmony_cistatic
314162306a36Sopenharmony_ciinline void RTW89_SET_FWCMD_MCC_SET_DURATION_DURATION_X(void *cmd, u32 val)
314262306a36Sopenharmony_ci{
314362306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 3, val, GENMASK(31, 0));
314462306a36Sopenharmony_ci}
314562306a36Sopenharmony_ci
314662306a36Sopenharmony_cistatic
314762306a36Sopenharmony_ciinline void RTW89_SET_FWCMD_MCC_SET_DURATION_DURATION_Y(void *cmd, u32 val)
314862306a36Sopenharmony_ci{
314962306a36Sopenharmony_ci	le32p_replace_bits((__le32 *)cmd + 4, val, GENMASK(31, 0));
315062306a36Sopenharmony_ci}
315162306a36Sopenharmony_ci
315262306a36Sopenharmony_ci#define RTW89_C2H_HEADER_LEN 8
315362306a36Sopenharmony_ci
315462306a36Sopenharmony_cistruct rtw89_c2h_hdr {
315562306a36Sopenharmony_ci	__le32 w0;
315662306a36Sopenharmony_ci	__le32 w1;
315762306a36Sopenharmony_ci} __packed;
315862306a36Sopenharmony_ci
315962306a36Sopenharmony_ci#define RTW89_C2H_HDR_W0_CATEGORY GENMASK(1, 0)
316062306a36Sopenharmony_ci#define RTW89_C2H_HDR_W0_CLASS GENMASK(7, 2)
316162306a36Sopenharmony_ci#define RTW89_C2H_HDR_W0_FUNC GENMASK(15, 8)
316262306a36Sopenharmony_ci#define RTW89_C2H_HDR_W1_LEN GENMASK(13, 0)
316362306a36Sopenharmony_ci
316462306a36Sopenharmony_cistruct rtw89_fw_c2h_attr {
316562306a36Sopenharmony_ci	u8 category;
316662306a36Sopenharmony_ci	u8 class;
316762306a36Sopenharmony_ci	u8 func;
316862306a36Sopenharmony_ci	u16 len;
316962306a36Sopenharmony_ci};
317062306a36Sopenharmony_ci
317162306a36Sopenharmony_cistatic inline struct rtw89_fw_c2h_attr *RTW89_SKB_C2H_CB(struct sk_buff *skb)
317262306a36Sopenharmony_ci{
317362306a36Sopenharmony_ci	static_assert(sizeof(skb->cb) >= sizeof(struct rtw89_fw_c2h_attr));
317462306a36Sopenharmony_ci
317562306a36Sopenharmony_ci	return (struct rtw89_fw_c2h_attr *)skb->cb;
317662306a36Sopenharmony_ci}
317762306a36Sopenharmony_ci
317862306a36Sopenharmony_cistruct rtw89_c2h_done_ack {
317962306a36Sopenharmony_ci	__le32 w0;
318062306a36Sopenharmony_ci	__le32 w1;
318162306a36Sopenharmony_ci	__le32 w2;
318262306a36Sopenharmony_ci} __packed;
318362306a36Sopenharmony_ci
318462306a36Sopenharmony_ci#define RTW89_C2H_DONE_ACK_W2_CAT GENMASK(1, 0)
318562306a36Sopenharmony_ci#define RTW89_C2H_DONE_ACK_W2_CLASS GENMASK(7, 2)
318662306a36Sopenharmony_ci#define RTW89_C2H_DONE_ACK_W2_FUNC GENMASK(15, 8)
318762306a36Sopenharmony_ci#define RTW89_C2H_DONE_ACK_W2_H2C_RETURN GENMASK(23, 16)
318862306a36Sopenharmony_ci#define RTW89_C2H_DONE_ACK_W2_H2C_SEQ GENMASK(31, 24)
318962306a36Sopenharmony_ci
319062306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_REV_ACK_CAT(c2h) \
319162306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(1, 0))
319262306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_REV_ACK_CLASS(c2h) \
319362306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(7, 2))
319462306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_REV_ACK_FUNC(c2h) \
319562306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(15, 8))
319662306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_REV_ACK_H2C_SEQ(c2h) \
319762306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(23, 16))
319862306a36Sopenharmony_ci
319962306a36Sopenharmony_cistruct rtw89_fw_c2h_log_fmt {
320062306a36Sopenharmony_ci	__le16 signature;
320162306a36Sopenharmony_ci	u8 feature;
320262306a36Sopenharmony_ci	u8 syntax;
320362306a36Sopenharmony_ci	__le32 fmt_id;
320462306a36Sopenharmony_ci	u8 file_num;
320562306a36Sopenharmony_ci	__le16 line_num;
320662306a36Sopenharmony_ci	u8 argc;
320762306a36Sopenharmony_ci	union {
320862306a36Sopenharmony_ci		DECLARE_FLEX_ARRAY(u8, raw);
320962306a36Sopenharmony_ci		DECLARE_FLEX_ARRAY(__le32, argv);
321062306a36Sopenharmony_ci	} __packed u;
321162306a36Sopenharmony_ci} __packed;
321262306a36Sopenharmony_ci
321362306a36Sopenharmony_ci#define RTW89_C2H_FW_FORMATTED_LOG_MIN_LEN 11
321462306a36Sopenharmony_ci#define RTW89_C2H_FW_LOG_FEATURE_PARA_INT BIT(2)
321562306a36Sopenharmony_ci#define RTW89_C2H_FW_LOG_MAX_PARA_NUM 16
321662306a36Sopenharmony_ci#define RTW89_C2H_FW_LOG_SIGNATURE 0xA5A5
321762306a36Sopenharmony_ci#define RTW89_C2H_FW_LOG_STR_BUF_SIZE 512
321862306a36Sopenharmony_ci
321962306a36Sopenharmony_cistruct rtw89_c2h_mac_bcnfltr_rpt {
322062306a36Sopenharmony_ci	__le32 w0;
322162306a36Sopenharmony_ci	__le32 w1;
322262306a36Sopenharmony_ci	__le32 w2;
322362306a36Sopenharmony_ci} __packed;
322462306a36Sopenharmony_ci
322562306a36Sopenharmony_ci#define RTW89_C2H_MAC_BCNFLTR_RPT_W2_MACID GENMASK(7, 0)
322662306a36Sopenharmony_ci#define RTW89_C2H_MAC_BCNFLTR_RPT_W2_TYPE GENMASK(9, 8)
322762306a36Sopenharmony_ci#define RTW89_C2H_MAC_BCNFLTR_RPT_W2_EVENT GENMASK(11, 10)
322862306a36Sopenharmony_ci#define RTW89_C2H_MAC_BCNFLTR_RPT_W2_MA GENMASK(23, 16)
322962306a36Sopenharmony_ci
323062306a36Sopenharmony_cistruct rtw89_c2h_ra_rpt {
323162306a36Sopenharmony_ci	struct rtw89_c2h_hdr hdr;
323262306a36Sopenharmony_ci	__le32 w2;
323362306a36Sopenharmony_ci	__le32 w3;
323462306a36Sopenharmony_ci} __packed;
323562306a36Sopenharmony_ci
323662306a36Sopenharmony_ci#define RTW89_C2H_RA_RPT_W2_MACID GENMASK(15, 0)
323762306a36Sopenharmony_ci#define RTW89_C2H_RA_RPT_W2_RETRY_RATIO GENMASK(23, 16)
323862306a36Sopenharmony_ci#define RTW89_C2H_RA_RPT_W2_MCSNSS_B7 BIT(31)
323962306a36Sopenharmony_ci#define RTW89_C2H_RA_RPT_W3_MCSNSS GENMASK(6, 0)
324062306a36Sopenharmony_ci#define RTW89_C2H_RA_RPT_W3_MD_SEL GENMASK(9, 8)
324162306a36Sopenharmony_ci#define RTW89_C2H_RA_RPT_W3_GILTF GENMASK(12, 10)
324262306a36Sopenharmony_ci#define RTW89_C2H_RA_RPT_W3_BW GENMASK(14, 13)
324362306a36Sopenharmony_ci#define RTW89_C2H_RA_RPT_W3_MD_SEL_B2 BIT(15)
324462306a36Sopenharmony_ci#define RTW89_C2H_RA_RPT_W3_BW_B2 BIT(16)
324562306a36Sopenharmony_ci
324662306a36Sopenharmony_ci/* For WiFi 6 chips:
324762306a36Sopenharmony_ci *   VHT, HE, HT-old: [6:4]: NSS, [3:0]: MCS
324862306a36Sopenharmony_ci *   HT-new: [6:5]: NA, [4:0]: MCS
324962306a36Sopenharmony_ci * For WiFi 7 chips (V1):
325062306a36Sopenharmony_ci *   HT, VHT, HE, EHT: [7:5]: NSS, [4:0]: MCS
325162306a36Sopenharmony_ci */
325262306a36Sopenharmony_ci#define RTW89_RA_RATE_MASK_NSS GENMASK(6, 4)
325362306a36Sopenharmony_ci#define RTW89_RA_RATE_MASK_MCS GENMASK(3, 0)
325462306a36Sopenharmony_ci#define RTW89_RA_RATE_MASK_NSS_V1 GENMASK(7, 5)
325562306a36Sopenharmony_ci#define RTW89_RA_RATE_MASK_MCS_V1 GENMASK(4, 0)
325662306a36Sopenharmony_ci#define RTW89_RA_RATE_MASK_HT_MCS GENMASK(4, 0)
325762306a36Sopenharmony_ci#define RTW89_MK_HT_RATE(nss, mcs) (FIELD_PREP(GENMASK(4, 3), nss) | \
325862306a36Sopenharmony_ci				    FIELD_PREP(GENMASK(2, 0), mcs))
325962306a36Sopenharmony_ci
326062306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_PKTOFLD_ID(c2h) \
326162306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(7, 0))
326262306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_PKTOFLD_OP(c2h) \
326362306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(10, 8))
326462306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_PKTOFLD_LEN(c2h) \
326562306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(31, 16))
326662306a36Sopenharmony_ci
326762306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_SCANOFLD_PRI_CH(c2h) \
326862306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(7, 0))
326962306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_SCANOFLD_RSP(c2h) \
327062306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(19, 16))
327162306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_SCANOFLD_STATUS(c2h) \
327262306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(23, 20))
327362306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_ACTUAL_PERIOD(c2h) \
327462306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(31, 24))
327562306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_SCANOFLD_TX_FAIL(c2h) \
327662306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 5), GENMASK(3, 0))
327762306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_SCANOFLD_AIR_DENSITY(c2h) \
327862306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 5), GENMASK(7, 4))
327962306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_SCANOFLD_BAND(c2h) \
328062306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 5), GENMASK(25, 24))
328162306a36Sopenharmony_ci
328262306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_RCV_ACK_GROUP(c2h) \
328362306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(1, 0))
328462306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_RCV_ACK_H2C_FUNC(c2h) \
328562306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(15, 8))
328662306a36Sopenharmony_ci
328762306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_REQ_ACK_GROUP(c2h) \
328862306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(1, 0))
328962306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_REQ_ACK_H2C_RETURN(c2h) \
329062306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(7, 2))
329162306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_REQ_ACK_H2C_FUNC(c2h) \
329262306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(15, 8))
329362306a36Sopenharmony_ci
329462306a36Sopenharmony_cistruct rtw89_mac_mcc_tsf_rpt {
329562306a36Sopenharmony_ci	u32 macid_x;
329662306a36Sopenharmony_ci	u32 macid_y;
329762306a36Sopenharmony_ci	u32 tsf_x_low;
329862306a36Sopenharmony_ci	u32 tsf_x_high;
329962306a36Sopenharmony_ci	u32 tsf_y_low;
330062306a36Sopenharmony_ci	u32 tsf_y_high;
330162306a36Sopenharmony_ci};
330262306a36Sopenharmony_ci
330362306a36Sopenharmony_cistatic_assert(sizeof(struct rtw89_mac_mcc_tsf_rpt) <= RTW89_COMPLETION_BUF_SIZE);
330462306a36Sopenharmony_ci
330562306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_MACID_X(c2h) \
330662306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(7, 0))
330762306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_MACID_Y(c2h) \
330862306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(15, 8))
330962306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_GROUP(c2h) \
331062306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(17, 16))
331162306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_LOW_X(c2h) \
331262306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 3), GENMASK(31, 0))
331362306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_HIGH_X(c2h) \
331462306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 4), GENMASK(31, 0))
331562306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_LOW_Y(c2h) \
331662306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 5), GENMASK(31, 0))
331762306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_TSF_RPT_TSF_HIGH_Y(c2h) \
331862306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 6), GENMASK(31, 0))
331962306a36Sopenharmony_ci
332062306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_STATUS(c2h) \
332162306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(5, 0))
332262306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_GROUP(c2h) \
332362306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(7, 6))
332462306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_MACID(c2h) \
332562306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 2), GENMASK(15, 8))
332662306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_TSF_LOW(c2h) \
332762306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 3), GENMASK(31, 0))
332862306a36Sopenharmony_ci#define RTW89_GET_MAC_C2H_MCC_STATUS_RPT_TSF_HIGH(c2h) \
332962306a36Sopenharmony_ci	le32_get_bits(*((const __le32 *)(c2h) + 4), GENMASK(31, 0))
333062306a36Sopenharmony_ci
333162306a36Sopenharmony_cistruct rtw89_c2h_pkt_ofld_rsp {
333262306a36Sopenharmony_ci	__le32 w0;
333362306a36Sopenharmony_ci	__le32 w1;
333462306a36Sopenharmony_ci	__le32 w2;
333562306a36Sopenharmony_ci} __packed;
333662306a36Sopenharmony_ci
333762306a36Sopenharmony_ci#define RTW89_C2H_PKT_OFLD_RSP_W2_PTK_ID GENMASK(7, 0)
333862306a36Sopenharmony_ci#define RTW89_C2H_PKT_OFLD_RSP_W2_PTK_OP GENMASK(10, 8)
333962306a36Sopenharmony_ci#define RTW89_C2H_PKT_OFLD_RSP_W2_PTK_LEN GENMASK(31, 16)
334062306a36Sopenharmony_ci
334162306a36Sopenharmony_cistruct rtw89_h2c_bcnfltr {
334262306a36Sopenharmony_ci	__le32 w0;
334362306a36Sopenharmony_ci} __packed;
334462306a36Sopenharmony_ci
334562306a36Sopenharmony_ci#define RTW89_H2C_BCNFLTR_W0_MON_RSSI BIT(0)
334662306a36Sopenharmony_ci#define RTW89_H2C_BCNFLTR_W0_MON_BCN BIT(1)
334762306a36Sopenharmony_ci#define RTW89_H2C_BCNFLTR_W0_MON_EN BIT(2)
334862306a36Sopenharmony_ci#define RTW89_H2C_BCNFLTR_W0_MODE GENMASK(4, 3)
334962306a36Sopenharmony_ci#define RTW89_H2C_BCNFLTR_W0_BCN_LOSS_CNT GENMASK(11, 8)
335062306a36Sopenharmony_ci#define RTW89_H2C_BCNFLTR_W0_RSSI_HYST GENMASK(15, 12)
335162306a36Sopenharmony_ci#define RTW89_H2C_BCNFLTR_W0_RSSI_THRESHOLD GENMASK(23, 16)
335262306a36Sopenharmony_ci#define RTW89_H2C_BCNFLTR_W0_MAC_ID GENMASK(31, 24)
335362306a36Sopenharmony_ci
335462306a36Sopenharmony_cistruct rtw89_h2c_ofld_rssi {
335562306a36Sopenharmony_ci	__le32 w0;
335662306a36Sopenharmony_ci	__le32 w1;
335762306a36Sopenharmony_ci} __packed;
335862306a36Sopenharmony_ci
335962306a36Sopenharmony_ci#define RTW89_H2C_OFLD_RSSI_W0_MACID GENMASK(7, 0)
336062306a36Sopenharmony_ci#define RTW89_H2C_OFLD_RSSI_W0_NUM GENMASK(15, 8)
336162306a36Sopenharmony_ci#define RTW89_H2C_OFLD_RSSI_W1_VAL GENMASK(7, 0)
336262306a36Sopenharmony_ci
336362306a36Sopenharmony_cistruct rtw89_h2c_ofld {
336462306a36Sopenharmony_ci	__le32 w0;
336562306a36Sopenharmony_ci} __packed;
336662306a36Sopenharmony_ci
336762306a36Sopenharmony_ci#define RTW89_H2C_OFLD_W0_MAC_ID GENMASK(7, 0)
336862306a36Sopenharmony_ci#define RTW89_H2C_OFLD_W0_TX_TP GENMASK(17, 8)
336962306a36Sopenharmony_ci#define RTW89_H2C_OFLD_W0_RX_TP GENMASK(27, 18)
337062306a36Sopenharmony_ci
337162306a36Sopenharmony_ci#define RTW89_MFW_SIG	0xFF
337262306a36Sopenharmony_ci
337362306a36Sopenharmony_cistruct rtw89_mfw_info {
337462306a36Sopenharmony_ci	u8 cv;
337562306a36Sopenharmony_ci	u8 type; /* enum rtw89_fw_type */
337662306a36Sopenharmony_ci	u8 mp;
337762306a36Sopenharmony_ci	u8 rsvd;
337862306a36Sopenharmony_ci	__le32 shift;
337962306a36Sopenharmony_ci	__le32 size;
338062306a36Sopenharmony_ci	u8 rsvd2[4];
338162306a36Sopenharmony_ci} __packed;
338262306a36Sopenharmony_ci
338362306a36Sopenharmony_cistruct rtw89_mfw_hdr {
338462306a36Sopenharmony_ci	u8 sig;	/* RTW89_MFW_SIG */
338562306a36Sopenharmony_ci	u8 fw_nr;
338662306a36Sopenharmony_ci	u8 rsvd0[2];
338762306a36Sopenharmony_ci	struct {
338862306a36Sopenharmony_ci		u8 major;
338962306a36Sopenharmony_ci		u8 minor;
339062306a36Sopenharmony_ci		u8 sub;
339162306a36Sopenharmony_ci		u8 idx;
339262306a36Sopenharmony_ci	} ver;
339362306a36Sopenharmony_ci	u8 rsvd1[8];
339462306a36Sopenharmony_ci	struct rtw89_mfw_info info[];
339562306a36Sopenharmony_ci} __packed;
339662306a36Sopenharmony_ci
339762306a36Sopenharmony_cistruct rtw89_fw_logsuit_hdr {
339862306a36Sopenharmony_ci	__le32 rsvd;
339962306a36Sopenharmony_ci	__le32 count;
340062306a36Sopenharmony_ci	__le32 ids[];
340162306a36Sopenharmony_ci} __packed;
340262306a36Sopenharmony_ci
340362306a36Sopenharmony_ci#define RTW89_FW_ELEMENT_ALIGN 16
340462306a36Sopenharmony_ci
340562306a36Sopenharmony_cienum rtw89_fw_element_id {
340662306a36Sopenharmony_ci	RTW89_FW_ELEMENT_ID_BBMCU0 = 0,
340762306a36Sopenharmony_ci	RTW89_FW_ELEMENT_ID_BBMCU1 = 1,
340862306a36Sopenharmony_ci	RTW89_FW_ELEMENT_ID_BB_REG = 2,
340962306a36Sopenharmony_ci	RTW89_FW_ELEMENT_ID_BB_GAIN = 3,
341062306a36Sopenharmony_ci	RTW89_FW_ELEMENT_ID_RADIO_A = 4,
341162306a36Sopenharmony_ci	RTW89_FW_ELEMENT_ID_RADIO_B = 5,
341262306a36Sopenharmony_ci	RTW89_FW_ELEMENT_ID_RADIO_C = 6,
341362306a36Sopenharmony_ci	RTW89_FW_ELEMENT_ID_RADIO_D = 7,
341462306a36Sopenharmony_ci	RTW89_FW_ELEMENT_ID_RF_NCTL = 8,
341562306a36Sopenharmony_ci
341662306a36Sopenharmony_ci	RTW89_FW_ELEMENT_ID_NUM,
341762306a36Sopenharmony_ci};
341862306a36Sopenharmony_ci
341962306a36Sopenharmony_cistruct rtw89_fw_element_hdr {
342062306a36Sopenharmony_ci	__le32 id; /* enum rtw89_fw_element_id */
342162306a36Sopenharmony_ci	__le32 size; /* exclude header size */
342262306a36Sopenharmony_ci	u8 ver[4];
342362306a36Sopenharmony_ci	__le32 rsvd0;
342462306a36Sopenharmony_ci	__le32 rsvd1;
342562306a36Sopenharmony_ci	__le32 rsvd2;
342662306a36Sopenharmony_ci	union {
342762306a36Sopenharmony_ci		struct {
342862306a36Sopenharmony_ci			u8 priv[8];
342962306a36Sopenharmony_ci			u8 contents[];
343062306a36Sopenharmony_ci		} __packed common;
343162306a36Sopenharmony_ci		struct {
343262306a36Sopenharmony_ci			u8 idx;
343362306a36Sopenharmony_ci			u8 rsvd[7];
343462306a36Sopenharmony_ci			struct {
343562306a36Sopenharmony_ci				__le32 addr;
343662306a36Sopenharmony_ci				__le32 data;
343762306a36Sopenharmony_ci			} __packed regs[];
343862306a36Sopenharmony_ci		} __packed reg2;
343962306a36Sopenharmony_ci	} __packed u;
344062306a36Sopenharmony_ci} __packed;
344162306a36Sopenharmony_ci
344262306a36Sopenharmony_cistruct fwcmd_hdr {
344362306a36Sopenharmony_ci	__le32 hdr0;
344462306a36Sopenharmony_ci	__le32 hdr1;
344562306a36Sopenharmony_ci};
344662306a36Sopenharmony_ci
344762306a36Sopenharmony_ciunion rtw89_compat_fw_hdr {
344862306a36Sopenharmony_ci	struct rtw89_mfw_hdr mfw_hdr;
344962306a36Sopenharmony_ci	struct rtw89_fw_hdr fw_hdr;
345062306a36Sopenharmony_ci};
345162306a36Sopenharmony_ci
345262306a36Sopenharmony_cistatic inline u32 rtw89_compat_fw_hdr_ver_code(const void *fw_buf)
345362306a36Sopenharmony_ci{
345462306a36Sopenharmony_ci	const union rtw89_compat_fw_hdr *compat = (typeof(compat))fw_buf;
345562306a36Sopenharmony_ci
345662306a36Sopenharmony_ci	if (compat->mfw_hdr.sig == RTW89_MFW_SIG)
345762306a36Sopenharmony_ci		return RTW89_MFW_HDR_VER_CODE(&compat->mfw_hdr);
345862306a36Sopenharmony_ci	else
345962306a36Sopenharmony_ci		return RTW89_FW_HDR_VER_CODE(&compat->fw_hdr);
346062306a36Sopenharmony_ci}
346162306a36Sopenharmony_ci
346262306a36Sopenharmony_cistatic inline void rtw89_fw_get_filename(char *buf, size_t size,
346362306a36Sopenharmony_ci					 const char *fw_basename, int fw_format)
346462306a36Sopenharmony_ci{
346562306a36Sopenharmony_ci	if (fw_format <= 0)
346662306a36Sopenharmony_ci		snprintf(buf, size, "%s.bin", fw_basename);
346762306a36Sopenharmony_ci	else
346862306a36Sopenharmony_ci		snprintf(buf, size, "%s-%d.bin", fw_basename, fw_format);
346962306a36Sopenharmony_ci}
347062306a36Sopenharmony_ci
347162306a36Sopenharmony_ci#define RTW89_H2C_RF_PAGE_SIZE 500
347262306a36Sopenharmony_ci#define RTW89_H2C_RF_PAGE_NUM 3
347362306a36Sopenharmony_cistruct rtw89_fw_h2c_rf_reg_info {
347462306a36Sopenharmony_ci	enum rtw89_rf_path rf_path;
347562306a36Sopenharmony_ci	__le32 rtw89_phy_config_rf_h2c[RTW89_H2C_RF_PAGE_NUM][RTW89_H2C_RF_PAGE_SIZE];
347662306a36Sopenharmony_ci	u16 curr_idx;
347762306a36Sopenharmony_ci};
347862306a36Sopenharmony_ci
347962306a36Sopenharmony_ci#define H2C_SEC_CAM_LEN			24
348062306a36Sopenharmony_ci
348162306a36Sopenharmony_ci#define H2C_HEADER_LEN			8
348262306a36Sopenharmony_ci#define H2C_HDR_CAT			GENMASK(1, 0)
348362306a36Sopenharmony_ci#define H2C_HDR_CLASS			GENMASK(7, 2)
348462306a36Sopenharmony_ci#define H2C_HDR_FUNC			GENMASK(15, 8)
348562306a36Sopenharmony_ci#define H2C_HDR_DEL_TYPE		GENMASK(19, 16)
348662306a36Sopenharmony_ci#define H2C_HDR_H2C_SEQ			GENMASK(31, 24)
348762306a36Sopenharmony_ci#define H2C_HDR_TOTAL_LEN		GENMASK(13, 0)
348862306a36Sopenharmony_ci#define H2C_HDR_REC_ACK			BIT(14)
348962306a36Sopenharmony_ci#define H2C_HDR_DONE_ACK		BIT(15)
349062306a36Sopenharmony_ci
349162306a36Sopenharmony_ci#define FWCMD_TYPE_H2C			0
349262306a36Sopenharmony_ci
349362306a36Sopenharmony_ci#define H2C_CAT_TEST		0x0
349462306a36Sopenharmony_ci
349562306a36Sopenharmony_ci/* CLASS 5 - FW STATUS TEST */
349662306a36Sopenharmony_ci#define H2C_CL_FW_STATUS_TEST		0x5
349762306a36Sopenharmony_ci#define H2C_FUNC_CPU_EXCEPTION		0x1
349862306a36Sopenharmony_ci
349962306a36Sopenharmony_ci#define H2C_CAT_MAC		0x1
350062306a36Sopenharmony_ci
350162306a36Sopenharmony_ci/* CLASS 0 - FW INFO */
350262306a36Sopenharmony_ci#define H2C_CL_FW_INFO			0x0
350362306a36Sopenharmony_ci#define H2C_FUNC_LOG_CFG		0x0
350462306a36Sopenharmony_ci#define H2C_FUNC_MAC_GENERAL_PKT	0x1
350562306a36Sopenharmony_ci
350662306a36Sopenharmony_ci/* CLASS 1 - WOW */
350762306a36Sopenharmony_ci#define H2C_CL_MAC_WOW			0x1
350862306a36Sopenharmony_ci#define H2C_FUNC_KEEP_ALIVE		0x0
350962306a36Sopenharmony_ci#define H2C_FUNC_DISCONNECT_DETECT	0x1
351062306a36Sopenharmony_ci#define H2C_FUNC_WOW_GLOBAL		0x2
351162306a36Sopenharmony_ci#define H2C_FUNC_WAKEUP_CTRL		0x8
351262306a36Sopenharmony_ci#define H2C_FUNC_WOW_CAM_UPD		0xC
351362306a36Sopenharmony_ci
351462306a36Sopenharmony_ci/* CLASS 2 - PS */
351562306a36Sopenharmony_ci#define H2C_CL_MAC_PS			0x2
351662306a36Sopenharmony_ci#define H2C_FUNC_MAC_LPS_PARM		0x0
351762306a36Sopenharmony_ci#define H2C_FUNC_P2P_ACT		0x1
351862306a36Sopenharmony_ci
351962306a36Sopenharmony_ci/* CLASS 3 - FW download */
352062306a36Sopenharmony_ci#define H2C_CL_MAC_FWDL		0x3
352162306a36Sopenharmony_ci#define H2C_FUNC_MAC_FWHDR_DL		0x0
352262306a36Sopenharmony_ci
352362306a36Sopenharmony_ci/* CLASS 5 - Frame Exchange */
352462306a36Sopenharmony_ci#define H2C_CL_MAC_FR_EXCHG		0x5
352562306a36Sopenharmony_ci#define H2C_FUNC_MAC_CCTLINFO_UD	0x2
352662306a36Sopenharmony_ci#define H2C_FUNC_MAC_BCN_UPD		0x5
352762306a36Sopenharmony_ci#define H2C_FUNC_MAC_DCTLINFO_UD_V1	0x9
352862306a36Sopenharmony_ci#define H2C_FUNC_MAC_CCTLINFO_UD_V1	0xa
352962306a36Sopenharmony_ci
353062306a36Sopenharmony_ci/* CLASS 6 - Address CAM */
353162306a36Sopenharmony_ci#define H2C_CL_MAC_ADDR_CAM_UPDATE	0x6
353262306a36Sopenharmony_ci#define H2C_FUNC_MAC_ADDR_CAM_UPD	0x0
353362306a36Sopenharmony_ci
353462306a36Sopenharmony_ci/* CLASS 8 - Media Status Report */
353562306a36Sopenharmony_ci#define H2C_CL_MAC_MEDIA_RPT		0x8
353662306a36Sopenharmony_ci#define H2C_FUNC_MAC_JOININFO		0x0
353762306a36Sopenharmony_ci#define H2C_FUNC_MAC_FWROLE_MAINTAIN	0x4
353862306a36Sopenharmony_ci
353962306a36Sopenharmony_ci/* CLASS 9 - FW offload */
354062306a36Sopenharmony_ci#define H2C_CL_MAC_FW_OFLD		0x9
354162306a36Sopenharmony_cienum rtw89_fw_ofld_h2c_func {
354262306a36Sopenharmony_ci	H2C_FUNC_PACKET_OFLD		= 0x1,
354362306a36Sopenharmony_ci	H2C_FUNC_MAC_MACID_PAUSE	= 0x8,
354462306a36Sopenharmony_ci	H2C_FUNC_USR_EDCA		= 0xF,
354562306a36Sopenharmony_ci	H2C_FUNC_TSF32_TOGL		= 0x10,
354662306a36Sopenharmony_ci	H2C_FUNC_OFLD_CFG		= 0x14,
354762306a36Sopenharmony_ci	H2C_FUNC_ADD_SCANOFLD_CH	= 0x16,
354862306a36Sopenharmony_ci	H2C_FUNC_SCANOFLD		= 0x17,
354962306a36Sopenharmony_ci	H2C_FUNC_PKT_DROP		= 0x1b,
355062306a36Sopenharmony_ci	H2C_FUNC_CFG_BCNFLTR		= 0x1e,
355162306a36Sopenharmony_ci	H2C_FUNC_OFLD_RSSI		= 0x1f,
355262306a36Sopenharmony_ci	H2C_FUNC_OFLD_TP		= 0x20,
355362306a36Sopenharmony_ci
355462306a36Sopenharmony_ci	NUM_OF_RTW89_FW_OFLD_H2C_FUNC,
355562306a36Sopenharmony_ci};
355662306a36Sopenharmony_ci
355762306a36Sopenharmony_ci#define RTW89_FW_OFLD_WAIT_COND(tag, func) \
355862306a36Sopenharmony_ci	((tag) * NUM_OF_RTW89_FW_OFLD_H2C_FUNC + (func))
355962306a36Sopenharmony_ci
356062306a36Sopenharmony_ci#define RTW89_FW_OFLD_WAIT_COND_PKT_OFLD(pkt_id, pkt_op) \
356162306a36Sopenharmony_ci	RTW89_FW_OFLD_WAIT_COND(RTW89_PKT_OFLD_WAIT_TAG(pkt_id, pkt_op), \
356262306a36Sopenharmony_ci				H2C_FUNC_PACKET_OFLD)
356362306a36Sopenharmony_ci
356462306a36Sopenharmony_ci/* CLASS 10 - Security CAM */
356562306a36Sopenharmony_ci#define H2C_CL_MAC_SEC_CAM		0xa
356662306a36Sopenharmony_ci#define H2C_FUNC_MAC_SEC_UPD		0x1
356762306a36Sopenharmony_ci
356862306a36Sopenharmony_ci/* CLASS 12 - BA CAM */
356962306a36Sopenharmony_ci#define H2C_CL_BA_CAM			0xc
357062306a36Sopenharmony_ci#define H2C_FUNC_MAC_BA_CAM		0x0
357162306a36Sopenharmony_ci
357262306a36Sopenharmony_ci/* CLASS 14 - MCC */
357362306a36Sopenharmony_ci#define H2C_CL_MCC			0xe
357462306a36Sopenharmony_cienum rtw89_mcc_h2c_func {
357562306a36Sopenharmony_ci	H2C_FUNC_ADD_MCC		= 0x0,
357662306a36Sopenharmony_ci	H2C_FUNC_START_MCC		= 0x1,
357762306a36Sopenharmony_ci	H2C_FUNC_STOP_MCC		= 0x2,
357862306a36Sopenharmony_ci	H2C_FUNC_DEL_MCC_GROUP		= 0x3,
357962306a36Sopenharmony_ci	H2C_FUNC_RESET_MCC_GROUP	= 0x4,
358062306a36Sopenharmony_ci	H2C_FUNC_MCC_REQ_TSF		= 0x5,
358162306a36Sopenharmony_ci	H2C_FUNC_MCC_MACID_BITMAP	= 0x6,
358262306a36Sopenharmony_ci	H2C_FUNC_MCC_SYNC		= 0x7,
358362306a36Sopenharmony_ci	H2C_FUNC_MCC_SET_DURATION	= 0x8,
358462306a36Sopenharmony_ci
358562306a36Sopenharmony_ci	NUM_OF_RTW89_MCC_H2C_FUNC,
358662306a36Sopenharmony_ci};
358762306a36Sopenharmony_ci
358862306a36Sopenharmony_ci#define RTW89_MCC_WAIT_COND(group, func) \
358962306a36Sopenharmony_ci	((group) * NUM_OF_RTW89_MCC_H2C_FUNC + (func))
359062306a36Sopenharmony_ci
359162306a36Sopenharmony_ci#define H2C_CAT_OUTSRC			0x2
359262306a36Sopenharmony_ci
359362306a36Sopenharmony_ci#define H2C_CL_OUTSRC_RA		0x1
359462306a36Sopenharmony_ci#define H2C_FUNC_OUTSRC_RA_MACIDCFG	0x0
359562306a36Sopenharmony_ci
359662306a36Sopenharmony_ci#define H2C_CL_OUTSRC_RF_REG_A		0x8
359762306a36Sopenharmony_ci#define H2C_CL_OUTSRC_RF_REG_B		0x9
359862306a36Sopenharmony_ci#define H2C_CL_OUTSRC_RF_FW_NOTIFY	0xa
359962306a36Sopenharmony_ci#define H2C_FUNC_OUTSRC_RF_GET_MCCCH	0x2
360062306a36Sopenharmony_ci
360162306a36Sopenharmony_cistruct rtw89_fw_h2c_rf_get_mccch {
360262306a36Sopenharmony_ci	__le32 ch_0;
360362306a36Sopenharmony_ci	__le32 ch_1;
360462306a36Sopenharmony_ci	__le32 band_0;
360562306a36Sopenharmony_ci	__le32 band_1;
360662306a36Sopenharmony_ci	__le32 current_channel;
360762306a36Sopenharmony_ci	__le32 current_band_type;
360862306a36Sopenharmony_ci} __packed;
360962306a36Sopenharmony_ci
361062306a36Sopenharmony_ci#define RTW89_FW_RSVD_PLE_SIZE 0x800
361162306a36Sopenharmony_ci
361262306a36Sopenharmony_ci#define RTW89_WCPU_BASE_MASK GENMASK(27, 0)
361362306a36Sopenharmony_ci
361462306a36Sopenharmony_ci#define RTW89_FW_BACKTRACE_INFO_SIZE 8
361562306a36Sopenharmony_ci#define RTW89_VALID_FW_BACKTRACE_SIZE(_size) \
361662306a36Sopenharmony_ci	((_size) % RTW89_FW_BACKTRACE_INFO_SIZE == 0)
361762306a36Sopenharmony_ci
361862306a36Sopenharmony_ci#define RTW89_FW_BACKTRACE_MAX_SIZE 512 /* 8 * 64 (entries) */
361962306a36Sopenharmony_ci#define RTW89_FW_BACKTRACE_KEY 0xBACEBACE
362062306a36Sopenharmony_ci
362162306a36Sopenharmony_ciint rtw89_fw_check_rdy(struct rtw89_dev *rtwdev);
362262306a36Sopenharmony_ciint rtw89_fw_recognize(struct rtw89_dev *rtwdev);
362362306a36Sopenharmony_ciint rtw89_fw_recognize_elements(struct rtw89_dev *rtwdev);
362462306a36Sopenharmony_ciconst struct firmware *
362562306a36Sopenharmony_cirtw89_early_fw_feature_recognize(struct device *device,
362662306a36Sopenharmony_ci				 const struct rtw89_chip_info *chip,
362762306a36Sopenharmony_ci				 struct rtw89_fw_info *early_fw,
362862306a36Sopenharmony_ci				 int *used_fw_format);
362962306a36Sopenharmony_ciint rtw89_fw_download(struct rtw89_dev *rtwdev, enum rtw89_fw_type type);
363062306a36Sopenharmony_civoid rtw89_load_firmware_work(struct work_struct *work);
363162306a36Sopenharmony_civoid rtw89_unload_firmware(struct rtw89_dev *rtwdev);
363262306a36Sopenharmony_ciint rtw89_wait_firmware_completion(struct rtw89_dev *rtwdev);
363362306a36Sopenharmony_ciint rtw89_fw_log_prepare(struct rtw89_dev *rtwdev);
363462306a36Sopenharmony_civoid rtw89_fw_log_dump(struct rtw89_dev *rtwdev, u8 *buf, u32 len);
363562306a36Sopenharmony_civoid rtw89_h2c_pkt_set_hdr(struct rtw89_dev *rtwdev, struct sk_buff *skb,
363662306a36Sopenharmony_ci			   u8 type, u8 cat, u8 class, u8 func,
363762306a36Sopenharmony_ci			   bool rack, bool dack, u32 len);
363862306a36Sopenharmony_ciint rtw89_fw_h2c_default_cmac_tbl(struct rtw89_dev *rtwdev,
363962306a36Sopenharmony_ci				  struct rtw89_vif *rtwvif);
364062306a36Sopenharmony_ciint rtw89_fw_h2c_assoc_cmac_tbl(struct rtw89_dev *rtwdev,
364162306a36Sopenharmony_ci				struct ieee80211_vif *vif,
364262306a36Sopenharmony_ci				struct ieee80211_sta *sta);
364362306a36Sopenharmony_ciint rtw89_fw_h2c_txtime_cmac_tbl(struct rtw89_dev *rtwdev,
364462306a36Sopenharmony_ci				 struct rtw89_sta *rtwsta);
364562306a36Sopenharmony_ciint rtw89_fw_h2c_txpath_cmac_tbl(struct rtw89_dev *rtwdev,
364662306a36Sopenharmony_ci				 struct rtw89_sta *rtwsta);
364762306a36Sopenharmony_ciint rtw89_fw_h2c_update_beacon(struct rtw89_dev *rtwdev,
364862306a36Sopenharmony_ci			       struct rtw89_vif *rtwvif);
364962306a36Sopenharmony_ciint rtw89_fw_h2c_cam(struct rtw89_dev *rtwdev, struct rtw89_vif *vif,
365062306a36Sopenharmony_ci		     struct rtw89_sta *rtwsta, const u8 *scan_mac_addr);
365162306a36Sopenharmony_ciint rtw89_fw_h2c_dctl_sec_cam_v1(struct rtw89_dev *rtwdev,
365262306a36Sopenharmony_ci				 struct rtw89_vif *rtwvif,
365362306a36Sopenharmony_ci				 struct rtw89_sta *rtwsta);
365462306a36Sopenharmony_civoid rtw89_fw_c2h_irqsafe(struct rtw89_dev *rtwdev, struct sk_buff *c2h);
365562306a36Sopenharmony_civoid rtw89_fw_c2h_work(struct work_struct *work);
365662306a36Sopenharmony_ciint rtw89_fw_h2c_role_maintain(struct rtw89_dev *rtwdev,
365762306a36Sopenharmony_ci			       struct rtw89_vif *rtwvif,
365862306a36Sopenharmony_ci			       struct rtw89_sta *rtwsta,
365962306a36Sopenharmony_ci			       enum rtw89_upd_mode upd_mode);
366062306a36Sopenharmony_ciint rtw89_fw_h2c_join_info(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
366162306a36Sopenharmony_ci			   struct rtw89_sta *rtwsta, bool dis_conn);
366262306a36Sopenharmony_ciint rtw89_fw_h2c_macid_pause(struct rtw89_dev *rtwdev, u8 sh, u8 grp,
366362306a36Sopenharmony_ci			     bool pause);
366462306a36Sopenharmony_ciint rtw89_fw_h2c_set_edca(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
366562306a36Sopenharmony_ci			  u8 ac, u32 val);
366662306a36Sopenharmony_ciint rtw89_fw_h2c_set_ofld_cfg(struct rtw89_dev *rtwdev);
366762306a36Sopenharmony_ciint rtw89_fw_h2c_set_bcn_fltr_cfg(struct rtw89_dev *rtwdev,
366862306a36Sopenharmony_ci				  struct ieee80211_vif *vif,
366962306a36Sopenharmony_ci				  bool connect);
367062306a36Sopenharmony_ciint rtw89_fw_h2c_rssi_offload(struct rtw89_dev *rtwdev,
367162306a36Sopenharmony_ci			      struct rtw89_rx_phy_ppdu *phy_ppdu);
367262306a36Sopenharmony_ciint rtw89_fw_h2c_tp_offload(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
367362306a36Sopenharmony_ciint rtw89_fw_h2c_ra(struct rtw89_dev *rtwdev, struct rtw89_ra_info *ra, bool csi);
367462306a36Sopenharmony_ciint rtw89_fw_h2c_cxdrv_init(struct rtw89_dev *rtwdev);
367562306a36Sopenharmony_ciint rtw89_fw_h2c_cxdrv_role(struct rtw89_dev *rtwdev);
367662306a36Sopenharmony_ciint rtw89_fw_h2c_cxdrv_role_v1(struct rtw89_dev *rtwdev);
367762306a36Sopenharmony_ciint rtw89_fw_h2c_cxdrv_role_v2(struct rtw89_dev *rtwdev);
367862306a36Sopenharmony_ciint rtw89_fw_h2c_cxdrv_ctrl(struct rtw89_dev *rtwdev);
367962306a36Sopenharmony_ciint rtw89_fw_h2c_cxdrv_trx(struct rtw89_dev *rtwdev);
368062306a36Sopenharmony_ciint rtw89_fw_h2c_cxdrv_rfk(struct rtw89_dev *rtwdev);
368162306a36Sopenharmony_ciint rtw89_fw_h2c_del_pkt_offload(struct rtw89_dev *rtwdev, u8 id);
368262306a36Sopenharmony_ciint rtw89_fw_h2c_add_pkt_offload(struct rtw89_dev *rtwdev, u8 *id,
368362306a36Sopenharmony_ci				 struct sk_buff *skb_ofld);
368462306a36Sopenharmony_ciint rtw89_fw_h2c_scan_list_offload(struct rtw89_dev *rtwdev, int len,
368562306a36Sopenharmony_ci				   struct list_head *chan_list);
368662306a36Sopenharmony_ciint rtw89_fw_h2c_scan_offload(struct rtw89_dev *rtwdev,
368762306a36Sopenharmony_ci			      struct rtw89_scan_option *opt,
368862306a36Sopenharmony_ci			      struct rtw89_vif *vif);
368962306a36Sopenharmony_ciint rtw89_fw_h2c_rf_reg(struct rtw89_dev *rtwdev,
369062306a36Sopenharmony_ci			struct rtw89_fw_h2c_rf_reg_info *info,
369162306a36Sopenharmony_ci			u16 len, u8 page);
369262306a36Sopenharmony_ciint rtw89_fw_h2c_rf_ntfy_mcc(struct rtw89_dev *rtwdev);
369362306a36Sopenharmony_ciint rtw89_fw_h2c_raw_with_hdr(struct rtw89_dev *rtwdev,
369462306a36Sopenharmony_ci			      u8 h2c_class, u8 h2c_func, u8 *buf, u16 len,
369562306a36Sopenharmony_ci			      bool rack, bool dack);
369662306a36Sopenharmony_ciint rtw89_fw_h2c_raw(struct rtw89_dev *rtwdev, const u8 *buf, u16 len);
369762306a36Sopenharmony_civoid rtw89_fw_send_all_early_h2c(struct rtw89_dev *rtwdev);
369862306a36Sopenharmony_civoid rtw89_fw_free_all_early_h2c(struct rtw89_dev *rtwdev);
369962306a36Sopenharmony_ciint rtw89_fw_h2c_general_pkt(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
370062306a36Sopenharmony_ci			     u8 macid);
370162306a36Sopenharmony_civoid rtw89_fw_release_general_pkt_list_vif(struct rtw89_dev *rtwdev,
370262306a36Sopenharmony_ci					   struct rtw89_vif *rtwvif, bool notify_fw);
370362306a36Sopenharmony_civoid rtw89_fw_release_general_pkt_list(struct rtw89_dev *rtwdev, bool notify_fw);
370462306a36Sopenharmony_ciint rtw89_fw_h2c_ba_cam(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta,
370562306a36Sopenharmony_ci			bool valid, struct ieee80211_ampdu_params *params);
370662306a36Sopenharmony_civoid rtw89_fw_h2c_init_dynamic_ba_cam_v0_ext(struct rtw89_dev *rtwdev);
370762306a36Sopenharmony_ci
370862306a36Sopenharmony_ciint rtw89_fw_h2c_lps_parm(struct rtw89_dev *rtwdev,
370962306a36Sopenharmony_ci			  struct rtw89_lps_parm *lps_param);
371062306a36Sopenharmony_cistruct sk_buff *rtw89_fw_h2c_alloc_skb_with_hdr(struct rtw89_dev *rtwdev, u32 len);
371162306a36Sopenharmony_cistruct sk_buff *rtw89_fw_h2c_alloc_skb_no_hdr(struct rtw89_dev *rtwdev, u32 len);
371262306a36Sopenharmony_ciint rtw89_fw_msg_reg(struct rtw89_dev *rtwdev,
371362306a36Sopenharmony_ci		     struct rtw89_mac_h2c_info *h2c_info,
371462306a36Sopenharmony_ci		     struct rtw89_mac_c2h_info *c2h_info);
371562306a36Sopenharmony_ciint rtw89_fw_h2c_fw_log(struct rtw89_dev *rtwdev, bool enable);
371662306a36Sopenharmony_civoid rtw89_fw_st_dbg_dump(struct rtw89_dev *rtwdev);
371762306a36Sopenharmony_civoid rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
371862306a36Sopenharmony_ci			 struct ieee80211_scan_request *req);
371962306a36Sopenharmony_civoid rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
372062306a36Sopenharmony_ci			    bool aborted);
372162306a36Sopenharmony_ciint rtw89_hw_scan_offload(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
372262306a36Sopenharmony_ci			  bool enable);
372362306a36Sopenharmony_civoid rtw89_hw_scan_abort(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif);
372462306a36Sopenharmony_ciint rtw89_fw_h2c_trigger_cpu_exception(struct rtw89_dev *rtwdev);
372562306a36Sopenharmony_ciint rtw89_fw_h2c_pkt_drop(struct rtw89_dev *rtwdev,
372662306a36Sopenharmony_ci			  const struct rtw89_pkt_drop_params *params);
372762306a36Sopenharmony_ciint rtw89_fw_h2c_p2p_act(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
372862306a36Sopenharmony_ci			 struct ieee80211_p2p_noa_desc *desc,
372962306a36Sopenharmony_ci			 u8 act, u8 noa_id);
373062306a36Sopenharmony_ciint rtw89_fw_h2c_tsf32_toggle(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
373162306a36Sopenharmony_ci			      bool en);
373262306a36Sopenharmony_ciint rtw89_fw_h2c_wow_global(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
373362306a36Sopenharmony_ci			    bool enable);
373462306a36Sopenharmony_ciint rtw89_fw_h2c_wow_wakeup_ctrl(struct rtw89_dev *rtwdev,
373562306a36Sopenharmony_ci				 struct rtw89_vif *rtwvif, bool enable);
373662306a36Sopenharmony_ciint rtw89_fw_h2c_keep_alive(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
373762306a36Sopenharmony_ci			    bool enable);
373862306a36Sopenharmony_ciint rtw89_fw_h2c_disconnect_detect(struct rtw89_dev *rtwdev,
373962306a36Sopenharmony_ci				   struct rtw89_vif *rtwvif, bool enable);
374062306a36Sopenharmony_ciint rtw89_fw_h2c_wow_global(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
374162306a36Sopenharmony_ci			    bool enable);
374262306a36Sopenharmony_ciint rtw89_fw_h2c_wow_wakeup_ctrl(struct rtw89_dev *rtwdev,
374362306a36Sopenharmony_ci				 struct rtw89_vif *rtwvif, bool enable);
374462306a36Sopenharmony_ciint rtw89_fw_wow_cam_update(struct rtw89_dev *rtwdev,
374562306a36Sopenharmony_ci			    struct rtw89_wow_cam_info *cam_info);
374662306a36Sopenharmony_ciint rtw89_fw_h2c_add_mcc(struct rtw89_dev *rtwdev,
374762306a36Sopenharmony_ci			 const struct rtw89_fw_mcc_add_req *p);
374862306a36Sopenharmony_ciint rtw89_fw_h2c_start_mcc(struct rtw89_dev *rtwdev,
374962306a36Sopenharmony_ci			   const struct rtw89_fw_mcc_start_req *p);
375062306a36Sopenharmony_ciint rtw89_fw_h2c_stop_mcc(struct rtw89_dev *rtwdev, u8 group, u8 macid,
375162306a36Sopenharmony_ci			  bool prev_groups);
375262306a36Sopenharmony_ciint rtw89_fw_h2c_del_mcc_group(struct rtw89_dev *rtwdev, u8 group,
375362306a36Sopenharmony_ci			       bool prev_groups);
375462306a36Sopenharmony_ciint rtw89_fw_h2c_reset_mcc_group(struct rtw89_dev *rtwdev, u8 group);
375562306a36Sopenharmony_ciint rtw89_fw_h2c_mcc_req_tsf(struct rtw89_dev *rtwdev,
375662306a36Sopenharmony_ci			     const struct rtw89_fw_mcc_tsf_req *req,
375762306a36Sopenharmony_ci			     struct rtw89_mac_mcc_tsf_rpt *rpt);
375862306a36Sopenharmony_ciint rtw89_fw_h2c_mcc_macid_bitamp(struct rtw89_dev *rtwdev, u8 group, u8 macid,
375962306a36Sopenharmony_ci				  u8 *bitmap);
376062306a36Sopenharmony_ciint rtw89_fw_h2c_mcc_sync(struct rtw89_dev *rtwdev, u8 group, u8 source,
376162306a36Sopenharmony_ci			  u8 target, u8 offset);
376262306a36Sopenharmony_ciint rtw89_fw_h2c_mcc_set_duration(struct rtw89_dev *rtwdev,
376362306a36Sopenharmony_ci				  const struct rtw89_fw_mcc_duration *p);
376462306a36Sopenharmony_ci
376562306a36Sopenharmony_cistatic inline void rtw89_fw_h2c_init_ba_cam(struct rtw89_dev *rtwdev)
376662306a36Sopenharmony_ci{
376762306a36Sopenharmony_ci	const struct rtw89_chip_info *chip = rtwdev->chip;
376862306a36Sopenharmony_ci
376962306a36Sopenharmony_ci	if (chip->bacam_ver == RTW89_BACAM_V0_EXT)
377062306a36Sopenharmony_ci		rtw89_fw_h2c_init_dynamic_ba_cam_v0_ext(rtwdev);
377162306a36Sopenharmony_ci}
377262306a36Sopenharmony_ci
377362306a36Sopenharmony_ci#endif
3774