1
0
mirror of https://github.com/aircrack-ng/rtl8812au.git synced 2024-11-23 05:44:40 +00:00
rtl8812au/hal/phydm/phydm_auto_dbg.c

714 lines
21 KiB
C
Raw Normal View History

2018-06-22 16:48:32 +00:00
/******************************************************************************
*
2018-08-24 20:52:34 +00:00
* Copyright(c) 2007 - 2017 Realtek Corporation.
2018-06-22 16:48:32 +00:00
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2018-08-24 20:52:34 +00:00
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
2018-06-22 16:48:32 +00:00
* more details.
*
2018-08-24 20:52:34 +00:00
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
2018-06-22 16:48:32 +00:00
*****************************************************************************/
2019-05-24 19:43:57 +00:00
/*************************************************************
2018-06-22 16:48:32 +00:00
* include files
2019-05-24 19:43:57 +00:00
************************************************************/
2018-06-22 16:48:32 +00:00
#include "mp_precomp.h"
#include "phydm_precomp.h"
#ifdef PHYDM_AUTO_DEGBUG
2019-05-24 19:43:57 +00:00
void phydm_check_hang_reset(
void *dm_void)
2018-06-22 16:48:32 +00:00
{
2019-05-24 19:43:57 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
struct phydm_auto_dbg_struct *atd_t = &dm->auto_dbg_table;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
atd_t->dbg_step = 0;
atd_t->auto_dbg_type = AUTO_DBG_STOP;
phydm_pause_dm_watchdog(dm, PHYDM_RESUME);
dm->debug_components &= (~ODM_COMP_API);
2018-06-22 16:48:32 +00:00
}
2019-05-24 19:43:57 +00:00
void phydm_check_hang_init(
void *dm_void)
2018-06-22 16:48:32 +00:00
{
2019-05-24 19:43:57 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
struct phydm_auto_dbg_struct *atd_t = &dm->auto_dbg_table;
atd_t->dbg_step = 0;
atd_t->auto_dbg_type = AUTO_DBG_STOP;
phydm_pause_dm_watchdog(dm, PHYDM_RESUME);
}
2018-06-22 16:48:32 +00:00
2019-05-24 19:43:57 +00:00
#if (ODM_IC_11N_SERIES_SUPPORT == 1)
void phydm_auto_check_hang_engine_n(
void *dm_void)
{
struct dm_struct *dm = (struct dm_struct *)dm_void;
struct phydm_auto_dbg_struct *atd_t = &dm->auto_dbg_table;
struct n_dbgport_803 dbgport_803 = {0};
u32 value32_tmp = 0, value32_tmp_2 = 0;
u8 i;
u32 curr_dbg_port_val[DBGPORT_CHK_NUM];
u16 curr_ofdm_t_cnt;
u16 curr_ofdm_r_cnt;
u16 curr_cck_t_cnt;
u16 curr_cck_r_cnt;
u16 curr_ofdm_crc_error_cnt;
u16 curr_cck_crc_error_cnt;
u16 diff_ofdm_t_cnt;
u16 diff_ofdm_r_cnt;
u16 diff_cck_t_cnt;
u16 diff_cck_r_cnt;
u16 diff_ofdm_crc_error_cnt;
u16 diff_cck_crc_error_cnt;
u8 rf_mode;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (atd_t->auto_dbg_type == AUTO_DBG_STOP)
2018-06-22 16:48:32 +00:00
return;
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_IC_11AC_SERIES) {
phydm_check_hang_reset(dm);
2018-06-22 16:48:32 +00:00
return;
}
2018-08-24 20:52:34 +00:00
if (atd_t->dbg_step == 0) {
pr_debug("dbg_step=0\n\n");
2018-06-22 16:48:32 +00:00
2019-05-24 19:43:57 +00:00
/*Reset all packet counter*/
odm_set_bb_reg(dm, R_0xf14, BIT(16), 1);
odm_set_bb_reg(dm, R_0xf14, BIT(16), 0);
2018-06-22 16:48:32 +00:00
2019-05-24 19:43:57 +00:00
} else if (atd_t->dbg_step == 1) {
2018-08-24 20:52:34 +00:00
pr_debug("dbg_step=1\n\n");
2018-06-22 16:48:32 +00:00
/*Check packet counter Register*/
2019-05-24 19:43:57 +00:00
atd_t->ofdm_t_cnt = (u16)odm_get_bb_reg(dm, R_0x9cc, MASKHWORD);
atd_t->ofdm_r_cnt = (u16)odm_get_bb_reg(dm, R_0xf94, MASKLWORD);
atd_t->ofdm_crc_error_cnt = (u16)odm_get_bb_reg(dm, R_0xf94,
MASKHWORD);
2018-06-22 16:48:32 +00:00
2019-05-24 19:43:57 +00:00
atd_t->cck_t_cnt = (u16)odm_get_bb_reg(dm, R_0x9d0, MASKHWORD);
atd_t->cck_r_cnt = (u16)odm_get_bb_reg(dm, R_0xfa0, MASKHWORD);
atd_t->cck_crc_error_cnt = (u16)odm_get_bb_reg(dm, R_0xf84,
0x3fff);
2018-06-22 16:48:32 +00:00
/*Check Debug Port*/
for (i = 0; i < DBGPORT_CHK_NUM; i++) {
2019-05-24 19:43:57 +00:00
if (phydm_set_bb_dbg_port(dm, DBGPORT_PRI_3,
(u32)atd_t->dbg_port_table[i])
) {
atd_t->dbg_port_val[i] =
phydm_get_bb_dbg_port_val(dm);
2018-08-24 20:52:34 +00:00
phydm_release_bb_dbg_port(dm);
2018-06-22 16:48:32 +00:00
}
}
2019-05-24 19:43:57 +00:00
} else if (atd_t->dbg_step == 2) {
2018-08-24 20:52:34 +00:00
pr_debug("dbg_step=2\n\n");
2018-06-22 16:48:32 +00:00
/*Check packet counter Register*/
2019-05-24 19:43:57 +00:00
curr_ofdm_t_cnt = (u16)odm_get_bb_reg(dm, R_0x9cc, MASKHWORD);
curr_ofdm_r_cnt = (u16)odm_get_bb_reg(dm, R_0xf94, MASKLWORD);
curr_ofdm_crc_error_cnt = (u16)odm_get_bb_reg(dm, R_0xf94,
MASKHWORD);
curr_cck_t_cnt = (u16)odm_get_bb_reg(dm, R_0x9d0, MASKHWORD);
curr_cck_r_cnt = (u16)odm_get_bb_reg(dm, R_0xfa0, MASKHWORD);
curr_cck_crc_error_cnt = (u16)odm_get_bb_reg(dm, R_0xf84,
0x3fff);
2018-06-22 16:48:32 +00:00
/*Check Debug Port*/
for (i = 0; i < DBGPORT_CHK_NUM; i++) {
2019-05-24 19:43:57 +00:00
if (phydm_set_bb_dbg_port(dm, DBGPORT_PRI_3,
(u32)atd_t->dbg_port_table[i])
) {
curr_dbg_port_val[i] =
phydm_get_bb_dbg_port_val(dm);
2018-08-24 20:52:34 +00:00
phydm_release_bb_dbg_port(dm);
2018-06-22 16:48:32 +00:00
}
}
2019-05-24 19:43:57 +00:00
/*=== Make check hang decision ===============================*/
2018-08-24 20:52:34 +00:00
pr_debug("Check Hang Decision\n\n");
2018-06-22 16:48:32 +00:00
/* ----- Check RF Register -----------------------------------*/
2018-08-24 20:52:34 +00:00
for (i = 0; i < dm->num_rf_path; i++) {
2019-05-24 19:43:57 +00:00
rf_mode = (u8)odm_get_rf_reg(dm, i, RF_0x0, 0xf0000);
2018-08-24 20:52:34 +00:00
pr_debug("RF0x0[%d] = 0x%x\n", i, rf_mode);
2018-06-22 16:48:32 +00:00
if (rf_mode > 3) {
2018-08-24 20:52:34 +00:00
pr_debug("Incorrect RF mode\n");
pr_debug("ReasonCode:RHN-1\n");
2018-06-22 16:48:32 +00:00
}
}
2019-05-24 19:43:57 +00:00
value32_tmp = odm_get_rf_reg(dm, 0, RF_0xb0, 0xf0000);
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type == ODM_RTL8188E) {
2018-06-22 16:48:32 +00:00
if (value32_tmp != 0xff8c8) {
2018-08-24 20:52:34 +00:00
pr_debug("ReasonCode:RHN-3\n");
2018-06-22 16:48:32 +00:00
}
}
2019-05-24 19:43:57 +00:00
/* ----- Check BB Register ----------------------------------*/
2018-06-22 16:48:32 +00:00
/*BB mode table*/
2019-05-24 19:43:57 +00:00
value32_tmp = odm_get_bb_reg(dm, R_0x824, 0xe);
value32_tmp_2 = odm_get_bb_reg(dm, R_0x82c, 0xe);
pr_debug("BB TX mode table {A, B}= {%d, %d}\n",
value32_tmp, value32_tmp_2);
2018-06-22 16:48:32 +00:00
2019-05-24 19:43:57 +00:00
if (value32_tmp > 3 || value32_tmp_2 > 3) {
2018-08-24 20:52:34 +00:00
pr_debug("ReasonCode:RHN-2\n");
2018-06-22 16:48:32 +00:00
}
2019-05-24 19:43:57 +00:00
value32_tmp = odm_get_bb_reg(dm, R_0x824, 0x700000);
value32_tmp_2 = odm_get_bb_reg(dm, R_0x82c, 0x700000);
pr_debug("BB RX mode table {A, B}= {%d, %d}\n", value32_tmp,
value32_tmp_2);
2018-06-22 16:48:32 +00:00
2019-05-24 19:43:57 +00:00
if (value32_tmp > 3 || value32_tmp_2 > 3) {
2018-08-24 20:52:34 +00:00
pr_debug("ReasonCode:RHN-2\n");
2018-06-22 16:48:32 +00:00
}
/*BB HW Block*/
2019-05-24 19:43:57 +00:00
value32_tmp = odm_get_bb_reg(dm, R_0x800, MASKDWORD);
2018-06-22 16:48:32 +00:00
if (!(value32_tmp & BIT(24))) {
2018-08-24 20:52:34 +00:00
pr_debug("Reg0x800[24] = 0, CCK BLK is disabled\n");
pr_debug("ReasonCode: THN-3\n");
2018-06-22 16:48:32 +00:00
}
2019-05-24 19:43:57 +00:00
2018-06-22 16:48:32 +00:00
if (!(value32_tmp & BIT(25))) {
2018-08-24 20:52:34 +00:00
pr_debug("Reg0x800[24] = 0, OFDM BLK is disabled\n");
pr_debug("ReasonCode:THN-3\n");
2018-06-22 16:48:32 +00:00
}
/*BB Continue TX*/
2019-05-24 19:43:57 +00:00
value32_tmp = odm_get_bb_reg(dm, R_0xd00, 0x70000000);
2018-08-24 20:52:34 +00:00
pr_debug("Continue TX=%d\n", value32_tmp);
2018-06-22 16:48:32 +00:00
if (value32_tmp != 0) {
2018-08-24 20:52:34 +00:00
pr_debug("ReasonCode: THN-4\n");
2018-06-22 16:48:32 +00:00
}
/* ----- Check Packet Counter --------------------------------*/
2018-08-24 20:52:34 +00:00
diff_ofdm_t_cnt = curr_ofdm_t_cnt - atd_t->ofdm_t_cnt;
diff_ofdm_r_cnt = curr_ofdm_r_cnt - atd_t->ofdm_r_cnt;
2019-05-24 19:43:57 +00:00
diff_ofdm_crc_error_cnt = curr_ofdm_crc_error_cnt -
atd_t->ofdm_crc_error_cnt;
2018-08-24 20:52:34 +00:00
diff_cck_t_cnt = curr_cck_t_cnt - atd_t->cck_t_cnt;
diff_cck_r_cnt = curr_cck_r_cnt - atd_t->cck_r_cnt;
2019-05-24 19:43:57 +00:00
diff_cck_crc_error_cnt = curr_cck_crc_error_cnt -
atd_t->cck_crc_error_cnt;
pr_debug("OFDM[t=0~1] {TX, RX, CRC_error} = {%d, %d, %d}\n",
atd_t->ofdm_t_cnt, atd_t->ofdm_r_cnt,
atd_t->ofdm_crc_error_cnt);
pr_debug("OFDM[t=1~2] {TX, RX, CRC_error} = {%d, %d, %d}\n",
curr_ofdm_t_cnt, curr_ofdm_r_cnt,
curr_ofdm_crc_error_cnt);
pr_debug("OFDM_diff {TX, RX, CRC_error} = {%d, %d, %d}\n",
diff_ofdm_t_cnt, diff_ofdm_r_cnt,
diff_ofdm_crc_error_cnt);
pr_debug("CCK[t=0~1] {TX, RX, CRC_error} = {%d, %d, %d}\n",
atd_t->cck_t_cnt, atd_t->cck_r_cnt,
atd_t->cck_crc_error_cnt);
pr_debug("CCK[t=1~2] {TX, RX, CRC_error} = {%d, %d, %d}\n",
curr_cck_t_cnt, curr_cck_r_cnt,
curr_cck_crc_error_cnt);
pr_debug("CCK_diff {TX, RX, CRC_error} = {%d, %d, %d}\n",
diff_cck_t_cnt, diff_cck_r_cnt,
diff_cck_crc_error_cnt);
2018-06-22 16:48:32 +00:00
/* ----- Check Dbg Port --------------------------------*/
for (i = 0; i < DBGPORT_CHK_NUM; i++) {
2019-05-24 19:43:57 +00:00
pr_debug("Dbg_port=((0x%x))\n",
atd_t->dbg_port_table[i]);
pr_debug("Val{pre, curr}={0x%x, 0x%x}\n",
atd_t->dbg_port_val[i], curr_dbg_port_val[i]);
if (atd_t->dbg_port_table[i] == 0) {
if (atd_t->dbg_port_val[i] ==
curr_dbg_port_val[i]) {
2018-08-24 20:52:34 +00:00
pr_debug("BB state hang\n");
pr_debug("ReasonCode:\n");
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
} else if (atd_t->dbg_port_table[i] == 0x803) {
2019-05-24 19:43:57 +00:00
if (atd_t->dbg_port_val[i] ==
curr_dbg_port_val[i]) {
/* dbgport_803 = */
/* (struct n_dbgport_803 ) */
/* (atd_t->dbg_port_val[i]); */
2018-08-24 20:52:34 +00:00
odm_move_memory(dm, &dbgport_803,
2019-05-24 19:43:57 +00:00
&atd_t->dbg_port_val[i],
2018-08-24 20:52:34 +00:00
sizeof(struct n_dbgport_803));
2019-05-24 19:43:57 +00:00
pr_debug("RSTB{BB, GLB, OFDM}={%d, %d,%d}\n",
dbgport_803.bb_rst_b,
dbgport_803.glb_rst_b,
dbgport_803.ofdm_rst_b);
pr_debug("{ofdm_tx_en, cck_tx_en, phy_tx_on}={%d, %d, %d}\n",
dbgport_803.ofdm_tx_en,
dbgport_803.cck_tx_en,
dbgport_803.phy_tx_on);
pr_debug("CCA_PP{OFDM, CCK}={%d, %d}\n",
dbgport_803.ofdm_cca_pp,
dbgport_803.cck_cca_pp);
2018-06-22 16:48:32 +00:00
if (dbgport_803.phy_tx_on)
2018-08-24 20:52:34 +00:00
pr_debug("Maybe TX Hang\n");
2019-05-24 19:43:57 +00:00
else if (dbgport_803.ofdm_cca_pp ||
dbgport_803.cck_cca_pp)
pr_debug("Maybe RX Hang\n");
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
} else if (atd_t->dbg_port_table[i] == 0x208) {
2019-05-24 19:43:57 +00:00
if ((atd_t->dbg_port_val[i] & BIT(30)) &&
(curr_dbg_port_val[i] & BIT(30))) {
2018-08-24 20:52:34 +00:00
pr_debug("EDCCA Pause TX\n");
pr_debug("ReasonCode: THN-2\n");
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
} else if (atd_t->dbg_port_table[i] == 0xab0) {
2019-05-24 19:43:57 +00:00
/* atd_t->dbg_port_val[i] & 0xffffff == 0 */
/* curr_dbg_port_val[i] & 0xffffff == 0 */
if (((atd_t->dbg_port_val[i] &
MASK24BITS) == 0) ||
((curr_dbg_port_val[i] &
MASK24BITS) == 0)) {
2018-08-24 20:52:34 +00:00
pr_debug("Wrong L-SIG formate\n");
pr_debug("ReasonCode: THN-1\n");
2018-06-22 16:48:32 +00:00
}
}
}
2019-05-24 19:43:57 +00:00
2018-08-24 20:52:34 +00:00
phydm_check_hang_reset(dm);
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
atd_t->dbg_step++;
2018-06-22 16:48:32 +00:00
}
2019-05-24 19:43:57 +00:00
void phydm_bb_auto_check_hang_start_n(
void *dm_void,
u32 *_used,
char *output,
u32 *_out_len)
2018-06-22 16:48:32 +00:00
{
2019-05-24 19:43:57 +00:00
u32 value32 = 0;
struct dm_struct *dm = (struct dm_struct *)dm_void;
struct phydm_auto_dbg_struct *atd_t = &dm->auto_dbg_table;
2018-06-22 16:48:32 +00:00
u32 used = *_used;
u32 out_len = *_out_len;
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_IC_11AC_SERIES)
2018-06-22 16:48:32 +00:00
return;
2019-05-24 19:43:57 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used,
"PHYDM auto check hang (N-series) is started, Please check the system log\n");
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
dm->debug_components |= ODM_COMP_API;
atd_t->auto_dbg_type = AUTO_DBG_CHECK_HANG;
atd_t->dbg_step = 0;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
phydm_pause_dm_watchdog(dm, PHYDM_PAUSE);
2018-06-22 16:48:32 +00:00
*_used = used;
*_out_len = out_len;
}
2019-05-24 19:43:57 +00:00
void phydm_dbg_port_dump_n(void *dm_void, u32 *_used, char *output,
u32 *_out_len)
2018-06-22 16:48:32 +00:00
{
2019-05-24 19:43:57 +00:00
u32 value32 = 0;
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
u32 used = *_used;
u32 out_len = *_out_len;
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_IC_11AC_SERIES)
2018-06-22 16:48:32 +00:00
return;
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"not support now\n");
2018-06-22 16:48:32 +00:00
*_used = used;
*_out_len = out_len;
}
2019-05-24 19:43:57 +00:00
#endif
2018-06-22 16:48:32 +00:00
#if (ODM_IC_11AC_SERIES_SUPPORT == 1)
2019-05-24 19:43:57 +00:00
void phydm_dbg_port_dump_ac(void *dm_void, u32 *_used, char *output,
u32 *_out_len)
2018-06-22 16:48:32 +00:00
{
2019-05-24 19:43:57 +00:00
u32 value32 = 0;
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
u32 used = *_used;
u32 out_len = *_out_len;
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_IC_11N_SERIES)
2018-06-22 16:48:32 +00:00
return;
2019-05-24 19:43:57 +00:00
value32 = odm_get_bb_reg(dm, R_0xf80, MASKDWORD);
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "rptreg of sc/bw/ht/...", value32);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_RTL8822B)
2019-05-24 19:43:57 +00:00
odm_set_bb_reg(dm, R_0x198c, BIT(2) | BIT(1) | BIT(0), 7);
2018-06-22 16:48:32 +00:00
/* dbg_port = basic state machine */
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0x000);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "basic state machine", value32);
2018-06-22 16:48:32 +00:00
}
/* dbg_port = state machine */
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0x007);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "state machine", value32);
2018-06-22 16:48:32 +00:00
}
/* dbg_port = CCA-related*/
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0x204);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "CCA-related", value32);
2018-06-22 16:48:32 +00:00
}
/* dbg_port = edcca/rxd*/
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0x278);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "edcca/rxd", value32);
2018-06-22 16:48:32 +00:00
}
/* dbg_port = rx_state/mux_state/ADC_MASK_OFDM*/
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0x290);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x",
"rx_state/mux_state/ADC_MASK_OFDM", value32);
2018-06-22 16:48:32 +00:00
}
/* dbg_port = bf-related*/
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0x2B2);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "bf-related", value32);
2018-06-22 16:48:32 +00:00
}
/* dbg_port = bf-related*/
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0x2B8);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "bf-related", value32);
2018-06-22 16:48:32 +00:00
}
/* dbg_port = txon/rxd*/
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0xA03);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "txon/rxd", value32);
2018-06-22 16:48:32 +00:00
}
/* dbg_port = l_rate/l_length*/
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0xA0B);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "l_rate/l_length", value32);
2018-06-22 16:48:32 +00:00
}
/* dbg_port = rxd/rxd_hit*/
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0xA0D);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "rxd/rxd_hit", value32);
2018-06-22 16:48:32 +00:00
}
/* dbg_port = dis_cca*/
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0xAA0);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "dis_cca", value32);
2018-06-22 16:48:32 +00:00
}
/* dbg_port = tx*/
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0xAB0);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "tx", value32);
2018-06-22 16:48:32 +00:00
}
/* dbg_port = rx plcp*/
{
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0xAD0);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "rx plcp", value32);
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0xAD1);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "rx plcp", value32);
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0xAD2);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "rx plcp", value32);
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD, 0xAD3);
value32 = odm_get_bb_reg(dm, ODM_REG_DBG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "0x8fc", value32);
2018-08-24 20:52:34 +00:00
value32 = odm_get_bb_reg(dm, ODM_REG_RPT_11AC, MASKDWORD);
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"\r\n %-35s = 0x%x", "rx plcp", value32);
2018-06-22 16:48:32 +00:00
}
*_used = used;
*_out_len = out_len;
}
#endif
2019-05-24 19:43:57 +00:00
#ifdef PHYDM_IC_JGR3_SERIES_SUPPORT
void phydm_dbg_port_dump_jgr3(void *dm_void, u32 *_used, char *output,
u32 *_out_len)
2018-06-22 16:48:32 +00:00
{
2019-05-24 19:43:57 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
u32 used = *_used;
u32 out_len = *_out_len;
u32 dbg_port_idx_all[3] = {0x000, 0x001, 0x002};
u32 val = 0;
u32 dbg_port_idx = 0;
u32 i = 0;
if (!(dm->support_ic_type & ODM_IC_JGR3_SERIES))
return;
PDM_SNPF(out_len, used, output + used, out_len - used,
"%-16s = %s\n", "DbgPort index", "Value");
/*0x000/0x001/0x002*/
for (i = 0; i < 3; i++) {
dbg_port_idx = dbg_port_idx_all[i];
if (phydm_set_bb_dbg_port(dm, DBGPORT_PRI_3, dbg_port_idx)) {
val = phydm_get_bb_dbg_port_val(dm);
PDM_SNPF(out_len, used, output + used, out_len - used,
"0x%-15x = 0x%x\n", dbg_port_idx, val);
phydm_release_bb_dbg_port(dm);
}
}
2018-06-22 16:48:32 +00:00
2019-05-24 19:43:57 +00:00
/*0x3a0/0x3a1/.../0x3ab/0x3ac*/
for (dbg_port_idx = 0x3a0; dbg_port_idx <= 0x3ac; dbg_port_idx++) {
if (phydm_set_bb_dbg_port(dm, DBGPORT_PRI_3, dbg_port_idx)) {
val = phydm_get_bb_dbg_port_val(dm);
PDM_SNPF(out_len, used, output + used, out_len - used,
"0x%-15x = 0x%x\n", dbg_port_idx, val);
phydm_release_bb_dbg_port(dm);
}
}
*_used = used;
*_out_len = out_len;
}
#endif
void phydm_auto_dbg_console(
void *dm_void,
char input[][16],
u32 *_used,
char *output,
u32 *_out_len)
{
struct dm_struct *dm = (struct dm_struct *)dm_void;
char help[] = "-h";
u32 var1[10] = {0};
u32 used = *_used;
u32 out_len = *_out_len;
2018-06-22 16:48:32 +00:00
PHYDM_SSCANF(input[1], DCMD_DECIMAL, &var1[0]);
if ((strcmp(input[1], help) == 0)) {
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used,
2019-05-24 19:43:57 +00:00
"hang: {1} {1:Show DbgPort, 2:Auto check hang}\n");
2018-06-22 16:48:32 +00:00
return;
} else if (var1[0] == 1) {
PHYDM_SSCANF(input[2], DCMD_DECIMAL, &var1[1]);
if (var1[1] == 1) {
2019-05-24 19:43:57 +00:00
switch (dm->ic_ip_series) {
#ifdef PHYDM_IC_JGR3_SERIES_SUPPORT
case PHYDM_IC_JGR3:
phydm_dbg_port_dump_jgr3(dm, &used, output,
&out_len);
break;
#endif
#if (ODM_IC_11AC_SERIES_SUPPORT == 1)
case PHYDM_IC_AC:
phydm_dbg_port_dump_ac(dm, &used, output,
&out_len);
break;
#endif
#if (ODM_IC_11N_SERIES_SUPPORT == 1)
case PHYDM_IC_N:
phydm_dbg_port_dump_n(dm, &used, output,
&out_len);
break;
#endif
default:
break;
2018-06-22 16:48:32 +00:00
}
} else if (var1[1] == 2) {
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_IC_11AC_SERIES) {
PDM_SNPF(out_len, used, output + used,
2019-05-24 19:43:57 +00:00
out_len - used, "Not support\n");
2018-06-22 16:48:32 +00:00
} else {
#if (ODM_IC_11N_SERIES_SUPPORT == 1)
2019-05-24 19:43:57 +00:00
phydm_bb_auto_check_hang_start_n(dm, &used,
output,
&out_len);
2018-06-22 16:48:32 +00:00
#else
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used,
2019-05-24 19:43:57 +00:00
out_len - used, "Not support\n");
2018-06-22 16:48:32 +00:00
#endif
}
}
2019-05-24 19:43:57 +00:00
}
2018-06-22 16:48:32 +00:00
*_used = used;
*_out_len = out_len;
}
2019-05-24 19:43:57 +00:00
void phydm_auto_dbg_engine(void *dm_void)
2018-06-22 16:48:32 +00:00
{
2019-05-24 19:43:57 +00:00
u32 value32 = 0;
struct dm_struct *dm = (struct dm_struct *)dm_void;
struct phydm_auto_dbg_struct *atd_t = &dm->auto_dbg_table;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (atd_t->auto_dbg_type == AUTO_DBG_STOP)
2018-06-22 16:48:32 +00:00
return;
2018-08-24 20:52:34 +00:00
pr_debug("%s ======>\n", __func__);
2019-05-24 19:43:57 +00:00
2018-08-24 20:52:34 +00:00
if (atd_t->auto_dbg_type == AUTO_DBG_CHECK_HANG) {
if (dm->support_ic_type & ODM_IC_11AC_SERIES) {
pr_debug("Not Support\n");
2018-06-22 16:48:32 +00:00
} else {
#if (ODM_IC_11N_SERIES_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
phydm_auto_check_hang_engine_n(dm);
2018-06-22 16:48:32 +00:00
#else
2018-08-24 20:52:34 +00:00
pr_debug("Not Support\n");
2018-06-22 16:48:32 +00:00
#endif
}
2018-08-24 20:52:34 +00:00
} else if (atd_t->auto_dbg_type == AUTO_DBG_CHECK_RA) {
pr_debug("Not Support\n");
2018-06-22 16:48:32 +00:00
}
}
2019-05-24 19:43:57 +00:00
void phydm_auto_dbg_engine_init(void *dm_void)
2018-06-22 16:48:32 +00:00
{
2019-05-24 19:43:57 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
struct phydm_auto_dbg_struct *atd_t = &dm->auto_dbg_table;
u16 dbg_port_table[DBGPORT_CHK_NUM] = {0x0, 0x803, 0x208, 0xab0,
0xab1, 0xab2};
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "%s ======>n", __func__);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
odm_move_memory(dm, &atd_t->dbg_port_table[0],
2019-05-24 19:43:57 +00:00
&dbg_port_table[0], (DBGPORT_CHK_NUM * 2));
2018-06-22 16:48:32 +00:00
2019-05-24 19:43:57 +00:00
phydm_check_hang_init(dm);
2018-06-22 16:48:32 +00:00
}
2019-05-24 19:43:57 +00:00
#endif