root/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. brcmf_debugfs_get_devdir
  2. brcmf_debugfs_add_entry
  3. brcmf_debug_create_memdump

   1 // SPDX-License-Identifier: ISC
   2 /*
   3  * Copyright (c) 2010 Broadcom Corporation
   4  */
   5 
   6 #ifndef BRCMFMAC_DEBUG_H
   7 #define BRCMFMAC_DEBUG_H
   8 
   9 #include <linux/net.h>  /* net_ratelimit() */
  10 
  11 /* message levels */
  12 #define BRCMF_TRACE_VAL         0x00000002
  13 #define BRCMF_INFO_VAL          0x00000004
  14 #define BRCMF_DATA_VAL          0x00000008
  15 #define BRCMF_CTL_VAL           0x00000010
  16 #define BRCMF_TIMER_VAL         0x00000020
  17 #define BRCMF_HDRS_VAL          0x00000040
  18 #define BRCMF_BYTES_VAL         0x00000080
  19 #define BRCMF_INTR_VAL          0x00000100
  20 #define BRCMF_GLOM_VAL          0x00000200
  21 #define BRCMF_EVENT_VAL         0x00000400
  22 #define BRCMF_BTA_VAL           0x00000800
  23 #define BRCMF_FIL_VAL           0x00001000
  24 #define BRCMF_USB_VAL           0x00002000
  25 #define BRCMF_SCAN_VAL          0x00004000
  26 #define BRCMF_CONN_VAL          0x00008000
  27 #define BRCMF_BCDC_VAL          0x00010000
  28 #define BRCMF_SDIO_VAL          0x00020000
  29 #define BRCMF_MSGBUF_VAL        0x00040000
  30 #define BRCMF_PCIE_VAL          0x00080000
  31 #define BRCMF_FWCON_VAL         0x00100000
  32 
  33 /* set default print format */
  34 #undef pr_fmt
  35 #define pr_fmt(fmt)             KBUILD_MODNAME ": " fmt
  36 
  37 struct brcmf_bus;
  38 
  39 __printf(3, 4)
  40 void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...);
  41 /* Macro for error messages. When debugging / tracing the driver all error
  42  * messages are important to us.
  43  */
  44 #ifndef brcmf_err
  45 #define brcmf_err(fmt, ...)                                             \
  46         do {                                                            \
  47                 if (IS_ENABLED(CONFIG_BRCMDBG) ||                       \
  48                     IS_ENABLED(CONFIG_BRCM_TRACING) ||                  \
  49                     net_ratelimit())                                    \
  50                         __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\
  51         } while (0)
  52 #endif
  53 
  54 #define bphy_err(drvr, fmt, ...)                                        \
  55         do {                                                            \
  56                 if (IS_ENABLED(CONFIG_BRCMDBG) ||                       \
  57                     IS_ENABLED(CONFIG_BRCM_TRACING) ||                  \
  58                     net_ratelimit())                                    \
  59                         wiphy_err((drvr)->wiphy, "%s: " fmt, __func__,  \
  60                                   ##__VA_ARGS__);                       \
  61         } while (0)
  62 
  63 #if defined(DEBUG) || defined(CONFIG_BRCM_TRACING)
  64 
  65 /* For debug/tracing purposes treat info messages as errors */
  66 #define brcmf_info brcmf_err
  67 
  68 __printf(3, 4)
  69 void __brcmf_dbg(u32 level, const char *func, const char *fmt, ...);
  70 #define brcmf_dbg(level, fmt, ...)                              \
  71 do {                                                            \
  72         __brcmf_dbg(BRCMF_##level##_VAL, __func__,              \
  73                     fmt, ##__VA_ARGS__);                        \
  74 } while (0)
  75 #define BRCMF_DATA_ON()         (brcmf_msg_level & BRCMF_DATA_VAL)
  76 #define BRCMF_CTL_ON()          (brcmf_msg_level & BRCMF_CTL_VAL)
  77 #define BRCMF_HDRS_ON()         (brcmf_msg_level & BRCMF_HDRS_VAL)
  78 #define BRCMF_BYTES_ON()        (brcmf_msg_level & BRCMF_BYTES_VAL)
  79 #define BRCMF_GLOM_ON()         (brcmf_msg_level & BRCMF_GLOM_VAL)
  80 #define BRCMF_EVENT_ON()        (brcmf_msg_level & BRCMF_EVENT_VAL)
  81 #define BRCMF_FIL_ON()          (brcmf_msg_level & BRCMF_FIL_VAL)
  82 #define BRCMF_FWCON_ON()        (brcmf_msg_level & BRCMF_FWCON_VAL)
  83 #define BRCMF_SCAN_ON()         (brcmf_msg_level & BRCMF_SCAN_VAL)
  84 
  85 #else /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */
  86 
  87 #define brcmf_info(fmt, ...)                                            \
  88         do {                                                            \
  89                 pr_info("%s: " fmt, __func__, ##__VA_ARGS__);           \
  90         } while (0)
  91 
  92 #define brcmf_dbg(level, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
  93 
  94 #define BRCMF_DATA_ON()         0
  95 #define BRCMF_CTL_ON()          0
  96 #define BRCMF_HDRS_ON()         0
  97 #define BRCMF_BYTES_ON()        0
  98 #define BRCMF_GLOM_ON()         0
  99 #define BRCMF_EVENT_ON()        0
 100 #define BRCMF_FIL_ON()          0
 101 #define BRCMF_FWCON_ON()        0
 102 #define BRCMF_SCAN_ON()         0
 103 
 104 #endif /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */
 105 
 106 #define brcmf_dbg_hex_dump(test, data, len, fmt, ...)                   \
 107 do {                                                                    \
 108         trace_brcmf_hexdump((void *)data, len);                         \
 109         if (test)                                                       \
 110                 brcmu_dbg_hex_dump(data, len, fmt, ##__VA_ARGS__);      \
 111 } while (0)
 112 
 113 extern int brcmf_msg_level;
 114 
 115 struct brcmf_bus;
 116 struct brcmf_pub;
 117 #ifdef DEBUG
 118 struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr);
 119 int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
 120                             int (*read_fn)(struct seq_file *seq, void *data));
 121 int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
 122                                size_t len);
 123 #else
 124 static inline struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr)
 125 {
 126         return ERR_PTR(-ENOENT);
 127 }
 128 static inline
 129 int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
 130                             int (*read_fn)(struct seq_file *seq, void *data))
 131 {
 132         return 0;
 133 }
 134 static inline
 135 int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
 136                                size_t len)
 137 {
 138         return 0;
 139 }
 140 #endif
 141 
 142 #endif /* BRCMFMAC_DEBUG_H */

/* [<][>][^][v][top][bottom][index][help] */