Skip to content

Commit

Permalink
mt6625l: fix/impove driver debugging features
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Loukianov <lx2@lexa2.ru>
  • Loading branch information
lexa2 committed Oct 25, 2019
1 parent 345ae64 commit 880f164
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 15 deletions.
Expand Up @@ -68,9 +68,7 @@ int do_wlan_drv_init(int chip_id)
WMT_DETECT_INFO_FUNC("finish wlan module init\n");

#else

WMT_DETECT_INFO_FUNC("CONFIG_MTK_COMBO_WIFI is not defined\n");

#endif

return i_ret;
Expand Down
Expand Up @@ -509,11 +509,13 @@ VOID mtk_wcn_wmt_exp_init(void)
.wmt_assert_cb = _mtk_wcn_wmt_assert
};

WMT_DBG_FUNC("call mtk_wcn_wmt_exp_cb_reg() to set callbacks\n");
mtk_wcn_wmt_exp_cb_reg(&wmtExpCb);
}

VOID mtk_wcn_wmt_exp_deinit(void)
{
WMT_DBG_FUNC("calling mtk_wcn_wmt_exp_cb_unreg() to clear callbacks\n");
mtk_wcn_wmt_exp_cb_unreg();
}
#ifdef CONFIG_MTK_COMBO_ANT
Expand Down
6 changes: 6 additions & 0 deletions drivers/misc/mediatek/connectivity/wlan/gen2/Makefile
Expand Up @@ -95,7 +95,13 @@ endif

ccflags-y += -D_HIF_SDIO=1

# ----------------------------------------------------
# Debug control: uncomment/comment to enable/disable
# ----------------------------------------------------
ccflags-y += -DDBG=0
#ccflags-y += -DDBG=1
# ----------------------------------------------------

ccflags-y += -I$(src)/os -I$(src)/os/linux/include -I$(src)/os/linux/hif/ahb/include
ccflags-y += -I$(src)/include -I$(src)/include/nic -I$(src)/include/mgmt
ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include
Expand Down
32 changes: 26 additions & 6 deletions drivers/misc/mediatek/connectivity/wlan/gen2/include/debug.h
Expand Up @@ -276,13 +276,15 @@ typedef enum _ENUM_DBG_MODULE_T {
extern PINT_16 g_wbuf_p;
extern PINT_8 g_buf_p;

/* If __FUNCTION__ is already defined by compiler, we just use it. */
#if defined(__func__)
#define DEBUGFUNC(_Func)
#else
#define DEBUGFUNC(_Func) \
static const char __func__[] = _Func
#endif

#define WARNLOG(_Fmt) \
{ \
if (aucDebugModule[DBG_INIT_IDX] & DBG_CLASS_WARN) { \
LOG_FUNC("**Warning[%s:%d]-", __FILE__, __LINE__); \
LOG_FUNC _Fmt; \
} \
}

#define DBGLOG_MEM8(_Module, _Class, _StartAddr, _Length) \
{ \
Expand Down Expand Up @@ -315,20 +317,26 @@ extern PINT_8 g_buf_p;
#else
#define ASSERT(_exp) \
{ \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Waddress\"") \
if (!(_exp) && !fgIsBusAccessFailed) { \
LOG_FUNC("Assertion failed: %s:%d %s\n", __FILE__, __LINE__, #_exp); \
kalBreakPoint(); \
} \
_Pragma("GCC diagnostic pop") \
}
#endif /* _lint */

#define ASSERT_REPORT(_exp, _fmt) \
{ \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Waddress\"") \
if (!(_exp) && !fgIsBusAccessFailed) { \
LOG_FUNC("Assertion failed: %s:%d %s\n", __FILE__, __LINE__, #_exp); \
LOG_FUNC _fmt; \
kalBreakPoint(); \
} \
_Pragma("GCC diagnostic pop") \
}

#define DISP_STRING(_str) _str
Expand All @@ -349,19 +357,25 @@ extern PINT_8 g_buf_p;
#if defined(LINUX) /* For debugging in Linux w/o GDB */
#define ASSERT(_exp) \
{ \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Waddress\"") \
if (!(_exp) && !fgIsBusAccessFailed) { \
LOG_FUNC("Assertion failed: %s:%d (%s)\n", __FILE__, __LINE__, #_exp); \
kalBreakPoint(); \
} \
_Pragma("GCC diagnostic pop") \
}

#define ASSERT_REPORT(_exp, _fmt) \
{ \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Waddress\"") \
if (!(_exp) && !fgIsBusAccessFailed) { \
LOG_FUNC("Assertion failed: %s:%d (%s)\n", __FILE__, __LINE__, #_exp); \
LOG_FUNC _fmt; \
kalBreakPoint(); \
} \
_Pragma("GCC diagnostic pop") \
}
#else
#ifdef WINDOWS_CE
Expand Down Expand Up @@ -410,17 +424,23 @@ extern PINT_8 g_buf_p;
#else
#define ASSERT(_exp) \
{ \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Waddress\"") \
if (!(_exp) && !fgIsBusAccessFailed) { \
LOG_FUNC("Warning at %s:%d (%s)\n", __func__, __LINE__, #_exp); \
} \
_Pragma("GCC diagnostic pop") \
}

#define ASSERT_REPORT(_exp, _fmt) \
{ \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Waddress\"") \
if (!(_exp) && !fgIsBusAccessFailed) { \
LOG_FUNC("Warning at %s:%d (%s)\n", __func__, __LINE__, #_exp); \
LOG_FUNC _fmt; \
} \
_Pragma("GCC diagnostic pop") \
}
#endif /* BUILD_QA_DBG */

Expand Down
Expand Up @@ -221,9 +221,9 @@
********************************************************************************
*/
#if DBG
extern UINT_8 aucDebugModule[DBG_MODULE_NUM];
extern UINT_8 aucDebugModule[];
extern UINT_32 u4DebugModule;
UINT_32 u4DebugModuleTemp;
/* UINT_32 u4DebugModuleTemp; */
#endif /* DBG */
extern int sprintf(char *buf, const char *fmt, ...);

Expand Down
6 changes: 3 additions & 3 deletions drivers/misc/mediatek/connectivity/wlan/gen2/mgmt/p2p_fsm.c
Expand Up @@ -2301,7 +2301,7 @@ VOID p2pFsmRunEventJoinComplete(IN P_ADAPTER_T prAdapter, IN P_MSG_HDR_T prMsgHd
P_SW_RFB_T prAssocRspSwRfb = (P_SW_RFB_T) NULL;
P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T) NULL;

ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
ASSERT((prAdapter != NULL) && (prMsgHdr != NULL));
DBGLOG(P2P, TRACE, "P2P Join Complete\n");

prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
Expand Down Expand Up @@ -2759,12 +2759,12 @@ VOID p2pFsmRunEventExtendListen(IN P_ADAPTER_T prAdapter, IN P_MSG_HDR_T prMsgHd
P_P2P_FSM_INFO_T prP2pFsmInfo = NULL;
struct _MSG_P2P_EXTEND_LISTEN_INTERVAL_T *prExtListenMsg = NULL;

ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL));
ASSERT((prAdapter != NULL) && (prMsgHdr != NULL));

prExtListenMsg = (struct _MSG_P2P_EXTEND_LISTEN_INTERVAL_T *) prMsgHdr;

prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo;
ASSERT_BREAK(prP2pFsmInfo);
ASSERT(prP2pFsmInfo);

if (!prExtListenMsg->wait) {
DBGLOG(P2P, INFO, "reset listen interval\n");
Expand Down
Expand Up @@ -798,7 +798,7 @@ BOOLEAN secFsmEventPTKInstalled(IN P_ADAPTER_T prAdapter, IN P_STA_RECORD_T prSt
return TRUE; /* Not PTK */

#if DBG
DBGLOG(RSN, TRACE, "%pM Sec state %s\n", prSta->aucMacAdd),
DBGLOG(RSN, TRACE, "%pM Sec state %s\n", prSta->aucMacAddr,
apucDebugSecState[prSecInfo->eCurrentState]);
#else
DBGLOG(RSN, TRACE, "%pM Sec state [%d]\n", prSta->aucMacAddr, prSecInfo->eCurrentState);
Expand Down
Expand Up @@ -1281,7 +1281,7 @@ VOID kalUpdateRxCSUMOffloadParam(IN PVOID pvPacket, IN ENUM_CSUM_RESULT_T aeCSUM
else if (aeCSUM[CSUM_TYPE_UDP] == CSUM_RES_FAILED)
DBGLOG(RX, TRACE, "RX: \"bad UDP Checksum\" Packet\n");
else
/* Do nothing */
/* Do nothing */;
#endif
}

Expand Down

0 comments on commit 880f164

Please sign in to comment.