uboot的log系统 有些使用dev_dbg, dev_err来控制。
dev_err默认开着。
如何打开dev_dbg呢?
查看代码, 有两处定义分别位于两个头文件中...
include/dm/device.h
934 #ifdef DEBUG
935 #define dev_dbg(dev, fmt, ...) \
936 ? __dev_printk(7, dev, fmt, ##__VA_ARGS__)
937 #else
938 #define dev_dbg(dev, fmt, ...)? ? ? ? ? \
939 ({? ? ? ? ? ? ? ? \
940 ? if (0)? ? ? ? ? ? ? \
941 ? ? __dev_printk(7, dev, fmt, ##__VA_ARGS__);? \
942 })
include/linux/compat.h
36 #define dev_dbg(dev, fmt, args...)› › \
37 › debug(fmt, ##args)
+ 38 #endif
42 #define dev_vdbg(dev, fmt, args...)›› \
43 › debug(fmt, ##args)
44 #define dev_info(dev, fmt, args...)›› \
45 › printf(fmt, ##args)
46 #define dev_err(dev, fmt, args...)› › \
47 › printf(fmt, ##args)
48 #define dev_warn(dev, fmt, args...)›› \
49 › printf(fmt, ##args)
故导致有时未正确打开相应宏, 导致没log输出。
其他模块未深究,
关于dwc3/ep0.c的log输出, 需要更改compat.h的dev_dbg定义。
* debug宏的定义又有很多,
感觉是include/log.h中的定义
101 #ifdef DEBUG
102 #define _DEBUG› 1
103 #else
104 #define _DEBUG› 0
105 #endif
106
107 #ifdef CONFIG_SPL_BUILD
108 #define _SPL_BUILD› 1
109 #else
110 #define _SPL_BUILD› 0
111 #endif
112
113 #if !_DEBUG && CONFIG_IS_ENABLED(LOG)
114
115 #define debug_cond(cond, fmt, args...)› › › \
116 › do {› › › › › › \
117 › › if (1)› › › › › \
118 › › › log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \
119 › } while (0)
120
121 #else /* _DEBUG */
122
123 /*
124 * Output a debug text when condition "cond" is met. The "cond" should be
125 * computed by a preprocessor in the best case, allowing for the best
126 * optimization.
127 */
128 #define debug_cond(cond, fmt, args...)› › › \
129 › do {› › › › › › \
130 › › if (cond)› › › › \
131 › › › printf(pr_fmt(fmt), ##args);› \
132 › } while (0)
133
134 #endif /* _DEBUG */
136 /* Show a message if DEBUG is defined in a file */
137 #define debug(fmt, args...)›› › \
138 › debug_cond(_DEBUG, fmt, ##args)
139
140 /* Show a message if not in SPL */
141 #define warn_non_spl(fmt, args...)› › › \
142 › debug_cond(!_SPL_BUILD, fmt, ##args)
如果#define DEBUG在这里, uboot中会有很多log...
故直接修改compat.h中 dev_dbg的定义...
+ 39 #define dev_dbg(dev, fmt, args...)› › \
+ 40 › printf(fmt, ##args); \
+ 41 printf("\n")