162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Copyright(c) 2009-2010  Realtek Corporation.*/
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef __RTL8821AE__FW__H__
562306a36Sopenharmony_ci#define __RTL8821AE__FW__H__
662306a36Sopenharmony_ci#include "def.h"
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#define FW_8821AE_SIZE					0x8000
962306a36Sopenharmony_ci#define FW_8821AE_START_ADDRESS			0x1000
1062306a36Sopenharmony_ci#define FW_8821AE_END_ADDRESS			0x5FFF
1162306a36Sopenharmony_ci#define FW_8821AE_PAGE_SIZE				4096
1262306a36Sopenharmony_ci#define FW_8821AE_POLLING_DELAY			5
1362306a36Sopenharmony_ci#define FW_8821AE_POLLING_TIMEOUT_COUNT	6000
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#define IS_FW_HEADER_EXIST_8812(_pfwhdr)	\
1662306a36Sopenharmony_ci	((le16_to_cpu(_pfwhdr->signature) & 0xFFF0) == 0x9500)
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define IS_FW_HEADER_EXIST_8821(_pfwhdr)	\
1962306a36Sopenharmony_ci	((le16_to_cpu(_pfwhdr->signature) & 0xFFF0) == 0x2100)
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#define USE_OLD_WOWLAN_DEBUG_FW 0
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci#define H2C_8821AE_RSVDPAGE_LOC_LEN		5
2462306a36Sopenharmony_ci#define H2C_8821AE_PWEMODE_LENGTH			7
2562306a36Sopenharmony_ci#define H2C_8821AE_JOINBSSRPT_LENGTH		1
2662306a36Sopenharmony_ci#define H2C_8821AE_AP_OFFLOAD_LENGTH		3
2762306a36Sopenharmony_ci#define H2C_8821AE_WOWLAN_LENGTH			3
2862306a36Sopenharmony_ci#define H2C_8821AE_KEEP_ALIVE_CTRL_LENGTH	3
2962306a36Sopenharmony_ci#if (USE_OLD_WOWLAN_DEBUG_FW == 0)
3062306a36Sopenharmony_ci#define H2C_8821AE_REMOTE_WAKE_CTRL_LEN	1
3162306a36Sopenharmony_ci#else
3262306a36Sopenharmony_ci#define H2C_8821AE_REMOTE_WAKE_CTRL_LEN	3
3362306a36Sopenharmony_ci#endif
3462306a36Sopenharmony_ci#define H2C_8821AE_AOAC_GLOBAL_INFO_LEN	2
3562306a36Sopenharmony_ci#define H2C_8821AE_AOAC_RSVDPAGE_LOC_LEN	7
3662306a36Sopenharmony_ci#define H2C_8821AE_DISCONNECT_DECISION_CTRL_LEN	3
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci/* Fw PS state for RPWM.
3962306a36Sopenharmony_ci*BIT[2:0] = HW state
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci*BIT[3] = Protocol PS state,
4262306a36Sopenharmony_ci1: register active state ,
4362306a36Sopenharmony_ci0: register sleep state
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci*BIT[4] = sub-state
4662306a36Sopenharmony_ci*/
4762306a36Sopenharmony_ci#define	FW_PS_GO_ON			BIT(0)
4862306a36Sopenharmony_ci#define	FW_PS_TX_NULL			BIT(1)
4962306a36Sopenharmony_ci#define	FW_PS_RF_ON			BIT(2)
5062306a36Sopenharmony_ci#define	FW_PS_REGISTER_ACTIVE	BIT(3)
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#define	FW_PS_DPS		BIT(0)
5362306a36Sopenharmony_ci#define	FW_PS_LCLK		(FW_PS_DPS)
5462306a36Sopenharmony_ci#define	FW_PS_RF_OFF		BIT(1)
5562306a36Sopenharmony_ci#define	FW_PS_ALL_ON		BIT(2)
5662306a36Sopenharmony_ci#define	FW_PS_ST_ACTIVE		BIT(3)
5762306a36Sopenharmony_ci#define	FW_PS_ISR_ENABLE	BIT(4)
5862306a36Sopenharmony_ci#define	FW_PS_IMR_ENABLE	BIT(5)
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define	FW_PS_ACK		BIT(6)
6162306a36Sopenharmony_ci#define	FW_PS_TOGGLE		BIT(7)
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci /* 8821AE RPWM value*/
6462306a36Sopenharmony_ci /* BIT[0] = 1: 32k, 0: 40M*/
6562306a36Sopenharmony_ci /* 32k*/
6662306a36Sopenharmony_ci#define	FW_PS_CLOCK_OFF		BIT(0)
6762306a36Sopenharmony_ci/*40M*/
6862306a36Sopenharmony_ci#define	FW_PS_CLOCK_ON		0
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#define	FW_PS_STATE_MASK		(0x0F)
7162306a36Sopenharmony_ci#define	FW_PS_STATE_HW_MASK	(0x07)
7262306a36Sopenharmony_ci/*ISR_ENABLE, IMR_ENABLE, and PS mode should be inherited.*/
7362306a36Sopenharmony_ci#define	FW_PS_STATE_INT_MASK	(0x3F)
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci#define	FW_PS_STATE(x)			(FW_PS_STATE_MASK & (x))
7662306a36Sopenharmony_ci#define	FW_PS_STATE_HW(x)		(FW_PS_STATE_HW_MASK & (x))
7762306a36Sopenharmony_ci#define	FW_PS_STATE_INT(x)	(FW_PS_STATE_INT_MASK & (x))
7862306a36Sopenharmony_ci#define	FW_PS_ISR_VAL(x)		((x) & 0x70)
7962306a36Sopenharmony_ci#define	FW_PS_IMR_MASK(x)	((x) & 0xDF)
8062306a36Sopenharmony_ci#define	FW_PS_KEEP_IMR(x)		((x) & 0x20)
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci#define	FW_PS_STATE_S0		(FW_PS_DPS)
8362306a36Sopenharmony_ci#define	FW_PS_STATE_S1		(FW_PS_LCLK)
8462306a36Sopenharmony_ci#define	FW_PS_STATE_S2		(FW_PS_RF_OFF)
8562306a36Sopenharmony_ci#define	FW_PS_STATE_S3		(FW_PS_ALL_ON)
8662306a36Sopenharmony_ci#define	FW_PS_STATE_S4		((FW_PS_ST_ACTIVE) | (FW_PS_ALL_ON))
8762306a36Sopenharmony_ci /* ((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE))*/
8862306a36Sopenharmony_ci#define	FW_PS_STATE_ALL_ON_8821AE	(FW_PS_CLOCK_ON)
8962306a36Sopenharmony_ci /* (FW_PS_RF_ON)*/
9062306a36Sopenharmony_ci#define	FW_PS_STATE_RF_ON_8821AE	(FW_PS_CLOCK_ON)
9162306a36Sopenharmony_ci /* 0x0*/
9262306a36Sopenharmony_ci#define	FW_PS_STATE_RF_OFF_8821AE	(FW_PS_CLOCK_ON)
9362306a36Sopenharmony_ci /* (FW_PS_STATE_RF_OFF)*/
9462306a36Sopenharmony_ci#define	FW_PS_STATE_RF_OFF_LOW_PWR_8821AE	(FW_PS_CLOCK_OFF)
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci#define	FW_PS_STATE_ALL_ON_92C	(FW_PS_STATE_S4)
9762306a36Sopenharmony_ci#define	FW_PS_STATE_RF_ON_92C		(FW_PS_STATE_S3)
9862306a36Sopenharmony_ci#define	FW_PS_STATE_RF_OFF_92C	(FW_PS_STATE_S2)
9962306a36Sopenharmony_ci#define	FW_PS_STATE_RF_OFF_LOW_PWR_92C	(FW_PS_STATE_S1)
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci/* For 8821AE H2C PwrMode Cmd ID 5.*/
10262306a36Sopenharmony_ci#define	FW_PWR_STATE_ACTIVE	((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE))
10362306a36Sopenharmony_ci#define	FW_PWR_STATE_RF_OFF	0
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci#define	FW_PS_IS_ACK(x)		((x) & FW_PS_ACK)
10662306a36Sopenharmony_ci#define	FW_PS_IS_CLK_ON(x)	((x) & (FW_PS_RF_OFF | FW_PS_ALL_ON))
10762306a36Sopenharmony_ci#define	FW_PS_IS_RF_ON(x)	((x) & (FW_PS_ALL_ON))
10862306a36Sopenharmony_ci#define	FW_PS_IS_ACTIVE(x)	((x) & (FW_PS_ST_ACTIVE))
10962306a36Sopenharmony_ci#define	FW_PS_IS_CPWM_INT(x)	((x) & 0x40)
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci#define	FW_CLR_PS_STATE(x)	((x) = ((x) & (0xF0)))
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci#define	IS_IN_LOW_POWER_STATE_8821AE(__state)		\
11462306a36Sopenharmony_ci			(FW_PS_STATE(__state) == FW_PS_CLOCK_OFF)
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci#define	FW_PWR_STATE_ACTIVE	((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE))
11762306a36Sopenharmony_ci#define	FW_PWR_STATE_RF_OFF	0
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_cienum rtl8821a_h2c_cmd {
12062306a36Sopenharmony_ci	H2C_8821AE_RSVDPAGE = 0,
12162306a36Sopenharmony_ci	H2C_8821AE_MSRRPT = 1,
12262306a36Sopenharmony_ci	H2C_8821AE_SCAN = 2,
12362306a36Sopenharmony_ci	H2C_8821AE_KEEP_ALIVE_CTRL = 3,
12462306a36Sopenharmony_ci	H2C_8821AE_DISCONNECT_DECISION = 4,
12562306a36Sopenharmony_ci	H2C_8821AE_INIT_OFFLOAD = 6,
12662306a36Sopenharmony_ci	H2C_8821AE_AP_OFFLOAD = 8,
12762306a36Sopenharmony_ci	H2C_8821AE_BCN_RSVDPAGE = 9,
12862306a36Sopenharmony_ci	H2C_8821AE_PROBERSP_RSVDPAGE = 10,
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci	H2C_8821AE_SETPWRMODE = 0x20,
13162306a36Sopenharmony_ci	H2C_8821AE_PS_TUNING_PARA = 0x21,
13262306a36Sopenharmony_ci	H2C_8821AE_PS_TUNING_PARA2 = 0x22,
13362306a36Sopenharmony_ci	H2C_8821AE_PS_LPS_PARA = 0x23,
13462306a36Sopenharmony_ci	H2C_8821AE_P2P_PS_OFFLOAD = 024,
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci	H2C_8821AE_WO_WLAN = 0x80,
13762306a36Sopenharmony_ci	H2C_8821AE_REMOTE_WAKE_CTRL = 0x81,
13862306a36Sopenharmony_ci	H2C_8821AE_AOAC_GLOBAL_INFO = 0x82,
13962306a36Sopenharmony_ci	H2C_8821AE_AOAC_RSVDPAGE = 0x83,
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci	H2C_RSSI_21AE_REPORT = 0x42,
14262306a36Sopenharmony_ci	H2C_8821AE_RA_MASK = 0x40,
14362306a36Sopenharmony_ci	H2C_8821AE_SELECTIVE_SUSPEND_ROF_CMD,
14462306a36Sopenharmony_ci	H2C_8821AE_P2P_PS_MODE,
14562306a36Sopenharmony_ci	H2C_8821AE_PSD_RESULT,
14662306a36Sopenharmony_ci	/*Not defined CTW CMD for P2P yet*/
14762306a36Sopenharmony_ci	H2C_8821AE_P2P_PS_CTW_CMD,
14862306a36Sopenharmony_ci	MAX_8821AE_H2CCMD
14962306a36Sopenharmony_ci};
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci#define pagenum_128(_len)	(u32)(((_len)>>7) + ((_len)&0x7F ? 1 : 0))
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_FUNC_ENABLE(__cmd, __value)		\
15462306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(0))
15562306a36Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(__cmd, __value)	\
15662306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(1))
15762306a36Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_MAGIC_PKT_ENABLE(__cmd, __value)	\
15862306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(2))
15962306a36Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(__cmd, __value)	\
16062306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(3))
16162306a36Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_ALL_PKT_DROP(__cmd, __value)		\
16262306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(4))
16362306a36Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_GPIO_ACTIVE(__cmd, __value)		\
16462306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(5))
16562306a36Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_REKEY_WAKE_UP(__cmd, __value)	\
16662306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(6))
16762306a36Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(__cmd, __value)	\
16862306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(7))
16962306a36Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_GPIONUM(__cmd, __value)		\
17062306a36Sopenharmony_ci	*(u8 *)(__cmd + 1) = __value
17162306a36Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_GPIO_DURATION(__cmd, __value)	\
17262306a36Sopenharmony_ci	*(u8 *)(__cmd + 2) = __value
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val)			\
17562306a36Sopenharmony_ci	*(u8 *)__ph2ccmd = __val
17662306a36Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_RLBM(__cmd, __value)		\
17762306a36Sopenharmony_ci	u8p_replace_bits(__cmd + 1, __value, GENMASK(3, 0))
17862306a36Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__cmd, __value)	\
17962306a36Sopenharmony_ci	u8p_replace_bits(__cmd + 1, __value, GENMASK(7, 4))
18062306a36Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_AWAKE_INTERVAL(__cmd, __value)	\
18162306a36Sopenharmony_ci	*(u8 *)(__cmd + 2) = __value
18262306a36Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(__cmd, __value)		\
18362306a36Sopenharmony_ci	*(u8 *)(__cmd + 3) = __value
18462306a36Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_PWR_STATE(__cmd, __value)	\
18562306a36Sopenharmony_ci	*(u8 *)(__cmd + 4) = __value
18662306a36Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_BYTE5(__cmd, __value)		\
18762306a36Sopenharmony_ci	*(u8 *)(__cmd + 5) = __value
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci#define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val)		\
19062306a36Sopenharmony_ci	*(u8 *)(__ph2ccmd + 1) = __val
19162306a36Sopenharmony_ci#define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val)		\
19262306a36Sopenharmony_ci	*(u8 *)(__ph2ccmd + 2) = __val
19362306a36Sopenharmony_ci#define SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(__ph2ccmd, __val)		\
19462306a36Sopenharmony_ci	*(u8 *)(__ph2ccmd + 3) = __val
19562306a36Sopenharmony_ci#define SET_H2CCMD_RSVDPAGE_LOC_BT_QOS_NULL_DATA(__ph2ccmd, __val)	\
19662306a36Sopenharmony_ci	*(u8 *)(__ph2ccmd + 4) = __val
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ci/* _MEDIA_STATUS_RPT_PARM_CMD1 */
19962306a36Sopenharmony_ci#define SET_H2CCMD_MSRRPT_PARM_OPMODE(__cmd, __value)	\
20062306a36Sopenharmony_ci	u8p_replace_bits(__cmd + 1, __value, BIT(0))
20162306a36Sopenharmony_ci#define SET_H2CCMD_MSRRPT_PARM_MACID_IND(__cmd, __value)	\
20262306a36Sopenharmony_ci	u8p_replace_bits(__cmd + 1, __value, BIT(1))
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci/* AP_OFFLOAD */
20562306a36Sopenharmony_ci#define SET_H2CCMD_AP_OFFLOAD_ON(__cmd, __value)	\
20662306a36Sopenharmony_ci	*(u8 *)__cmd = __value
20762306a36Sopenharmony_ci#define SET_H2CCMD_AP_OFFLOAD_HIDDEN(__cmd, __value)	\
20862306a36Sopenharmony_ci	*(u8 *)(__cmd + 1) = __value
20962306a36Sopenharmony_ci#define SET_H2CCMD_AP_OFFLOAD_DENYANY(__cmd, __value)	\
21062306a36Sopenharmony_ci	*(u8 *)(__cmd + 2) = __value
21162306a36Sopenharmony_ci#define SET_H2CCMD_AP_OFFLOAD_WAKEUP_EVT_RPT(__cmd, __value) \
21262306a36Sopenharmony_ci	*(u8 *)(__cmd + 3) = __value
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci/* Keep Alive Control*/
21562306a36Sopenharmony_ci#define SET_8812_H2CCMD_KEEP_ALIVE_ENABLE(__cmd, __value)	\
21662306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(0))
21762306a36Sopenharmony_ci#define SET_8812_H2CCMD_KEEP_ALIVE_ACCPEPT_USER_DEFINED(__cmd, __value)	\
21862306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(1))
21962306a36Sopenharmony_ci#define SET_8812_H2CCMD_KEEP_ALIVE_PERIOD(__cmd, __value)	\
22062306a36Sopenharmony_ci	*(u8 *)(__cmd + 1) = __value
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci/*REMOTE_WAKE_CTRL */
22362306a36Sopenharmony_ci#define SET_8812_H2CCMD_REMOTE_WAKECTRL_ENABLE(__cmd, __value)	\
22462306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(0))
22562306a36Sopenharmony_ci#define SET_8812_H2CCMD_REMOTE_WAKE_CTRL_ARP_OFFLOAD_EN(__cmd, __value)\
22662306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(1))
22762306a36Sopenharmony_ci#define SET_8812_H2CCMD_REMOTE_WAKE_CTRL_NDP_OFFLOAD_EN(__cmd, __value)\
22862306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(2))
22962306a36Sopenharmony_ci#define SET_8812_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(__cmd, __value)\
23062306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(3))
23162306a36Sopenharmony_ci#define SET_8812_H2CCMD_REMOTE_WAKE_CTRL_REALWOWV2_EN(__cmd, __value)\
23262306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(6))
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ci/* GTK_OFFLOAD */
23562306a36Sopenharmony_ci#define SET_8812_H2CCMD_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(__cmd, __value)\
23662306a36Sopenharmony_ci	*(u8 *)__cmd = __value
23762306a36Sopenharmony_ci#define SET_8812_H2CCMD_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(__cmd, __value)	\
23862306a36Sopenharmony_ci	*(u8 *)(__cmd + 1) = __value
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci/* AOAC_RSVDPAGE_LOC */
24162306a36Sopenharmony_ci#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(__cmd, __value)	\
24262306a36Sopenharmony_ci	*(u8 *)__cmd = __value
24362306a36Sopenharmony_ci#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(__cmd, __value)	\
24462306a36Sopenharmony_ci	*(u8 *)(__cmd + 1) = __value
24562306a36Sopenharmony_ci#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(__cmd, __value)\
24662306a36Sopenharmony_ci	*(u8 *)(__cmd + 2) = __value
24762306a36Sopenharmony_ci#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(__cmd, __value)	\
24862306a36Sopenharmony_ci	*(u8 *)(__cmd + 3) = __value
24962306a36Sopenharmony_ci#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(__cmd, __value)	\
25062306a36Sopenharmony_ci	*(u8 *)(__cmd + 4) = __value
25162306a36Sopenharmony_ci#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(__cmd, __value)	\
25262306a36Sopenharmony_ci	*(u8 *)(__cmd + 5) = __value
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ci/* Disconnect_Decision_Control */
25562306a36Sopenharmony_ci#define SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_ENABLE(__cmd, __value)	\
25662306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(0))
25762306a36Sopenharmony_ci#define SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_USER_SETTING(__cmd, __value)\
25862306a36Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(1))
25962306a36Sopenharmony_ci#define SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_CHECK_PERIOD(__cmd, __value)\
26062306a36Sopenharmony_ci	*(u8 *)(__cmd + 1) = __value
26162306a36Sopenharmony_ci#define SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_TRYPKT_NUM(__cmd, __value)\
26262306a36Sopenharmony_ci	*(u8 *)(__cmd + 2) = __value
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ciint rtl8821ae_download_fw(struct ieee80211_hw *hw, bool buse_wake_on_wlan_fw);
26562306a36Sopenharmony_ci#if (USE_SPECIFIC_FW_TO_SUPPORT_WOWLAN == 1)
26662306a36Sopenharmony_civoid rtl8821ae_set_fw_related_for_wowlan(struct ieee80211_hw *hw,
26762306a36Sopenharmony_ci					 bool used_wowlan_fw);
26862306a36Sopenharmony_ci
26962306a36Sopenharmony_ci#endif
27062306a36Sopenharmony_civoid rtl8821ae_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id,
27162306a36Sopenharmony_ci			    u32 cmd_len, u8 *cmdbuffer);
27262306a36Sopenharmony_civoid rtl8821ae_firmware_selfreset(struct ieee80211_hw *hw);
27362306a36Sopenharmony_civoid rtl8821ae_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
27462306a36Sopenharmony_civoid rtl8821ae_set_fw_media_status_rpt_cmd(struct ieee80211_hw *hw,
27562306a36Sopenharmony_ci					   u8 mstatus);
27662306a36Sopenharmony_civoid rtl8821ae_set_fw_ap_off_load_cmd(struct ieee80211_hw *hw,
27762306a36Sopenharmony_ci				      u8 ap_offload_enable);
27862306a36Sopenharmony_civoid rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
27962306a36Sopenharmony_ci				  bool b_dl_finished, bool dl_whole_packet);
28062306a36Sopenharmony_civoid rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
28162306a36Sopenharmony_ci				  bool b_dl_finished, bool dl_whole_packet);
28262306a36Sopenharmony_civoid rtl8821ae_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw,
28362306a36Sopenharmony_ci				      u8 p2p_ps_state);
28462306a36Sopenharmony_civoid rtl8821ae_set_fw_wowlan_mode(struct ieee80211_hw *hw, bool func_en);
28562306a36Sopenharmony_civoid rtl8821ae_set_fw_remote_wake_ctrl_cmd(struct ieee80211_hw *hw,
28662306a36Sopenharmony_ci					   u8 enable);
28762306a36Sopenharmony_civoid rtl8821ae_set_fw_keep_alive_cmd(struct ieee80211_hw *hw, bool func_en);
28862306a36Sopenharmony_civoid rtl8821ae_set_fw_disconnect_decision_ctrl_cmd(struct ieee80211_hw *hw,
28962306a36Sopenharmony_ci						   bool enabled);
29062306a36Sopenharmony_civoid rtl8821ae_set_fw_global_info_cmd(struct ieee80211_hw *hw);
29162306a36Sopenharmony_civoid rtl8821ae_c2h_ra_report_handler(struct ieee80211_hw *hw,
29262306a36Sopenharmony_ci				     u8 *cmd_buf, u8 cmd_len);
29362306a36Sopenharmony_ci#endif
294