Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright(c) 2009-2012  Realtek Corporation.*/
0003 
0004 #ifndef __RTL_DEBUG_H__
0005 #define __RTL_DEBUG_H__
0006 
0007 /*--------------------------------------------------------------
0008             Debug level
0009 --------------------------------------------------------------*/
0010 /*
0011  *Fatal bug.
0012  *For example, Tx/Rx/IO locked up,
0013  *memory access violation,
0014  *resource allocation failed,
0015  *unexpected HW behavior, HW BUG
0016  *and so on.
0017  */
0018 /*#define DBG_EMERG         0 */
0019 
0020 /*
0021  *Abnormal, rare, or unexpeted cases.
0022  *For example, Packet/IO Ctl canceled,
0023  *device suprisely unremoved and so on.
0024  */
0025 #define DBG_WARNING         2
0026 
0027 /*
0028  *Normal case driver developer should
0029  *open, we can see link status like
0030  *assoc/AddBA/DHCP/adapter start and
0031  *so on basic and useful infromations.
0032  */
0033 #define DBG_DMESG           3
0034 
0035 /*
0036  *Normal case with useful information
0037  *about current SW or HW state.
0038  *For example, Tx/Rx descriptor to fill,
0039  *Tx/Rx descriptor completed status,
0040  *SW protocol state change, dynamic
0041  *mechanism state change and so on.
0042  */
0043 #define DBG_LOUD            4
0044 
0045 /*
0046  *Normal case with detail execution
0047  *flow or information.
0048  */
0049 #define DBG_TRACE           5
0050 
0051 /*--------------------------------------------------------------
0052         Define the rt_trace components
0053 --------------------------------------------------------------*/
0054 #define COMP_ERR            BIT(0)
0055 #define COMP_FW             BIT(1)
0056 #define COMP_INIT           BIT(2)  /*For init/deinit */
0057 #define COMP_RECV           BIT(3)  /*For Rx. */
0058 #define COMP_SEND           BIT(4)  /*For Tx. */
0059 #define COMP_MLME           BIT(5)  /*For MLME. */
0060 #define COMP_SCAN           BIT(6)  /*For Scan. */
0061 #define COMP_INTR           BIT(7)  /*For interrupt Related. */
0062 #define COMP_LED            BIT(8)  /*For LED. */
0063 #define COMP_SEC            BIT(9)  /*For sec. */
0064 #define COMP_BEACON         BIT(10) /*For beacon. */
0065 #define COMP_RATE           BIT(11) /*For rate. */
0066 #define COMP_RXDESC         BIT(12) /*For rx desc. */
0067 #define COMP_DIG            BIT(13) /*For DIG */
0068 #define COMP_TXAGC          BIT(14) /*For Tx power */
0069 #define COMP_HIPWR          BIT(15) /*For High Power Mechanism */
0070 #define COMP_POWER          BIT(16) /*For lps/ips/aspm. */
0071 #define COMP_POWER_TRACKING BIT(17) /*For TX POWER TRACKING */
0072 #define COMP_BB_POWERSAVING BIT(18)
0073 #define COMP_SWAS           BIT(19) /*For SW Antenna Switch */
0074 #define COMP_RF             BIT(20) /*For RF. */
0075 #define COMP_TURBO          BIT(21) /*For EDCA TURBO. */
0076 #define COMP_RATR           BIT(22)
0077 #define COMP_CMD            BIT(23)
0078 #define COMP_EFUSE          BIT(24)
0079 #define COMP_QOS            BIT(25)
0080 #define COMP_MAC80211       BIT(26)
0081 #define COMP_REGD           BIT(27)
0082 #define COMP_CHAN           BIT(28)
0083 #define COMP_USB            BIT(29)
0084 #define COMP_EASY_CONCURRENT    COMP_USB /* reuse of this bit is OK */
0085 #define COMP_BT_COEXIST         BIT(30)
0086 #define COMP_IQK            BIT(31)
0087 #define COMP_TX_REPORT          BIT_ULL(32)
0088 
0089 /*--------------------------------------------------------------
0090         Define the rt_print components
0091 --------------------------------------------------------------*/
0092 /* Define EEPROM and EFUSE  check module bit*/
0093 #define EEPROM_W            BIT(0)
0094 #define EFUSE_PG            BIT(1)
0095 #define EFUSE_READ_ALL          BIT(2)
0096 
0097 /* Define init check for module bit*/
0098 #define INIT_EEPROM         BIT(0)
0099 #define INIT_TXPOWER            BIT(1)
0100 #define INIT_IQK            BIT(2)
0101 #define INIT_RF             BIT(3)
0102 
0103 /* Define PHY-BB/RF/MAC check module bit */
0104 #define PHY_BBR             BIT(0)
0105 #define PHY_BBW             BIT(1)
0106 #define PHY_RFR             BIT(2)
0107 #define PHY_RFW             BIT(3)
0108 #define PHY_MACR            BIT(4)
0109 #define PHY_MACW            BIT(5)
0110 #define PHY_ALLR            BIT(6)
0111 #define PHY_ALLW            BIT(7)
0112 #define PHY_TXPWR           BIT(8)
0113 #define PHY_PWRDIFF         BIT(9)
0114 
0115 /* Define Dynamic Mechanism check module bit --> FDM */
0116 #define WA_IOT              BIT(0)
0117 #define DM_PWDB             BIT(1)
0118 #define DM_MONITOR          BIT(2)
0119 #define DM_DIG              BIT(3)
0120 #define DM_EDCA_TURBO           BIT(4)
0121 
0122 #define DM_PWDB             BIT(1)
0123 
0124 enum dbgp_flag_e {
0125     FQOS = 0,
0126     FTX = 1,
0127     FRX = 2,
0128     FSEC = 3,
0129     FMGNT = 4,
0130     FMLME = 5,
0131     FRESOURCE = 6,
0132     FBEACON = 7,
0133     FISR = 8,
0134     FPHY = 9,
0135     FMP = 10,
0136     FEEPROM = 11,
0137     FPWR = 12,
0138     FDM = 13,
0139     FDBGCTRL = 14,
0140     FC2H = 15,
0141     FBT = 16,
0142     FINIT = 17,
0143     FIOCTL = 18,
0144     DBGP_TYPE_MAX
0145 };
0146 
0147 #ifdef CONFIG_RTLWIFI_DEBUG
0148 
0149 struct rtl_priv;
0150 
0151 __printf(4, 5)
0152 void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
0153             const char *fmt, ...);
0154 
0155 void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
0156              const char *titlestring,
0157              const void *hexdata, int hexdatalen);
0158 
0159 #define rtl_dbg(rtlpriv, comp, level, fmt, ...)             \
0160     _rtl_dbg_print(rtlpriv, comp, level,                \
0161                fmt, ##__VA_ARGS__)
0162 
0163 #define RTPRINT(rtlpriv, dbgtype, dbgflag, fmt, ...)            \
0164     _rtl_dbg_print(rtlpriv, dbgtype, dbgflag, fmt, ##__VA_ARGS__)
0165 
0166 #define RT_PRINT_DATA(rtlpriv, _comp, _level, _titlestring, _hexdata,   \
0167               _hexdatalen)                  \
0168     _rtl_dbg_print_data(rtlpriv, _comp, _level,         \
0169                 _titlestring, _hexdata, _hexdatalen)
0170 
0171 #else
0172 
0173 struct rtl_priv;
0174 
0175 __printf(4, 5)
0176 static inline void rtl_dbg(struct rtl_priv *rtlpriv,
0177                u64 comp, int level,
0178                const char *fmt, ...)
0179 {
0180 }
0181 
0182 __printf(4, 5)
0183 static inline void RTPRINT(struct rtl_priv *rtlpriv,
0184                int dbgtype, int dbgflag,
0185                const char *fmt, ...)
0186 {
0187 }
0188 
0189 static inline void RT_PRINT_DATA(struct rtl_priv *rtlpriv,
0190                  u64 comp, int level,
0191                  const char *titlestring,
0192                  const void *hexdata, size_t hexdatalen)
0193 {
0194 }
0195 
0196 #endif
0197 
0198 #ifdef CONFIG_RTLWIFI_DEBUG
0199 void rtl_debug_add_one(struct ieee80211_hw *hw);
0200 void rtl_debug_remove_one(struct ieee80211_hw *hw);
0201 void rtl_debugfs_add_topdir(void);
0202 void rtl_debugfs_remove_topdir(void);
0203 #else
0204 #define rtl_debug_add_one(hw)
0205 #define rtl_debug_remove_one(hw)
0206 #define rtl_debugfs_add_topdir()
0207 #define rtl_debugfs_remove_topdir()
0208 #endif
0209 #endif