1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2009-2010  Realtek Corporation.*/
3 
4 #include "../wifi.h"
5 #include "../pci.h"
6 #include "../base.h"
7 #include "../core.h"
8 #include "../efuse.h"
9 #include "reg.h"
10 #include "def.h"
11 #include "fw.h"
12 #include "dm.h"
13 
14 static void _rtl8821ae_enable_fw_download(struct ieee80211_hw *hw, bool enable)
15 {
16 	struct rtl_priv *rtlpriv = rtl_priv(hw);
17 	u8 tmp;
18 
19 	if (enable) {
20 		rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x05);
21 
22 		tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL + 2);
23 		rtl_write_byte(rtlpriv, REG_MCUFWDL + 2, tmp & 0xf7);
24 
25 		tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL);
26 	} else {
27 		tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL);
28 		rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp & 0xfe);
29 		tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL);
30 	}
31 }
32 
33 static void _rtl8821ae_write_fw(struct ieee80211_hw *hw,
34 				enum version_8821ae version,
35 				u8 *buffer, u32 size)
36 {
37 	struct rtl_priv *rtlpriv = rtl_priv(hw);
38 	u8 *bufferptr = (u8 *)buffer;
39 	u32 pagenums, remainsize;
40 	u32 page, offset;
41 
42 	rtl_dbg(rtlpriv, COMP_FW, DBG_LOUD, "FW size is %d bytes,\n", size);
43 
44 	rtl_fill_dummy(bufferptr, &size);
45 
46 	pagenums = size / FW_8821AE_PAGE_SIZE;
47 	remainsize = size % FW_8821AE_PAGE_SIZE;
48 
49 	if (pagenums > 8)
50 		pr_err("Page numbers should not greater then 8\n");
51 
52 	for (page = 0; page < pagenums; page++) {
53 		offset = page * FW_8821AE_PAGE_SIZE;
54 		rtl_fw_page_write(hw, page, (bufferptr + offset),
55 				  FW_8821AE_PAGE_SIZE);
56 	}
57 
58 	if (remainsize) {
59 		offset = pagenums * FW_8821AE_PAGE_SIZE;
60 		page = pagenums;
61 		rtl_fw_page_write(hw, page, (bufferptr + offset), remainsize);
62 	}
63 }
64 
65 static int _rtl8821ae_fw_free_to_go(struct ieee80211_hw *hw)
66 {
67 	struct rtl_priv *rtlpriv = rtl_priv(hw);
68 	int err = -EIO;
69 	u32 counter = 0;
70 	u32 value32;
71 
72 	do {
73 		value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
74 	} while ((counter++ < FW_8821AE_POLLING_TIMEOUT_COUNT) &&
75 		 (!(value32 & FWDL_CHKSUM_RPT)));
76 
77 	if (counter >= FW_8821AE_POLLING_TIMEOUT_COUNT) {
78 		rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
79 			"chksum report fail! REG_MCUFWDL:0x%08x .\n",
80 			value32);
81 		goto exit;
82 	}
83 	value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
84 	value32 |= MCUFWDL_RDY;
85 	value32 &= ~WINTINI_RDY;
86 	rtl_write_dword(rtlpriv, REG_MCUFWDL, value32);
87 
88 	rtl8821ae_firmware_selfreset(hw);
89 
90 	counter = 0;
91 	do {
92 		value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
93 		if (value32 & WINTINI_RDY)
94 			return 0;
95 
96 		udelay(FW_8821AE_POLLING_DELAY);
97 	} while (counter++ < FW_8821AE_POLLING_TIMEOUT_COUNT);
98 
99 	pr_err("Polling FW ready fail!! REG_MCUFWDL:0x%08x .\n",
100 	       value32);
101 
102 exit:
103 	return err;
104 }
105 
106 static void _rtl8821ae_wait_for_h2c_cmd_finish(struct rtl_priv *rtlpriv)
107 {
108 	u8 val;
109 	u16 count = 0;
110 
111 	do {
112 		val = rtl_read_byte(rtlpriv, REG_HMETFR);
113 		mdelay(1);
114 		count++;
115 	} while ((val & 0x0F) && (count < 1000));
116 }
117 
118 int rtl8821ae_download_fw(struct ieee80211_hw *hw, bool buse_wake_on_wlan_fw)
119 {
120 	struct rtl_priv *rtlpriv = rtl_priv(hw);
121 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
122 	struct rtlwifi_firmware_header *pfwheader;
123 	u8 *pfwdata;
124 	u32 fwsize;
125 	int err;
126 	bool support_remote_wakeup;
127 	enum version_8821ae version = rtlhal->version;
128 
129 	rtlpriv->cfg->ops->get_hw_reg(hw, HAL_DEF_WOWLAN,
130 				      (u8 *)(&support_remote_wakeup));
131 
132 	if (support_remote_wakeup)
133 		_rtl8821ae_wait_for_h2c_cmd_finish(rtlpriv);
134 
135 	if (buse_wake_on_wlan_fw) {
136 		if (!rtlhal->wowlan_firmware)
137 			return 1;
138 
139 		pfwheader =
140 		  (struct rtlwifi_firmware_header *)rtlhal->wowlan_firmware;
141 		rtlhal->fw_version = le16_to_cpu(pfwheader->version);
142 		rtlhal->fw_subversion = pfwheader->subversion;
143 		pfwdata = (u8 *)rtlhal->wowlan_firmware;
144 		fwsize = rtlhal->wowlan_fwsize;
145 	} else {
146 		if (!rtlhal->pfirmware)
147 			return 1;
148 
149 		pfwheader =
150 		  (struct rtlwifi_firmware_header *)rtlhal->pfirmware;
151 		rtlhal->fw_version = le16_to_cpu(pfwheader->version);
152 		rtlhal->fw_subversion = pfwheader->subversion;
153 		pfwdata = (u8 *)rtlhal->pfirmware;
154 		fwsize = rtlhal->fwsize;
155 	}
156 
157 	rtl_dbg(rtlpriv, COMP_FW, DBG_DMESG,
158 		"%s Firmware SIZE %d\n",
159 		buse_wake_on_wlan_fw ? "Wowlan" : "Normal", fwsize);
160 
161 	if (IS_FW_HEADER_EXIST_8812(pfwheader) ||
162 	    IS_FW_HEADER_EXIST_8821(pfwheader)) {
163 		rtl_dbg(rtlpriv, COMP_FW, DBG_DMESG,
164 			"Firmware Version(%d), Signature(%#x)\n",
165 			pfwheader->version, pfwheader->signature);
166 
167 		pfwdata = pfwdata + sizeof(struct rtlwifi_firmware_header);
168 		fwsize = fwsize - sizeof(struct rtlwifi_firmware_header);
169 	}
170 
171 	if (rtlhal->mac_func_enable) {
172 		if (rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(7)) {
173 			rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00);
174 			rtl8821ae_firmware_selfreset(hw);
175 		}
176 	}
177 	_rtl8821ae_enable_fw_download(hw, true);
178 	_rtl8821ae_write_fw(hw, version, pfwdata, fwsize);
179 	_rtl8821ae_enable_fw_download(hw, false);
180 
181 	err = _rtl8821ae_fw_free_to_go(hw);
182 	if (err) {
183 		rtl_dbg(rtlpriv, COMP_ERR, DBG_DMESG,
184 			"Firmware is not ready to run!\n");
185 	} else {
186 		rtl_dbg(rtlpriv, COMP_FW, DBG_LOUD,
187 			"Firmware is ready to run!\n");
188 	}
189 
190 	return 0;
191 }
192 
193 #if (USE_SPECIFIC_FW_TO_SUPPORT_WOWLAN == 1)
194 void rtl8821ae_set_fw_related_for_wowlan(struct ieee80211_hw *hw,
195 					 bool used_wowlan_fw)
196 {
197 	struct rtl_priv *rtlpriv = rtl_priv(hw);
198 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
199 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
200 	/* 1. Before WoWLAN or After WOWLAN we need to re-download Fw. */
201 	if (rtl8821ae_download_fw(hw, used_wowlan_fw)) {
202 		rtl_dbg(rtlpriv, COMP_INIT, DBG_DMESG,
203 			"Re-Download Firmware failed!!\n");
204 		rtlhal->fw_ready = false;
205 		return;
206 	}
207 	rtl_dbg(rtlpriv, COMP_INIT, DBG_DMESG,
208 		"Re-Download Firmware Success !!\n");
209 	rtlhal->fw_ready = true;
210 
211 	/* 2. Re-Init the variables about Fw related setting. */
212 	ppsc->fw_current_inpsmode = false;
213 	rtlhal->fw_ps_state = FW_PS_STATE_ALL_ON_8821AE;
214 	rtlhal->fw_clk_change_in_progress = false;
215 	rtlhal->allow_sw_to_change_hwclc = false;
216 	rtlhal->last_hmeboxnum = 0;
217 }
218 #endif
219 
220 static bool _rtl8821ae_check_fw_read_last_h2c(struct ieee80211_hw *hw,
221 					      u8 boxnum)
222 {
223 	struct rtl_priv *rtlpriv = rtl_priv(hw);
224 	u8 val_hmetfr;
225 	bool result = false;
226 
227 	val_hmetfr = rtl_read_byte(rtlpriv, REG_HMETFR);
228 	if (((val_hmetfr >> boxnum) & BIT(0)) == 0)
229 		result = true;
230 	return result;
231 }
232 
233 static void _rtl8821ae_fill_h2c_command(struct ieee80211_hw *hw,
234 					u8 element_id, u32 cmd_len,
235 					u8 *cmdbuffer)
236 {
237 	struct rtl_priv *rtlpriv = rtl_priv(hw);
238 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
239 	u8 boxnum = 0;
240 	u16 box_reg = 0, box_extreg = 0;
241 	u8 u1b_tmp = 0;
242 	bool isfw_read = false;
243 	u8 buf_index = 0;
244 	bool bwrite_sucess = false;
245 	u8 wait_h2c_limmit = 100;
246 	/*u8 wait_writeh2c_limmit = 100;*/
247 	u8 boxcontent[4], boxextcontent[4];
248 	u32 h2c_waitcounter = 0;
249 	unsigned long flag = 0;
250 	u8 idx = 0;
251 
252 	rtl_dbg(rtlpriv, COMP_CMD, DBG_LOUD, "come in\n");
253 
254 	while (true) {
255 		spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag);
256 		if (rtlhal->h2c_setinprogress) {
257 			rtl_dbg(rtlpriv, COMP_CMD, DBG_LOUD,
258 				"H2C set in progress! Wait to set..element_id(%d).\n",
259 				element_id);
260 
261 			while (rtlhal->h2c_setinprogress) {
262 				spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock,
263 						       flag);
264 				h2c_waitcounter++;
265 				rtl_dbg(rtlpriv, COMP_CMD, DBG_LOUD,
266 					"Wait 100 us (%d times)...\n",
267 					h2c_waitcounter);
268 				udelay(100);
269 
270 				if (h2c_waitcounter > 1000)
271 					return;
272 				spin_lock_irqsave(&rtlpriv->locks.h2c_lock,
273 						  flag);
274 			}
275 			spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag);
276 		} else {
277 			rtlhal->h2c_setinprogress = true;
278 			spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag);
279 			break;
280 		}
281 	}
282 
283 	while (!bwrite_sucess) {
284 		boxnum = rtlhal->last_hmeboxnum;
285 		switch (boxnum) {
286 		case 0:
287 			box_reg = REG_HMEBOX_0;
288 			box_extreg = REG_HMEBOX_EXT_0;
289 			break;
290 		case 1:
291 			box_reg = REG_HMEBOX_1;
292 			box_extreg = REG_HMEBOX_EXT_1;
293 			break;
294 		case 2:
295 			box_reg = REG_HMEBOX_2;
296 			box_extreg = REG_HMEBOX_EXT_2;
297 			break;
298 		case 3:
299 			box_reg = REG_HMEBOX_3;
300 			box_extreg = REG_HMEBOX_EXT_3;
301 			break;
302 		default:
303 			rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
304 				"switch case %#x not processed\n", boxnum);
305 			break;
306 		}
307 
308 		isfw_read = false;
309 		u1b_tmp = rtl_read_byte(rtlpriv, REG_CR);
310 
311 		if (u1b_tmp != 0xEA) {
312 			isfw_read = true;
313 		} else {
314 			if (rtl_read_byte(rtlpriv, REG_TXDMA_STATUS) == 0xEA ||
315 			    rtl_read_byte(rtlpriv, REG_TXPKT_EMPTY) == 0xEA)
316 				rtl_write_byte(rtlpriv, REG_SYS_CFG1 + 3, 0xFF);
317 		}
318 
319 		if (isfw_read) {
320 			wait_h2c_limmit = 100;
321 			isfw_read =
322 			  _rtl8821ae_check_fw_read_last_h2c(hw, boxnum);
323 			while (!isfw_read) {
324 				/*wait until Fw read*/
325 				wait_h2c_limmit--;
326 				if (wait_h2c_limmit == 0) {
327 					rtl_dbg(rtlpriv, COMP_CMD, DBG_LOUD,
328 						"Waiting too long for FW read clear HMEBox(%d)!\n",
329 						boxnum);
330 					break;
331 				}
332 
333 				udelay(10);
334 
335 				isfw_read =
336 				  _rtl8821ae_check_fw_read_last_h2c(hw, boxnum);
337 				u1b_tmp = rtl_read_byte(rtlpriv, 0x130);
338 				rtl_dbg(rtlpriv, COMP_CMD, DBG_LOUD,
339 					"Waiting for FW read clear HMEBox(%d)!!! 0x130 = %2x\n",
340 					boxnum, u1b_tmp);
341 			}
342 		}
343 
344 		if (!isfw_read) {
345 			rtl_dbg(rtlpriv, COMP_CMD, DBG_LOUD,
346 				"Write H2C register BOX[%d] fail!!!!! Fw do not read.\n",
347 				boxnum);
348 			break;
349 		}
350 
351 		memset(boxcontent, 0, sizeof(boxcontent));
352 		memset(boxextcontent, 0, sizeof(boxextcontent));
353 		boxcontent[0] = element_id;
354 		rtl_dbg(rtlpriv, COMP_CMD, DBG_LOUD,
355 			"Write element_id box_reg(%4x) = %2x\n",
356 			box_reg, element_id);
357 
358 		switch (cmd_len) {
359 		case 1:
360 		case 2:
361 		case 3:
362 			/*boxcontent[0] &= ~(BIT(7));*/
363 			memcpy((u8 *)(boxcontent) + 1,
364 			       cmdbuffer + buf_index, cmd_len);
365 
366 			for (idx = 0; idx < 4; idx++) {
367 				rtl_write_byte(rtlpriv, box_reg + idx,
368 					       boxcontent[idx]);
369 			}
370 			break;
371 		case 4:
372 		case 5:
373 		case 6:
374 		case 7:
375 			/*boxcontent[0] |= (BIT(7));*/
376 			memcpy((u8 *)(boxextcontent),
377 			       cmdbuffer + buf_index+3, cmd_len-3);
378 			memcpy((u8 *)(boxcontent) + 1,
379 			       cmdbuffer + buf_index, 3);
380 
381 			for (idx = 0; idx < 4; idx++) {
382 				rtl_write_byte(rtlpriv, box_extreg + idx,
383 					       boxextcontent[idx]);
384 			}
385 
386 			for (idx = 0; idx < 4; idx++) {
387 				rtl_write_byte(rtlpriv, box_reg + idx,
388 					       boxcontent[idx]);
389 			}
390 			break;
391 		default:
392 			rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD,
393 				"switch case %#x not processed\n", cmd_len);
394 			break;
395 		}
396 
397 		bwrite_sucess = true;
398 
399 		rtlhal->last_hmeboxnum = boxnum + 1;
400 		if (rtlhal->last_hmeboxnum == 4)
401 			rtlhal->last_hmeboxnum = 0;
402 
403 		rtl_dbg(rtlpriv, COMP_CMD, DBG_LOUD,
404 			"pHalData->last_hmeboxnum  = %d\n",
405 			rtlhal->last_hmeboxnum);
406 	}
407 
408 	spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag);
409 	rtlhal->h2c_setinprogress = false;
410 	spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag);
411 
412 	rtl_dbg(rtlpriv, COMP_CMD, DBG_LOUD, "go out\n");
413 }
414 
415 void rtl8821ae_fill_h2c_cmd(struct ieee80211_hw *hw,
416 			    u8 element_id, u32 cmd_len, u8 *cmdbuffer)
417 {
418 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
419 	u32 tmp_cmdbuf[2];
420 
421 	if (!rtlhal->fw_ready) {
422 		WARN_ONCE(true,
423 			  "rtl8821ae: error H2C cmd because of Fw download fail!!!\n");
424 		return;
425 	}
426 
427 	memset(tmp_cmdbuf, 0, 8);
428 	memcpy(tmp_cmdbuf, cmdbuffer, cmd_len);
429 	_rtl8821ae_fill_h2c_command(hw, element_id, cmd_len, (u8 *)&tmp_cmdbuf);
430 }
431 
432 void rtl8821ae_firmware_selfreset(struct ieee80211_hw *hw)
433 {
434 	struct rtl_priv *rtlpriv = rtl_priv(hw);
435 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
436 	u8 u1b_tmp;
437 
438 	if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) {
439 		u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1);
440 		rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp & (~BIT(3))));
441 	} else {
442 		u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1);
443 		rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp & (~BIT(0))));
444 	}
445 
446 	u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN+1);
447 	rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN+1, (u1b_tmp & (~BIT(2))));
448 	udelay(50);
449 
450 	if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) {
451 		u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1);
452 		rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp | BIT(3)));
453 	} else {
454 		u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1);
455 		rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp | BIT(0)));
456 	}
457 
458 	u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN+1);
459 	rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN+1, (u1b_tmp | BIT(2)));
460 
461 	rtl_dbg(rtlpriv, COMP_INIT, DBG_LOUD,
462 		"_8051Reset8812ae(): 8051 reset success .\n");
463 }
464 
465 void rtl8821ae_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
466 {
467 	struct rtl_priv *rtlpriv = rtl_priv(hw);
468 	u8 u1_h2c_set_pwrmode[H2C_8821AE_PWEMODE_LENGTH] = { 0 };
469 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
470 	u8 rlbm, power_state = 0, byte5 = 0;
471 	u8 awake_intvl;	/* DTIM = (awake_intvl - 1) */
472 	struct rtl_btc_ops *btc_ops = rtlpriv->btcoexist.btc_ops;
473 	bool bt_ctrl_lps = (rtlpriv->cfg->ops->get_btc_status() ?
474 			    btc_ops->btc_is_bt_ctrl_lps(rtlpriv) : false);
475 	bool bt_lps_on = (rtlpriv->cfg->ops->get_btc_status() ?
476 			  btc_ops->btc_is_bt_lps_on(rtlpriv) : false);
477 
478 	if (bt_ctrl_lps)
479 		mode = (bt_lps_on ? FW_PS_MIN_MODE : FW_PS_ACTIVE_MODE);
480 
481 	rtl_dbg(rtlpriv, COMP_POWER, DBG_DMESG, "FW LPS mode = %d (coex:%d)\n",
482 		mode, bt_ctrl_lps);
483 
484 	switch (mode) {
485 	case FW_PS_MIN_MODE:
486 		rlbm = 0;
487 		awake_intvl = 2;
488 		break;
489 	case FW_PS_MAX_MODE:
490 		rlbm = 1;
491 		awake_intvl = 2;
492 		break;
493 	case FW_PS_DTIM_MODE:
494 		rlbm = 2;
495 		awake_intvl = ppsc->reg_max_lps_awakeintvl;
496 		/* hw->conf.ps_dtim_period or mac->vif->bss_conf.dtim_period
497 		 * is only used in swlps.
498 		 */
499 		break;
500 	default:
501 		rlbm = 2;
502 		awake_intvl = 4;
503 		break;
504 	}
505 
506 	if (rtlpriv->mac80211.p2p) {
507 		awake_intvl = 2;
508 		rlbm = 1;
509 	}
510 
511 	if (mode == FW_PS_ACTIVE_MODE) {
512 		byte5 = 0x40;
513 		power_state = FW_PWR_STATE_ACTIVE;
514 	} else {
515 		if (bt_ctrl_lps) {
516 			byte5 = btc_ops->btc_get_lps_val(rtlpriv);
517 			power_state = btc_ops->btc_get_rpwm_val(rtlpriv);
518 
519 			if ((rlbm == 2) && (byte5 & BIT(4))) {
520 				/* Keep awake interval to 1 to prevent from
521 				 * decreasing coex performance
522 				 */
523 				awake_intvl = 2;
524 				rlbm = 2;
525 			}
526 		} else {
527 			byte5 = 0x40;
528 			power_state = FW_PWR_STATE_RF_OFF;
529 		}
530 	}
531 
532 	SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, ((mode) ? 1 : 0));
533 	SET_H2CCMD_PWRMODE_PARM_RLBM(u1_h2c_set_pwrmode, rlbm);
534 	SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode,
535 					 bt_ctrl_lps ? 0 :
536 					 ((rtlpriv->mac80211.p2p) ?
537 					  ppsc->smart_ps : 1));
538 	SET_H2CCMD_PWRMODE_PARM_AWAKE_INTERVAL(u1_h2c_set_pwrmode,
539 					       awake_intvl);
540 	SET_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(u1_h2c_set_pwrmode, 0);
541 	SET_H2CCMD_PWRMODE_PARM_PWR_STATE(u1_h2c_set_pwrmode, power_state);
542 	SET_H2CCMD_PWRMODE_PARM_BYTE5(u1_h2c_set_pwrmode, byte5);
543 
544 	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
545 		      "rtl92c_set_fw_pwrmode(): u1_h2c_set_pwrmode\n",
546 		      u1_h2c_set_pwrmode, H2C_8821AE_PWEMODE_LENGTH);
547 	if (rtlpriv->cfg->ops->get_btc_status())
548 		btc_ops->btc_record_pwr_mode(rtlpriv, u1_h2c_set_pwrmode,
549 					     H2C_8821AE_PWEMODE_LENGTH);
550 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_SETPWRMODE,
551 			       H2C_8821AE_PWEMODE_LENGTH,
552 			       u1_h2c_set_pwrmode);
553 }
554 
555 void rtl8821ae_set_fw_media_status_rpt_cmd(struct ieee80211_hw *hw,
556 					   u8 mstatus)
557 {
558 	u8 parm[3] = { 0, 0, 0 };
559 	/* parm[0]: bit0=0-->Disconnect, bit0=1-->Connect
560 	 *          bit1=0-->update Media Status to MACID
561 	 *          bit1=1-->update Media Status from MACID to MACID_End
562 	 * parm[1]: MACID, if this is INFRA_STA, MacID = 0
563 	 * parm[2]: MACID_End
564 	 */
565 
566 	SET_H2CCMD_MSRRPT_PARM_OPMODE(parm, mstatus);
567 	SET_H2CCMD_MSRRPT_PARM_MACID_IND(parm, 0);
568 
569 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_MSRRPT, 3, parm);
570 }
571 
572 void rtl8821ae_set_fw_ap_off_load_cmd(struct ieee80211_hw *hw,
573 				      u8 ap_offload_enable)
574 {
575 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
576 	u8 u1_apoffload_parm[H2C_8821AE_AP_OFFLOAD_LENGTH] = { 0 };
577 
578 	SET_H2CCMD_AP_OFFLOAD_ON(u1_apoffload_parm, ap_offload_enable);
579 	SET_H2CCMD_AP_OFFLOAD_HIDDEN(u1_apoffload_parm, mac->hiddenssid);
580 	SET_H2CCMD_AP_OFFLOAD_DENYANY(u1_apoffload_parm, 0);
581 
582 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AP_OFFLOAD,
583 			       H2C_8821AE_AP_OFFLOAD_LENGTH,
584 			       u1_apoffload_parm);
585 }
586 
587 void rtl8821ae_set_fw_wowlan_mode(struct ieee80211_hw *hw, bool func_en)
588 {
589 	struct rtl_priv *rtlpriv = rtl_priv(hw);
590 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
591 	u8 fw_wowlan_info[H2C_8821AE_WOWLAN_LENGTH] = {0};
592 
593 	rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, "enable(%d)\n", func_en);
594 
595 	SET_8812_H2CCMD_WOWLAN_FUNC_ENABLE(fw_wowlan_info,
596 					   (func_en ? true : false));
597 
598 	SET_8812_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(fw_wowlan_info,
599 		((ppsc->wo_wlan_mode & WAKE_ON_PATTERN_MATCH) ? 1 : 0));
600 	SET_8812_H2CCMD_WOWLAN_MAGIC_PKT_ENABLE(fw_wowlan_info,
601 		((ppsc->wo_wlan_mode & WAKE_ON_MAGIC_PACKET) ? 1 : 0));
602 
603 	SET_8812_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(fw_wowlan_info, 0);
604 	SET_8812_H2CCMD_WOWLAN_ALL_PKT_DROP(fw_wowlan_info, false);
605 	SET_8812_H2CCMD_WOWLAN_GPIO_ACTIVE(fw_wowlan_info, 0);
606 	SET_8812_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(fw_wowlan_info, 1);
607 	SET_8812_H2CCMD_WOWLAN_GPIONUM(fw_wowlan_info, 0);
608 	SET_8812_H2CCMD_WOWLAN_GPIO_DURATION(fw_wowlan_info, 0);
609 
610 	RT_PRINT_DATA(rtlpriv, COMP_POWER, DBG_DMESG,
611 		      "wowlan mode: cmd 0x80: Content:\n",
612 		      fw_wowlan_info, H2C_8821AE_WOWLAN_LENGTH);
613 
614 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_WO_WLAN,
615 			       H2C_8821AE_WOWLAN_LENGTH,
616 			       fw_wowlan_info);
617 }
618 
619 void rtl8821ae_set_fw_remote_wake_ctrl_cmd(struct ieee80211_hw *hw,
620 					   u8 enable)
621 {
622 	struct rtl_priv *rtlpriv = rtl_priv(hw);
623 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
624 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
625 	u8 remote_wake_ctrl_parm[H2C_8821AE_REMOTE_WAKE_CTRL_LEN] = {0};
626 
627 	rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD,
628 		"enable=%d, ARP offload=%d, GTK offload=%d\n",
629 		enable, ppsc->arp_offload_enable, ppsc->gtk_offload_enable);
630 
631 	SET_8812_H2CCMD_REMOTE_WAKECTRL_ENABLE(remote_wake_ctrl_parm, enable);
632 	SET_8812_H2CCMD_REMOTE_WAKE_CTRL_ARP_OFFLOAD_EN(remote_wake_ctrl_parm,
633 					(ppsc->arp_offload_enable ? 1 : 0));
634 	SET_8812_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(remote_wake_ctrl_parm,
635 					(ppsc->gtk_offload_enable ? 1 : 0));
636 	SET_8812_H2CCMD_REMOTE_WAKE_CTRL_REALWOWV2_EN(remote_wake_ctrl_parm,
637 					(rtlhal->real_wow_v2_enable ? 1 : 0));
638 
639 	RT_PRINT_DATA(rtlpriv, COMP_POWER, DBG_TRACE,
640 		      "remote_wake_ctrl: cmd 0x4: Content:\n",
641 		      remote_wake_ctrl_parm, H2C_8821AE_REMOTE_WAKE_CTRL_LEN);
642 
643 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_REMOTE_WAKE_CTRL,
644 			       H2C_8821AE_REMOTE_WAKE_CTRL_LEN,
645 			       remote_wake_ctrl_parm);
646 }
647 
648 void rtl8821ae_set_fw_keep_alive_cmd(struct ieee80211_hw *hw,
649 				     bool func_en)
650 {
651 	struct rtl_priv *rtlpriv = rtl_priv(hw);
652 	u8 keep_alive_info[H2C_8821AE_KEEP_ALIVE_CTRL_LENGTH] = {0};
653 
654 	rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD, "Enable(%d)\n", func_en);
655 
656 	SET_8812_H2CCMD_KEEP_ALIVE_ENABLE(keep_alive_info, func_en);
657 	/* 1: the period is controled by driver, 0: by Fw default */
658 	SET_8812_H2CCMD_KEEP_ALIVE_ACCPEPT_USER_DEFINED(keep_alive_info, 1);
659 	SET_8812_H2CCMD_KEEP_ALIVE_PERIOD(keep_alive_info, 10); /* 10 sec */
660 
661 	RT_PRINT_DATA(rtlpriv, COMP_POWER, DBG_TRACE,
662 		      "keep alive: cmd 0x3: Content:\n",
663 		      keep_alive_info, H2C_8821AE_KEEP_ALIVE_CTRL);
664 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_KEEP_ALIVE_CTRL,
665 			       H2C_8821AE_KEEP_ALIVE_CTRL_LENGTH,
666 			       keep_alive_info);
667 }
668 
669 void rtl8821ae_set_fw_disconnect_decision_ctrl_cmd(struct ieee80211_hw *hw,
670 						   bool enabled)
671 {
672 	struct rtl_priv *rtlpriv = rtl_priv(hw);
673 	u8 parm[H2C_8821AE_DISCONNECT_DECISION_CTRL_LEN] = {0};
674 
675 	SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_ENABLE(parm, enabled);
676 	SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_USER_SETTING(parm, 1);
677 	SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_CHECK_PERIOD(parm, 30);
678 	SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_TRYPKT_NUM(parm, 3);
679 
680 	RT_PRINT_DATA(rtlpriv, COMP_POWER, DBG_TRACE,
681 		      "disconnect_decision_ctrl: cmd 0x4: Content:\n",
682 		      parm, H2C_8821AE_DISCONNECT_DECISION_CTRL_LEN);
683 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_DISCONNECT_DECISION,
684 			       H2C_8821AE_DISCONNECT_DECISION_CTRL_LEN, parm);
685 }
686 
687 void rtl8821ae_set_fw_global_info_cmd(struct ieee80211_hw *hw)
688 {
689 	struct rtl_priv *rtlpriv = rtl_priv(hw);
690 	struct rtl_security *sec = &rtlpriv->sec;
691 	u8 remote_wakeup_sec_info[H2C_8821AE_AOAC_GLOBAL_INFO_LEN] = {0};
692 
693 	rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD,
694 		"PairwiseEncAlgorithm=%d, GroupEncAlgorithm=%d\n",
695 		sec->pairwise_enc_algorithm, sec->group_enc_algorithm);
696 
697 	SET_8812_H2CCMD_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(
698 						remote_wakeup_sec_info,
699 						sec->pairwise_enc_algorithm);
700 	SET_8812_H2CCMD_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(remote_wakeup_sec_info,
701 						      sec->group_enc_algorithm);
702 
703 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_GLOBAL_INFO,
704 			       H2C_8821AE_AOAC_GLOBAL_INFO_LEN,
705 			       remote_wakeup_sec_info);
706 
707 	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_TRACE,
708 		      "rtl8821ae_set_global_info: cmd 0x82:\n",
709 		      remote_wakeup_sec_info, H2C_8821AE_AOAC_GLOBAL_INFO_LEN);
710 }
711 
712 #define BEACON_PG		0
713 #define PSPOLL_PG		1
714 #define NULL_PG			2
715 #define QOSNULL_PG		3
716 #define BT_QOSNULL_PG	4
717 #define ARPRESP_PG		5
718 #define REMOTE_PG		6
719 #define GTKEXT_PG		7
720 
721 #define TOTAL_RESERVED_PKT_LEN_8812	4096
722 #define TOTAL_RESERVED_PKT_LEN_8821	2048
723 
724 static u8 reserved_page_packet_8821[TOTAL_RESERVED_PKT_LEN_8821] = {
725 	/* page 0: beacon */
726 	0x80, 0x00, 0x00, 0x00,  0xff, 0xff, 0xff, 0xff,
727 	0xff, 0xff, 0x00, 0xe0,  0x4c, 0x02, 0xe2, 0x64,
728 	0x40, 0x16, 0x9f, 0x23,  0xd4, 0x46, 0x20, 0x00,
729 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
730 	0x64, 0x00, 0x20, 0x04,  0x00, 0x06, 0x64, 0x6c,
731 	0x69, 0x6e, 0x6b, 0x31,  0x01, 0x08, 0x82, 0x84,
732 	0x8b, 0x96, 0x0c, 0x18,  0x30, 0x48, 0x03, 0x01,
733 	0x0b, 0x06, 0x02, 0x00,  0x00, 0x2a, 0x01, 0x8b,
734 	0x32, 0x04, 0x12, 0x24,  0x60, 0x6c, 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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
751 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
752 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
753 	0x10, 0x00, 0x28, 0x8c,  0x00, 0x12, 0x00, 0x00,
754 	0x00, 0x00, 0x00, 0x00,  0x00, 0x81, 0x00, 0x00,
755 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
756 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
757 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
758 	/* page 1: ps-poll */
759 	0xa4, 0x10, 0x01, 0xc0,  0x40, 0x16, 0x9f, 0x23,
760 	0xd4, 0x46, 0x00, 0xe0,  0x4c, 0x02, 0xe2, 0x64,
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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
784 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
785 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
786 	0x18, 0x00, 0x28, 0x8c,  0x00, 0x12, 0x00, 0x00,
787 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
788 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
789 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
790 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
791 	/* page 2: null data */
792 	0x48, 0x01, 0x00, 0x00,  0x40, 0x16, 0x9f, 0x23,
793 	0xd4, 0x46, 0x00, 0xe0,  0x4c, 0x02, 0xe2, 0x64,
794 	0x40, 0x16, 0x9f, 0x23,  0xd4, 0x46, 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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
817 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
818 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
819 	0x1A, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
820 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
821 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
822 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
823 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
824 	/* page 3: qos null data */
825 	0xC8, 0x01, 0x00, 0x00,  0x84, 0xC9, 0XB2, 0xA7,
826 	0XB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
827 	0x84, 0xC9, 0XB2, 0xA7,  0XB3, 0x6E, 0x00, 0x00,
828 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
829 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
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 	0x1A, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
853 	0x00, 0x00, 0x80, 0x00,  0x00, 0x01, 0x00, 0x00,
854 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
855 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
856 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
857 	/* page 4: BT qos null data */
858 	0xC8, 0x01, 0x00, 0x00,  0x84, 0xC9, 0XB2, 0xA7,
859 	0XB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
860 	0x84, 0xC9, 0XB2, 0xA7,  0XB3, 0x6E, 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 	0x3C, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
886 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
887 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
888 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
889 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
890 	/* page 5~7 is for wowlan */
891 	/* page 5: ARP resp */
892 	0x08, 0x01, 0x00, 0x00,  0x84, 0xC9, 0XB2, 0xA7,
893 	0XB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
894 	0x84, 0xC9, 0XB2, 0xA7,  0XB3, 0x6E, 0x00, 0x00,
895 	0xAA, 0xAA, 0x03, 0x00,  0x00, 0x00, 0x08, 0x06,
896 	0x00, 0x01, 0x08, 0x00,  0x06, 0x04, 0x00, 0x02,
897 	0x00, 0xE0, 0x4C, 0x02,  0x51, 0x02, 0x00, 0x00,
898 	0x00, 0x00, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
922 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
923 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
924 	/* page 6: H2C_REMOTE_WAKE_CTRL_INFO */
925 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
926 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
927 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
928 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
929 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
930 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
931 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
932 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
933 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
934 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
935 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
936 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
937 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
938 	0x00, 0x00, 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 	/* page 7: Rsvd GTK extend memory (zero memory) */
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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
985 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
986 	0x00, 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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
990 };
991 
992 static u8 reserved_page_packet_8812[TOTAL_RESERVED_PKT_LEN_8812] = {
993 	/* page 0: beacon */
994 	0x80, 0x00, 0x00, 0x00,  0xFF, 0xFF, 0xFF, 0xFF,
995 	0xFF, 0xFF, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
996 	0x84, 0xC9, 0XB2, 0xA7,  0XB3, 0x6E, 0x60, 0x00,
997 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
998 	0x64, 0x00, 0x20, 0x04,  0x00, 0x03, 0x32, 0x31,
999 	0x35, 0x01, 0x08, 0x82,  0x84, 0x8B, 0x96, 0x0C,
1000 	0x12, 0x18, 0x24, 0x03,  0x01, 0x01, 0x06, 0x02,
1001 	0x00, 0x00, 0x2A, 0x01,  0x02, 0x32, 0x04, 0x30,
1002 	0x48, 0x60, 0x6C, 0x2D,  0x1A, 0xED, 0x09, 0x03,
1003 	0xFF, 0xFF, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1004 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1005 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x3D,
1006 	0x00, 0xDD, 0x07, 0x00,  0xE0, 0x4C, 0x02, 0x02,
1007 	0x08, 0x04, 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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1050 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1051 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1052 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1053 	0x10, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1054 	0x00, 0x00, 0x00, 0x00,  0x00, 0x81, 0x00, 0x00,
1055 	0x04, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1056 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1057 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1058 	/* page 1: ps-poll */
1059 	0xA4, 0x10, 0x09, 0xC0,  0x84, 0xC9, 0XB2, 0xA7,
1060 	0XB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1115 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1116 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1117 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1118 	0x18, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1119 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
1120 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1121 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1122 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1123 	/* page 2: null data */
1124 	0x48, 0x01, 0x00, 0x00,  0x84, 0xC9, 0XB2, 0xA7,
1125 	0XB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1126 	0x84, 0xC9, 0XB2, 0xA7,  0XB3, 0x6E, 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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1180 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1181 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1182 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1183 	0x1A, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1184 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
1185 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1186 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1187 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1188 	/* page 3: Qos null data */
1189 	0xC8, 0x01, 0x00, 0x00,  0x84, 0xC9, 0XB2, 0xA7,
1190 	0XB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1191 	0x84, 0xC9, 0XB2, 0xA7,  0XB3, 0x6E, 0x00, 0x00,
1192 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
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 	0x1A, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1249 	0x00, 0x00, 0x80, 0x00,  0x00, 0x01, 0x00, 0x00,
1250 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1251 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1252 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1253 	/* page 4: BT Qos null data */
1254 	0xC8, 0x01, 0x00, 0x00,  0x84, 0xC9, 0XB2, 0xA7,
1255 	0XB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1256 	0x84, 0xC9, 0XB2, 0xA7,  0XB3, 0x6E, 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 	0x3C, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1314 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
1315 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1316 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1317 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1318 	/* page 5~7 is for wowlan */
1319 	/* page 5: ARP resp */
1320 	0x08, 0x01, 0x00, 0x00,  0x84, 0xC9, 0XB2, 0xA7,
1321 	0XB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1322 	0x84, 0xC9, 0XB2, 0xA7,  0XB3, 0x6E, 0x00, 0x00,
1323 	0xAA, 0xAA, 0x03, 0x00,  0x00, 0x00, 0x08, 0x06,
1324 	0x00, 0x01, 0x08, 0x00,  0x06, 0x04, 0x00, 0x02,
1325 	0x00, 0xE0, 0x4C, 0x02,  0x51, 0x02, 0x00, 0x00,
1326 	0x00, 0x00, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1381 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1382 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1383 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1384 	/* page 6: H2C_REMOTE_WAKE_CTRL_INFO */
1385 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1386 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1387 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1388 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1389 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1390 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1391 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1392 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1393 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1394 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1395 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1396 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1397 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1398 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1399 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1400 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1401 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1402 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1403 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1404 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1405 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1406 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1407 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1408 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1409 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1410 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1411 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1412 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1413 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1414 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1415 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1416 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1417 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1418 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1419 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1420 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1421 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1422 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1423 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1424 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1425 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1426 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1427 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1428 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1429 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1430 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1431 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1432 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1433 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1434 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1435 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1436 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1437 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1438 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1439 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1440 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1441 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1442 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1443 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1444 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1445 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1446 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1447 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1448 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1449 	/* page 7: Rsvd GTK extend memory (zero memory) */
1450 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1451 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1452 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1453 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1454 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1455 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1456 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1457 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1458 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1459 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1460 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1461 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1462 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1463 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1464 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1465 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1466 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1467 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1468 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1469 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1470 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1471 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1472 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1473 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1474 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1475 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1476 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1477 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1478 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1479 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1480 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1481 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1482 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1483 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1484 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1485 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1486 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1487 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1488 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1489 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1490 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1491 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1492 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1493 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1494 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1495 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1496 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1497 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1498 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1499 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1500 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1501 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1502 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1503 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1504 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1505 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1506 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1507 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1508 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1509 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1510 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1511 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1512 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1513 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1514 };
1515 
1516 void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1517 				  bool b_dl_finished, bool dl_whole_packets)
1518 {
1519 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1520 	struct rtl_mac *mac = rtl_mac(rtlpriv);
1521 	struct sk_buff *skb = NULL;
1522 	u32 totalpacketlen;
1523 	bool rtstatus;
1524 	u8 u1rsvdpageloc[5] = { 0 };
1525 	u8 u1rsvdpageloc2[7] = { 0 };
1526 	bool b_dlok = false;
1527 	u8 *beacon;
1528 	u8 *p_pspoll;
1529 	u8 *nullfunc;
1530 	u8 *qosnull;
1531 	u8 *btqosnull;
1532 	u8 *arpresp;
1533 
1534 	/*---------------------------------------------------------
1535 	 *			(1) beacon
1536 	 *---------------------------------------------------------
1537 	 */
1538 	beacon = &reserved_page_packet_8812[BEACON_PG * 512];
1539 	SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr);
1540 	SET_80211_HDR_ADDRESS3(beacon, mac->bssid);
1541 
1542 	if (b_dl_finished) {
1543 		totalpacketlen = 512 - 40;
1544 		goto out;
1545 	}
1546 	/*-------------------------------------------------------
1547 	 *			(2) ps-poll
1548 	 *--------------------------------------------------------
1549 	 */
1550 	p_pspoll = &reserved_page_packet_8812[PSPOLL_PG * 512];
1551 	SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000));
1552 	SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid);
1553 	SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr);
1554 
1555 	SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1rsvdpageloc, PSPOLL_PG);
1556 
1557 	/*--------------------------------------------------------
1558 	 *			(3) null data
1559 	 *---------------------------------------------------------
1560 	 */
1561 	nullfunc = &reserved_page_packet_8812[NULL_PG * 512];
1562 	SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid);
1563 	SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr);
1564 	SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid);
1565 
1566 	SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1rsvdpageloc, NULL_PG);
1567 
1568 	/*---------------------------------------------------------
1569 	 *			(4) Qos null data
1570 	 *----------------------------------------------------------
1571 	 */
1572 	qosnull = &reserved_page_packet_8812[QOSNULL_PG * 512];
1573 	SET_80211_HDR_ADDRESS1(qosnull, mac->bssid);
1574 	SET_80211_HDR_ADDRESS2(qosnull, mac->mac_addr);
1575 	SET_80211_HDR_ADDRESS3(qosnull, mac->bssid);
1576 
1577 	SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1rsvdpageloc, QOSNULL_PG);
1578 
1579 	/*---------------------------------------------------------
1580 	 *			(5) BT Qos null data
1581 	 *----------------------------------------------------------
1582 	 */
1583 	btqosnull = &reserved_page_packet_8812[BT_QOSNULL_PG * 512];
1584 	SET_80211_HDR_ADDRESS1(btqosnull, mac->bssid);
1585 	SET_80211_HDR_ADDRESS2(btqosnull, mac->mac_addr);
1586 	SET_80211_HDR_ADDRESS3(btqosnull, mac->bssid);
1587 
1588 	SET_H2CCMD_RSVDPAGE_LOC_BT_QOS_NULL_DATA(u1rsvdpageloc, BT_QOSNULL_PG);
1589 
1590 	if (!dl_whole_packets) {
1591 		totalpacketlen = 512 * (BT_QOSNULL_PG + 1) - 40;
1592 		goto out;
1593 	}
1594 	/*---------------------------------------------------------
1595 	 *			(6) ARP Resp
1596 	 *----------------------------------------------------------
1597 	 */
1598 	arpresp = &reserved_page_packet_8812[ARPRESP_PG * 512];
1599 	SET_80211_HDR_ADDRESS1(arpresp, mac->bssid);
1600 	SET_80211_HDR_ADDRESS2(arpresp, mac->mac_addr);
1601 	SET_80211_HDR_ADDRESS3(arpresp, mac->bssid);
1602 
1603 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1rsvdpageloc2, ARPRESP_PG);
1604 
1605 	/*---------------------------------------------------------
1606 	 *			(7) Remote Wake Ctrl
1607 	 *----------------------------------------------------------
1608 	 */
1609 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1rsvdpageloc2,
1610 								REMOTE_PG);
1611 
1612 	/*---------------------------------------------------------
1613 	 *			(8) GTK Ext Memory
1614 	 *----------------------------------------------------------
1615 	 */
1616 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1rsvdpageloc2, GTKEXT_PG);
1617 
1618 	totalpacketlen = TOTAL_RESERVED_PKT_LEN_8812 - 40;
1619 
1620 out:
1621 	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
1622 		      "rtl8812ae_set_fw_rsvdpagepkt(): packet data\n",
1623 		      &reserved_page_packet_8812[0], totalpacketlen);
1624 
1625 	skb = dev_alloc_skb(totalpacketlen);
1626 	if (!skb)
1627 		return;
1628 	skb_put_data(skb, &reserved_page_packet_8812, totalpacketlen);
1629 
1630 	rtstatus = rtl_cmd_send_packet(hw, skb);
1631 
1632 	if (rtstatus)
1633 		b_dlok = true;
1634 
1635 	if (!b_dl_finished && b_dlok) {
1636 		RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1637 			      "H2C_RSVDPAGE:\n", u1rsvdpageloc, 5);
1638 		rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RSVDPAGE,
1639 				       sizeof(u1rsvdpageloc), u1rsvdpageloc);
1640 		if (dl_whole_packets) {
1641 			RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1642 				      "wowlan H2C_RSVDPAGE:\n", u1rsvdpageloc2, 7);
1643 			rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_RSVDPAGE,
1644 					       sizeof(u1rsvdpageloc2), u1rsvdpageloc2);
1645 		}
1646 	}
1647 
1648 	if (!b_dlok)
1649 		rtl_dbg(rtlpriv, COMP_ERR, DBG_WARNING,
1650 			"Set RSVD page location to Fw FAIL!!!!!!.\n");
1651 }
1652 
1653 void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1654 				  bool b_dl_finished, bool dl_whole_packets)
1655 {
1656 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1657 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
1658 	struct sk_buff *skb = NULL;
1659 	u32 totalpacketlen;
1660 	bool rtstatus;
1661 	u8 u1rsvdpageloc[5] = { 0 };
1662 	u8 u1rsvdpageloc2[7] = { 0 };
1663 	bool b_dlok = false;
1664 	u8 *beacon;
1665 	u8 *p_pspoll;
1666 	u8 *nullfunc;
1667 	u8 *qosnull;
1668 	u8 *btqosnull;
1669 	u8 *arpresp;
1670 
1671 	/*---------------------------------------------------------
1672 	 *			(1) beacon
1673 	 *---------------------------------------------------------
1674 	 */
1675 	beacon = &reserved_page_packet_8821[BEACON_PG * 256];
1676 	SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr);
1677 	SET_80211_HDR_ADDRESS3(beacon, mac->bssid);
1678 
1679 	if (b_dl_finished) {
1680 		totalpacketlen = 256 - 40;
1681 		goto out;
1682 	}
1683 	/*-------------------------------------------------------
1684 	 *			(2) ps-poll
1685 	 *--------------------------------------------------------
1686 	 */
1687 	p_pspoll = &reserved_page_packet_8821[PSPOLL_PG * 256];
1688 	SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000));
1689 	SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid);
1690 	SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr);
1691 
1692 	SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1rsvdpageloc, PSPOLL_PG);
1693 
1694 	/*--------------------------------------------------------
1695 	 *			(3) null data
1696 	 *---------------------------------------------------------i
1697 	 */
1698 	nullfunc = &reserved_page_packet_8821[NULL_PG * 256];
1699 	SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid);
1700 	SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr);
1701 	SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid);
1702 
1703 	SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1rsvdpageloc, NULL_PG);
1704 
1705 	/*---------------------------------------------------------
1706 	 *			(4) Qos null data
1707 	 *----------------------------------------------------------
1708 	 */
1709 	qosnull = &reserved_page_packet_8821[QOSNULL_PG * 256];
1710 	SET_80211_HDR_ADDRESS1(qosnull, mac->bssid);
1711 	SET_80211_HDR_ADDRESS2(qosnull, mac->mac_addr);
1712 	SET_80211_HDR_ADDRESS3(qosnull, mac->bssid);
1713 
1714 	SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1rsvdpageloc, QOSNULL_PG);
1715 
1716 	/*---------------------------------------------------------
1717 	 *			(5) Qos null data
1718 	 *----------------------------------------------------------
1719 	 */
1720 	btqosnull = &reserved_page_packet_8821[BT_QOSNULL_PG * 256];
1721 	SET_80211_HDR_ADDRESS1(btqosnull, mac->bssid);
1722 	SET_80211_HDR_ADDRESS2(btqosnull, mac->mac_addr);
1723 	SET_80211_HDR_ADDRESS3(btqosnull, mac->bssid);
1724 
1725 	SET_H2CCMD_RSVDPAGE_LOC_BT_QOS_NULL_DATA(u1rsvdpageloc, BT_QOSNULL_PG);
1726 
1727 	if (!dl_whole_packets) {
1728 		totalpacketlen = 256 * (BT_QOSNULL_PG + 1) - 40;
1729 		goto out;
1730 	}
1731 	/*---------------------------------------------------------
1732 	 *			(6) ARP Resp
1733 	 *----------------------------------------------------------
1734 	 */
1735 	arpresp = &reserved_page_packet_8821[ARPRESP_PG * 256];
1736 	SET_80211_HDR_ADDRESS1(arpresp, mac->bssid);
1737 	SET_80211_HDR_ADDRESS2(arpresp, mac->mac_addr);
1738 	SET_80211_HDR_ADDRESS3(arpresp, mac->bssid);
1739 
1740 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1rsvdpageloc2, ARPRESP_PG);
1741 
1742 	/*---------------------------------------------------------
1743 	 *			(7) Remote Wake Ctrl
1744 	 *----------------------------------------------------------
1745 	 */
1746 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1rsvdpageloc2,
1747 									REMOTE_PG);
1748 
1749 	/*---------------------------------------------------------
1750 	 *			(8) GTK Ext Memory
1751 	 *----------------------------------------------------------
1752 	 */
1753 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1rsvdpageloc2, GTKEXT_PG);
1754 
1755 	totalpacketlen = TOTAL_RESERVED_PKT_LEN_8821 - 40;
1756 
1757 out:
1758 
1759 	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
1760 		      "rtl8821ae_set_fw_rsvdpagepkt(): packet data\n",
1761 		      &reserved_page_packet_8821[0], totalpacketlen);
1762 
1763 	skb = dev_alloc_skb(totalpacketlen);
1764 	if (!skb)
1765 		return;
1766 	skb_put_data(skb, &reserved_page_packet_8821, totalpacketlen);
1767 
1768 	rtstatus = rtl_cmd_send_packet(hw, skb);
1769 
1770 	if (rtstatus)
1771 		b_dlok = true;
1772 
1773 	if (!b_dl_finished && b_dlok) {
1774 		rtl_dbg(rtlpriv, COMP_POWER, DBG_LOUD,
1775 			"Set RSVD page location to Fw.\n");
1776 		RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1777 				"H2C_RSVDPAGE:\n", u1rsvdpageloc, 5);
1778 		rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RSVDPAGE,
1779 				       sizeof(u1rsvdpageloc), u1rsvdpageloc);
1780 		if (dl_whole_packets) {
1781 			RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1782 				      "wowlan H2C_RSVDPAGE:\n",
1783 				      u1rsvdpageloc2, 7);
1784 			rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_RSVDPAGE,
1785 					       sizeof(u1rsvdpageloc2),
1786 					       u1rsvdpageloc2);
1787 		}
1788 	}
1789 
1790 	if (!b_dlok) {
1791 		rtl_dbg(rtlpriv, COMP_ERR, DBG_WARNING,
1792 			"Set RSVD page location to Fw FAIL!!!!!!.\n");
1793 	}
1794 }
1795 
1796 /*Should check FW support p2p or not.*/
1797 static void rtl8821ae_set_p2p_ctw_period_cmd(struct ieee80211_hw *hw, u8 ctwindow)
1798 {
1799 	u8 u1_ctwindow_period[1] = { ctwindow};
1800 
1801 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_P2P_PS_CTW_CMD, 1,
1802 			       u1_ctwindow_period);
1803 }
1804 
1805 void rtl8821ae_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
1806 {
1807 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1808 	struct rtl_ps_ctl *rtlps = rtl_psc(rtl_priv(hw));
1809 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1810 	struct rtl_p2p_ps_info *p2pinfo = &rtlps->p2p_ps_info;
1811 	struct p2p_ps_offload_t *p2p_ps_offload = &rtlhal->p2p_ps_offload;
1812 	u8	i;
1813 	u16	ctwindow;
1814 	u32	start_time, tsf_low;
1815 
1816 	switch (p2p_ps_state) {
1817 	case P2P_PS_DISABLE:
1818 		rtl_dbg(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_DISABLE\n");
1819 		memset(p2p_ps_offload, 0, sizeof(*p2p_ps_offload));
1820 		break;
1821 	case P2P_PS_ENABLE:
1822 		rtl_dbg(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_ENABLE\n");
1823 		/* update CTWindow value. */
1824 		if (p2pinfo->ctwindow > 0) {
1825 			p2p_ps_offload->ctwindow_en = 1;
1826 			ctwindow = p2pinfo->ctwindow;
1827 			rtl8821ae_set_p2p_ctw_period_cmd(hw, ctwindow);
1828 		}
1829 
1830 		/* hw only support 2 set of NoA */
1831 		for (i = 0 ; i < p2pinfo->noa_num ; i++) {
1832 			/* To control the register setting for which NOA*/
1833 			rtl_write_byte(rtlpriv, 0x5cf, (i << 4));
1834 			if (i == 0)
1835 				p2p_ps_offload->noa0_en = 1;
1836 			else
1837 				p2p_ps_offload->noa1_en = 1;
1838 
1839 			/* config P2P NoA Descriptor Register */
1840 			rtl_write_dword(rtlpriv, 0x5E0, p2pinfo->noa_duration[i]);
1841 			rtl_write_dword(rtlpriv, 0x5E4, p2pinfo->noa_interval[i]);
1842 
1843 			/*Get Current TSF value */
1844 			tsf_low = rtl_read_dword(rtlpriv, REG_TSFTR);
1845 
1846 			start_time = p2pinfo->noa_start_time[i];
1847 			if (p2pinfo->noa_count_type[i] != 1) {
1848 				while (start_time <= (tsf_low+(50*1024))) {
1849 					start_time += p2pinfo->noa_interval[i];
1850 					if (p2pinfo->noa_count_type[i] != 255)
1851 						p2pinfo->noa_count_type[i]--;
1852 				}
1853 			}
1854 			rtl_write_dword(rtlpriv, 0x5E8, start_time);
1855 			rtl_write_dword(rtlpriv, 0x5EC,
1856 					p2pinfo->noa_count_type[i]);
1857 		}
1858 
1859 		if ((p2pinfo->opp_ps == 1) || (p2pinfo->noa_num > 0)) {
1860 			/* rst p2p circuit */
1861 			rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, BIT(4));
1862 
1863 			p2p_ps_offload->offload_en = 1;
1864 
1865 			if (P2P_ROLE_GO == rtlpriv->mac80211.p2p) {
1866 				p2p_ps_offload->role = 1;
1867 				p2p_ps_offload->allstasleep = 0;
1868 			} else {
1869 				p2p_ps_offload->role = 0;
1870 			}
1871 
1872 			p2p_ps_offload->discovery = 0;
1873 		}
1874 		break;
1875 	case P2P_PS_SCAN:
1876 		rtl_dbg(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN\n");
1877 		p2p_ps_offload->discovery = 1;
1878 		break;
1879 	case P2P_PS_SCAN_DONE:
1880 		rtl_dbg(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN_DONE\n");
1881 		p2p_ps_offload->discovery = 0;
1882 		p2pinfo->p2p_ps_state = P2P_PS_ENABLE;
1883 		break;
1884 	default:
1885 		break;
1886 	}
1887 
1888 	rtl8821ae_fill_h2c_cmd(hw,
1889 			H2C_8821AE_P2P_PS_OFFLOAD, 1, (u8 *)p2p_ps_offload);
1890 }
1891 
1892 void rtl8821ae_c2h_ra_report_handler(struct ieee80211_hw *hw,
1893 				     u8 *cmd_buf, u8 cmd_len)
1894 {
1895 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1896 	u8 rate = cmd_buf[0] & 0x3F;
1897 
1898 	rtlhal->current_ra_rate = rtl8821ae_hw_rate_to_mrate(hw, rate);
1899 
1900 	rtl8821ae_dm_update_init_rate(hw, rate);
1901 }
1902