xref: /linux/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c (revision e5c86679d5e864947a52fb31e45a425dea3e7fa9)
1 /******************************************************************************
2  *
3  * Copyright(c) 2009-2010  Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  * wlanfae <wlanfae@realtek.com>
19  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20  * Hsinchu 300, Taiwan.
21  *
22  * Larry Finger <Larry.Finger@lwfinger.net>
23  *
24  *****************************************************************************/
25 
26 #include "../wifi.h"
27 #include "../pci.h"
28 #include "../base.h"
29 #include "../core.h"
30 #include "../efuse.h"
31 #include "reg.h"
32 #include "def.h"
33 #include "fw.h"
34 #include "dm.h"
35 
36 static void _rtl8821ae_enable_fw_download(struct ieee80211_hw *hw, bool enable)
37 {
38 	struct rtl_priv *rtlpriv = rtl_priv(hw);
39 	u8 tmp;
40 
41 	if (enable) {
42 		rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x05);
43 
44 		tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL + 2);
45 		rtl_write_byte(rtlpriv, REG_MCUFWDL + 2, tmp & 0xf7);
46 
47 		tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL);
48 	} else {
49 		tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL);
50 		rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp & 0xfe);
51 		tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL);
52 	}
53 }
54 
55 static void _rtl8821ae_write_fw(struct ieee80211_hw *hw,
56 				enum version_8821ae version,
57 				u8 *buffer, u32 size)
58 {
59 	struct rtl_priv *rtlpriv = rtl_priv(hw);
60 	u8 *bufferptr = (u8 *)buffer;
61 	u32 pagenums, remainsize;
62 	u32 page, offset;
63 
64 	RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "FW size is %d bytes,\n", size);
65 
66 	rtl_fill_dummy(bufferptr, &size);
67 
68 	pagenums = size / FW_8821AE_PAGE_SIZE;
69 	remainsize = size % FW_8821AE_PAGE_SIZE;
70 
71 	if (pagenums > 8)
72 		pr_err("Page numbers should not greater then 8\n");
73 
74 	for (page = 0; page < pagenums; page++) {
75 		offset = page * FW_8821AE_PAGE_SIZE;
76 		rtl_fw_page_write(hw, page, (bufferptr + offset),
77 				  FW_8821AE_PAGE_SIZE);
78 	}
79 
80 	if (remainsize) {
81 		offset = pagenums * FW_8821AE_PAGE_SIZE;
82 		page = pagenums;
83 		rtl_fw_page_write(hw, page, (bufferptr + offset), remainsize);
84 	}
85 }
86 
87 static int _rtl8821ae_fw_free_to_go(struct ieee80211_hw *hw)
88 {
89 	struct rtl_priv *rtlpriv = rtl_priv(hw);
90 	int err = -EIO;
91 	u32 counter = 0;
92 	u32 value32;
93 
94 	do {
95 		value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
96 	} while ((counter++ < FW_8821AE_POLLING_TIMEOUT_COUNT) &&
97 		 (!(value32 & FWDL_CHKSUM_RPT)));
98 
99 	if (counter >= FW_8821AE_POLLING_TIMEOUT_COUNT) {
100 		RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
101 			 "chksum report faill ! REG_MCUFWDL:0x%08x .\n",
102 			  value32);
103 		goto exit;
104 	}
105 	value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
106 	value32 |= MCUFWDL_RDY;
107 	value32 &= ~WINTINI_RDY;
108 	rtl_write_dword(rtlpriv, REG_MCUFWDL, value32);
109 
110 	rtl8821ae_firmware_selfreset(hw);
111 
112 	counter = 0;
113 	do {
114 		value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
115 		if (value32 & WINTINI_RDY)
116 			return 0;
117 
118 		udelay(FW_8821AE_POLLING_DELAY);
119 	} while (counter++ < FW_8821AE_POLLING_TIMEOUT_COUNT);
120 
121 	pr_err("Polling FW ready fail!! REG_MCUFWDL:0x%08x .\n",
122 	       value32);
123 
124 exit:
125 	return err;
126 }
127 
128 static void _rtl8821ae_wait_for_h2c_cmd_finish(struct rtl_priv *rtlpriv)
129 {
130 	u8 val;
131 	u16 count = 0;
132 
133 	do {
134 		val = rtl_read_byte(rtlpriv, REG_HMETFR);
135 		mdelay(1);
136 		count++;
137 	} while ((val & 0x0F) && (count < 1000));
138 }
139 
140 int rtl8821ae_download_fw(struct ieee80211_hw *hw, bool buse_wake_on_wlan_fw)
141 {
142 	struct rtl_priv *rtlpriv = rtl_priv(hw);
143 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
144 	struct rtlwifi_firmware_header *pfwheader;
145 	u8 *pfwdata;
146 	u32 fwsize;
147 	int err;
148 	bool support_remote_wakeup;
149 	enum version_8821ae version = rtlhal->version;
150 
151 	rtlpriv->cfg->ops->get_hw_reg(hw, HAL_DEF_WOWLAN,
152 				      (u8 *)(&support_remote_wakeup));
153 
154 	if (support_remote_wakeup)
155 		_rtl8821ae_wait_for_h2c_cmd_finish(rtlpriv);
156 
157 	if (buse_wake_on_wlan_fw) {
158 		if (!rtlhal->wowlan_firmware)
159 			return 1;
160 
161 		pfwheader =
162 		  (struct rtlwifi_firmware_header *)rtlhal->wowlan_firmware;
163 		rtlhal->fw_version = le16_to_cpu(pfwheader->version);
164 		rtlhal->fw_subversion = pfwheader->subversion;
165 		pfwdata = (u8 *)rtlhal->wowlan_firmware;
166 		fwsize = rtlhal->wowlan_fwsize;
167 	} else {
168 		if (!rtlhal->pfirmware)
169 			return 1;
170 
171 		pfwheader =
172 		  (struct rtlwifi_firmware_header *)rtlhal->pfirmware;
173 		rtlhal->fw_version = le16_to_cpu(pfwheader->version);
174 		rtlhal->fw_subversion = pfwheader->subversion;
175 		pfwdata = (u8 *)rtlhal->pfirmware;
176 		fwsize = rtlhal->fwsize;
177 	}
178 
179 	RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
180 		 "%s Firmware SIZE %d\n",
181 		 buse_wake_on_wlan_fw ? "Wowlan" : "Normal", fwsize);
182 
183 	if (IS_FW_HEADER_EXIST_8812(pfwheader) ||
184 	    IS_FW_HEADER_EXIST_8821(pfwheader)) {
185 		RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
186 			 "Firmware Version(%d), Signature(%#x)\n",
187 			 pfwheader->version, pfwheader->signature);
188 
189 		pfwdata = pfwdata + sizeof(struct rtlwifi_firmware_header);
190 		fwsize = fwsize - sizeof(struct rtlwifi_firmware_header);
191 	}
192 
193 	if (rtlhal->mac_func_enable) {
194 		if (rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(7)) {
195 			rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00);
196 			rtl8821ae_firmware_selfreset(hw);
197 		}
198 	}
199 	_rtl8821ae_enable_fw_download(hw, true);
200 	_rtl8821ae_write_fw(hw, version, pfwdata, fwsize);
201 	_rtl8821ae_enable_fw_download(hw, false);
202 
203 	err = _rtl8821ae_fw_free_to_go(hw);
204 	if (err) {
205 		RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG,
206 			 "Firmware is not ready to run!\n");
207 	} else {
208 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD,
209 			 "Firmware is ready to run!\n");
210 	}
211 
212 	return 0;
213 }
214 
215 #if (USE_SPECIFIC_FW_TO_SUPPORT_WOWLAN == 1)
216 void rtl8821ae_set_fw_related_for_wowlan(struct ieee80211_hw *hw,
217 					 bool used_wowlan_fw)
218 {
219 	struct rtl_priv *rtlpriv = rtl_priv(hw);
220 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
221 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
222 	/* 1. Before WoWLAN or After WOWLAN we need to re-download Fw. */
223 	if (rtl8821ae_download_fw(hw, used_wowlan_fw)) {
224 		RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
225 			 "Re-Download Firmware failed!!\n");
226 		rtlhal->fw_ready = false;
227 		return;
228 	}
229 	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
230 		 "Re-Download Firmware Success !!\n");
231 	rtlhal->fw_ready = true;
232 
233 	/* 2. Re-Init the variables about Fw related setting. */
234 	ppsc->fw_current_inpsmode = false;
235 	rtlhal->fw_ps_state = FW_PS_STATE_ALL_ON_8821AE;
236 	rtlhal->fw_clk_change_in_progress = false;
237 	rtlhal->allow_sw_to_change_hwclc = false;
238 	rtlhal->last_hmeboxnum = 0;
239 }
240 #endif
241 
242 static bool _rtl8821ae_check_fw_read_last_h2c(struct ieee80211_hw *hw,
243 					      u8 boxnum)
244 {
245 	struct rtl_priv *rtlpriv = rtl_priv(hw);
246 	u8 val_hmetfr;
247 	bool result = false;
248 
249 	val_hmetfr = rtl_read_byte(rtlpriv, REG_HMETFR);
250 	if (((val_hmetfr >> boxnum) & BIT(0)) == 0)
251 		result = true;
252 	return result;
253 }
254 
255 static void _rtl8821ae_fill_h2c_command(struct ieee80211_hw *hw,
256 					u8 element_id, u32 cmd_len,
257 					u8 *cmdbuffer)
258 {
259 	struct rtl_priv *rtlpriv = rtl_priv(hw);
260 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
261 	u8 boxnum = 0;
262 	u16 box_reg = 0, box_extreg = 0;
263 	u8 u1b_tmp = 0;
264 	bool isfw_read = false;
265 	u8 buf_index = 0;
266 	bool bwrite_sucess = false;
267 	u8 wait_h2c_limmit = 100;
268 	/*u8 wait_writeh2c_limmit = 100;*/
269 	u8 boxcontent[4], boxextcontent[4];
270 	u32 h2c_waitcounter = 0;
271 	unsigned long flag = 0;
272 	u8 idx = 0;
273 
274 	RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "come in\n");
275 
276 	while (true) {
277 		spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag);
278 		if (rtlhal->h2c_setinprogress) {
279 			RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
280 				 "H2C set in progress! Wait to set..element_id(%d).\n",
281 				 element_id);
282 
283 			while (rtlhal->h2c_setinprogress) {
284 				spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock,
285 						       flag);
286 				h2c_waitcounter++;
287 				RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
288 					 "Wait 100 us (%d times)...\n",
289 					  h2c_waitcounter);
290 				udelay(100);
291 
292 				if (h2c_waitcounter > 1000)
293 					return;
294 				spin_lock_irqsave(&rtlpriv->locks.h2c_lock,
295 						  flag);
296 			}
297 			spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag);
298 		} else {
299 			rtlhal->h2c_setinprogress = true;
300 			spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag);
301 			break;
302 		}
303 	}
304 
305 	while (!bwrite_sucess) {
306 		boxnum = rtlhal->last_hmeboxnum;
307 		switch (boxnum) {
308 		case 0:
309 			box_reg = REG_HMEBOX_0;
310 			box_extreg = REG_HMEBOX_EXT_0;
311 			break;
312 		case 1:
313 			box_reg = REG_HMEBOX_1;
314 			box_extreg = REG_HMEBOX_EXT_1;
315 			break;
316 		case 2:
317 			box_reg = REG_HMEBOX_2;
318 			box_extreg = REG_HMEBOX_EXT_2;
319 			break;
320 		case 3:
321 			box_reg = REG_HMEBOX_3;
322 			box_extreg = REG_HMEBOX_EXT_3;
323 			break;
324 		default:
325 			RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
326 				 "switch case %#x not processed\n", boxnum);
327 			break;
328 		}
329 
330 		isfw_read = false;
331 		u1b_tmp = rtl_read_byte(rtlpriv, REG_CR);
332 
333 		if (u1b_tmp != 0xEA) {
334 			isfw_read = true;
335 		} else {
336 			if (rtl_read_byte(rtlpriv, REG_TXDMA_STATUS) == 0xEA ||
337 			    rtl_read_byte(rtlpriv, REG_TXPKT_EMPTY) == 0xEA)
338 				rtl_write_byte(rtlpriv, REG_SYS_CFG1 + 3, 0xFF);
339 		}
340 
341 		if (isfw_read) {
342 			wait_h2c_limmit = 100;
343 			isfw_read =
344 			  _rtl8821ae_check_fw_read_last_h2c(hw, boxnum);
345 			while (!isfw_read) {
346 				/*wait until Fw read*/
347 				wait_h2c_limmit--;
348 				if (wait_h2c_limmit == 0) {
349 					RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
350 						 "Waiting too long for FW read clear HMEBox(%d)!\n",
351 						 boxnum);
352 					break;
353 				}
354 
355 				udelay(10);
356 
357 				isfw_read =
358 				  _rtl8821ae_check_fw_read_last_h2c(hw, boxnum);
359 				u1b_tmp = rtl_read_byte(rtlpriv, 0x130);
360 				RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
361 					 "Waiting for FW read clear HMEBox(%d)!!! 0x130 = %2x\n",
362 					 boxnum, u1b_tmp);
363 			}
364 		}
365 
366 		if (!isfw_read) {
367 			RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
368 				 "Write H2C register BOX[%d] fail!!!!! Fw do not read.\n",
369 				 boxnum);
370 			break;
371 		}
372 
373 		memset(boxcontent, 0, sizeof(boxcontent));
374 		memset(boxextcontent, 0, sizeof(boxextcontent));
375 		boxcontent[0] = element_id;
376 		RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
377 			 "Write element_id box_reg(%4x) = %2x\n",
378 			 box_reg, element_id);
379 
380 		switch (cmd_len) {
381 		case 1:
382 		case 2:
383 		case 3:
384 			/*boxcontent[0] &= ~(BIT(7));*/
385 			memcpy((u8 *)(boxcontent) + 1,
386 			       cmdbuffer + buf_index, cmd_len);
387 
388 			for (idx = 0; idx < 4; idx++) {
389 				rtl_write_byte(rtlpriv, box_reg + idx,
390 					       boxcontent[idx]);
391 			}
392 			break;
393 		case 4:
394 		case 5:
395 		case 6:
396 		case 7:
397 			/*boxcontent[0] |= (BIT(7));*/
398 			memcpy((u8 *)(boxextcontent),
399 			       cmdbuffer + buf_index+3, cmd_len-3);
400 			memcpy((u8 *)(boxcontent) + 1,
401 			       cmdbuffer + buf_index, 3);
402 
403 			for (idx = 0; idx < 4; idx++) {
404 				rtl_write_byte(rtlpriv, box_extreg + idx,
405 					       boxextcontent[idx]);
406 			}
407 
408 			for (idx = 0; idx < 4; idx++) {
409 				rtl_write_byte(rtlpriv, box_reg + idx,
410 					       boxcontent[idx]);
411 			}
412 			break;
413 		default:
414 			RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
415 				 "switch case %#x not processed\n", cmd_len);
416 			break;
417 		}
418 
419 		bwrite_sucess = true;
420 
421 		rtlhal->last_hmeboxnum = boxnum + 1;
422 		if (rtlhal->last_hmeboxnum == 4)
423 			rtlhal->last_hmeboxnum = 0;
424 
425 		RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
426 			 "pHalData->last_hmeboxnum  = %d\n",
427 			  rtlhal->last_hmeboxnum);
428 	}
429 
430 	spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag);
431 	rtlhal->h2c_setinprogress = false;
432 	spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag);
433 
434 	RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "go out\n");
435 }
436 
437 void rtl8821ae_fill_h2c_cmd(struct ieee80211_hw *hw,
438 			    u8 element_id, u32 cmd_len, u8 *cmdbuffer)
439 {
440 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
441 	u32 tmp_cmdbuf[2];
442 
443 	if (!rtlhal->fw_ready) {
444 		WARN_ONCE(true,
445 			  "rtl8821ae: error H2C cmd because of Fw download fail!!!\n");
446 		return;
447 	}
448 
449 	memset(tmp_cmdbuf, 0, 8);
450 	memcpy(tmp_cmdbuf, cmdbuffer, cmd_len);
451 	_rtl8821ae_fill_h2c_command(hw, element_id, cmd_len, (u8 *)&tmp_cmdbuf);
452 }
453 
454 void rtl8821ae_firmware_selfreset(struct ieee80211_hw *hw)
455 {
456 	struct rtl_priv *rtlpriv = rtl_priv(hw);
457 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
458 	u8 u1b_tmp;
459 
460 	if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) {
461 		u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1);
462 		rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp & (~BIT(3))));
463 	} else {
464 		u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1);
465 		rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp & (~BIT(0))));
466 	}
467 
468 	u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN+1);
469 	rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN+1, (u1b_tmp & (~BIT(2))));
470 	udelay(50);
471 
472 	if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) {
473 		u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1);
474 		rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp | BIT(3)));
475 	} else {
476 		u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1);
477 		rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp | BIT(0)));
478 	}
479 
480 	u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN+1);
481 	rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN+1, (u1b_tmp | BIT(2)));
482 
483 	RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
484 		 "_8051Reset8812ae(): 8051 reset success .\n");
485 }
486 
487 void rtl8821ae_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
488 {
489 	struct rtl_priv *rtlpriv = rtl_priv(hw);
490 	u8 u1_h2c_set_pwrmode[H2C_8821AE_PWEMODE_LENGTH] = { 0 };
491 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
492 	u8 rlbm, power_state = 0;
493 
494 	RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "FW LPS mode = %d\n", mode);
495 
496 	SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, ((mode) ? 1 : 0));
497 	rlbm = 0;/*YJ,temp,120316. FW now not support RLBM=2.*/
498 	SET_H2CCMD_PWRMODE_PARM_RLBM(u1_h2c_set_pwrmode, rlbm);
499 	SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode,
500 					 (rtlpriv->mac80211.p2p) ?
501 					 ppsc->smart_ps : 1);
502 	SET_H2CCMD_PWRMODE_PARM_AWAKE_INTERVAL(u1_h2c_set_pwrmode,
503 					       ppsc->reg_max_lps_awakeintvl);
504 	SET_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(u1_h2c_set_pwrmode, 0);
505 	if (mode == FW_PS_ACTIVE_MODE)
506 		power_state |= FW_PWR_STATE_ACTIVE;
507 	else
508 		power_state |= FW_PWR_STATE_RF_OFF;
509 
510 	SET_H2CCMD_PWRMODE_PARM_PWR_STATE(u1_h2c_set_pwrmode, power_state);
511 
512 	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
513 		      "rtl92c_set_fw_pwrmode(): u1_h2c_set_pwrmode\n",
514 		      u1_h2c_set_pwrmode, H2C_8821AE_PWEMODE_LENGTH);
515 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_SETPWRMODE,
516 			       H2C_8821AE_PWEMODE_LENGTH,
517 			       u1_h2c_set_pwrmode);
518 }
519 
520 void rtl8821ae_set_fw_media_status_rpt_cmd(struct ieee80211_hw *hw,
521 					   u8 mstatus)
522 {
523 	u8 parm[3] = { 0, 0, 0 };
524 	/* parm[0]: bit0=0-->Disconnect, bit0=1-->Connect
525 	 *          bit1=0-->update Media Status to MACID
526 	 *          bit1=1-->update Media Status from MACID to MACID_End
527 	 * parm[1]: MACID, if this is INFRA_STA, MacID = 0
528 	 * parm[2]: MACID_End
529 	 */
530 
531 	SET_H2CCMD_MSRRPT_PARM_OPMODE(parm, mstatus);
532 	SET_H2CCMD_MSRRPT_PARM_MACID_IND(parm, 0);
533 
534 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_MSRRPT, 3, parm);
535 }
536 
537 void rtl8821ae_set_fw_ap_off_load_cmd(struct ieee80211_hw *hw,
538 				      u8 ap_offload_enable)
539 {
540 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
541 	u8 u1_apoffload_parm[H2C_8821AE_AP_OFFLOAD_LENGTH] = { 0 };
542 
543 	SET_H2CCMD_AP_OFFLOAD_ON(u1_apoffload_parm, ap_offload_enable);
544 	SET_H2CCMD_AP_OFFLOAD_HIDDEN(u1_apoffload_parm, mac->hiddenssid);
545 	SET_H2CCMD_AP_OFFLOAD_DENYANY(u1_apoffload_parm, 0);
546 
547 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AP_OFFLOAD,
548 			       H2C_8821AE_AP_OFFLOAD_LENGTH,
549 			       u1_apoffload_parm);
550 }
551 
552 void rtl8821ae_set_fw_wowlan_mode(struct ieee80211_hw *hw, bool func_en)
553 {
554 	struct rtl_priv *rtlpriv = rtl_priv(hw);
555 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
556 	u8 fw_wowlan_info[H2C_8821AE_WOWLAN_LENGTH] = {0};
557 
558 	RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "enable(%d)\n", func_en);
559 
560 	SET_8812_H2CCMD_WOWLAN_FUNC_ENABLE(fw_wowlan_info,
561 					   (func_en ? true : false));
562 
563 	SET_8812_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(fw_wowlan_info,
564 		((ppsc->wo_wlan_mode & WAKE_ON_PATTERN_MATCH) ? 1 : 0));
565 	SET_8812_H2CCMD_WOWLAN_MAGIC_PKT_ENABLE(fw_wowlan_info,
566 		((ppsc->wo_wlan_mode & WAKE_ON_MAGIC_PACKET) ? 1 : 0));
567 
568 	SET_8812_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(fw_wowlan_info, 0);
569 	SET_8812_H2CCMD_WOWLAN_ALL_PKT_DROP(fw_wowlan_info, false);
570 	SET_8812_H2CCMD_WOWLAN_GPIO_ACTIVE(fw_wowlan_info, 0);
571 	SET_8812_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(fw_wowlan_info, 1);
572 	SET_8812_H2CCMD_WOWLAN_GPIONUM(fw_wowlan_info, 0);
573 	SET_8812_H2CCMD_WOWLAN_GPIO_DURATION(fw_wowlan_info, 0);
574 
575 	RT_PRINT_DATA(rtlpriv, COMP_POWER, DBG_DMESG,
576 		      "wowlan mode: cmd 0x80: Content:\n",
577 		      fw_wowlan_info, H2C_8821AE_WOWLAN_LENGTH);
578 
579 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_WO_WLAN,
580 			       H2C_8821AE_WOWLAN_LENGTH,
581 			       fw_wowlan_info);
582 }
583 
584 void rtl8821ae_set_fw_remote_wake_ctrl_cmd(struct ieee80211_hw *hw,
585 					   u8 enable)
586 {
587 	struct rtl_priv *rtlpriv = rtl_priv(hw);
588 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
589 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
590 	u8 remote_wake_ctrl_parm[H2C_8821AE_REMOTE_WAKE_CTRL_LEN] = {0};
591 
592 	RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
593 		 "enable=%d, ARP offload=%d, GTK offload=%d\n",
594 		 enable, ppsc->arp_offload_enable, ppsc->gtk_offload_enable);
595 
596 	SET_8812_H2CCMD_REMOTE_WAKECTRL_ENABLE(remote_wake_ctrl_parm, enable);
597 	SET_8812_H2CCMD_REMOTE_WAKE_CTRL_ARP_OFFLOAD_EN(remote_wake_ctrl_parm,
598 					(ppsc->arp_offload_enable ? 1 : 0));
599 	SET_8812_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(remote_wake_ctrl_parm,
600 					(ppsc->gtk_offload_enable ? 1 : 0));
601 	SET_8812_H2CCMD_REMOTE_WAKE_CTRL_REALWOWV2_EN(remote_wake_ctrl_parm,
602 					(rtlhal->real_wow_v2_enable ? 1 : 0));
603 
604 	RT_PRINT_DATA(rtlpriv, COMP_POWER, DBG_TRACE,
605 		      "remote_wake_ctrl: cmd 0x4: Content:\n",
606 		      remote_wake_ctrl_parm, H2C_8821AE_REMOTE_WAKE_CTRL_LEN);
607 
608 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_REMOTE_WAKE_CTRL,
609 			       H2C_8821AE_REMOTE_WAKE_CTRL_LEN,
610 			       remote_wake_ctrl_parm);
611 }
612 
613 void rtl8821ae_set_fw_keep_alive_cmd(struct ieee80211_hw *hw,
614 				     bool func_en)
615 {
616 	struct rtl_priv *rtlpriv = rtl_priv(hw);
617 	u8 keep_alive_info[H2C_8821AE_KEEP_ALIVE_CTRL_LENGTH] = {0};
618 
619 	RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "Enable(%d)\n", func_en);
620 
621 	SET_8812_H2CCMD_KEEP_ALIVE_ENABLE(keep_alive_info, func_en);
622 	/* 1: the period is controled by driver, 0: by Fw default */
623 	SET_8812_H2CCMD_KEEP_ALIVE_ACCPEPT_USER_DEFINED(keep_alive_info, 1);
624 	SET_8812_H2CCMD_KEEP_ALIVE_PERIOD(keep_alive_info, 10); /* 10 sec */
625 
626 	RT_PRINT_DATA(rtlpriv, COMP_POWER, DBG_TRACE,
627 		      "keep alive: cmd 0x3: Content:\n",
628 		      keep_alive_info, H2C_8821AE_KEEP_ALIVE_CTRL);
629 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_KEEP_ALIVE_CTRL,
630 			       H2C_8821AE_KEEP_ALIVE_CTRL_LENGTH,
631 			       keep_alive_info);
632 }
633 
634 void rtl8821ae_set_fw_disconnect_decision_ctrl_cmd(struct ieee80211_hw *hw,
635 						   bool enabled)
636 {
637 	struct rtl_priv *rtlpriv = rtl_priv(hw);
638 	u8 parm[H2C_8821AE_DISCONNECT_DECISION_CTRL_LEN] = {0};
639 
640 	SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_ENABLE(parm, enabled);
641 	SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_USER_SETTING(parm, 1);
642 	SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_CHECK_PERIOD(parm, 30);
643 	SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_TRYPKT_NUM(parm, 3);
644 
645 	RT_PRINT_DATA(rtlpriv, COMP_POWER, DBG_TRACE,
646 		      "disconnect_decision_ctrl: cmd 0x4: Content:\n",
647 		      parm, H2C_8821AE_DISCONNECT_DECISION_CTRL_LEN);
648 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_DISCONNECT_DECISION,
649 			       H2C_8821AE_DISCONNECT_DECISION_CTRL_LEN, parm);
650 }
651 
652 void rtl8821ae_set_fw_global_info_cmd(struct ieee80211_hw *hw)
653 {
654 	struct rtl_priv *rtlpriv = rtl_priv(hw);
655 	struct rtl_security *sec = &rtlpriv->sec;
656 	u8 remote_wakeup_sec_info[H2C_8821AE_AOAC_GLOBAL_INFO_LEN] = {0};
657 
658 	RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
659 		 "PairwiseEncAlgorithm=%d, GroupEncAlgorithm=%d\n",
660 		 sec->pairwise_enc_algorithm, sec->group_enc_algorithm);
661 
662 	SET_8812_H2CCMD_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(
663 						remote_wakeup_sec_info,
664 						sec->pairwise_enc_algorithm);
665 	SET_8812_H2CCMD_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(remote_wakeup_sec_info,
666 						      sec->group_enc_algorithm);
667 
668 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_GLOBAL_INFO,
669 			       H2C_8821AE_AOAC_GLOBAL_INFO_LEN,
670 			       remote_wakeup_sec_info);
671 
672 	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_TRACE,
673 		      "rtl8821ae_set_global_info: cmd 0x82:\n",
674 		      remote_wakeup_sec_info, H2C_8821AE_AOAC_GLOBAL_INFO_LEN);
675 }
676 
677 #define BEACON_PG		0
678 #define PSPOLL_PG		1
679 #define NULL_PG			2
680 #define QOSNULL_PG		3
681 #define ARPRESP_PG		4
682 #define REMOTE_PG		5
683 #define GTKEXT_PG		6
684 
685 #define TOTAL_RESERVED_PKT_LEN_8812	3584
686 #define TOTAL_RESERVED_PKT_LEN_8821	1792
687 
688 static u8 reserved_page_packet_8821[TOTAL_RESERVED_PKT_LEN_8821] = {
689 	/* page 0: beacon */
690 	0x80, 0x00, 0x00, 0x00,  0xff, 0xff, 0xff, 0xff,
691 	0xff, 0xff, 0x00, 0xe0,  0x4c, 0x02, 0xe2, 0x64,
692 	0x40, 0x16, 0x9f, 0x23,  0xd4, 0x46, 0x20, 0x00,
693 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
694 	0x64, 0x00, 0x20, 0x04,  0x00, 0x06, 0x64, 0x6c,
695 	0x69, 0x6e, 0x6b, 0x31,  0x01, 0x08, 0x82, 0x84,
696 	0x8b, 0x96, 0x0c, 0x18,  0x30, 0x48, 0x03, 0x01,
697 	0x0b, 0x06, 0x02, 0x00,  0x00, 0x2a, 0x01, 0x8b,
698 	0x32, 0x04, 0x12, 0x24,  0x60, 0x6c, 0x00, 0x00,
699 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
700 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
701 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
702 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
703 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
704 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
705 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
706 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
707 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
708 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
709 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
710 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
711 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
712 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
713 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
714 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
715 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
716 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
717 	0x10, 0x00, 0x28, 0x8c,  0x00, 0x12, 0x00, 0x00,
718 	0x00, 0x00, 0x00, 0x00,  0x00, 0x81, 0x00, 0x00,
719 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
720 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
721 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
722 	/* page 1: ps-poll */
723 	0xa4, 0x10, 0x01, 0xc0,  0x40, 0x16, 0x9f, 0x23,
724 	0xd4, 0x46, 0x00, 0xe0,  0x4c, 0x02, 0xe2, 0x64,
725 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
726 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
727 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
728 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
729 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
730 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
731 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
732 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
733 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
734 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
735 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
736 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
737 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
738 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
739 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
740 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
741 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
742 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
743 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
744 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
745 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
746 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
747 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
748 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
749 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
750 	0x18, 0x00, 0x28, 0x8c,  0x00, 0x12, 0x00, 0x00,
751 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
752 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
753 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
754 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
755 	/* page 2: null data */
756 	0x48, 0x01, 0x00, 0x00,  0x40, 0x16, 0x9f, 0x23,
757 	0xd4, 0x46, 0x00, 0xe0,  0x4c, 0x02, 0xe2, 0x64,
758 	0x40, 0x16, 0x9f, 0x23,  0xd4, 0x46, 0x00, 0x00,
759 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
760 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
761 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
762 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
763 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
764 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
765 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
766 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
767 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
768 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
769 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
770 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
771 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
772 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
773 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
774 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
775 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
776 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
777 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
778 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
779 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
780 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
781 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
782 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
783 	0x1A, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
784 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
785 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
786 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
787 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
788 	/* page 3: qos null data */
789 	0xC8, 0x01, 0x00, 0x00,  0x84, 0xC9, 0xB2, 0xA7,
790 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
791 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 0x00, 0x00,
792 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
793 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
794 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
795 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
796 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
797 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
798 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
799 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
800 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
801 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
802 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
803 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
804 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
805 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
806 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
807 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
808 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
809 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
810 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
811 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
812 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
813 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
814 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
815 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
816 	0x3C, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
817 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
818 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
819 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
820 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
821 	/* page 4~6 is for wowlan */
822 	/* page 4: ARP resp */
823 	0x08, 0x01, 0x00, 0x00,  0x84, 0xC9, 0xB2, 0xA7,
824 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
825 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 0x00, 0x00,
826 	0xAA, 0xAA, 0x03, 0x00,  0x00, 0x00, 0x08, 0x06,
827 	0x00, 0x01, 0x08, 0x00,  0x06, 0x04, 0x00, 0x02,
828 	0x00, 0xE0, 0x4C, 0x02,  0x51, 0x02, 0x00, 0x00,
829 	0x00, 0x00, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
830 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
831 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
832 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
833 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
834 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
835 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
836 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
837 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
838 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
839 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
840 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
841 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
842 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
843 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
844 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
845 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
846 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
847 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
848 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
849 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
850 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
851 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
852 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
853 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
854 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
855 	/* page 5: H2C_REMOTE_WAKE_CTRL_INFO */
856 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
857 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
858 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
859 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
860 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
861 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
862 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
863 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
864 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
865 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
866 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
867 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
868 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
869 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
870 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
871 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
872 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
873 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
874 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
875 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
876 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
877 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
878 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
879 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
880 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
881 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
882 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
883 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
884 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
885 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
886 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
887 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
888 	/* page 6: Rsvd GTK extend memory (zero memory) */
889 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
890 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
891 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
892 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
893 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
894 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
895 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
896 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
897 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
898 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
899 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
900 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
901 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
902 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
903 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
904 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
905 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
906 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
907 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
908 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
909 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
910 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
911 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
912 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
913 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
914 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
915 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
916 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
917 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
918 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
919 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
920 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
921 };
922 
923 static u8 reserved_page_packet_8812[TOTAL_RESERVED_PKT_LEN_8812] = {
924 	/* page 0: beacon */
925 	0x80, 0x00, 0x00, 0x00,  0xFF, 0xFF, 0xFF, 0xFF,
926 	0xFF, 0xFF, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
927 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 0x60, 0x00,
928 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
929 	0x64, 0x00, 0x20, 0x04,  0x00, 0x03, 0x32, 0x31,
930 	0x35, 0x01, 0x08, 0x82,  0x84, 0x8B, 0x96, 0x0C,
931 	0x12, 0x18, 0x24, 0x03,  0x01, 0x01, 0x06, 0x02,
932 	0x00, 0x00, 0x2A, 0x01,  0x02, 0x32, 0x04, 0x30,
933 	0x48, 0x60, 0x6C, 0x2D,  0x1A, 0xED, 0x09, 0x03,
934 	0xFF, 0xFF, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
935 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
936 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x3D,
937 	0x00, 0xDD, 0x07, 0x00,  0xE0, 0x4C, 0x02, 0x02,
938 	0x08, 0x04, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
939 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
940 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
941 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
942 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
943 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
944 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
945 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
946 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
947 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
948 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
949 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
950 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
951 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
952 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
953 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
954 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
955 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
956 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
957 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
958 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
959 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
960 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
961 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
962 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
963 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
964 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
965 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
966 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
967 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
968 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
969 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
970 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
971 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
972 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
973 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
974 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
975 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
976 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
977 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
978 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
979 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
980 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
981 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
982 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
983 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
984 	0x10, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
985 	0x00, 0x00, 0x00, 0x00,  0x00, 0x81, 0x00, 0x00,
986 	0x04, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
987 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
988 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
989 	/* page 1: ps-poll */
990 	0xA4, 0x10, 0x09, 0xC0,  0x84, 0xC9, 0xB2, 0xA7,
991 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
992 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
993 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
994 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
995 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
996 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
997 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
998 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
999 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1000 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1001 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1002 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1003 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1004 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1005 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1006 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1007 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1008 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1009 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1010 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1011 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1012 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1013 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1014 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1015 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1016 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1017 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1018 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1019 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1020 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1021 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1022 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1023 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1024 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1025 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1026 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1027 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1028 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1029 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1030 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1031 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1032 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1033 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1034 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1035 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1036 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1037 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1038 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1039 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1040 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1041 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1042 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1043 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1044 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1045 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1046 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1047 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1048 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1049 	0x18, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1050 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
1051 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1052 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1053 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1054 	/* page 2: null data */
1055 	0x48, 0x01, 0x00, 0x00,  0x84, 0xC9, 0xB2, 0xA7,
1056 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1057 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 0x00, 0x00,
1058 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1059 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1060 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1061 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1062 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1063 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1064 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1065 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1066 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1067 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1068 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1069 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1070 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1071 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1072 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1073 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1074 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1075 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1076 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1077 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1078 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1079 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1080 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1081 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1082 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1083 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1084 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1085 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1086 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1087 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1088 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1089 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1090 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1091 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1092 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1093 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1094 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1095 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1096 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1097 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1098 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1099 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1100 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1101 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1102 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1103 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1104 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1105 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1106 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1107 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1108 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1109 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1110 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1111 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1112 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1113 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1114 	0x1A, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1115 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
1116 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1117 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1118 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1119 	/* page 3: Qos null data */
1120 	0xC8, 0x01, 0x00, 0x00,  0x84, 0xC9, 0xB2, 0xA7,
1121 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1122 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 0x00, 0x00,
1123 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1124 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1125 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1126 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1127 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1128 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1129 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1130 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1131 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1132 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1133 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1134 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1135 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1136 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1137 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1138 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1139 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1140 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1141 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1142 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1143 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1144 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1145 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1146 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1147 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1148 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1149 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1150 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1151 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1152 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1153 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1154 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1155 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1156 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1157 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1158 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1159 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1160 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1161 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1162 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1163 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1164 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1165 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1166 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1167 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1168 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1169 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1170 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1171 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1172 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1173 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1174 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1175 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1176 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1177 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1178 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1179 	0x3C, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1180 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
1181 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1182 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1183 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1184 	/* page 4~6 is for wowlan */
1185 	/* page 4: ARP resp */
1186 	0x08, 0x01, 0x00, 0x00,  0x84, 0xC9, 0xB2, 0xA7,
1187 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1188 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 0x00, 0x00,
1189 	0xAA, 0xAA, 0x03, 0x00,  0x00, 0x00, 0x08, 0x06,
1190 	0x00, 0x01, 0x08, 0x00,  0x06, 0x04, 0x00, 0x02,
1191 	0x00, 0xE0, 0x4C, 0x02,  0x51, 0x02, 0x00, 0x00,
1192 	0x00, 0x00, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1193 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1194 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1195 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1196 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1197 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1198 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1199 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1200 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1201 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1202 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1203 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1204 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1205 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1206 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1207 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1208 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1209 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1210 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1211 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1212 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1213 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1214 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1215 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1216 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1217 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1218 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1219 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1220 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1221 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1222 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1223 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1224 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1225 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1226 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1227 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1228 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1229 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1230 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1231 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1232 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1233 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1234 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1235 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1236 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1237 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1238 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1239 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1240 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1241 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1242 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1243 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1244 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1245 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1246 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1247 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1248 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1249 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1250 	/* page 5: H2C_REMOTE_WAKE_CTRL_INFO */
1251 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1252 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1253 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1254 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1255 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1256 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1257 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1258 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1259 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1260 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1261 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1262 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1263 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1264 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1265 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1266 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1267 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1268 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1269 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1270 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1271 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1272 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1273 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1274 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1275 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1276 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1277 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1278 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1279 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1280 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1281 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1282 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1283 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1284 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1285 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1286 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1287 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1288 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1289 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1290 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1291 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1292 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1293 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1294 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1295 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1296 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1297 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1298 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1299 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1300 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1301 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1302 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1303 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1304 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1305 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1306 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1307 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1308 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1309 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1310 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1311 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1312 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1313 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1314 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1315 	/* page 6: Rsvd GTK extend memory (zero memory) */
1316 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1317 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1318 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1319 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1320 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1321 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1322 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1323 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1324 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1325 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1326 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1327 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1328 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1329 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1330 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1331 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1332 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1333 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1334 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1335 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1336 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1337 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1338 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1339 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1340 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1341 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1342 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1343 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1344 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1345 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1346 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1347 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1348 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1349 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1350 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1351 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1352 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1353 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1354 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1355 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1356 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1357 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1358 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1359 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1360 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1361 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1362 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1363 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1364 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1365 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1366 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1367 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1368 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1369 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1370 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1371 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1372 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1373 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1374 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1375 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1376 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1377 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1378 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1379 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1380 };
1381 
1382 void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1383 				  bool b_dl_finished, bool dl_whole_packets)
1384 {
1385 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1386 	struct rtl_mac *mac = rtl_mac(rtlpriv);
1387 	struct sk_buff *skb = NULL;
1388 	u32 totalpacketlen;
1389 	bool rtstatus;
1390 	u8 u1RsvdPageLoc[5] = { 0 };
1391 	u8 u1RsvdPageLoc2[7] = { 0 };
1392 	bool b_dlok = false;
1393 	u8 *beacon;
1394 	u8 *p_pspoll;
1395 	u8 *nullfunc;
1396 	u8 *qosnull;
1397 	u8 *arpresp;
1398 
1399 	/*---------------------------------------------------------
1400 	 *			(1) beacon
1401 	 *---------------------------------------------------------
1402 	 */
1403 	beacon = &reserved_page_packet_8812[BEACON_PG * 512];
1404 	SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr);
1405 	SET_80211_HDR_ADDRESS3(beacon, mac->bssid);
1406 
1407 	if (b_dl_finished) {
1408 		totalpacketlen = 512 - 40;
1409 		goto out;
1410 	}
1411 	/*-------------------------------------------------------
1412 	 *			(2) ps-poll
1413 	 *--------------------------------------------------------
1414 	 */
1415 	p_pspoll = &reserved_page_packet_8812[PSPOLL_PG * 512];
1416 	SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000));
1417 	SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid);
1418 	SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr);
1419 
1420 	SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG);
1421 
1422 	/*--------------------------------------------------------
1423 	 *			(3) null data
1424 	 *---------------------------------------------------------
1425 	 */
1426 	nullfunc = &reserved_page_packet_8812[NULL_PG * 512];
1427 	SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid);
1428 	SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr);
1429 	SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid);
1430 
1431 	SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG);
1432 
1433 	/*---------------------------------------------------------
1434 	 *			(4) Qos null data
1435 	 *----------------------------------------------------------
1436 	 */
1437 	qosnull = &reserved_page_packet_8812[QOSNULL_PG * 512];
1438 	SET_80211_HDR_ADDRESS1(qosnull, mac->bssid);
1439 	SET_80211_HDR_ADDRESS2(qosnull, mac->mac_addr);
1440 	SET_80211_HDR_ADDRESS3(qosnull, mac->bssid);
1441 
1442 	SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1RsvdPageLoc, QOSNULL_PG);
1443 
1444 	if (!dl_whole_packets) {
1445 		totalpacketlen = 512 * (QOSNULL_PG + 1) - 40;
1446 		goto out;
1447 	}
1448 	/*---------------------------------------------------------
1449 	 *			(5) ARP Resp
1450 	 *----------------------------------------------------------
1451 	 */
1452 	arpresp = &reserved_page_packet_8812[ARPRESP_PG * 512];
1453 	SET_80211_HDR_ADDRESS1(arpresp, mac->bssid);
1454 	SET_80211_HDR_ADDRESS2(arpresp, mac->mac_addr);
1455 	SET_80211_HDR_ADDRESS3(arpresp, mac->bssid);
1456 
1457 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1RsvdPageLoc2, ARPRESP_PG);
1458 
1459 	/*---------------------------------------------------------
1460 	 *			(6) Remote Wake Ctrl
1461 	 *----------------------------------------------------------
1462 	 */
1463 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1RsvdPageLoc2,
1464 								REMOTE_PG);
1465 
1466 	/*---------------------------------------------------------
1467 	 *			(7) GTK Ext Memory
1468 	 *----------------------------------------------------------
1469 	 */
1470 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1RsvdPageLoc2, GTKEXT_PG);
1471 
1472 	totalpacketlen = TOTAL_RESERVED_PKT_LEN_8812 - 40;
1473 
1474 out:
1475 	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
1476 		      "rtl8812ae_set_fw_rsvdpagepkt(): packet data\n",
1477 		      &reserved_page_packet_8812[0], totalpacketlen);
1478 
1479 	skb = dev_alloc_skb(totalpacketlen);
1480 	memcpy((u8 *)skb_put(skb, totalpacketlen),
1481 	       &reserved_page_packet_8812, totalpacketlen);
1482 
1483 	rtstatus = rtl_cmd_send_packet(hw, skb);
1484 
1485 	if (rtstatus)
1486 		b_dlok = true;
1487 
1488 	if (!b_dl_finished && b_dlok) {
1489 		RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1490 			      "H2C_RSVDPAGE:\n", u1RsvdPageLoc, 5);
1491 		rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RSVDPAGE,
1492 				       sizeof(u1RsvdPageLoc), u1RsvdPageLoc);
1493 		if (dl_whole_packets) {
1494 			RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1495 				      "wowlan H2C_RSVDPAGE:\n", u1RsvdPageLoc2, 7);
1496 			rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_RSVDPAGE,
1497 					       sizeof(u1RsvdPageLoc2), u1RsvdPageLoc2);
1498 		}
1499 	}
1500 
1501 	if (!b_dlok)
1502 		RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1503 			 "Set RSVD page location to Fw FAIL!!!!!!.\n");
1504 }
1505 
1506 void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1507 				  bool b_dl_finished, bool dl_whole_packets)
1508 {
1509 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1510 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
1511 	struct sk_buff *skb = NULL;
1512 	u32 totalpacketlen;
1513 	bool rtstatus;
1514 	u8 u1RsvdPageLoc[5] = { 0 };
1515 	u8 u1RsvdPageLoc2[7] = { 0 };
1516 	bool b_dlok = false;
1517 	u8 *beacon;
1518 	u8 *p_pspoll;
1519 	u8 *nullfunc;
1520 	u8 *qosnull;
1521 	u8 *arpresp;
1522 
1523 	/*---------------------------------------------------------
1524 	 *			(1) beacon
1525 	 *---------------------------------------------------------
1526 	 */
1527 	beacon = &reserved_page_packet_8821[BEACON_PG * 256];
1528 	SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr);
1529 	SET_80211_HDR_ADDRESS3(beacon, mac->bssid);
1530 
1531 	if (b_dl_finished) {
1532 		totalpacketlen = 256 - 40;
1533 		goto out;
1534 	}
1535 	/*-------------------------------------------------------
1536 	 *			(2) ps-poll
1537 	 *--------------------------------------------------------
1538 	 */
1539 	p_pspoll = &reserved_page_packet_8821[PSPOLL_PG * 256];
1540 	SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000));
1541 	SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid);
1542 	SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr);
1543 
1544 	SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG);
1545 
1546 	/*--------------------------------------------------------
1547 	 *			(3) null data
1548 	 *---------------------------------------------------------i
1549 	 */
1550 	nullfunc = &reserved_page_packet_8821[NULL_PG * 256];
1551 	SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid);
1552 	SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr);
1553 	SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid);
1554 
1555 	SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG);
1556 
1557 	/*---------------------------------------------------------
1558 	 *			(4) Qos null data
1559 	 *----------------------------------------------------------
1560 	 */
1561 	qosnull = &reserved_page_packet_8821[QOSNULL_PG * 256];
1562 	SET_80211_HDR_ADDRESS1(qosnull, mac->bssid);
1563 	SET_80211_HDR_ADDRESS2(qosnull, mac->mac_addr);
1564 	SET_80211_HDR_ADDRESS3(qosnull, mac->bssid);
1565 
1566 	SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1RsvdPageLoc, QOSNULL_PG);
1567 
1568 	if (!dl_whole_packets) {
1569 		totalpacketlen = 256 * (QOSNULL_PG + 1) - 40;
1570 		goto out;
1571 	}
1572 	/*---------------------------------------------------------
1573 	 *			(5) ARP Resp
1574 	 *----------------------------------------------------------
1575 	 */
1576 	arpresp = &reserved_page_packet_8821[ARPRESP_PG * 256];
1577 	SET_80211_HDR_ADDRESS1(arpresp, mac->bssid);
1578 	SET_80211_HDR_ADDRESS2(arpresp, mac->mac_addr);
1579 	SET_80211_HDR_ADDRESS3(arpresp, mac->bssid);
1580 
1581 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1RsvdPageLoc2, ARPRESP_PG);
1582 
1583 	/*---------------------------------------------------------
1584 	 *			(6) Remote Wake Ctrl
1585 	 *----------------------------------------------------------
1586 	 */
1587 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1RsvdPageLoc2,
1588 									REMOTE_PG);
1589 
1590 	/*---------------------------------------------------------
1591 	 *			(7) GTK Ext Memory
1592 	 *----------------------------------------------------------
1593 	 */
1594 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1RsvdPageLoc2, GTKEXT_PG);
1595 
1596 	totalpacketlen = TOTAL_RESERVED_PKT_LEN_8821 - 40;
1597 
1598 out:
1599 
1600 	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
1601 		      "rtl8821ae_set_fw_rsvdpagepkt(): packet data\n",
1602 		      &reserved_page_packet_8821[0], totalpacketlen);
1603 
1604 	skb = dev_alloc_skb(totalpacketlen);
1605 	memcpy((u8 *)skb_put(skb, totalpacketlen),
1606 	       &reserved_page_packet_8821, totalpacketlen);
1607 
1608 	rtstatus = rtl_cmd_send_packet(hw, skb);
1609 
1610 	if (rtstatus)
1611 		b_dlok = true;
1612 
1613 	if (!b_dl_finished && b_dlok) {
1614 		RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
1615 			 "Set RSVD page location to Fw.\n");
1616 		RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1617 				"H2C_RSVDPAGE:\n", u1RsvdPageLoc, 5);
1618 		rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RSVDPAGE,
1619 				       sizeof(u1RsvdPageLoc), u1RsvdPageLoc);
1620 		if (dl_whole_packets) {
1621 			RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1622 				      "wowlan H2C_RSVDPAGE:\n",
1623 				      u1RsvdPageLoc2, 7);
1624 			rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_RSVDPAGE,
1625 					       sizeof(u1RsvdPageLoc2),
1626 					       u1RsvdPageLoc2);
1627 		}
1628 	}
1629 
1630 	if (!b_dlok) {
1631 		RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1632 			 "Set RSVD page location to Fw FAIL!!!!!!.\n");
1633 	}
1634 }
1635 
1636 /*Should check FW support p2p or not.*/
1637 static void rtl8821ae_set_p2p_ctw_period_cmd(struct ieee80211_hw *hw, u8 ctwindow)
1638 {
1639 	u8 u1_ctwindow_period[1] = { ctwindow};
1640 
1641 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_P2P_PS_CTW_CMD, 1,
1642 			       u1_ctwindow_period);
1643 }
1644 
1645 void rtl8821ae_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
1646 {
1647 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1648 	struct rtl_ps_ctl *rtlps = rtl_psc(rtl_priv(hw));
1649 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1650 	struct rtl_p2p_ps_info *p2pinfo = &rtlps->p2p_ps_info;
1651 	struct p2p_ps_offload_t *p2p_ps_offload = &rtlhal->p2p_ps_offload;
1652 	u8	i;
1653 	u16	ctwindow;
1654 	u32	start_time, tsf_low;
1655 
1656 	switch (p2p_ps_state) {
1657 	case P2P_PS_DISABLE:
1658 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_DISABLE\n");
1659 		memset(p2p_ps_offload, 0, sizeof(*p2p_ps_offload));
1660 		break;
1661 	case P2P_PS_ENABLE:
1662 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_ENABLE\n");
1663 		/* update CTWindow value. */
1664 		if (p2pinfo->ctwindow > 0) {
1665 			p2p_ps_offload->ctwindow_en = 1;
1666 			ctwindow = p2pinfo->ctwindow;
1667 			rtl8821ae_set_p2p_ctw_period_cmd(hw, ctwindow);
1668 		}
1669 
1670 		/* hw only support 2 set of NoA */
1671 		for (i = 0 ; i < p2pinfo->noa_num ; i++) {
1672 			/* To control the register setting for which NOA*/
1673 			rtl_write_byte(rtlpriv, 0x5cf, (i << 4));
1674 			if (i == 0)
1675 				p2p_ps_offload->noa0_en = 1;
1676 			else
1677 				p2p_ps_offload->noa1_en = 1;
1678 
1679 			/* config P2P NoA Descriptor Register */
1680 			rtl_write_dword(rtlpriv, 0x5E0, p2pinfo->noa_duration[i]);
1681 			rtl_write_dword(rtlpriv, 0x5E4, p2pinfo->noa_interval[i]);
1682 
1683 			/*Get Current TSF value */
1684 			tsf_low = rtl_read_dword(rtlpriv, REG_TSFTR);
1685 
1686 			start_time = p2pinfo->noa_start_time[i];
1687 			if (p2pinfo->noa_count_type[i] != 1) {
1688 				while (start_time <= (tsf_low+(50*1024))) {
1689 					start_time += p2pinfo->noa_interval[i];
1690 					if (p2pinfo->noa_count_type[i] != 255)
1691 						p2pinfo->noa_count_type[i]--;
1692 				}
1693 			}
1694 			rtl_write_dword(rtlpriv, 0x5E8, start_time);
1695 			rtl_write_dword(rtlpriv, 0x5EC,
1696 					p2pinfo->noa_count_type[i]);
1697 		}
1698 
1699 		if ((p2pinfo->opp_ps == 1) || (p2pinfo->noa_num > 0)) {
1700 			/* rst p2p circuit */
1701 			rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, BIT(4));
1702 
1703 			p2p_ps_offload->offload_en = 1;
1704 
1705 			if (P2P_ROLE_GO == rtlpriv->mac80211.p2p) {
1706 				p2p_ps_offload->role = 1;
1707 				p2p_ps_offload->allstasleep = 0;
1708 			} else {
1709 				p2p_ps_offload->role = 0;
1710 			}
1711 
1712 			p2p_ps_offload->discovery = 0;
1713 		}
1714 		break;
1715 	case P2P_PS_SCAN:
1716 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN\n");
1717 		p2p_ps_offload->discovery = 1;
1718 		break;
1719 	case P2P_PS_SCAN_DONE:
1720 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN_DONE\n");
1721 		p2p_ps_offload->discovery = 0;
1722 		p2pinfo->p2p_ps_state = P2P_PS_ENABLE;
1723 		break;
1724 	default:
1725 		break;
1726 	}
1727 
1728 	rtl8821ae_fill_h2c_cmd(hw,
1729 			H2C_8821AE_P2P_PS_OFFLOAD, 1, (u8 *)p2p_ps_offload);
1730 }
1731 
1732 static void rtl8821ae_c2h_ra_report_handler(struct ieee80211_hw *hw,
1733 				     u8 *cmd_buf, u8 cmd_len)
1734 {
1735 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1736 	u8 rate = cmd_buf[0] & 0x3F;
1737 
1738 	rtlhal->current_ra_rate = rtl8821ae_hw_rate_to_mrate(hw, rate);
1739 
1740 	rtl8821ae_dm_update_init_rate(hw, rate);
1741 }
1742 
1743 void rtl8821ae_c2h_content_parsing(struct ieee80211_hw *hw,
1744 				   u8 c2h_cmd_id, u8 c2h_cmd_len,
1745 				   u8 *tmp_buf)
1746 {
1747 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1748 
1749 	switch (c2h_cmd_id) {
1750 	case C2H_8812_DBG:
1751 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "[C2H], C2H_8812_DBG!!\n");
1752 		break;
1753 	case C2H_8812_RA_RPT:
1754 		rtl8821ae_c2h_ra_report_handler(hw, tmp_buf, c2h_cmd_len);
1755 		break;
1756 	case C2H_8812_BT_INFO:
1757 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD,
1758 			 "[C2H], C2H_8812_BT_INFO!!\n");
1759 		if (rtlpriv->cfg->ops->get_btc_status())
1760 			rtlpriv->btcoexist.btc_ops->btc_btinfo_notify(rtlpriv,
1761 								      tmp_buf,
1762 								      c2h_cmd_len);
1763 		break;
1764 	default:
1765 		break;
1766 	}
1767 }
1768 
1769 void rtl8821ae_c2h_packet_handler(struct ieee80211_hw *hw, u8 *buffer,
1770 				  u8 length)
1771 {
1772 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1773 	u8 c2h_cmd_id = 0, c2h_cmd_seq = 0, c2h_cmd_len = 0;
1774 	u8 *tmp_buf = NULL;
1775 
1776 	c2h_cmd_id = buffer[0];
1777 	c2h_cmd_seq = buffer[1];
1778 	c2h_cmd_len = length - 2;
1779 	tmp_buf = buffer + 2;
1780 
1781 	RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD,
1782 		 "[C2H packet], c2hCmdId=0x%x, c2hCmdSeq=0x%x, c2hCmdLen=%d\n",
1783 		 c2h_cmd_id, c2h_cmd_seq, c2h_cmd_len);
1784 
1785 	RT_PRINT_DATA(rtlpriv, COMP_FW, DBG_LOUD,
1786 		      "[C2H packet], Content Hex:\n", tmp_buf, c2h_cmd_len);
1787 
1788 	switch (c2h_cmd_id) {
1789 	case C2H_8812_BT_INFO:
1790 		rtl_c2hcmd_enqueue(hw, c2h_cmd_id, c2h_cmd_len, tmp_buf);
1791 		break;
1792 
1793 	default:
1794 		rtl8821ae_c2h_content_parsing(hw, c2h_cmd_id, c2h_cmd_len,
1795 					      tmp_buf);
1796 		break;
1797 	}
1798 }
1799