18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright(c) 2009-2010  Realtek Corporation.*/
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef __RTL8821AE__FW__H__
58c2ecf20Sopenharmony_ci#define __RTL8821AE__FW__H__
68c2ecf20Sopenharmony_ci#include "def.h"
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#define FW_8821AE_SIZE					0x8000
98c2ecf20Sopenharmony_ci#define FW_8821AE_START_ADDRESS			0x1000
108c2ecf20Sopenharmony_ci#define FW_8821AE_END_ADDRESS			0x5FFF
118c2ecf20Sopenharmony_ci#define FW_8821AE_PAGE_SIZE				4096
128c2ecf20Sopenharmony_ci#define FW_8821AE_POLLING_DELAY			5
138c2ecf20Sopenharmony_ci#define FW_8821AE_POLLING_TIMEOUT_COUNT	6000
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define IS_FW_HEADER_EXIST_8812(_pfwhdr)	\
168c2ecf20Sopenharmony_ci	((le16_to_cpu(_pfwhdr->signature) & 0xFFF0) == 0x9500)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define IS_FW_HEADER_EXIST_8821(_pfwhdr)	\
198c2ecf20Sopenharmony_ci	((le16_to_cpu(_pfwhdr->signature) & 0xFFF0) == 0x2100)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define USE_OLD_WOWLAN_DEBUG_FW 0
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define H2C_8821AE_RSVDPAGE_LOC_LEN		5
248c2ecf20Sopenharmony_ci#define H2C_8821AE_PWEMODE_LENGTH			7
258c2ecf20Sopenharmony_ci#define H2C_8821AE_JOINBSSRPT_LENGTH		1
268c2ecf20Sopenharmony_ci#define H2C_8821AE_AP_OFFLOAD_LENGTH		3
278c2ecf20Sopenharmony_ci#define H2C_8821AE_WOWLAN_LENGTH			3
288c2ecf20Sopenharmony_ci#define H2C_8821AE_KEEP_ALIVE_CTRL_LENGTH	3
298c2ecf20Sopenharmony_ci#if (USE_OLD_WOWLAN_DEBUG_FW == 0)
308c2ecf20Sopenharmony_ci#define H2C_8821AE_REMOTE_WAKE_CTRL_LEN	1
318c2ecf20Sopenharmony_ci#else
328c2ecf20Sopenharmony_ci#define H2C_8821AE_REMOTE_WAKE_CTRL_LEN	3
338c2ecf20Sopenharmony_ci#endif
348c2ecf20Sopenharmony_ci#define H2C_8821AE_AOAC_GLOBAL_INFO_LEN	2
358c2ecf20Sopenharmony_ci#define H2C_8821AE_AOAC_RSVDPAGE_LOC_LEN	7
368c2ecf20Sopenharmony_ci#define H2C_8821AE_DISCONNECT_DECISION_CTRL_LEN	3
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/* Fw PS state for RPWM.
398c2ecf20Sopenharmony_ci*BIT[2:0] = HW state
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci*BIT[3] = Protocol PS state,
428c2ecf20Sopenharmony_ci1: register active state ,
438c2ecf20Sopenharmony_ci0: register sleep state
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci*BIT[4] = sub-state
468c2ecf20Sopenharmony_ci*/
478c2ecf20Sopenharmony_ci#define	FW_PS_GO_ON			BIT(0)
488c2ecf20Sopenharmony_ci#define	FW_PS_TX_NULL			BIT(1)
498c2ecf20Sopenharmony_ci#define	FW_PS_RF_ON			BIT(2)
508c2ecf20Sopenharmony_ci#define	FW_PS_REGISTER_ACTIVE	BIT(3)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define	FW_PS_DPS		BIT(0)
538c2ecf20Sopenharmony_ci#define	FW_PS_LCLK		(FW_PS_DPS)
548c2ecf20Sopenharmony_ci#define	FW_PS_RF_OFF		BIT(1)
558c2ecf20Sopenharmony_ci#define	FW_PS_ALL_ON		BIT(2)
568c2ecf20Sopenharmony_ci#define	FW_PS_ST_ACTIVE		BIT(3)
578c2ecf20Sopenharmony_ci#define	FW_PS_ISR_ENABLE	BIT(4)
588c2ecf20Sopenharmony_ci#define	FW_PS_IMR_ENABLE	BIT(5)
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define	FW_PS_ACK		BIT(6)
618c2ecf20Sopenharmony_ci#define	FW_PS_TOGGLE		BIT(7)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci /* 8821AE RPWM value*/
648c2ecf20Sopenharmony_ci /* BIT[0] = 1: 32k, 0: 40M*/
658c2ecf20Sopenharmony_ci /* 32k*/
668c2ecf20Sopenharmony_ci#define	FW_PS_CLOCK_OFF		BIT(0)
678c2ecf20Sopenharmony_ci/*40M*/
688c2ecf20Sopenharmony_ci#define	FW_PS_CLOCK_ON		0
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#define	FW_PS_STATE_MASK		(0x0F)
718c2ecf20Sopenharmony_ci#define	FW_PS_STATE_HW_MASK	(0x07)
728c2ecf20Sopenharmony_ci/*ISR_ENABLE, IMR_ENABLE, and PS mode should be inherited.*/
738c2ecf20Sopenharmony_ci#define	FW_PS_STATE_INT_MASK	(0x3F)
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define	FW_PS_STATE(x)			(FW_PS_STATE_MASK & (x))
768c2ecf20Sopenharmony_ci#define	FW_PS_STATE_HW(x)		(FW_PS_STATE_HW_MASK & (x))
778c2ecf20Sopenharmony_ci#define	FW_PS_STATE_INT(x)	(FW_PS_STATE_INT_MASK & (x))
788c2ecf20Sopenharmony_ci#define	FW_PS_ISR_VAL(x)		((x) & 0x70)
798c2ecf20Sopenharmony_ci#define	FW_PS_IMR_MASK(x)	((x) & 0xDF)
808c2ecf20Sopenharmony_ci#define	FW_PS_KEEP_IMR(x)		((x) & 0x20)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define	FW_PS_STATE_S0		(FW_PS_DPS)
838c2ecf20Sopenharmony_ci#define	FW_PS_STATE_S1		(FW_PS_LCLK)
848c2ecf20Sopenharmony_ci#define	FW_PS_STATE_S2		(FW_PS_RF_OFF)
858c2ecf20Sopenharmony_ci#define	FW_PS_STATE_S3		(FW_PS_ALL_ON)
868c2ecf20Sopenharmony_ci#define	FW_PS_STATE_S4		((FW_PS_ST_ACTIVE) | (FW_PS_ALL_ON))
878c2ecf20Sopenharmony_ci /* ((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE))*/
888c2ecf20Sopenharmony_ci#define	FW_PS_STATE_ALL_ON_8821AE	(FW_PS_CLOCK_ON)
898c2ecf20Sopenharmony_ci /* (FW_PS_RF_ON)*/
908c2ecf20Sopenharmony_ci#define	FW_PS_STATE_RF_ON_8821AE	(FW_PS_CLOCK_ON)
918c2ecf20Sopenharmony_ci /* 0x0*/
928c2ecf20Sopenharmony_ci#define	FW_PS_STATE_RF_OFF_8821AE	(FW_PS_CLOCK_ON)
938c2ecf20Sopenharmony_ci /* (FW_PS_STATE_RF_OFF)*/
948c2ecf20Sopenharmony_ci#define	FW_PS_STATE_RF_OFF_LOW_PWR_8821AE	(FW_PS_CLOCK_OFF)
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci#define	FW_PS_STATE_ALL_ON_92C	(FW_PS_STATE_S4)
978c2ecf20Sopenharmony_ci#define	FW_PS_STATE_RF_ON_92C		(FW_PS_STATE_S3)
988c2ecf20Sopenharmony_ci#define	FW_PS_STATE_RF_OFF_92C	(FW_PS_STATE_S2)
998c2ecf20Sopenharmony_ci#define	FW_PS_STATE_RF_OFF_LOW_PWR_92C	(FW_PS_STATE_S1)
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci/* For 8821AE H2C PwrMode Cmd ID 5.*/
1028c2ecf20Sopenharmony_ci#define	FW_PWR_STATE_ACTIVE	((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE))
1038c2ecf20Sopenharmony_ci#define	FW_PWR_STATE_RF_OFF	0
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci#define	FW_PS_IS_ACK(x)		((x) & FW_PS_ACK)
1068c2ecf20Sopenharmony_ci#define	FW_PS_IS_CLK_ON(x)	((x) & (FW_PS_RF_OFF | FW_PS_ALL_ON))
1078c2ecf20Sopenharmony_ci#define	FW_PS_IS_RF_ON(x)	((x) & (FW_PS_ALL_ON))
1088c2ecf20Sopenharmony_ci#define	FW_PS_IS_ACTIVE(x)	((x) & (FW_PS_ST_ACTIVE))
1098c2ecf20Sopenharmony_ci#define	FW_PS_IS_CPWM_INT(x)	((x) & 0x40)
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci#define	FW_CLR_PS_STATE(x)	((x) = ((x) & (0xF0)))
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci#define	IS_IN_LOW_POWER_STATE_8821AE(__state)		\
1148c2ecf20Sopenharmony_ci			(FW_PS_STATE(__state) == FW_PS_CLOCK_OFF)
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci#define	FW_PWR_STATE_ACTIVE	((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE))
1178c2ecf20Sopenharmony_ci#define	FW_PWR_STATE_RF_OFF	0
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_cienum rtl8821a_h2c_cmd {
1208c2ecf20Sopenharmony_ci	H2C_8821AE_RSVDPAGE = 0,
1218c2ecf20Sopenharmony_ci	H2C_8821AE_MSRRPT = 1,
1228c2ecf20Sopenharmony_ci	H2C_8821AE_SCAN = 2,
1238c2ecf20Sopenharmony_ci	H2C_8821AE_KEEP_ALIVE_CTRL = 3,
1248c2ecf20Sopenharmony_ci	H2C_8821AE_DISCONNECT_DECISION = 4,
1258c2ecf20Sopenharmony_ci	H2C_8821AE_INIT_OFFLOAD = 6,
1268c2ecf20Sopenharmony_ci	H2C_8821AE_AP_OFFLOAD = 8,
1278c2ecf20Sopenharmony_ci	H2C_8821AE_BCN_RSVDPAGE = 9,
1288c2ecf20Sopenharmony_ci	H2C_8821AE_PROBERSP_RSVDPAGE = 10,
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci	H2C_8821AE_SETPWRMODE = 0x20,
1318c2ecf20Sopenharmony_ci	H2C_8821AE_PS_TUNING_PARA = 0x21,
1328c2ecf20Sopenharmony_ci	H2C_8821AE_PS_TUNING_PARA2 = 0x22,
1338c2ecf20Sopenharmony_ci	H2C_8821AE_PS_LPS_PARA = 0x23,
1348c2ecf20Sopenharmony_ci	H2C_8821AE_P2P_PS_OFFLOAD = 024,
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci	H2C_8821AE_WO_WLAN = 0x80,
1378c2ecf20Sopenharmony_ci	H2C_8821AE_REMOTE_WAKE_CTRL = 0x81,
1388c2ecf20Sopenharmony_ci	H2C_8821AE_AOAC_GLOBAL_INFO = 0x82,
1398c2ecf20Sopenharmony_ci	H2C_8821AE_AOAC_RSVDPAGE = 0x83,
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci	H2C_RSSI_21AE_REPORT = 0x42,
1428c2ecf20Sopenharmony_ci	H2C_8821AE_RA_MASK = 0x40,
1438c2ecf20Sopenharmony_ci	H2C_8821AE_SELECTIVE_SUSPEND_ROF_CMD,
1448c2ecf20Sopenharmony_ci	H2C_8821AE_P2P_PS_MODE,
1458c2ecf20Sopenharmony_ci	H2C_8821AE_PSD_RESULT,
1468c2ecf20Sopenharmony_ci	/*Not defined CTW CMD for P2P yet*/
1478c2ecf20Sopenharmony_ci	H2C_8821AE_P2P_PS_CTW_CMD,
1488c2ecf20Sopenharmony_ci	MAX_8821AE_H2CCMD
1498c2ecf20Sopenharmony_ci};
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci#define pagenum_128(_len)	(u32)(((_len)>>7) + ((_len)&0x7F ? 1 : 0))
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_FUNC_ENABLE(__cmd, __value)		\
1548c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(0))
1558c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(__cmd, __value)	\
1568c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(1))
1578c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_MAGIC_PKT_ENABLE(__cmd, __value)	\
1588c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(2))
1598c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(__cmd, __value)	\
1608c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(3))
1618c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_ALL_PKT_DROP(__cmd, __value)		\
1628c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(4))
1638c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_GPIO_ACTIVE(__cmd, __value)		\
1648c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(5))
1658c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_REKEY_WAKE_UP(__cmd, __value)	\
1668c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(6))
1678c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(__cmd, __value)	\
1688c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(7))
1698c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_GPIONUM(__cmd, __value)		\
1708c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 1) = __value
1718c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_WOWLAN_GPIO_DURATION(__cmd, __value)	\
1728c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 2) = __value
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val)			\
1758c2ecf20Sopenharmony_ci	*(u8 *)__ph2ccmd = __val
1768c2ecf20Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_RLBM(__cmd, __value)		\
1778c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd + 1, __value, GENMASK(3, 0))
1788c2ecf20Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__cmd, __value)	\
1798c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd + 1, __value, GENMASK(7, 4))
1808c2ecf20Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_AWAKE_INTERVAL(__cmd, __value)	\
1818c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 2) = __value
1828c2ecf20Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(__cmd, __value)		\
1838c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 3) = __value
1848c2ecf20Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_PWR_STATE(__cmd, __value)	\
1858c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 4) = __value
1868c2ecf20Sopenharmony_ci#define SET_H2CCMD_PWRMODE_PARM_BYTE5(__cmd, __value)		\
1878c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 5) = __value
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci#define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val)		\
1908c2ecf20Sopenharmony_ci	*(u8 *)(__ph2ccmd + 1) = __val
1918c2ecf20Sopenharmony_ci#define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val)		\
1928c2ecf20Sopenharmony_ci	*(u8 *)(__ph2ccmd + 2) = __val
1938c2ecf20Sopenharmony_ci#define SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(__ph2ccmd, __val)		\
1948c2ecf20Sopenharmony_ci	*(u8 *)(__ph2ccmd + 3) = __val
1958c2ecf20Sopenharmony_ci#define SET_H2CCMD_RSVDPAGE_LOC_BT_QOS_NULL_DATA(__ph2ccmd, __val)	\
1968c2ecf20Sopenharmony_ci	*(u8 *)(__ph2ccmd + 4) = __val
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci/* _MEDIA_STATUS_RPT_PARM_CMD1 */
1998c2ecf20Sopenharmony_ci#define SET_H2CCMD_MSRRPT_PARM_OPMODE(__cmd, __value)	\
2008c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd + 1, __value, BIT(0))
2018c2ecf20Sopenharmony_ci#define SET_H2CCMD_MSRRPT_PARM_MACID_IND(__cmd, __value)	\
2028c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd + 1, __value, BIT(1))
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/* AP_OFFLOAD */
2058c2ecf20Sopenharmony_ci#define SET_H2CCMD_AP_OFFLOAD_ON(__cmd, __value)	\
2068c2ecf20Sopenharmony_ci	*(u8 *)__cmd = __value
2078c2ecf20Sopenharmony_ci#define SET_H2CCMD_AP_OFFLOAD_HIDDEN(__cmd, __value)	\
2088c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 1) = __value
2098c2ecf20Sopenharmony_ci#define SET_H2CCMD_AP_OFFLOAD_DENYANY(__cmd, __value)	\
2108c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 2) = __value
2118c2ecf20Sopenharmony_ci#define SET_H2CCMD_AP_OFFLOAD_WAKEUP_EVT_RPT(__cmd, __value) \
2128c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 3) = __value
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci/* Keep Alive Control*/
2158c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_KEEP_ALIVE_ENABLE(__cmd, __value)	\
2168c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(0))
2178c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_KEEP_ALIVE_ACCPEPT_USER_DEFINED(__cmd, __value)	\
2188c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(1))
2198c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_KEEP_ALIVE_PERIOD(__cmd, __value)	\
2208c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 1) = __value
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci/*REMOTE_WAKE_CTRL */
2238c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_REMOTE_WAKECTRL_ENABLE(__cmd, __value)	\
2248c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(0))
2258c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_REMOTE_WAKE_CTRL_ARP_OFFLOAD_EN(__cmd, __value)\
2268c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(1))
2278c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_REMOTE_WAKE_CTRL_NDP_OFFLOAD_EN(__cmd, __value)\
2288c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(2))
2298c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(__cmd, __value)\
2308c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(3))
2318c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_REMOTE_WAKE_CTRL_REALWOWV2_EN(__cmd, __value)\
2328c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(6))
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci/* GTK_OFFLOAD */
2358c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(__cmd, __value)\
2368c2ecf20Sopenharmony_ci	*(u8 *)__cmd = __value
2378c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(__cmd, __value)	\
2388c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 1) = __value
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci/* AOAC_RSVDPAGE_LOC */
2418c2ecf20Sopenharmony_ci#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(__cmd, __value)	\
2428c2ecf20Sopenharmony_ci	*(u8 *)__cmd = __value
2438c2ecf20Sopenharmony_ci#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(__cmd, __value)	\
2448c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 1) = __value
2458c2ecf20Sopenharmony_ci#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(__cmd, __value)\
2468c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 2) = __value
2478c2ecf20Sopenharmony_ci#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(__cmd, __value)	\
2488c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 3) = __value
2498c2ecf20Sopenharmony_ci#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(__cmd, __value)	\
2508c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 4) = __value
2518c2ecf20Sopenharmony_ci#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(__cmd, __value)	\
2528c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 5) = __value
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci/* Disconnect_Decision_Control */
2558c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_ENABLE(__cmd, __value)	\
2568c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(0))
2578c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_USER_SETTING(__cmd, __value)\
2588c2ecf20Sopenharmony_ci	u8p_replace_bits(__cmd, __value, BIT(1))
2598c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_CHECK_PERIOD(__cmd, __value)\
2608c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 1) = __value
2618c2ecf20Sopenharmony_ci#define SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_TRYPKT_NUM(__cmd, __value)\
2628c2ecf20Sopenharmony_ci	*(u8 *)(__cmd + 2) = __value
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ciint rtl8821ae_download_fw(struct ieee80211_hw *hw, bool buse_wake_on_wlan_fw);
2658c2ecf20Sopenharmony_ci#if (USE_SPECIFIC_FW_TO_SUPPORT_WOWLAN == 1)
2668c2ecf20Sopenharmony_civoid rtl8821ae_set_fw_related_for_wowlan(struct ieee80211_hw *hw,
2678c2ecf20Sopenharmony_ci					 bool used_wowlan_fw);
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci#endif
2708c2ecf20Sopenharmony_civoid rtl8821ae_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id,
2718c2ecf20Sopenharmony_ci			    u32 cmd_len, u8 *cmdbuffer);
2728c2ecf20Sopenharmony_civoid rtl8821ae_firmware_selfreset(struct ieee80211_hw *hw);
2738c2ecf20Sopenharmony_civoid rtl8821ae_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
2748c2ecf20Sopenharmony_civoid rtl8821ae_set_fw_media_status_rpt_cmd(struct ieee80211_hw *hw,
2758c2ecf20Sopenharmony_ci					   u8 mstatus);
2768c2ecf20Sopenharmony_civoid rtl8821ae_set_fw_ap_off_load_cmd(struct ieee80211_hw *hw,
2778c2ecf20Sopenharmony_ci				      u8 ap_offload_enable);
2788c2ecf20Sopenharmony_civoid rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
2798c2ecf20Sopenharmony_ci				  bool b_dl_finished, bool dl_whole_packet);
2808c2ecf20Sopenharmony_civoid rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
2818c2ecf20Sopenharmony_ci				  bool b_dl_finished, bool dl_whole_packet);
2828c2ecf20Sopenharmony_civoid rtl8821ae_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw,
2838c2ecf20Sopenharmony_ci				      u8 p2p_ps_state);
2848c2ecf20Sopenharmony_civoid rtl8821ae_set_fw_wowlan_mode(struct ieee80211_hw *hw, bool func_en);
2858c2ecf20Sopenharmony_civoid rtl8821ae_set_fw_remote_wake_ctrl_cmd(struct ieee80211_hw *hw,
2868c2ecf20Sopenharmony_ci					   u8 enable);
2878c2ecf20Sopenharmony_civoid rtl8821ae_set_fw_keep_alive_cmd(struct ieee80211_hw *hw, bool func_en);
2888c2ecf20Sopenharmony_civoid rtl8821ae_set_fw_disconnect_decision_ctrl_cmd(struct ieee80211_hw *hw,
2898c2ecf20Sopenharmony_ci						   bool enabled);
2908c2ecf20Sopenharmony_civoid rtl8821ae_set_fw_global_info_cmd(struct ieee80211_hw *hw);
2918c2ecf20Sopenharmony_civoid rtl8821ae_c2h_ra_report_handler(struct ieee80211_hw *hw,
2928c2ecf20Sopenharmony_ci				     u8 *cmd_buf, u8 cmd_len);
2938c2ecf20Sopenharmony_ci#endif
294