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 fail! 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, byte5 = 0;
493 	u8 awake_intvl;	/* DTIM = (awake_intvl - 1) */
494 	struct rtl_btc_ops *btc_ops = rtlpriv->btcoexist.btc_ops;
495 	bool bt_ctrl_lps = (rtlpriv->cfg->ops->get_btc_status() ?
496 			    btc_ops->btc_is_bt_ctrl_lps(rtlpriv) : false);
497 	bool bt_lps_on = (rtlpriv->cfg->ops->get_btc_status() ?
498 			  btc_ops->btc_is_bt_lps_on(rtlpriv) : false);
499 
500 	if (bt_ctrl_lps)
501 		mode = (bt_lps_on ? FW_PS_MIN_MODE : FW_PS_ACTIVE_MODE);
502 
503 	RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, "FW LPS mode = %d (coex:%d)\n",
504 		 mode, bt_ctrl_lps);
505 
506 	switch (mode) {
507 	case FW_PS_MIN_MODE:
508 		rlbm = 0;
509 		awake_intvl = 2;
510 		break;
511 	case FW_PS_MAX_MODE:
512 		rlbm = 1;
513 		awake_intvl = 2;
514 		break;
515 	case FW_PS_DTIM_MODE:
516 		rlbm = 2;
517 		awake_intvl = ppsc->reg_max_lps_awakeintvl;
518 		/* hw->conf.ps_dtim_period or mac->vif->bss_conf.dtim_period
519 		 * is only used in swlps.
520 		 */
521 		break;
522 	default:
523 		rlbm = 2;
524 		awake_intvl = 4;
525 		break;
526 	}
527 
528 	if (rtlpriv->mac80211.p2p) {
529 		awake_intvl = 2;
530 		rlbm = 1;
531 	}
532 
533 	if (mode == FW_PS_ACTIVE_MODE) {
534 		byte5 = 0x40;
535 		power_state = FW_PWR_STATE_ACTIVE;
536 	} else {
537 		if (bt_ctrl_lps) {
538 			byte5 = btc_ops->btc_get_lps_val(rtlpriv);
539 			power_state = btc_ops->btc_get_rpwm_val(rtlpriv);
540 
541 			if ((rlbm == 2) && (byte5 & BIT(4))) {
542 				/* Keep awake interval to 1 to prevent from
543 				 * decreasing coex performance
544 				 */
545 				awake_intvl = 2;
546 				rlbm = 2;
547 			}
548 		} else {
549 			byte5 = 0x40;
550 			power_state = FW_PWR_STATE_RF_OFF;
551 		}
552 	}
553 
554 	SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, ((mode) ? 1 : 0));
555 	SET_H2CCMD_PWRMODE_PARM_RLBM(u1_h2c_set_pwrmode, rlbm);
556 	SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode,
557 					 bt_ctrl_lps ? 0 :
558 					 ((rtlpriv->mac80211.p2p) ?
559 					  ppsc->smart_ps : 1));
560 	SET_H2CCMD_PWRMODE_PARM_AWAKE_INTERVAL(u1_h2c_set_pwrmode,
561 					       awake_intvl);
562 	SET_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(u1_h2c_set_pwrmode, 0);
563 	SET_H2CCMD_PWRMODE_PARM_PWR_STATE(u1_h2c_set_pwrmode, power_state);
564 	SET_H2CCMD_PWRMODE_PARM_BYTE5(u1_h2c_set_pwrmode, byte5);
565 
566 	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
567 		      "rtl92c_set_fw_pwrmode(): u1_h2c_set_pwrmode\n",
568 		      u1_h2c_set_pwrmode, H2C_8821AE_PWEMODE_LENGTH);
569 	if (rtlpriv->cfg->ops->get_btc_status())
570 		btc_ops->btc_record_pwr_mode(rtlpriv, u1_h2c_set_pwrmode,
571 					     H2C_8821AE_PWEMODE_LENGTH);
572 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_SETPWRMODE,
573 			       H2C_8821AE_PWEMODE_LENGTH,
574 			       u1_h2c_set_pwrmode);
575 }
576 
577 void rtl8821ae_set_fw_media_status_rpt_cmd(struct ieee80211_hw *hw,
578 					   u8 mstatus)
579 {
580 	u8 parm[3] = { 0, 0, 0 };
581 	/* parm[0]: bit0=0-->Disconnect, bit0=1-->Connect
582 	 *          bit1=0-->update Media Status to MACID
583 	 *          bit1=1-->update Media Status from MACID to MACID_End
584 	 * parm[1]: MACID, if this is INFRA_STA, MacID = 0
585 	 * parm[2]: MACID_End
586 	 */
587 
588 	SET_H2CCMD_MSRRPT_PARM_OPMODE(parm, mstatus);
589 	SET_H2CCMD_MSRRPT_PARM_MACID_IND(parm, 0);
590 
591 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_MSRRPT, 3, parm);
592 }
593 
594 void rtl8821ae_set_fw_ap_off_load_cmd(struct ieee80211_hw *hw,
595 				      u8 ap_offload_enable)
596 {
597 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
598 	u8 u1_apoffload_parm[H2C_8821AE_AP_OFFLOAD_LENGTH] = { 0 };
599 
600 	SET_H2CCMD_AP_OFFLOAD_ON(u1_apoffload_parm, ap_offload_enable);
601 	SET_H2CCMD_AP_OFFLOAD_HIDDEN(u1_apoffload_parm, mac->hiddenssid);
602 	SET_H2CCMD_AP_OFFLOAD_DENYANY(u1_apoffload_parm, 0);
603 
604 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AP_OFFLOAD,
605 			       H2C_8821AE_AP_OFFLOAD_LENGTH,
606 			       u1_apoffload_parm);
607 }
608 
609 void rtl8821ae_set_fw_wowlan_mode(struct ieee80211_hw *hw, bool func_en)
610 {
611 	struct rtl_priv *rtlpriv = rtl_priv(hw);
612 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
613 	u8 fw_wowlan_info[H2C_8821AE_WOWLAN_LENGTH] = {0};
614 
615 	RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "enable(%d)\n", func_en);
616 
617 	SET_8812_H2CCMD_WOWLAN_FUNC_ENABLE(fw_wowlan_info,
618 					   (func_en ? true : false));
619 
620 	SET_8812_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(fw_wowlan_info,
621 		((ppsc->wo_wlan_mode & WAKE_ON_PATTERN_MATCH) ? 1 : 0));
622 	SET_8812_H2CCMD_WOWLAN_MAGIC_PKT_ENABLE(fw_wowlan_info,
623 		((ppsc->wo_wlan_mode & WAKE_ON_MAGIC_PACKET) ? 1 : 0));
624 
625 	SET_8812_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(fw_wowlan_info, 0);
626 	SET_8812_H2CCMD_WOWLAN_ALL_PKT_DROP(fw_wowlan_info, false);
627 	SET_8812_H2CCMD_WOWLAN_GPIO_ACTIVE(fw_wowlan_info, 0);
628 	SET_8812_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(fw_wowlan_info, 1);
629 	SET_8812_H2CCMD_WOWLAN_GPIONUM(fw_wowlan_info, 0);
630 	SET_8812_H2CCMD_WOWLAN_GPIO_DURATION(fw_wowlan_info, 0);
631 
632 	RT_PRINT_DATA(rtlpriv, COMP_POWER, DBG_DMESG,
633 		      "wowlan mode: cmd 0x80: Content:\n",
634 		      fw_wowlan_info, H2C_8821AE_WOWLAN_LENGTH);
635 
636 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_WO_WLAN,
637 			       H2C_8821AE_WOWLAN_LENGTH,
638 			       fw_wowlan_info);
639 }
640 
641 void rtl8821ae_set_fw_remote_wake_ctrl_cmd(struct ieee80211_hw *hw,
642 					   u8 enable)
643 {
644 	struct rtl_priv *rtlpriv = rtl_priv(hw);
645 	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
646 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
647 	u8 remote_wake_ctrl_parm[H2C_8821AE_REMOTE_WAKE_CTRL_LEN] = {0};
648 
649 	RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
650 		 "enable=%d, ARP offload=%d, GTK offload=%d\n",
651 		 enable, ppsc->arp_offload_enable, ppsc->gtk_offload_enable);
652 
653 	SET_8812_H2CCMD_REMOTE_WAKECTRL_ENABLE(remote_wake_ctrl_parm, enable);
654 	SET_8812_H2CCMD_REMOTE_WAKE_CTRL_ARP_OFFLOAD_EN(remote_wake_ctrl_parm,
655 					(ppsc->arp_offload_enable ? 1 : 0));
656 	SET_8812_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(remote_wake_ctrl_parm,
657 					(ppsc->gtk_offload_enable ? 1 : 0));
658 	SET_8812_H2CCMD_REMOTE_WAKE_CTRL_REALWOWV2_EN(remote_wake_ctrl_parm,
659 					(rtlhal->real_wow_v2_enable ? 1 : 0));
660 
661 	RT_PRINT_DATA(rtlpriv, COMP_POWER, DBG_TRACE,
662 		      "remote_wake_ctrl: cmd 0x4: Content:\n",
663 		      remote_wake_ctrl_parm, H2C_8821AE_REMOTE_WAKE_CTRL_LEN);
664 
665 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_REMOTE_WAKE_CTRL,
666 			       H2C_8821AE_REMOTE_WAKE_CTRL_LEN,
667 			       remote_wake_ctrl_parm);
668 }
669 
670 void rtl8821ae_set_fw_keep_alive_cmd(struct ieee80211_hw *hw,
671 				     bool func_en)
672 {
673 	struct rtl_priv *rtlpriv = rtl_priv(hw);
674 	u8 keep_alive_info[H2C_8821AE_KEEP_ALIVE_CTRL_LENGTH] = {0};
675 
676 	RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "Enable(%d)\n", func_en);
677 
678 	SET_8812_H2CCMD_KEEP_ALIVE_ENABLE(keep_alive_info, func_en);
679 	/* 1: the period is controled by driver, 0: by Fw default */
680 	SET_8812_H2CCMD_KEEP_ALIVE_ACCPEPT_USER_DEFINED(keep_alive_info, 1);
681 	SET_8812_H2CCMD_KEEP_ALIVE_PERIOD(keep_alive_info, 10); /* 10 sec */
682 
683 	RT_PRINT_DATA(rtlpriv, COMP_POWER, DBG_TRACE,
684 		      "keep alive: cmd 0x3: Content:\n",
685 		      keep_alive_info, H2C_8821AE_KEEP_ALIVE_CTRL);
686 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_KEEP_ALIVE_CTRL,
687 			       H2C_8821AE_KEEP_ALIVE_CTRL_LENGTH,
688 			       keep_alive_info);
689 }
690 
691 void rtl8821ae_set_fw_disconnect_decision_ctrl_cmd(struct ieee80211_hw *hw,
692 						   bool enabled)
693 {
694 	struct rtl_priv *rtlpriv = rtl_priv(hw);
695 	u8 parm[H2C_8821AE_DISCONNECT_DECISION_CTRL_LEN] = {0};
696 
697 	SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_ENABLE(parm, enabled);
698 	SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_USER_SETTING(parm, 1);
699 	SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_CHECK_PERIOD(parm, 30);
700 	SET_8812_H2CCMD_DISCONNECT_DECISION_CTRL_TRYPKT_NUM(parm, 3);
701 
702 	RT_PRINT_DATA(rtlpriv, COMP_POWER, DBG_TRACE,
703 		      "disconnect_decision_ctrl: cmd 0x4: Content:\n",
704 		      parm, H2C_8821AE_DISCONNECT_DECISION_CTRL_LEN);
705 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_DISCONNECT_DECISION,
706 			       H2C_8821AE_DISCONNECT_DECISION_CTRL_LEN, parm);
707 }
708 
709 void rtl8821ae_set_fw_global_info_cmd(struct ieee80211_hw *hw)
710 {
711 	struct rtl_priv *rtlpriv = rtl_priv(hw);
712 	struct rtl_security *sec = &rtlpriv->sec;
713 	u8 remote_wakeup_sec_info[H2C_8821AE_AOAC_GLOBAL_INFO_LEN] = {0};
714 
715 	RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
716 		 "PairwiseEncAlgorithm=%d, GroupEncAlgorithm=%d\n",
717 		 sec->pairwise_enc_algorithm, sec->group_enc_algorithm);
718 
719 	SET_8812_H2CCMD_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(
720 						remote_wakeup_sec_info,
721 						sec->pairwise_enc_algorithm);
722 	SET_8812_H2CCMD_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(remote_wakeup_sec_info,
723 						      sec->group_enc_algorithm);
724 
725 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_GLOBAL_INFO,
726 			       H2C_8821AE_AOAC_GLOBAL_INFO_LEN,
727 			       remote_wakeup_sec_info);
728 
729 	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_TRACE,
730 		      "rtl8821ae_set_global_info: cmd 0x82:\n",
731 		      remote_wakeup_sec_info, H2C_8821AE_AOAC_GLOBAL_INFO_LEN);
732 }
733 
734 #define BEACON_PG		0
735 #define PSPOLL_PG		1
736 #define NULL_PG			2
737 #define QOSNULL_PG		3
738 #define BT_QOSNULL_PG	4
739 #define ARPRESP_PG		5
740 #define REMOTE_PG		6
741 #define GTKEXT_PG		7
742 
743 #define TOTAL_RESERVED_PKT_LEN_8812	4096
744 #define TOTAL_RESERVED_PKT_LEN_8821	2048
745 
746 static u8 reserved_page_packet_8821[TOTAL_RESERVED_PKT_LEN_8821] = {
747 	/* page 0: beacon */
748 	0x80, 0x00, 0x00, 0x00,  0xff, 0xff, 0xff, 0xff,
749 	0xff, 0xff, 0x00, 0xe0,  0x4c, 0x02, 0xe2, 0x64,
750 	0x40, 0x16, 0x9f, 0x23,  0xd4, 0x46, 0x20, 0x00,
751 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
752 	0x64, 0x00, 0x20, 0x04,  0x00, 0x06, 0x64, 0x6c,
753 	0x69, 0x6e, 0x6b, 0x31,  0x01, 0x08, 0x82, 0x84,
754 	0x8b, 0x96, 0x0c, 0x18,  0x30, 0x48, 0x03, 0x01,
755 	0x0b, 0x06, 0x02, 0x00,  0x00, 0x2a, 0x01, 0x8b,
756 	0x32, 0x04, 0x12, 0x24,  0x60, 0x6c, 0x00, 0x00,
757 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
758 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 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 	0x10, 0x00, 0x28, 0x8c,  0x00, 0x12, 0x00, 0x00,
776 	0x00, 0x00, 0x00, 0x00,  0x00, 0x81, 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 	/* page 1: ps-poll */
781 	0xa4, 0x10, 0x01, 0xc0,  0x40, 0x16, 0x9f, 0x23,
782 	0xd4, 0x46, 0x00, 0xe0,  0x4c, 0x02, 0xe2, 0x64,
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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
787 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
788 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
789 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
790 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
791 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 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 	0x18, 0x00, 0x28, 0x8c,  0x00, 0x12, 0x00, 0x00,
809 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
810 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
811 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
812 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
813 	/* page 2: null data */
814 	0x48, 0x01, 0x00, 0x00,  0x40, 0x16, 0x9f, 0x23,
815 	0xd4, 0x46, 0x00, 0xe0,  0x4c, 0x02, 0xe2, 0x64,
816 	0x40, 0x16, 0x9f, 0x23,  0xd4, 0x46, 0x00, 0x00,
817 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
818 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
819 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
820 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
821 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
822 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
823 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
824 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
825 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
826 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
827 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 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 	0x1A, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
842 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
843 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
844 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
845 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
846 	/* page 3: qos null data */
847 	0xC8, 0x01, 0x00, 0x00,  0x84, 0xC9, 0xB2, 0xA7,
848 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
849 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
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 	0x1A, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
875 	0x00, 0x00, 0x80, 0x00,  0x00, 0x01, 0x00, 0x00,
876 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
877 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
878 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
879 	/* page 4: BT qos null data */
880 	0xC8, 0x01, 0x00, 0x00,  0x84, 0xC9, 0xB2, 0xA7,
881 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
882 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
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 	0x3C, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
908 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
909 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
910 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
911 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
912 	/* page 5~7 is for wowlan */
913 	/* page 5: ARP resp */
914 	0x08, 0x01, 0x00, 0x00,  0x84, 0xC9, 0xB2, 0xA7,
915 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
916 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 0x00, 0x00,
917 	0xAA, 0xAA, 0x03, 0x00,  0x00, 0x00, 0x08, 0x06,
918 	0x00, 0x01, 0x08, 0x00,  0x06, 0x04, 0x00, 0x02,
919 	0x00, 0xE0, 0x4C, 0x02,  0x51, 0x02, 0x00, 0x00,
920 	0x00, 0x00, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
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 	/* page 6: H2C_REMOTE_WAKE_CTRL_INFO */
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 	/* page 7: Rsvd GTK extend memory (zero memory) */
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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
991 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
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 };
1013 
1014 static u8 reserved_page_packet_8812[TOTAL_RESERVED_PKT_LEN_8812] = {
1015 	/* page 0: beacon */
1016 	0x80, 0x00, 0x00, 0x00,  0xFF, 0xFF, 0xFF, 0xFF,
1017 	0xFF, 0xFF, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1018 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 0x60, 0x00,
1019 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1020 	0x64, 0x00, 0x20, 0x04,  0x00, 0x03, 0x32, 0x31,
1021 	0x35, 0x01, 0x08, 0x82,  0x84, 0x8B, 0x96, 0x0C,
1022 	0x12, 0x18, 0x24, 0x03,  0x01, 0x01, 0x06, 0x02,
1023 	0x00, 0x00, 0x2A, 0x01,  0x02, 0x32, 0x04, 0x30,
1024 	0x48, 0x60, 0x6C, 0x2D,  0x1A, 0xED, 0x09, 0x03,
1025 	0xFF, 0xFF, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1026 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1027 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x3D,
1028 	0x00, 0xDD, 0x07, 0x00,  0xE0, 0x4C, 0x02, 0x02,
1029 	0x08, 0x04, 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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1054 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1055 	0x00, 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 	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 	0x10, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1076 	0x00, 0x00, 0x00, 0x00,  0x00, 0x81, 0x00, 0x00,
1077 	0x04, 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 	/* page 1: ps-poll */
1081 	0xA4, 0x10, 0x09, 0xC0,  0x84, 0xC9, 0xB2, 0xA7,
1082 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1119 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1120 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1121 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1122 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 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 	0x18, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1141 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
1142 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1143 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1144 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1145 	/* page 2: null data */
1146 	0x48, 0x01, 0x00, 0x00,  0x84, 0xC9, 0xB2, 0xA7,
1147 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1148 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1184 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1185 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1186 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1187 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1188 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1189 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1190 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1191 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 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 	0x1A, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1206 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
1207 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1208 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1209 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1210 	/* page 3: Qos null data */
1211 	0xC8, 0x01, 0x00, 0x00,  0x84, 0xC9, 0xB2, 0xA7,
1212 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1213 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
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 	0x1A, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1271 	0x00, 0x00, 0x80, 0x00,  0x00, 0x01, 0x00, 0x00,
1272 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1273 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1274 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1275 	/* page 4: BT Qos null data */
1276 	0xC8, 0x01, 0x00, 0x00,  0x84, 0xC9, 0xB2, 0xA7,
1277 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1278 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
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 	0x3C, 0x00, 0x28, 0x8C,  0x00, 0x12, 0x00, 0x00,
1336 	0x00, 0x00, 0x00, 0x00,  0x00, 0x01, 0x00, 0x00,
1337 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1338 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1339 	0x00, 0x80, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1340 	/* page 5~7 is for wowlan */
1341 	/* page 5: ARP resp */
1342 	0x08, 0x01, 0x00, 0x00,  0x84, 0xC9, 0xB2, 0xA7,
1343 	0xB3, 0x6E, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
1344 	0x84, 0xC9, 0xB2, 0xA7,  0xB3, 0x6E, 0x00, 0x00,
1345 	0xAA, 0xAA, 0x03, 0x00,  0x00, 0x00, 0x08, 0x06,
1346 	0x00, 0x01, 0x08, 0x00,  0x06, 0x04, 0x00, 0x02,
1347 	0x00, 0xE0, 0x4C, 0x02,  0x51, 0x02, 0x00, 0x00,
1348 	0x00, 0x00, 0x00, 0xE0,  0x4C, 0x02, 0x51, 0x02,
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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
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 	/* page 6: H2C_REMOTE_WAKE_CTRL_INFO */
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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
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 	/* page 7: Rsvd GTK extend memory (zero memory) */
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 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1515 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1516 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1517 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1518 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1519 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1520 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1521 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1522 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1523 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1524 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1525 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1526 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1527 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1528 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1529 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1530 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1531 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1532 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1533 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1534 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1535 	0x00, 0x00, 0x00, 0x00,  0x00, 0x00, 0x00, 0x00,
1536 };
1537 
1538 void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1539 				  bool b_dl_finished, bool dl_whole_packets)
1540 {
1541 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1542 	struct rtl_mac *mac = rtl_mac(rtlpriv);
1543 	struct sk_buff *skb = NULL;
1544 	u32 totalpacketlen;
1545 	bool rtstatus;
1546 	u8 u1RsvdPageLoc[5] = { 0 };
1547 	u8 u1RsvdPageLoc2[7] = { 0 };
1548 	bool b_dlok = false;
1549 	u8 *beacon;
1550 	u8 *p_pspoll;
1551 	u8 *nullfunc;
1552 	u8 *qosnull;
1553 	u8 *btqosnull;
1554 	u8 *arpresp;
1555 
1556 	/*---------------------------------------------------------
1557 	 *			(1) beacon
1558 	 *---------------------------------------------------------
1559 	 */
1560 	beacon = &reserved_page_packet_8812[BEACON_PG * 512];
1561 	SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr);
1562 	SET_80211_HDR_ADDRESS3(beacon, mac->bssid);
1563 
1564 	if (b_dl_finished) {
1565 		totalpacketlen = 512 - 40;
1566 		goto out;
1567 	}
1568 	/*-------------------------------------------------------
1569 	 *			(2) ps-poll
1570 	 *--------------------------------------------------------
1571 	 */
1572 	p_pspoll = &reserved_page_packet_8812[PSPOLL_PG * 512];
1573 	SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000));
1574 	SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid);
1575 	SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr);
1576 
1577 	SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG);
1578 
1579 	/*--------------------------------------------------------
1580 	 *			(3) null data
1581 	 *---------------------------------------------------------
1582 	 */
1583 	nullfunc = &reserved_page_packet_8812[NULL_PG * 512];
1584 	SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid);
1585 	SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr);
1586 	SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid);
1587 
1588 	SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG);
1589 
1590 	/*---------------------------------------------------------
1591 	 *			(4) Qos null data
1592 	 *----------------------------------------------------------
1593 	 */
1594 	qosnull = &reserved_page_packet_8812[QOSNULL_PG * 512];
1595 	SET_80211_HDR_ADDRESS1(qosnull, mac->bssid);
1596 	SET_80211_HDR_ADDRESS2(qosnull, mac->mac_addr);
1597 	SET_80211_HDR_ADDRESS3(qosnull, mac->bssid);
1598 
1599 	SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1RsvdPageLoc, QOSNULL_PG);
1600 
1601 	/*---------------------------------------------------------
1602 	 *			(5) BT Qos null data
1603 	 *----------------------------------------------------------
1604 	 */
1605 	btqosnull = &reserved_page_packet_8812[BT_QOSNULL_PG * 512];
1606 	SET_80211_HDR_ADDRESS1(btqosnull, mac->bssid);
1607 	SET_80211_HDR_ADDRESS2(btqosnull, mac->mac_addr);
1608 	SET_80211_HDR_ADDRESS3(btqosnull, mac->bssid);
1609 
1610 	SET_H2CCMD_RSVDPAGE_LOC_BT_QOS_NULL_DATA(u1RsvdPageLoc, BT_QOSNULL_PG);
1611 
1612 	if (!dl_whole_packets) {
1613 		totalpacketlen = 512 * (BT_QOSNULL_PG + 1) - 40;
1614 		goto out;
1615 	}
1616 	/*---------------------------------------------------------
1617 	 *			(6) ARP Resp
1618 	 *----------------------------------------------------------
1619 	 */
1620 	arpresp = &reserved_page_packet_8812[ARPRESP_PG * 512];
1621 	SET_80211_HDR_ADDRESS1(arpresp, mac->bssid);
1622 	SET_80211_HDR_ADDRESS2(arpresp, mac->mac_addr);
1623 	SET_80211_HDR_ADDRESS3(arpresp, mac->bssid);
1624 
1625 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1RsvdPageLoc2, ARPRESP_PG);
1626 
1627 	/*---------------------------------------------------------
1628 	 *			(7) Remote Wake Ctrl
1629 	 *----------------------------------------------------------
1630 	 */
1631 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1RsvdPageLoc2,
1632 								REMOTE_PG);
1633 
1634 	/*---------------------------------------------------------
1635 	 *			(8) GTK Ext Memory
1636 	 *----------------------------------------------------------
1637 	 */
1638 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1RsvdPageLoc2, GTKEXT_PG);
1639 
1640 	totalpacketlen = TOTAL_RESERVED_PKT_LEN_8812 - 40;
1641 
1642 out:
1643 	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
1644 		      "rtl8812ae_set_fw_rsvdpagepkt(): packet data\n",
1645 		      &reserved_page_packet_8812[0], totalpacketlen);
1646 
1647 	skb = dev_alloc_skb(totalpacketlen);
1648 	skb_put_data(skb, &reserved_page_packet_8812, totalpacketlen);
1649 
1650 	rtstatus = rtl_cmd_send_packet(hw, skb);
1651 
1652 	if (rtstatus)
1653 		b_dlok = true;
1654 
1655 	if (!b_dl_finished && b_dlok) {
1656 		RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1657 			      "H2C_RSVDPAGE:\n", u1RsvdPageLoc, 5);
1658 		rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RSVDPAGE,
1659 				       sizeof(u1RsvdPageLoc), u1RsvdPageLoc);
1660 		if (dl_whole_packets) {
1661 			RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1662 				      "wowlan H2C_RSVDPAGE:\n", u1RsvdPageLoc2, 7);
1663 			rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_RSVDPAGE,
1664 					       sizeof(u1RsvdPageLoc2), u1RsvdPageLoc2);
1665 		}
1666 	}
1667 
1668 	if (!b_dlok)
1669 		RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1670 			 "Set RSVD page location to Fw FAIL!!!!!!.\n");
1671 }
1672 
1673 void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1674 				  bool b_dl_finished, bool dl_whole_packets)
1675 {
1676 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1677 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
1678 	struct sk_buff *skb = NULL;
1679 	u32 totalpacketlen;
1680 	bool rtstatus;
1681 	u8 u1RsvdPageLoc[5] = { 0 };
1682 	u8 u1RsvdPageLoc2[7] = { 0 };
1683 	bool b_dlok = false;
1684 	u8 *beacon;
1685 	u8 *p_pspoll;
1686 	u8 *nullfunc;
1687 	u8 *qosnull;
1688 	u8 *btqosnull;
1689 	u8 *arpresp;
1690 
1691 	/*---------------------------------------------------------
1692 	 *			(1) beacon
1693 	 *---------------------------------------------------------
1694 	 */
1695 	beacon = &reserved_page_packet_8821[BEACON_PG * 256];
1696 	SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr);
1697 	SET_80211_HDR_ADDRESS3(beacon, mac->bssid);
1698 
1699 	if (b_dl_finished) {
1700 		totalpacketlen = 256 - 40;
1701 		goto out;
1702 	}
1703 	/*-------------------------------------------------------
1704 	 *			(2) ps-poll
1705 	 *--------------------------------------------------------
1706 	 */
1707 	p_pspoll = &reserved_page_packet_8821[PSPOLL_PG * 256];
1708 	SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000));
1709 	SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid);
1710 	SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr);
1711 
1712 	SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG);
1713 
1714 	/*--------------------------------------------------------
1715 	 *			(3) null data
1716 	 *---------------------------------------------------------i
1717 	 */
1718 	nullfunc = &reserved_page_packet_8821[NULL_PG * 256];
1719 	SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid);
1720 	SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr);
1721 	SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid);
1722 
1723 	SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG);
1724 
1725 	/*---------------------------------------------------------
1726 	 *			(4) Qos null data
1727 	 *----------------------------------------------------------
1728 	 */
1729 	qosnull = &reserved_page_packet_8821[QOSNULL_PG * 256];
1730 	SET_80211_HDR_ADDRESS1(qosnull, mac->bssid);
1731 	SET_80211_HDR_ADDRESS2(qosnull, mac->mac_addr);
1732 	SET_80211_HDR_ADDRESS3(qosnull, mac->bssid);
1733 
1734 	SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1RsvdPageLoc, QOSNULL_PG);
1735 
1736 	/*---------------------------------------------------------
1737 	 *			(5) Qos null data
1738 	 *----------------------------------------------------------
1739 	 */
1740 	btqosnull = &reserved_page_packet_8821[BT_QOSNULL_PG * 256];
1741 	SET_80211_HDR_ADDRESS1(btqosnull, mac->bssid);
1742 	SET_80211_HDR_ADDRESS2(btqosnull, mac->mac_addr);
1743 	SET_80211_HDR_ADDRESS3(btqosnull, mac->bssid);
1744 
1745 	SET_H2CCMD_RSVDPAGE_LOC_BT_QOS_NULL_DATA(u1RsvdPageLoc, BT_QOSNULL_PG);
1746 
1747 	if (!dl_whole_packets) {
1748 		totalpacketlen = 256 * (BT_QOSNULL_PG + 1) - 40;
1749 		goto out;
1750 	}
1751 	/*---------------------------------------------------------
1752 	 *			(6) ARP Resp
1753 	 *----------------------------------------------------------
1754 	 */
1755 	arpresp = &reserved_page_packet_8821[ARPRESP_PG * 256];
1756 	SET_80211_HDR_ADDRESS1(arpresp, mac->bssid);
1757 	SET_80211_HDR_ADDRESS2(arpresp, mac->mac_addr);
1758 	SET_80211_HDR_ADDRESS3(arpresp, mac->bssid);
1759 
1760 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1RsvdPageLoc2, ARPRESP_PG);
1761 
1762 	/*---------------------------------------------------------
1763 	 *			(7) Remote Wake Ctrl
1764 	 *----------------------------------------------------------
1765 	 */
1766 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1RsvdPageLoc2,
1767 									REMOTE_PG);
1768 
1769 	/*---------------------------------------------------------
1770 	 *			(8) GTK Ext Memory
1771 	 *----------------------------------------------------------
1772 	 */
1773 	SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1RsvdPageLoc2, GTKEXT_PG);
1774 
1775 	totalpacketlen = TOTAL_RESERVED_PKT_LEN_8821 - 40;
1776 
1777 out:
1778 
1779 	RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
1780 		      "rtl8821ae_set_fw_rsvdpagepkt(): packet data\n",
1781 		      &reserved_page_packet_8821[0], totalpacketlen);
1782 
1783 	skb = dev_alloc_skb(totalpacketlen);
1784 	skb_put_data(skb, &reserved_page_packet_8821, totalpacketlen);
1785 
1786 	rtstatus = rtl_cmd_send_packet(hw, skb);
1787 
1788 	if (rtstatus)
1789 		b_dlok = true;
1790 
1791 	if (!b_dl_finished && b_dlok) {
1792 		RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
1793 			 "Set RSVD page location to Fw.\n");
1794 		RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1795 				"H2C_RSVDPAGE:\n", u1RsvdPageLoc, 5);
1796 		rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RSVDPAGE,
1797 				       sizeof(u1RsvdPageLoc), u1RsvdPageLoc);
1798 		if (dl_whole_packets) {
1799 			RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1800 				      "wowlan H2C_RSVDPAGE:\n",
1801 				      u1RsvdPageLoc2, 7);
1802 			rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_RSVDPAGE,
1803 					       sizeof(u1RsvdPageLoc2),
1804 					       u1RsvdPageLoc2);
1805 		}
1806 	}
1807 
1808 	if (!b_dlok) {
1809 		RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1810 			 "Set RSVD page location to Fw FAIL!!!!!!.\n");
1811 	}
1812 }
1813 
1814 /*Should check FW support p2p or not.*/
1815 static void rtl8821ae_set_p2p_ctw_period_cmd(struct ieee80211_hw *hw, u8 ctwindow)
1816 {
1817 	u8 u1_ctwindow_period[1] = { ctwindow};
1818 
1819 	rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_P2P_PS_CTW_CMD, 1,
1820 			       u1_ctwindow_period);
1821 }
1822 
1823 void rtl8821ae_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
1824 {
1825 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1826 	struct rtl_ps_ctl *rtlps = rtl_psc(rtl_priv(hw));
1827 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1828 	struct rtl_p2p_ps_info *p2pinfo = &rtlps->p2p_ps_info;
1829 	struct p2p_ps_offload_t *p2p_ps_offload = &rtlhal->p2p_ps_offload;
1830 	u8	i;
1831 	u16	ctwindow;
1832 	u32	start_time, tsf_low;
1833 
1834 	switch (p2p_ps_state) {
1835 	case P2P_PS_DISABLE:
1836 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_DISABLE\n");
1837 		memset(p2p_ps_offload, 0, sizeof(*p2p_ps_offload));
1838 		break;
1839 	case P2P_PS_ENABLE:
1840 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_ENABLE\n");
1841 		/* update CTWindow value. */
1842 		if (p2pinfo->ctwindow > 0) {
1843 			p2p_ps_offload->ctwindow_en = 1;
1844 			ctwindow = p2pinfo->ctwindow;
1845 			rtl8821ae_set_p2p_ctw_period_cmd(hw, ctwindow);
1846 		}
1847 
1848 		/* hw only support 2 set of NoA */
1849 		for (i = 0 ; i < p2pinfo->noa_num ; i++) {
1850 			/* To control the register setting for which NOA*/
1851 			rtl_write_byte(rtlpriv, 0x5cf, (i << 4));
1852 			if (i == 0)
1853 				p2p_ps_offload->noa0_en = 1;
1854 			else
1855 				p2p_ps_offload->noa1_en = 1;
1856 
1857 			/* config P2P NoA Descriptor Register */
1858 			rtl_write_dword(rtlpriv, 0x5E0, p2pinfo->noa_duration[i]);
1859 			rtl_write_dword(rtlpriv, 0x5E4, p2pinfo->noa_interval[i]);
1860 
1861 			/*Get Current TSF value */
1862 			tsf_low = rtl_read_dword(rtlpriv, REG_TSFTR);
1863 
1864 			start_time = p2pinfo->noa_start_time[i];
1865 			if (p2pinfo->noa_count_type[i] != 1) {
1866 				while (start_time <= (tsf_low+(50*1024))) {
1867 					start_time += p2pinfo->noa_interval[i];
1868 					if (p2pinfo->noa_count_type[i] != 255)
1869 						p2pinfo->noa_count_type[i]--;
1870 				}
1871 			}
1872 			rtl_write_dword(rtlpriv, 0x5E8, start_time);
1873 			rtl_write_dword(rtlpriv, 0x5EC,
1874 					p2pinfo->noa_count_type[i]);
1875 		}
1876 
1877 		if ((p2pinfo->opp_ps == 1) || (p2pinfo->noa_num > 0)) {
1878 			/* rst p2p circuit */
1879 			rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, BIT(4));
1880 
1881 			p2p_ps_offload->offload_en = 1;
1882 
1883 			if (P2P_ROLE_GO == rtlpriv->mac80211.p2p) {
1884 				p2p_ps_offload->role = 1;
1885 				p2p_ps_offload->allstasleep = 0;
1886 			} else {
1887 				p2p_ps_offload->role = 0;
1888 			}
1889 
1890 			p2p_ps_offload->discovery = 0;
1891 		}
1892 		break;
1893 	case P2P_PS_SCAN:
1894 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN\n");
1895 		p2p_ps_offload->discovery = 1;
1896 		break;
1897 	case P2P_PS_SCAN_DONE:
1898 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN_DONE\n");
1899 		p2p_ps_offload->discovery = 0;
1900 		p2pinfo->p2p_ps_state = P2P_PS_ENABLE;
1901 		break;
1902 	default:
1903 		break;
1904 	}
1905 
1906 	rtl8821ae_fill_h2c_cmd(hw,
1907 			H2C_8821AE_P2P_PS_OFFLOAD, 1, (u8 *)p2p_ps_offload);
1908 }
1909 
1910 static void rtl8821ae_c2h_ra_report_handler(struct ieee80211_hw *hw,
1911 				     u8 *cmd_buf, u8 cmd_len)
1912 {
1913 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1914 	u8 rate = cmd_buf[0] & 0x3F;
1915 
1916 	rtlhal->current_ra_rate = rtl8821ae_hw_rate_to_mrate(hw, rate);
1917 
1918 	rtl8821ae_dm_update_init_rate(hw, rate);
1919 }
1920 
1921 void rtl8821ae_c2h_content_parsing(struct ieee80211_hw *hw,
1922 				   u8 c2h_cmd_id, u8 c2h_cmd_len,
1923 				   u8 *tmp_buf)
1924 {
1925 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1926 	struct rtl_btc_ops *btc_ops = rtlpriv->btcoexist.btc_ops;
1927 
1928 	switch (c2h_cmd_id) {
1929 	case C2H_8812_DBG:
1930 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "[C2H], C2H_8812_DBG!!\n");
1931 		break;
1932 	case C2H_8812_TX_REPORT:
1933 		rtl_tx_report_handler(hw, tmp_buf, c2h_cmd_len);
1934 		break;
1935 	case C2H_8812_RA_RPT:
1936 		rtl8821ae_c2h_ra_report_handler(hw, tmp_buf, c2h_cmd_len);
1937 		break;
1938 	case C2H_8812_BT_INFO:
1939 		RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD,
1940 			 "[C2H], C2H_8812_BT_INFO!!\n");
1941 		if (rtlpriv->cfg->ops->get_btc_status())
1942 			btc_ops->btc_btinfo_notify(rtlpriv, tmp_buf,
1943 						   c2h_cmd_len);
1944 		break;
1945 	case C2H_8812_BT_MP:
1946 		RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE,
1947 			 "[C2H], C2H_8812_BT_MP!!\n");
1948 		if (rtlpriv->cfg->ops->get_btc_status())
1949 			btc_ops->btc_btmpinfo_notify(rtlpriv, tmp_buf,
1950 						     c2h_cmd_len);
1951 		break;
1952 	default:
1953 		break;
1954 	}
1955 }
1956 
1957 void rtl8821ae_c2h_packet_handler(struct ieee80211_hw *hw, u8 *buffer,
1958 				  u8 length)
1959 {
1960 	struct rtl_priv *rtlpriv = rtl_priv(hw);
1961 	u8 c2h_cmd_id = 0, c2h_cmd_seq = 0, c2h_cmd_len = 0;
1962 	u8 *tmp_buf = NULL;
1963 
1964 	c2h_cmd_id = buffer[0];
1965 	c2h_cmd_seq = buffer[1];
1966 	c2h_cmd_len = length - 2;
1967 	tmp_buf = buffer + 2;
1968 
1969 	RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD,
1970 		 "[C2H packet], c2hCmdId=0x%x, c2hCmdSeq=0x%x, c2hCmdLen=%d\n",
1971 		 c2h_cmd_id, c2h_cmd_seq, c2h_cmd_len);
1972 
1973 	RT_PRINT_DATA(rtlpriv, COMP_FW, DBG_LOUD,
1974 		      "[C2H packet], Content Hex:\n", tmp_buf, c2h_cmd_len);
1975 
1976 	switch (c2h_cmd_id) {
1977 	case C2H_8812_BT_INFO:
1978 		rtl_c2hcmd_enqueue(hw, c2h_cmd_id, c2h_cmd_len, tmp_buf);
1979 		break;
1980 
1981 	default:
1982 		rtl8821ae_c2h_content_parsing(hw, c2h_cmd_id, c2h_cmd_len,
1983 					      tmp_buf);
1984 		break;
1985 	}
1986 }
1987