Commit 3707c6ee0d1f939130a62c945b56045d9a83fafc
1 parent
8cb7c04248
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
log: Add a way to log error-return values
When functions return an error it propagates up the stack to the point where it is reported. Often the error code provides enough information about the root cause of the error that this is obvious what went wrong. However in some cases the error may be hard to trace. For example if a driver uses several devices to perform an operation, it may not be obvious which one failed. Add a log_ret() macro to help with this. This can be used to wrap any error-return value. The logging system will then output a log record when the original error is generated, making it easy to trace the call stack of the error. This macro can significantly impact code size, so its use is controlled by a Kconfig option, which is enabled for sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 4 changed files with 33 additions and 0 deletions Inline Diff
common/Kconfig
1 | menu "Boot timing" | 1 | menu "Boot timing" |
2 | 2 | ||
3 | config BOOTSTAGE | 3 | config BOOTSTAGE |
4 | bool "Boot timing and reporting" | 4 | bool "Boot timing and reporting" |
5 | help | 5 | help |
6 | Enable recording of boot time while booting. To use it, insert | 6 | Enable recording of boot time while booting. To use it, insert |
7 | calls to bootstage_mark() with a suitable BOOTSTAGE_ID from | 7 | calls to bootstage_mark() with a suitable BOOTSTAGE_ID from |
8 | bootstage.h. Only a single entry is recorded for each ID. You can | 8 | bootstage.h. Only a single entry is recorded for each ID. You can |
9 | give the entry a name with bootstage_mark_name(). You can also | 9 | give the entry a name with bootstage_mark_name(). You can also |
10 | record elapsed time in a particular stage using bootstage_start() | 10 | record elapsed time in a particular stage using bootstage_start() |
11 | before starting and bootstage_accum() when finished. Bootstage will | 11 | before starting and bootstage_accum() when finished. Bootstage will |
12 | add up all the accumulated time and report it. | 12 | add up all the accumulated time and report it. |
13 | 13 | ||
14 | Normally, IDs are defined in bootstage.h but a small number of | 14 | Normally, IDs are defined in bootstage.h but a small number of |
15 | additional 'user' IDs can be used by passing BOOTSTAGE_ID_ALLOC | 15 | additional 'user' IDs can be used by passing BOOTSTAGE_ID_ALLOC |
16 | as the ID. | 16 | as the ID. |
17 | 17 | ||
18 | Calls to show_boot_progress() will also result in log entries but | 18 | Calls to show_boot_progress() will also result in log entries but |
19 | these will not have names. | 19 | these will not have names. |
20 | 20 | ||
21 | config SPL_BOOTSTAGE | 21 | config SPL_BOOTSTAGE |
22 | bool "Boot timing and reported in SPL" | 22 | bool "Boot timing and reported in SPL" |
23 | depends on BOOTSTAGE | 23 | depends on BOOTSTAGE |
24 | help | 24 | help |
25 | Enable recording of boot time in SPL. To make this visible to U-Boot | 25 | Enable recording of boot time in SPL. To make this visible to U-Boot |
26 | proper, enable BOOTSTAGE_STASH as well. This will stash the timing | 26 | proper, enable BOOTSTAGE_STASH as well. This will stash the timing |
27 | information when SPL finishes and load it when U-Boot proper starts | 27 | information when SPL finishes and load it when U-Boot proper starts |
28 | up. | 28 | up. |
29 | 29 | ||
30 | config BOOTSTAGE_REPORT | 30 | config BOOTSTAGE_REPORT |
31 | bool "Display a detailed boot timing report before booting the OS" | 31 | bool "Display a detailed boot timing report before booting the OS" |
32 | depends on BOOTSTAGE | 32 | depends on BOOTSTAGE |
33 | help | 33 | help |
34 | Enable output of a boot time report just before the OS is booted. | 34 | Enable output of a boot time report just before the OS is booted. |
35 | This shows how long it took U-Boot to go through each stage of the | 35 | This shows how long it took U-Boot to go through each stage of the |
36 | boot process. The report looks something like this: | 36 | boot process. The report looks something like this: |
37 | 37 | ||
38 | Timer summary in microseconds: | 38 | Timer summary in microseconds: |
39 | Mark Elapsed Stage | 39 | Mark Elapsed Stage |
40 | 0 0 reset | 40 | 0 0 reset |
41 | 3,575,678 3,575,678 board_init_f start | 41 | 3,575,678 3,575,678 board_init_f start |
42 | 3,575,695 17 arch_cpu_init A9 | 42 | 3,575,695 17 arch_cpu_init A9 |
43 | 3,575,777 82 arch_cpu_init done | 43 | 3,575,777 82 arch_cpu_init done |
44 | 3,659,598 83,821 board_init_r start | 44 | 3,659,598 83,821 board_init_r start |
45 | 3,910,375 250,777 main_loop | 45 | 3,910,375 250,777 main_loop |
46 | 29,916,167 26,005,792 bootm_start | 46 | 29,916,167 26,005,792 bootm_start |
47 | 30,361,327 445,160 start_kernel | 47 | 30,361,327 445,160 start_kernel |
48 | 48 | ||
49 | config BOOTSTAGE_RECORD_COUNT | 49 | config BOOTSTAGE_RECORD_COUNT |
50 | int "Number of boot stage records to store" | 50 | int "Number of boot stage records to store" |
51 | default 30 | 51 | default 30 |
52 | help | 52 | help |
53 | This is the size of the bootstage record list and is the maximum | 53 | This is the size of the bootstage record list and is the maximum |
54 | number of bootstage records that can be recorded. | 54 | number of bootstage records that can be recorded. |
55 | 55 | ||
56 | config SPL_BOOTSTAGE_RECORD_COUNT | 56 | config SPL_BOOTSTAGE_RECORD_COUNT |
57 | int "Number of boot stage records to store for SPL" | 57 | int "Number of boot stage records to store for SPL" |
58 | default 5 | 58 | default 5 |
59 | help | 59 | help |
60 | This is the size of the bootstage record list and is the maximum | 60 | This is the size of the bootstage record list and is the maximum |
61 | number of bootstage records that can be recorded. | 61 | number of bootstage records that can be recorded. |
62 | 62 | ||
63 | config BOOTSTAGE_FDT | 63 | config BOOTSTAGE_FDT |
64 | bool "Store boot timing information in the OS device tree" | 64 | bool "Store boot timing information in the OS device tree" |
65 | depends on BOOTSTAGE | 65 | depends on BOOTSTAGE |
66 | help | 66 | help |
67 | Stash the bootstage information in the FDT. A root 'bootstage' | 67 | Stash the bootstage information in the FDT. A root 'bootstage' |
68 | node is created with each bootstage id as a child. Each child | 68 | node is created with each bootstage id as a child. Each child |
69 | has a 'name' property and either 'mark' containing the | 69 | has a 'name' property and either 'mark' containing the |
70 | mark time in microseconds, or 'accum' containing the | 70 | mark time in microseconds, or 'accum' containing the |
71 | accumulated time for that bootstage id in microseconds. | 71 | accumulated time for that bootstage id in microseconds. |
72 | For example: | 72 | For example: |
73 | 73 | ||
74 | bootstage { | 74 | bootstage { |
75 | 154 { | 75 | 154 { |
76 | name = "board_init_f"; | 76 | name = "board_init_f"; |
77 | mark = <3575678>; | 77 | mark = <3575678>; |
78 | }; | 78 | }; |
79 | 170 { | 79 | 170 { |
80 | name = "lcd"; | 80 | name = "lcd"; |
81 | accum = <33482>; | 81 | accum = <33482>; |
82 | }; | 82 | }; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | Code in the Linux kernel can find this in /proc/devicetree. | 85 | Code in the Linux kernel can find this in /proc/devicetree. |
86 | 86 | ||
87 | config BOOTSTAGE_STASH | 87 | config BOOTSTAGE_STASH |
88 | bool "Stash the boot timing information in memory before booting OS" | 88 | bool "Stash the boot timing information in memory before booting OS" |
89 | depends on BOOTSTAGE | 89 | depends on BOOTSTAGE |
90 | help | 90 | help |
91 | Some OSes do not support device tree. Bootstage can instead write | 91 | Some OSes do not support device tree. Bootstage can instead write |
92 | the boot timing information in a binary format at a given address. | 92 | the boot timing information in a binary format at a given address. |
93 | This happens through a call to bootstage_stash(), typically in | 93 | This happens through a call to bootstage_stash(), typically in |
94 | the CPU's cleanup_before_linux() function. You can use the | 94 | the CPU's cleanup_before_linux() function. You can use the |
95 | 'bootstage stash' and 'bootstage unstash' commands to do this on | 95 | 'bootstage stash' and 'bootstage unstash' commands to do this on |
96 | the command line. | 96 | the command line. |
97 | 97 | ||
98 | config BOOTSTAGE_STASH_ADDR | 98 | config BOOTSTAGE_STASH_ADDR |
99 | hex "Address to stash boot timing information" | 99 | hex "Address to stash boot timing information" |
100 | default 0 | 100 | default 0 |
101 | help | 101 | help |
102 | Provide an address which will not be overwritten by the OS when it | 102 | Provide an address which will not be overwritten by the OS when it |
103 | starts, so that it can read this information when ready. | 103 | starts, so that it can read this information when ready. |
104 | 104 | ||
105 | config BOOTSTAGE_STASH_SIZE | 105 | config BOOTSTAGE_STASH_SIZE |
106 | hex "Size of boot timing stash region" | 106 | hex "Size of boot timing stash region" |
107 | default 0x1000 | 107 | default 0x1000 |
108 | help | 108 | help |
109 | This should be large enough to hold the bootstage stash. A value of | 109 | This should be large enough to hold the bootstage stash. A value of |
110 | 4096 (4KiB) is normally plenty. | 110 | 4096 (4KiB) is normally plenty. |
111 | 111 | ||
112 | endmenu | 112 | endmenu |
113 | 113 | ||
114 | menu "Boot media" | 114 | menu "Boot media" |
115 | 115 | ||
116 | config NOR_BOOT | 116 | config NOR_BOOT |
117 | bool "Support for booting from NOR flash" | 117 | bool "Support for booting from NOR flash" |
118 | depends on NOR | 118 | depends on NOR |
119 | help | 119 | help |
120 | Enabling this will make a U-Boot binary that is capable of being | 120 | Enabling this will make a U-Boot binary that is capable of being |
121 | booted via NOR. In this case we will enable certain pinmux early | 121 | booted via NOR. In this case we will enable certain pinmux early |
122 | as the ROM only partially sets up pinmux. We also default to using | 122 | as the ROM only partially sets up pinmux. We also default to using |
123 | NOR for environment. | 123 | NOR for environment. |
124 | 124 | ||
125 | config NAND_BOOT | 125 | config NAND_BOOT |
126 | bool "Support for booting from NAND flash" | 126 | bool "Support for booting from NAND flash" |
127 | default n | 127 | default n |
128 | help | 128 | help |
129 | Enabling this will make a U-Boot binary that is capable of being | 129 | Enabling this will make a U-Boot binary that is capable of being |
130 | booted via NAND flash. This is not a must, some SoCs need this, | 130 | booted via NAND flash. This is not a must, some SoCs need this, |
131 | some not. | 131 | some not. |
132 | 132 | ||
133 | config ONENAND_BOOT | 133 | config ONENAND_BOOT |
134 | bool "Support for booting from ONENAND" | 134 | bool "Support for booting from ONENAND" |
135 | default n | 135 | default n |
136 | help | 136 | help |
137 | Enabling this will make a U-Boot binary that is capable of being | 137 | Enabling this will make a U-Boot binary that is capable of being |
138 | booted via ONENAND. This is not a must, some SoCs need this, | 138 | booted via ONENAND. This is not a must, some SoCs need this, |
139 | some not. | 139 | some not. |
140 | 140 | ||
141 | config QSPI_BOOT | 141 | config QSPI_BOOT |
142 | bool "Support for booting from QSPI flash" | 142 | bool "Support for booting from QSPI flash" |
143 | default n | 143 | default n |
144 | help | 144 | help |
145 | Enabling this will make a U-Boot binary that is capable of being | 145 | Enabling this will make a U-Boot binary that is capable of being |
146 | booted via QSPI flash. This is not a must, some SoCs need this, | 146 | booted via QSPI flash. This is not a must, some SoCs need this, |
147 | some not. | 147 | some not. |
148 | 148 | ||
149 | config SATA_BOOT | 149 | config SATA_BOOT |
150 | bool "Support for booting from SATA" | 150 | bool "Support for booting from SATA" |
151 | default n | 151 | default n |
152 | help | 152 | help |
153 | Enabling this will make a U-Boot binary that is capable of being | 153 | Enabling this will make a U-Boot binary that is capable of being |
154 | booted via SATA. This is not a must, some SoCs need this, | 154 | booted via SATA. This is not a must, some SoCs need this, |
155 | some not. | 155 | some not. |
156 | 156 | ||
157 | config SD_BOOT | 157 | config SD_BOOT |
158 | bool "Support for booting from SD/EMMC" | 158 | bool "Support for booting from SD/EMMC" |
159 | default n | 159 | default n |
160 | help | 160 | help |
161 | Enabling this will make a U-Boot binary that is capable of being | 161 | Enabling this will make a U-Boot binary that is capable of being |
162 | booted via SD/EMMC. This is not a must, some SoCs need this, | 162 | booted via SD/EMMC. This is not a must, some SoCs need this, |
163 | some not. | 163 | some not. |
164 | 164 | ||
165 | config SPI_BOOT | 165 | config SPI_BOOT |
166 | bool "Support for booting from SPI flash" | 166 | bool "Support for booting from SPI flash" |
167 | default n | 167 | default n |
168 | help | 168 | help |
169 | Enabling this will make a U-Boot binary that is capable of being | 169 | Enabling this will make a U-Boot binary that is capable of being |
170 | booted via SPI flash. This is not a must, some SoCs need this, | 170 | booted via SPI flash. This is not a must, some SoCs need this, |
171 | some not. | 171 | some not. |
172 | 172 | ||
173 | endmenu | 173 | endmenu |
174 | 174 | ||
175 | config BOOTDELAY | 175 | config BOOTDELAY |
176 | int "delay in seconds before automatically booting" | 176 | int "delay in seconds before automatically booting" |
177 | default 2 | 177 | default 2 |
178 | depends on AUTOBOOT | 178 | depends on AUTOBOOT |
179 | help | 179 | help |
180 | Delay before automatically running bootcmd; | 180 | Delay before automatically running bootcmd; |
181 | set to 0 to autoboot with no delay, but you can stop it by key input. | 181 | set to 0 to autoboot with no delay, but you can stop it by key input. |
182 | set to -1 to disable autoboot. | 182 | set to -1 to disable autoboot. |
183 | set to -2 to autoboot with no delay and not check for abort | 183 | set to -2 to autoboot with no delay and not check for abort |
184 | 184 | ||
185 | See doc/README.autoboot for details. | 185 | See doc/README.autoboot for details. |
186 | 186 | ||
187 | config USE_BOOTARGS | 187 | config USE_BOOTARGS |
188 | bool "Enable boot arguments" | 188 | bool "Enable boot arguments" |
189 | help | 189 | help |
190 | Provide boot arguments to bootm command. Boot arguments are specified | 190 | Provide boot arguments to bootm command. Boot arguments are specified |
191 | in CONFIG_BOOTARGS option. Enable this option to be able to specify | 191 | in CONFIG_BOOTARGS option. Enable this option to be able to specify |
192 | CONFIG_BOOTARGS string. If this option is disabled, CONFIG_BOOTARGS | 192 | CONFIG_BOOTARGS string. If this option is disabled, CONFIG_BOOTARGS |
193 | will be undefined and won't take any space in U-Boot image. | 193 | will be undefined and won't take any space in U-Boot image. |
194 | 194 | ||
195 | config BOOTARGS | 195 | config BOOTARGS |
196 | string "Boot arguments" | 196 | string "Boot arguments" |
197 | depends on USE_BOOTARGS | 197 | depends on USE_BOOTARGS |
198 | help | 198 | help |
199 | This can be used to pass arguments to the bootm command. The value of | 199 | This can be used to pass arguments to the bootm command. The value of |
200 | CONFIG_BOOTARGS goes into the environment value "bootargs". Note that | 200 | CONFIG_BOOTARGS goes into the environment value "bootargs". Note that |
201 | this value will also override the "chosen" node in FDT blob. | 201 | this value will also override the "chosen" node in FDT blob. |
202 | 202 | ||
203 | config USE_BOOTCOMMAND | 203 | config USE_BOOTCOMMAND |
204 | bool "Enable a default value for bootcmd" | 204 | bool "Enable a default value for bootcmd" |
205 | help | 205 | help |
206 | Provide a default value for the bootcmd entry in the environment. If | 206 | Provide a default value for the bootcmd entry in the environment. If |
207 | autoboot is enabled this is what will be run automatically. Enable | 207 | autoboot is enabled this is what will be run automatically. Enable |
208 | this option to be able to specify CONFIG_BOOTCOMMAND as a string. If | 208 | this option to be able to specify CONFIG_BOOTCOMMAND as a string. If |
209 | this option is disabled, CONFIG_BOOTCOMMAND will be undefined and | 209 | this option is disabled, CONFIG_BOOTCOMMAND will be undefined and |
210 | won't take any space in U-Boot image. | 210 | won't take any space in U-Boot image. |
211 | 211 | ||
212 | config BOOTCOMMAND | 212 | config BOOTCOMMAND |
213 | string "bootcmd value" | 213 | string "bootcmd value" |
214 | depends on USE_BOOTCOMMAND | 214 | depends on USE_BOOTCOMMAND |
215 | default "run distro_bootcmd" if DISTRO_DEFAULTS | 215 | default "run distro_bootcmd" if DISTRO_DEFAULTS |
216 | help | 216 | help |
217 | This is the string of commands that will be used as bootcmd and if | 217 | This is the string of commands that will be used as bootcmd and if |
218 | AUTOBOOT is set, automatically run. | 218 | AUTOBOOT is set, automatically run. |
219 | 219 | ||
220 | menu "Console" | 220 | menu "Console" |
221 | 221 | ||
222 | config MENU | 222 | config MENU |
223 | bool | 223 | bool |
224 | help | 224 | help |
225 | This is the library functionality to provide a text-based menu of | 225 | This is the library functionality to provide a text-based menu of |
226 | choices for the user to make choices with. | 226 | choices for the user to make choices with. |
227 | 227 | ||
228 | config CONSOLE_RECORD | 228 | config CONSOLE_RECORD |
229 | bool "Console recording" | 229 | bool "Console recording" |
230 | help | 230 | help |
231 | This provides a way to record console output (and provide console | 231 | This provides a way to record console output (and provide console |
232 | input) through circular buffers. This is mostly useful for testing. | 232 | input) through circular buffers. This is mostly useful for testing. |
233 | Console output is recorded even when the console is silent. | 233 | Console output is recorded even when the console is silent. |
234 | To enable console recording, call console_record_reset_enable() | 234 | To enable console recording, call console_record_reset_enable() |
235 | from your code. | 235 | from your code. |
236 | 236 | ||
237 | config CONSOLE_RECORD_OUT_SIZE | 237 | config CONSOLE_RECORD_OUT_SIZE |
238 | hex "Output buffer size" | 238 | hex "Output buffer size" |
239 | depends on CONSOLE_RECORD | 239 | depends on CONSOLE_RECORD |
240 | default 0x400 if CONSOLE_RECORD | 240 | default 0x400 if CONSOLE_RECORD |
241 | help | 241 | help |
242 | Set the size of the console output buffer. When this fills up, no | 242 | Set the size of the console output buffer. When this fills up, no |
243 | more data will be recorded until some is removed. The buffer is | 243 | more data will be recorded until some is removed. The buffer is |
244 | allocated immediately after the malloc() region is ready. | 244 | allocated immediately after the malloc() region is ready. |
245 | 245 | ||
246 | config CONSOLE_RECORD_IN_SIZE | 246 | config CONSOLE_RECORD_IN_SIZE |
247 | hex "Input buffer size" | 247 | hex "Input buffer size" |
248 | depends on CONSOLE_RECORD | 248 | depends on CONSOLE_RECORD |
249 | default 0x100 if CONSOLE_RECORD | 249 | default 0x100 if CONSOLE_RECORD |
250 | help | 250 | help |
251 | Set the size of the console input buffer. When this contains data, | 251 | Set the size of the console input buffer. When this contains data, |
252 | tstc() and getc() will use this in preference to real device input. | 252 | tstc() and getc() will use this in preference to real device input. |
253 | The buffer is allocated immediately after the malloc() region is | 253 | The buffer is allocated immediately after the malloc() region is |
254 | ready. | 254 | ready. |
255 | 255 | ||
256 | config IDENT_STRING | 256 | config IDENT_STRING |
257 | string "Board specific string to be added to uboot version string" | 257 | string "Board specific string to be added to uboot version string" |
258 | help | 258 | help |
259 | This options adds the board specific name to u-boot version. | 259 | This options adds the board specific name to u-boot version. |
260 | 260 | ||
261 | config LOGLEVEL | 261 | config LOGLEVEL |
262 | int "loglevel" | 262 | int "loglevel" |
263 | default 4 | 263 | default 4 |
264 | range 0 8 | 264 | range 0 8 |
265 | help | 265 | help |
266 | All Messages with a loglevel smaller than the console loglevel will | 266 | All Messages with a loglevel smaller than the console loglevel will |
267 | be compiled in. The loglevels are defined as follows: | 267 | be compiled in. The loglevels are defined as follows: |
268 | 268 | ||
269 | 0 (KERN_EMERG) system is unusable | 269 | 0 (KERN_EMERG) system is unusable |
270 | 1 (KERN_ALERT) action must be taken immediately | 270 | 1 (KERN_ALERT) action must be taken immediately |
271 | 2 (KERN_CRIT) critical conditions | 271 | 2 (KERN_CRIT) critical conditions |
272 | 3 (KERN_ERR) error conditions | 272 | 3 (KERN_ERR) error conditions |
273 | 4 (KERN_WARNING) warning conditions | 273 | 4 (KERN_WARNING) warning conditions |
274 | 5 (KERN_NOTICE) normal but significant condition | 274 | 5 (KERN_NOTICE) normal but significant condition |
275 | 6 (KERN_INFO) informational | 275 | 6 (KERN_INFO) informational |
276 | 7 (KERN_DEBUG) debug-level messages | 276 | 7 (KERN_DEBUG) debug-level messages |
277 | 277 | ||
278 | config SPL_LOGLEVEL | 278 | config SPL_LOGLEVEL |
279 | int | 279 | int |
280 | default LOGLEVEL | 280 | default LOGLEVEL |
281 | 281 | ||
282 | config SILENT_CONSOLE | 282 | config SILENT_CONSOLE |
283 | bool "Support a silent console" | 283 | bool "Support a silent console" |
284 | help | 284 | help |
285 | This option allows the console to be silenced, meaning that no | 285 | This option allows the console to be silenced, meaning that no |
286 | output will appear on the console devices. This is controlled by | 286 | output will appear on the console devices. This is controlled by |
287 | setting the environment vaariable 'silent' to a non-empty value. | 287 | setting the environment vaariable 'silent' to a non-empty value. |
288 | Note this also silences the console when booting Linux. | 288 | Note this also silences the console when booting Linux. |
289 | 289 | ||
290 | When the console is set up, the variable is checked, and the | 290 | When the console is set up, the variable is checked, and the |
291 | GD_FLG_SILENT flag is set. Changing the environment variable later | 291 | GD_FLG_SILENT flag is set. Changing the environment variable later |
292 | will update the flag. | 292 | will update the flag. |
293 | 293 | ||
294 | config SILENT_U_BOOT_ONLY | 294 | config SILENT_U_BOOT_ONLY |
295 | bool "Only silence the U-Boot console" | 295 | bool "Only silence the U-Boot console" |
296 | depends on SILENT_CONSOLE | 296 | depends on SILENT_CONSOLE |
297 | help | 297 | help |
298 | Normally when the U-Boot console is silenced, Linux's console is | 298 | Normally when the U-Boot console is silenced, Linux's console is |
299 | also silenced (assuming the board boots into Linux). This option | 299 | also silenced (assuming the board boots into Linux). This option |
300 | allows the linux console to operate normally, even if U-Boot's | 300 | allows the linux console to operate normally, even if U-Boot's |
301 | is silenced. | 301 | is silenced. |
302 | 302 | ||
303 | config SILENT_CONSOLE_UPDATE_ON_SET | 303 | config SILENT_CONSOLE_UPDATE_ON_SET |
304 | bool "Changes to the 'silent' environment variable update immediately" | 304 | bool "Changes to the 'silent' environment variable update immediately" |
305 | depends on SILENT_CONSOLE | 305 | depends on SILENT_CONSOLE |
306 | default y if SILENT_CONSOLE | 306 | default y if SILENT_CONSOLE |
307 | help | 307 | help |
308 | When the 'silent' environment variable is changed, update the | 308 | When the 'silent' environment variable is changed, update the |
309 | console silence flag immediately. This allows 'setenv' to be used | 309 | console silence flag immediately. This allows 'setenv' to be used |
310 | to silence or un-silence the console. | 310 | to silence or un-silence the console. |
311 | 311 | ||
312 | The effect is that any change to the variable will affect the | 312 | The effect is that any change to the variable will affect the |
313 | GD_FLG_SILENT flag. | 313 | GD_FLG_SILENT flag. |
314 | 314 | ||
315 | config SILENT_CONSOLE_UPDATE_ON_RELOC | 315 | config SILENT_CONSOLE_UPDATE_ON_RELOC |
316 | bool "Allow flags to take effect on relocation" | 316 | bool "Allow flags to take effect on relocation" |
317 | depends on SILENT_CONSOLE | 317 | depends on SILENT_CONSOLE |
318 | help | 318 | help |
319 | In some cases the environment is not available until relocation | 319 | In some cases the environment is not available until relocation |
320 | (e.g. NAND). This option makes the value of the 'silent' | 320 | (e.g. NAND). This option makes the value of the 'silent' |
321 | environment variable take effect at relocation. | 321 | environment variable take effect at relocation. |
322 | 322 | ||
323 | config PRE_CONSOLE_BUFFER | 323 | config PRE_CONSOLE_BUFFER |
324 | bool "Buffer characters before the console is available" | 324 | bool "Buffer characters before the console is available" |
325 | help | 325 | help |
326 | Prior to the console being initialised (i.e. serial UART | 326 | Prior to the console being initialised (i.e. serial UART |
327 | initialised etc) all console output is silently discarded. | 327 | initialised etc) all console output is silently discarded. |
328 | Defining CONFIG_PRE_CONSOLE_BUFFER will cause U-Boot to | 328 | Defining CONFIG_PRE_CONSOLE_BUFFER will cause U-Boot to |
329 | buffer any console messages prior to the console being | 329 | buffer any console messages prior to the console being |
330 | initialised to a buffer. The buffer is a circular buffer, so | 330 | initialised to a buffer. The buffer is a circular buffer, so |
331 | if it overflows, earlier output is discarded. | 331 | if it overflows, earlier output is discarded. |
332 | 332 | ||
333 | Note that this is not currently supported in SPL. It would be | 333 | Note that this is not currently supported in SPL. It would be |
334 | useful to be able to share the pre-console buffer with SPL. | 334 | useful to be able to share the pre-console buffer with SPL. |
335 | 335 | ||
336 | config PRE_CON_BUF_SZ | 336 | config PRE_CON_BUF_SZ |
337 | int "Sets the size of the pre-console buffer" | 337 | int "Sets the size of the pre-console buffer" |
338 | depends on PRE_CONSOLE_BUFFER | 338 | depends on PRE_CONSOLE_BUFFER |
339 | default 4096 | 339 | default 4096 |
340 | help | 340 | help |
341 | The size of the pre-console buffer affects how much console output | 341 | The size of the pre-console buffer affects how much console output |
342 | can be held before it overflows and starts discarding earlier | 342 | can be held before it overflows and starts discarding earlier |
343 | output. Normally there is very little output at this early stage, | 343 | output. Normally there is very little output at this early stage, |
344 | unless debugging is enabled, so allow enough for ~10 lines of | 344 | unless debugging is enabled, so allow enough for ~10 lines of |
345 | text. | 345 | text. |
346 | 346 | ||
347 | This is a useful feature if you are using a video console and | 347 | This is a useful feature if you are using a video console and |
348 | want to see the full boot output on the console. Without this | 348 | want to see the full boot output on the console. Without this |
349 | option only the post-relocation output will be displayed. | 349 | option only the post-relocation output will be displayed. |
350 | 350 | ||
351 | config PRE_CON_BUF_ADDR | 351 | config PRE_CON_BUF_ADDR |
352 | hex "Address of the pre-console buffer" | 352 | hex "Address of the pre-console buffer" |
353 | depends on PRE_CONSOLE_BUFFER | 353 | depends on PRE_CONSOLE_BUFFER |
354 | default 0x2f000000 if ARCH_SUNXI && MACH_SUN9I | 354 | default 0x2f000000 if ARCH_SUNXI && MACH_SUN9I |
355 | default 0x4f000000 if ARCH_SUNXI && !MACH_SUN9I | 355 | default 0x4f000000 if ARCH_SUNXI && !MACH_SUN9I |
356 | help | 356 | help |
357 | This sets the start address of the pre-console buffer. This must | 357 | This sets the start address of the pre-console buffer. This must |
358 | be in available memory and is accessed before relocation and | 358 | be in available memory and is accessed before relocation and |
359 | possibly before DRAM is set up. Therefore choose an address | 359 | possibly before DRAM is set up. Therefore choose an address |
360 | carefully. | 360 | carefully. |
361 | 361 | ||
362 | We should consider removing this option and allocating the memory | 362 | We should consider removing this option and allocating the memory |
363 | in board_init_f_init_reserve() instead. | 363 | in board_init_f_init_reserve() instead. |
364 | 364 | ||
365 | config CONSOLE_MUX | 365 | config CONSOLE_MUX |
366 | bool "Enable console multiplexing" | 366 | bool "Enable console multiplexing" |
367 | default y if DM_VIDEO || VIDEO || LCD | 367 | default y if DM_VIDEO || VIDEO || LCD |
368 | help | 368 | help |
369 | This allows multiple devices to be used for each console 'file'. | 369 | This allows multiple devices to be used for each console 'file'. |
370 | For example, stdout can be set to go to serial and video. | 370 | For example, stdout can be set to go to serial and video. |
371 | Similarly, stdin can be set to come from serial and keyboard. | 371 | Similarly, stdin can be set to come from serial and keyboard. |
372 | Input can be provided from either source. Console multiplexing | 372 | Input can be provided from either source. Console multiplexing |
373 | adds a small amount of size to U-Boot. Changes to the environment | 373 | adds a small amount of size to U-Boot. Changes to the environment |
374 | variables stdout, stdin and stderr will take effect immediately. | 374 | variables stdout, stdin and stderr will take effect immediately. |
375 | 375 | ||
376 | config SYS_CONSOLE_IS_IN_ENV | 376 | config SYS_CONSOLE_IS_IN_ENV |
377 | bool "Select console devices from the environment" | 377 | bool "Select console devices from the environment" |
378 | default y if CONSOLE_MUX | 378 | default y if CONSOLE_MUX |
379 | help | 379 | help |
380 | This allows multiple input/output devices to be set at boot time. | 380 | This allows multiple input/output devices to be set at boot time. |
381 | For example, if stdout is set to "serial,video" then output will | 381 | For example, if stdout is set to "serial,video" then output will |
382 | be sent to both the serial and video devices on boot. The | 382 | be sent to both the serial and video devices on boot. The |
383 | environment variables can be updated after boot to change the | 383 | environment variables can be updated after boot to change the |
384 | input/output devices. | 384 | input/output devices. |
385 | 385 | ||
386 | config SYS_CONSOLE_OVERWRITE_ROUTINE | 386 | config SYS_CONSOLE_OVERWRITE_ROUTINE |
387 | bool "Allow board control over console overwriting" | 387 | bool "Allow board control over console overwriting" |
388 | help | 388 | help |
389 | If this is enabled, and the board-specific function | 389 | If this is enabled, and the board-specific function |
390 | overwrite_console() returns 1, the stdin, stderr and stdout are | 390 | overwrite_console() returns 1, the stdin, stderr and stdout are |
391 | switched to the serial port, else the settings in the environment | 391 | switched to the serial port, else the settings in the environment |
392 | are used. If this is not enabled, the console will not be switched | 392 | are used. If this is not enabled, the console will not be switched |
393 | to serial. | 393 | to serial. |
394 | 394 | ||
395 | config SYS_CONSOLE_ENV_OVERWRITE | 395 | config SYS_CONSOLE_ENV_OVERWRITE |
396 | bool "Update environment variables during console init" | 396 | bool "Update environment variables during console init" |
397 | help | 397 | help |
398 | The console environment variables (stdout, stdin, stderr) can be | 398 | The console environment variables (stdout, stdin, stderr) can be |
399 | used to determine the correct console devices on start-up. This | 399 | used to determine the correct console devices on start-up. This |
400 | option writes the console devices to these variables on console | 400 | option writes the console devices to these variables on console |
401 | start-up (after relocation). This causes the environment to be | 401 | start-up (after relocation). This causes the environment to be |
402 | updated to match the console devices actually chosen. | 402 | updated to match the console devices actually chosen. |
403 | 403 | ||
404 | config SYS_CONSOLE_INFO_QUIET | 404 | config SYS_CONSOLE_INFO_QUIET |
405 | bool "Don't display the console devices on boot" | 405 | bool "Don't display the console devices on boot" |
406 | help | 406 | help |
407 | Normally U-Boot displays the current settings for stdout, stdin | 407 | Normally U-Boot displays the current settings for stdout, stdin |
408 | and stderr on boot when the post-relocation console is set up. | 408 | and stderr on boot when the post-relocation console is set up. |
409 | Enable this option to supress this output. It can be obtained by | 409 | Enable this option to supress this output. It can be obtained by |
410 | calling stdio_print_current_devices() from board code. | 410 | calling stdio_print_current_devices() from board code. |
411 | 411 | ||
412 | config SYS_STDIO_DEREGISTER | 412 | config SYS_STDIO_DEREGISTER |
413 | bool "Allow deregistering stdio devices" | 413 | bool "Allow deregistering stdio devices" |
414 | default y if USB_KEYBOARD | 414 | default y if USB_KEYBOARD |
415 | help | 415 | help |
416 | Generally there is no need to deregister stdio devices since they | 416 | Generally there is no need to deregister stdio devices since they |
417 | are never deactivated. But if a stdio device is used which can be | 417 | are never deactivated. But if a stdio device is used which can be |
418 | removed (for example a USB keyboard) then this option can be | 418 | removed (for example a USB keyboard) then this option can be |
419 | enabled to ensure this is handled correctly. | 419 | enabled to ensure this is handled correctly. |
420 | 420 | ||
421 | endmenu | 421 | endmenu |
422 | 422 | ||
423 | menu "Logging" | 423 | menu "Logging" |
424 | 424 | ||
425 | config LOG | 425 | config LOG |
426 | bool "Enable logging support" | 426 | bool "Enable logging support" |
427 | help | 427 | help |
428 | This enables support for logging of status and debug messages. These | 428 | This enables support for logging of status and debug messages. These |
429 | can be displayed on the console, recorded in a memory buffer, or | 429 | can be displayed on the console, recorded in a memory buffer, or |
430 | discarded if not needed. Logging supports various categories and | 430 | discarded if not needed. Logging supports various categories and |
431 | levels of severity. | 431 | levels of severity. |
432 | 432 | ||
433 | config SPL_LOG | 433 | config SPL_LOG |
434 | bool "Enable logging support in SPL" | 434 | bool "Enable logging support in SPL" |
435 | help | 435 | help |
436 | This enables support for logging of status and debug messages. These | 436 | This enables support for logging of status and debug messages. These |
437 | can be displayed on the console, recorded in a memory buffer, or | 437 | can be displayed on the console, recorded in a memory buffer, or |
438 | discarded if not needed. Logging supports various categories and | 438 | discarded if not needed. Logging supports various categories and |
439 | levels of severity. | 439 | levels of severity. |
440 | 440 | ||
441 | config LOG_MAX_LEVEL | 441 | config LOG_MAX_LEVEL |
442 | int "Maximum log level to record" | 442 | int "Maximum log level to record" |
443 | depends on LOG | 443 | depends on LOG |
444 | default 5 | 444 | default 5 |
445 | help | 445 | help |
446 | This selects the maximum log level that will be recorded. Any value | 446 | This selects the maximum log level that will be recorded. Any value |
447 | higher than this will be ignored. If possible log statements below | 447 | higher than this will be ignored. If possible log statements below |
448 | this level will be discarded at build time. Levels: | 448 | this level will be discarded at build time. Levels: |
449 | 449 | ||
450 | 0 - panic | 450 | 0 - panic |
451 | 1 - critical | 451 | 1 - critical |
452 | 2 - error | 452 | 2 - error |
453 | 3 - warning | 453 | 3 - warning |
454 | 4 - note | 454 | 4 - note |
455 | 5 - info | 455 | 5 - info |
456 | 6 - detail | 456 | 6 - detail |
457 | 7 - debug | 457 | 7 - debug |
458 | 458 | ||
459 | config SPL_LOG_MAX_LEVEL | 459 | config SPL_LOG_MAX_LEVEL |
460 | int "Maximum log level to record in SPL" | 460 | int "Maximum log level to record in SPL" |
461 | depends on SPL_LOG | 461 | depends on SPL_LOG |
462 | default 3 | 462 | default 3 |
463 | help | 463 | help |
464 | This selects the maximum log level that will be recorded. Any value | 464 | This selects the maximum log level that will be recorded. Any value |
465 | higher than this will be ignored. If possible log statements below | 465 | higher than this will be ignored. If possible log statements below |
466 | this level will be discarded at build time. Levels: | 466 | this level will be discarded at build time. Levels: |
467 | 467 | ||
468 | 0 - panic | 468 | 0 - panic |
469 | 1 - critical | 469 | 1 - critical |
470 | 2 - error | 470 | 2 - error |
471 | 3 - warning | 471 | 3 - warning |
472 | 4 - note | 472 | 4 - note |
473 | 5 - info | 473 | 5 - info |
474 | 6 - detail | 474 | 6 - detail |
475 | 7 - debug | 475 | 7 - debug |
476 | 476 | ||
477 | config LOG_CONSOLE | 477 | config LOG_CONSOLE |
478 | bool "Allow log output to the console" | 478 | bool "Allow log output to the console" |
479 | depends on LOG | 479 | depends on LOG |
480 | default y | 480 | default y |
481 | help | 481 | help |
482 | Enables a log driver which writes log records to the console. | 482 | Enables a log driver which writes log records to the console. |
483 | Generally the console is the serial port or LCD display. Only the | 483 | Generally the console is the serial port or LCD display. Only the |
484 | log message is shown - other details like level, category, file and | 484 | log message is shown - other details like level, category, file and |
485 | line number are omitted. | 485 | line number are omitted. |
486 | 486 | ||
487 | config LOG_SPL_CONSOLE | 487 | config LOG_SPL_CONSOLE |
488 | bool "Allow log output to the console in SPL" | 488 | bool "Allow log output to the console in SPL" |
489 | depends on LOG_SPL | 489 | depends on LOG_SPL |
490 | default y | 490 | default y |
491 | help | 491 | help |
492 | Enables a log driver which writes log records to the console. | 492 | Enables a log driver which writes log records to the console. |
493 | Generally the console is the serial port or LCD display. Only the | 493 | Generally the console is the serial port or LCD display. Only the |
494 | log message is shown - other details like level, category, file and | 494 | log message is shown - other details like level, category, file and |
495 | line number are omitted. | 495 | line number are omitted. |
496 | 496 | ||
497 | config LOG_TEST | 497 | config LOG_TEST |
498 | bool "Provide a test for logging" | 498 | bool "Provide a test for logging" |
499 | depends on LOG | 499 | depends on LOG |
500 | default y if SANDBOX | 500 | default y if SANDBOX |
501 | help | 501 | help |
502 | This enables a 'log test' command to test logging. It is normally | 502 | This enables a 'log test' command to test logging. It is normally |
503 | executed from a pytest and simply outputs logging information | 503 | executed from a pytest and simply outputs logging information |
504 | in various different ways to test that the logging system works | 504 | in various different ways to test that the logging system works |
505 | correctly with varoius settings. | 505 | correctly with varoius settings. |
506 | 506 | ||
507 | config LOG_ERROR_RETURN | ||
508 | bool "Log all functions which return an error" | ||
509 | depends on LOG | ||
510 | help | ||
511 | When an error is returned in U-Boot it is sometimes difficult to | ||
512 | figure out the root cause. For eaxmple, reading from SPI flash may | ||
513 | fail due to a problem in the SPI controller or due to the flash part | ||
514 | not returning the expected information. This option changes | ||
515 | log_ret() to log any errors it sees. With this option disabled, | ||
516 | log_ret() is a nop. | ||
517 | |||
518 | You can add log_ret() to all functions which return an error code. | ||
519 | |||
507 | endmenu | 520 | endmenu |
508 | 521 | ||
509 | config DEFAULT_FDT_FILE | 522 | config DEFAULT_FDT_FILE |
510 | string "Default fdt file" | 523 | string "Default fdt file" |
511 | help | 524 | help |
512 | This option is used to set the default fdt file to boot OS. | 525 | This option is used to set the default fdt file to boot OS. |
513 | 526 | ||
514 | config VERSION_VARIABLE | 527 | config VERSION_VARIABLE |
515 | bool "add U-Boot environment variable vers" | 528 | bool "add U-Boot environment variable vers" |
516 | default n | 529 | default n |
517 | help | 530 | help |
518 | If this variable is defined, an environment variable | 531 | If this variable is defined, an environment variable |
519 | named "ver" is created by U-Boot showing the U-Boot | 532 | named "ver" is created by U-Boot showing the U-Boot |
520 | version as printed by the "version" command. | 533 | version as printed by the "version" command. |
521 | Any change to this variable will be reverted at the | 534 | Any change to this variable will be reverted at the |
522 | next reset. | 535 | next reset. |
523 | 536 | ||
524 | config BOARD_LATE_INIT | 537 | config BOARD_LATE_INIT |
525 | bool | 538 | bool |
526 | help | 539 | help |
527 | Sometimes board require some initialization code that might | 540 | Sometimes board require some initialization code that might |
528 | require once the actual init done, example saving board specific env, | 541 | require once the actual init done, example saving board specific env, |
529 | boot-modes etc. which eventually done at late. | 542 | boot-modes etc. which eventually done at late. |
530 | 543 | ||
531 | So this config enable the late init code with the help of board_late_init | 544 | So this config enable the late init code with the help of board_late_init |
532 | function which should defined on respective boards. | 545 | function which should defined on respective boards. |
533 | 546 | ||
534 | config DISPLAY_CPUINFO | 547 | config DISPLAY_CPUINFO |
535 | bool "Display information about the CPU during start up" | 548 | bool "Display information about the CPU during start up" |
536 | default y if ARM || NIOS2 || X86 || XTENSA || M68K | 549 | default y if ARM || NIOS2 || X86 || XTENSA || M68K |
537 | help | 550 | help |
538 | Display information about the CPU that U-Boot is running on | 551 | Display information about the CPU that U-Boot is running on |
539 | when U-Boot starts up. The function print_cpuinfo() is called | 552 | when U-Boot starts up. The function print_cpuinfo() is called |
540 | to do this. | 553 | to do this. |
541 | 554 | ||
542 | config DISPLAY_BOARDINFO | 555 | config DISPLAY_BOARDINFO |
543 | bool "Display information about the board during start up" | 556 | bool "Display information about the board during start up" |
544 | default y if ARM || M68K || MIPS || PPC || SANDBOX || XTENSA | 557 | default y if ARM || M68K || MIPS || PPC || SANDBOX || XTENSA |
545 | help | 558 | help |
546 | Display information about the board that U-Boot is running on | 559 | Display information about the board that U-Boot is running on |
547 | when U-Boot starts up. The board function checkboard() is called | 560 | when U-Boot starts up. The board function checkboard() is called |
548 | to do this. | 561 | to do this. |
549 | 562 | ||
550 | menu "Start-up hooks" | 563 | menu "Start-up hooks" |
551 | 564 | ||
552 | config ARCH_EARLY_INIT_R | 565 | config ARCH_EARLY_INIT_R |
553 | bool "Call arch-specific init soon after relocation" | 566 | bool "Call arch-specific init soon after relocation" |
554 | help | 567 | help |
555 | With this option U-Boot will call arch_early_init_r() soon after | 568 | With this option U-Boot will call arch_early_init_r() soon after |
556 | relocation. Driver model is running by this point, and the cache | 569 | relocation. Driver model is running by this point, and the cache |
557 | is on. Note that board_early_init_r() is called first, if | 570 | is on. Note that board_early_init_r() is called first, if |
558 | enabled. This can be used to set up architecture-specific devices. | 571 | enabled. This can be used to set up architecture-specific devices. |
559 | 572 | ||
560 | config ARCH_MISC_INIT | 573 | config ARCH_MISC_INIT |
561 | bool "Call arch-specific init after relocation, when console is ready" | 574 | bool "Call arch-specific init after relocation, when console is ready" |
562 | help | 575 | help |
563 | With this option U-Boot will call arch_misc_init() after | 576 | With this option U-Boot will call arch_misc_init() after |
564 | relocation to allow miscellaneous arch-dependent initialisation | 577 | relocation to allow miscellaneous arch-dependent initialisation |
565 | to be performed. This function should be defined by the board | 578 | to be performed. This function should be defined by the board |
566 | and will be called after the console is set up, after relocaiton. | 579 | and will be called after the console is set up, after relocaiton. |
567 | 580 | ||
568 | config BOARD_EARLY_INIT_F | 581 | config BOARD_EARLY_INIT_F |
569 | bool "Call board-specific init before relocation" | 582 | bool "Call board-specific init before relocation" |
570 | help | 583 | help |
571 | Some boards need to perform initialisation as soon as possible | 584 | Some boards need to perform initialisation as soon as possible |
572 | after boot. With this option, U-Boot calls board_early_init_f() | 585 | after boot. With this option, U-Boot calls board_early_init_f() |
573 | after driver model is ready in the pre-relocation init sequence. | 586 | after driver model is ready in the pre-relocation init sequence. |
574 | Note that the normal serial console is not yet set up, but the | 587 | Note that the normal serial console is not yet set up, but the |
575 | debug UART will be available if enabled. | 588 | debug UART will be available if enabled. |
576 | 589 | ||
577 | endmenu | 590 | endmenu |
578 | 591 | ||
579 | menu "Security support" | 592 | menu "Security support" |
580 | 593 | ||
581 | config HASH | 594 | config HASH |
582 | bool # "Support hashing API (SHA1, SHA256, etc.)" | 595 | bool # "Support hashing API (SHA1, SHA256, etc.)" |
583 | help | 596 | help |
584 | This provides a way to hash data in memory using various supported | 597 | This provides a way to hash data in memory using various supported |
585 | algorithms (such as SHA1, MD5, CRC32). The API is defined in hash.h | 598 | algorithms (such as SHA1, MD5, CRC32). The API is defined in hash.h |
586 | and the algorithms it supports are defined in common/hash.c. See | 599 | and the algorithms it supports are defined in common/hash.c. See |
587 | also CMD_HASH for command-line access. | 600 | also CMD_HASH for command-line access. |
588 | 601 | ||
589 | endmenu | 602 | endmenu |
590 | 603 | ||
591 | source "common/spl/Kconfig" | 604 | source "common/spl/Kconfig" |
592 | 605 |
configs/sandbox_defconfig
1 | CONFIG_SYS_MALLOC_F_LEN=0x2000 | 1 | CONFIG_SYS_MALLOC_F_LEN=0x2000 |
2 | CONFIG_DEFAULT_DEVICE_TREE="sandbox" | 2 | CONFIG_DEFAULT_DEVICE_TREE="sandbox" |
3 | CONFIG_DISTRO_DEFAULTS=y | 3 | CONFIG_DISTRO_DEFAULTS=y |
4 | CONFIG_ANDROID_BOOT_IMAGE=y | 4 | CONFIG_ANDROID_BOOT_IMAGE=y |
5 | CONFIG_FIT=y | 5 | CONFIG_FIT=y |
6 | CONFIG_FIT_SIGNATURE=y | 6 | CONFIG_FIT_SIGNATURE=y |
7 | CONFIG_FIT_VERBOSE=y | 7 | CONFIG_FIT_VERBOSE=y |
8 | CONFIG_BOOTSTAGE=y | 8 | CONFIG_BOOTSTAGE=y |
9 | CONFIG_BOOTSTAGE_REPORT=y | 9 | CONFIG_BOOTSTAGE_REPORT=y |
10 | CONFIG_BOOTSTAGE_FDT=y | 10 | CONFIG_BOOTSTAGE_FDT=y |
11 | CONFIG_BOOTSTAGE_STASH=y | 11 | CONFIG_BOOTSTAGE_STASH=y |
12 | CONFIG_BOOTSTAGE_STASH_ADDR=0x0 | 12 | CONFIG_BOOTSTAGE_STASH_ADDR=0x0 |
13 | CONFIG_BOOTSTAGE_STASH_SIZE=0x4096 | 13 | CONFIG_BOOTSTAGE_STASH_SIZE=0x4096 |
14 | CONFIG_CONSOLE_RECORD=y | 14 | CONFIG_CONSOLE_RECORD=y |
15 | CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000 | 15 | CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000 |
16 | CONFIG_SILENT_CONSOLE=y | 16 | CONFIG_SILENT_CONSOLE=y |
17 | CONFIG_PRE_CONSOLE_BUFFER=y | 17 | CONFIG_PRE_CONSOLE_BUFFER=y |
18 | CONFIG_PRE_CON_BUF_ADDR=0x100000 | 18 | CONFIG_PRE_CON_BUF_ADDR=0x100000 |
19 | CONFIG_LOG=y | 19 | CONFIG_LOG=y |
20 | CONFIG_LOG_MAX_LEVEL=6 | 20 | CONFIG_LOG_MAX_LEVEL=6 |
21 | CONFIG_LOG_ERROR_RETURN=y | ||
21 | CONFIG_CMD_CPU=y | 22 | CONFIG_CMD_CPU=y |
22 | CONFIG_CMD_LICENSE=y | 23 | CONFIG_CMD_LICENSE=y |
23 | CONFIG_CMD_BOOTZ=y | 24 | CONFIG_CMD_BOOTZ=y |
24 | # CONFIG_CMD_ELF is not set | 25 | # CONFIG_CMD_ELF is not set |
25 | CONFIG_CMD_ASKENV=y | 26 | CONFIG_CMD_ASKENV=y |
26 | CONFIG_CMD_GREPENV=y | 27 | CONFIG_CMD_GREPENV=y |
27 | CONFIG_CMD_ENV_CALLBACK=y | 28 | CONFIG_CMD_ENV_CALLBACK=y |
28 | CONFIG_CMD_ENV_FLAGS=y | 29 | CONFIG_CMD_ENV_FLAGS=y |
29 | CONFIG_LOOPW=y | 30 | CONFIG_LOOPW=y |
30 | CONFIG_CMD_MD5SUM=y | 31 | CONFIG_CMD_MD5SUM=y |
31 | CONFIG_CMD_MEMINFO=y | 32 | CONFIG_CMD_MEMINFO=y |
32 | CONFIG_CMD_MEMTEST=y | 33 | CONFIG_CMD_MEMTEST=y |
33 | CONFIG_CMD_MX_CYCLIC=y | 34 | CONFIG_CMD_MX_CYCLIC=y |
34 | CONFIG_CMD_DEMO=y | 35 | CONFIG_CMD_DEMO=y |
35 | CONFIG_CMD_GPIO=y | 36 | CONFIG_CMD_GPIO=y |
36 | CONFIG_CMD_GPT=y | 37 | CONFIG_CMD_GPT=y |
37 | CONFIG_CMD_GPT_RENAME=y | 38 | CONFIG_CMD_GPT_RENAME=y |
38 | CONFIG_CMD_IDE=y | 39 | CONFIG_CMD_IDE=y |
39 | CONFIG_CMD_I2C=y | 40 | CONFIG_CMD_I2C=y |
40 | CONFIG_CMD_PCI=y | 41 | CONFIG_CMD_PCI=y |
41 | CONFIG_CMD_READ=y | 42 | CONFIG_CMD_READ=y |
42 | CONFIG_CMD_REMOTEPROC=y | 43 | CONFIG_CMD_REMOTEPROC=y |
43 | CONFIG_CMD_SF=y | 44 | CONFIG_CMD_SF=y |
44 | CONFIG_CMD_SPI=y | 45 | CONFIG_CMD_SPI=y |
45 | CONFIG_CMD_USB=y | 46 | CONFIG_CMD_USB=y |
46 | CONFIG_CMD_TFTPPUT=y | 47 | CONFIG_CMD_TFTPPUT=y |
47 | CONFIG_CMD_TFTPSRV=y | 48 | CONFIG_CMD_TFTPSRV=y |
48 | CONFIG_CMD_RARP=y | 49 | CONFIG_CMD_RARP=y |
49 | CONFIG_CMD_CDP=y | 50 | CONFIG_CMD_CDP=y |
50 | CONFIG_CMD_SNTP=y | 51 | CONFIG_CMD_SNTP=y |
51 | CONFIG_CMD_DNS=y | 52 | CONFIG_CMD_DNS=y |
52 | CONFIG_CMD_LINK_LOCAL=y | 53 | CONFIG_CMD_LINK_LOCAL=y |
53 | CONFIG_CMD_ETHSW=y | 54 | CONFIG_CMD_ETHSW=y |
54 | CONFIG_CMD_BMP=y | 55 | CONFIG_CMD_BMP=y |
55 | CONFIG_CMD_TIME=y | 56 | CONFIG_CMD_TIME=y |
56 | CONFIG_CMD_TIMER=y | 57 | CONFIG_CMD_TIMER=y |
57 | CONFIG_CMD_SOUND=y | 58 | CONFIG_CMD_SOUND=y |
58 | CONFIG_CMD_QFW=y | 59 | CONFIG_CMD_QFW=y |
59 | CONFIG_CMD_BOOTSTAGE=y | 60 | CONFIG_CMD_BOOTSTAGE=y |
60 | CONFIG_CMD_PMIC=y | 61 | CONFIG_CMD_PMIC=y |
61 | CONFIG_CMD_REGULATOR=y | 62 | CONFIG_CMD_REGULATOR=y |
62 | CONFIG_CMD_TPM=y | 63 | CONFIG_CMD_TPM=y |
63 | CONFIG_CMD_TPM_TEST=y | 64 | CONFIG_CMD_TPM_TEST=y |
64 | CONFIG_CMD_BTRFS=y | 65 | CONFIG_CMD_BTRFS=y |
65 | CONFIG_CMD_CBFS=y | 66 | CONFIG_CMD_CBFS=y |
66 | CONFIG_CMD_CRAMFS=y | 67 | CONFIG_CMD_CRAMFS=y |
67 | CONFIG_CMD_EXT4_WRITE=y | 68 | CONFIG_CMD_EXT4_WRITE=y |
68 | CONFIG_CMD_MTDPARTS=y | 69 | CONFIG_CMD_MTDPARTS=y |
69 | CONFIG_CMD_LOG=y | 70 | CONFIG_CMD_LOG=y |
70 | CONFIG_MAC_PARTITION=y | 71 | CONFIG_MAC_PARTITION=y |
71 | CONFIG_AMIGA_PARTITION=y | 72 | CONFIG_AMIGA_PARTITION=y |
72 | CONFIG_OF_CONTROL=y | 73 | CONFIG_OF_CONTROL=y |
73 | CONFIG_OF_LIVE=y | 74 | CONFIG_OF_LIVE=y |
74 | CONFIG_OF_HOSTFILE=y | 75 | CONFIG_OF_HOSTFILE=y |
75 | CONFIG_NETCONSOLE=y | 76 | CONFIG_NETCONSOLE=y |
76 | CONFIG_REGMAP=y | 77 | CONFIG_REGMAP=y |
77 | CONFIG_SYSCON=y | 78 | CONFIG_SYSCON=y |
78 | CONFIG_DEVRES=y | 79 | CONFIG_DEVRES=y |
79 | CONFIG_DEBUG_DEVRES=y | 80 | CONFIG_DEBUG_DEVRES=y |
80 | CONFIG_ADC=y | 81 | CONFIG_ADC=y |
81 | CONFIG_ADC_SANDBOX=y | 82 | CONFIG_ADC_SANDBOX=y |
82 | CONFIG_CLK=y | 83 | CONFIG_CLK=y |
83 | CONFIG_CPU=y | 84 | CONFIG_CPU=y |
84 | CONFIG_DM_DEMO=y | 85 | CONFIG_DM_DEMO=y |
85 | CONFIG_DM_DEMO_SIMPLE=y | 86 | CONFIG_DM_DEMO_SIMPLE=y |
86 | CONFIG_DM_DEMO_SHAPE=y | 87 | CONFIG_DM_DEMO_SHAPE=y |
87 | CONFIG_PM8916_GPIO=y | 88 | CONFIG_PM8916_GPIO=y |
88 | CONFIG_SANDBOX_GPIO=y | 89 | CONFIG_SANDBOX_GPIO=y |
89 | CONFIG_DM_I2C_COMPAT=y | 90 | CONFIG_DM_I2C_COMPAT=y |
90 | CONFIG_I2C_CROS_EC_TUNNEL=y | 91 | CONFIG_I2C_CROS_EC_TUNNEL=y |
91 | CONFIG_I2C_CROS_EC_LDO=y | 92 | CONFIG_I2C_CROS_EC_LDO=y |
92 | CONFIG_DM_I2C_GPIO=y | 93 | CONFIG_DM_I2C_GPIO=y |
93 | CONFIG_SYS_I2C_SANDBOX=y | 94 | CONFIG_SYS_I2C_SANDBOX=y |
94 | CONFIG_I2C_MUX=y | 95 | CONFIG_I2C_MUX=y |
95 | CONFIG_SPL_I2C_MUX=y | 96 | CONFIG_SPL_I2C_MUX=y |
96 | CONFIG_I2C_ARB_GPIO_CHALLENGE=y | 97 | CONFIG_I2C_ARB_GPIO_CHALLENGE=y |
97 | CONFIG_CROS_EC_KEYB=y | 98 | CONFIG_CROS_EC_KEYB=y |
98 | CONFIG_I8042_KEYB=y | 99 | CONFIG_I8042_KEYB=y |
99 | CONFIG_LED=y | 100 | CONFIG_LED=y |
100 | CONFIG_LED_BLINK=y | 101 | CONFIG_LED_BLINK=y |
101 | CONFIG_LED_GPIO=y | 102 | CONFIG_LED_GPIO=y |
102 | CONFIG_DM_MAILBOX=y | 103 | CONFIG_DM_MAILBOX=y |
103 | CONFIG_SANDBOX_MBOX=y | 104 | CONFIG_SANDBOX_MBOX=y |
104 | CONFIG_MISC=y | 105 | CONFIG_MISC=y |
105 | CONFIG_CROS_EC=y | 106 | CONFIG_CROS_EC=y |
106 | CONFIG_CROS_EC_I2C=y | 107 | CONFIG_CROS_EC_I2C=y |
107 | CONFIG_CROS_EC_LPC=y | 108 | CONFIG_CROS_EC_LPC=y |
108 | CONFIG_CROS_EC_SANDBOX=y | 109 | CONFIG_CROS_EC_SANDBOX=y |
109 | CONFIG_CROS_EC_SPI=y | 110 | CONFIG_CROS_EC_SPI=y |
110 | CONFIG_PWRSEQ=y | 111 | CONFIG_PWRSEQ=y |
111 | CONFIG_SPL_PWRSEQ=y | 112 | CONFIG_SPL_PWRSEQ=y |
112 | CONFIG_I2C_EEPROM=y | 113 | CONFIG_I2C_EEPROM=y |
113 | CONFIG_MMC_SANDBOX=y | 114 | CONFIG_MMC_SANDBOX=y |
114 | CONFIG_SPI_FLASH_SANDBOX=y | 115 | CONFIG_SPI_FLASH_SANDBOX=y |
115 | CONFIG_SPI_FLASH=y | 116 | CONFIG_SPI_FLASH=y |
116 | CONFIG_SPI_FLASH_ATMEL=y | 117 | CONFIG_SPI_FLASH_ATMEL=y |
117 | CONFIG_SPI_FLASH_EON=y | 118 | CONFIG_SPI_FLASH_EON=y |
118 | CONFIG_SPI_FLASH_GIGADEVICE=y | 119 | CONFIG_SPI_FLASH_GIGADEVICE=y |
119 | CONFIG_SPI_FLASH_MACRONIX=y | 120 | CONFIG_SPI_FLASH_MACRONIX=y |
120 | CONFIG_SPI_FLASH_SPANSION=y | 121 | CONFIG_SPI_FLASH_SPANSION=y |
121 | CONFIG_SPI_FLASH_STMICRO=y | 122 | CONFIG_SPI_FLASH_STMICRO=y |
122 | CONFIG_SPI_FLASH_SST=y | 123 | CONFIG_SPI_FLASH_SST=y |
123 | CONFIG_SPI_FLASH_WINBOND=y | 124 | CONFIG_SPI_FLASH_WINBOND=y |
124 | CONFIG_DM_ETH=y | 125 | CONFIG_DM_ETH=y |
125 | CONFIG_NVME=y | 126 | CONFIG_NVME=y |
126 | CONFIG_PCI=y | 127 | CONFIG_PCI=y |
127 | CONFIG_DM_PCI=y | 128 | CONFIG_DM_PCI=y |
128 | CONFIG_DM_PCI_COMPAT=y | 129 | CONFIG_DM_PCI_COMPAT=y |
129 | CONFIG_PCI_SANDBOX=y | 130 | CONFIG_PCI_SANDBOX=y |
130 | CONFIG_PHY=y | 131 | CONFIG_PHY=y |
131 | CONFIG_PHY_SANDBOX=y | 132 | CONFIG_PHY_SANDBOX=y |
132 | CONFIG_PINCTRL=y | 133 | CONFIG_PINCTRL=y |
133 | CONFIG_PINCONF=y | 134 | CONFIG_PINCONF=y |
134 | CONFIG_PINCTRL_ROCKCHIP_RK3036=y | 135 | CONFIG_PINCTRL_ROCKCHIP_RK3036=y |
135 | CONFIG_PINCTRL_ROCKCHIP_RK3288=y | 136 | CONFIG_PINCTRL_ROCKCHIP_RK3288=y |
136 | CONFIG_PINCTRL_SANDBOX=y | 137 | CONFIG_PINCTRL_SANDBOX=y |
137 | CONFIG_POWER_DOMAIN=y | 138 | CONFIG_POWER_DOMAIN=y |
138 | CONFIG_SANDBOX_POWER_DOMAIN=y | 139 | CONFIG_SANDBOX_POWER_DOMAIN=y |
139 | CONFIG_DM_PMIC=y | 140 | CONFIG_DM_PMIC=y |
140 | CONFIG_PMIC_ACT8846=y | 141 | CONFIG_PMIC_ACT8846=y |
141 | CONFIG_DM_PMIC_PFUZE100=y | 142 | CONFIG_DM_PMIC_PFUZE100=y |
142 | CONFIG_DM_PMIC_MAX77686=y | 143 | CONFIG_DM_PMIC_MAX77686=y |
143 | CONFIG_PMIC_PM8916=y | 144 | CONFIG_PMIC_PM8916=y |
144 | CONFIG_PMIC_RK8XX=y | 145 | CONFIG_PMIC_RK8XX=y |
145 | CONFIG_PMIC_S2MPS11=y | 146 | CONFIG_PMIC_S2MPS11=y |
146 | CONFIG_DM_PMIC_SANDBOX=y | 147 | CONFIG_DM_PMIC_SANDBOX=y |
147 | CONFIG_PMIC_S5M8767=y | 148 | CONFIG_PMIC_S5M8767=y |
148 | CONFIG_PMIC_TPS65090=y | 149 | CONFIG_PMIC_TPS65090=y |
149 | CONFIG_DM_REGULATOR=y | 150 | CONFIG_DM_REGULATOR=y |
150 | CONFIG_REGULATOR_ACT8846=y | 151 | CONFIG_REGULATOR_ACT8846=y |
151 | CONFIG_DM_REGULATOR_PFUZE100=y | 152 | CONFIG_DM_REGULATOR_PFUZE100=y |
152 | CONFIG_DM_REGULATOR_MAX77686=y | 153 | CONFIG_DM_REGULATOR_MAX77686=y |
153 | CONFIG_DM_REGULATOR_FIXED=y | 154 | CONFIG_DM_REGULATOR_FIXED=y |
154 | CONFIG_REGULATOR_RK8XX=y | 155 | CONFIG_REGULATOR_RK8XX=y |
155 | CONFIG_REGULATOR_S5M8767=y | 156 | CONFIG_REGULATOR_S5M8767=y |
156 | CONFIG_DM_REGULATOR_SANDBOX=y | 157 | CONFIG_DM_REGULATOR_SANDBOX=y |
157 | CONFIG_REGULATOR_TPS65090=y | 158 | CONFIG_REGULATOR_TPS65090=y |
158 | CONFIG_DM_PWM=y | 159 | CONFIG_DM_PWM=y |
159 | CONFIG_PWM_SANDBOX=y | 160 | CONFIG_PWM_SANDBOX=y |
160 | CONFIG_RAM=y | 161 | CONFIG_RAM=y |
161 | CONFIG_REMOTEPROC_SANDBOX=y | 162 | CONFIG_REMOTEPROC_SANDBOX=y |
162 | CONFIG_DM_RESET=y | 163 | CONFIG_DM_RESET=y |
163 | CONFIG_SANDBOX_RESET=y | 164 | CONFIG_SANDBOX_RESET=y |
164 | CONFIG_DM_RTC=y | 165 | CONFIG_DM_RTC=y |
165 | CONFIG_SANDBOX_SERIAL=y | 166 | CONFIG_SANDBOX_SERIAL=y |
166 | CONFIG_SOUND=y | 167 | CONFIG_SOUND=y |
167 | CONFIG_SOUND_SANDBOX=y | 168 | CONFIG_SOUND_SANDBOX=y |
168 | CONFIG_SANDBOX_SPI=y | 169 | CONFIG_SANDBOX_SPI=y |
169 | CONFIG_SPMI=y | 170 | CONFIG_SPMI=y |
170 | CONFIG_SPMI_SANDBOX=y | 171 | CONFIG_SPMI_SANDBOX=y |
171 | CONFIG_SYSRESET=y | 172 | CONFIG_SYSRESET=y |
172 | CONFIG_TIMER=y | 173 | CONFIG_TIMER=y |
173 | CONFIG_TIMER_EARLY=y | 174 | CONFIG_TIMER_EARLY=y |
174 | CONFIG_SANDBOX_TIMER=y | 175 | CONFIG_SANDBOX_TIMER=y |
175 | CONFIG_TPM_TIS_SANDBOX=y | 176 | CONFIG_TPM_TIS_SANDBOX=y |
176 | CONFIG_USB=y | 177 | CONFIG_USB=y |
177 | CONFIG_DM_USB=y | 178 | CONFIG_DM_USB=y |
178 | CONFIG_USB_EMUL=y | 179 | CONFIG_USB_EMUL=y |
179 | CONFIG_USB_STORAGE=y | 180 | CONFIG_USB_STORAGE=y |
180 | CONFIG_USB_KEYBOARD=y | 181 | CONFIG_USB_KEYBOARD=y |
181 | CONFIG_DM_VIDEO=y | 182 | CONFIG_DM_VIDEO=y |
182 | CONFIG_CONSOLE_ROTATION=y | 183 | CONFIG_CONSOLE_ROTATION=y |
183 | CONFIG_CONSOLE_TRUETYPE=y | 184 | CONFIG_CONSOLE_TRUETYPE=y |
184 | CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y | 185 | CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y |
185 | CONFIG_VIDEO_SANDBOX_SDL=y | 186 | CONFIG_VIDEO_SANDBOX_SDL=y |
186 | CONFIG_WDT=y | 187 | CONFIG_WDT=y |
187 | CONFIG_WDT_SANDBOX=y | 188 | CONFIG_WDT_SANDBOX=y |
188 | CONFIG_FS_CBFS=y | 189 | CONFIG_FS_CBFS=y |
189 | CONFIG_FS_CRAMFS=y | 190 | CONFIG_FS_CRAMFS=y |
190 | CONFIG_CMD_DHRYSTONE=y | 191 | CONFIG_CMD_DHRYSTONE=y |
191 | CONFIG_TPM=y | 192 | CONFIG_TPM=y |
192 | CONFIG_LZ4=y | 193 | CONFIG_LZ4=y |
193 | CONFIG_ERRNO_STR=y | 194 | CONFIG_ERRNO_STR=y |
194 | CONFIG_OF_LIBFDT_OVERLAY=y | 195 | CONFIG_OF_LIBFDT_OVERLAY=y |
195 | CONFIG_UNIT_TEST=y | 196 | CONFIG_UNIT_TEST=y |
196 | CONFIG_UT_TIME=y | 197 | CONFIG_UT_TIME=y |
197 | CONFIG_UT_DM=y | 198 | CONFIG_UT_DM=y |
198 | CONFIG_UT_ENV=y | 199 | CONFIG_UT_ENV=y |
199 | CONFIG_UT_OVERLAY=y | 200 | CONFIG_UT_OVERLAY=y |
200 | 201 |
doc/README.log
1 | Logging in U-Boot | 1 | Logging in U-Boot |
2 | ================= | 2 | ================= |
3 | 3 | ||
4 | Introduction | 4 | Introduction |
5 | ------------ | 5 | ------------ |
6 | 6 | ||
7 | U-Boot's internal operation involves many different steps and actions. From | 7 | U-Boot's internal operation involves many different steps and actions. From |
8 | setting up the board to displaying a start-up screen to loading an Operating | 8 | setting up the board to displaying a start-up screen to loading an Operating |
9 | System, there are many component parts each with many actions. | 9 | System, there are many component parts each with many actions. |
10 | 10 | ||
11 | Most of the time this internal detail is not useful. Displaying it on the | 11 | Most of the time this internal detail is not useful. Displaying it on the |
12 | console would delay booting (U-Boot's primary purpose) and confuse users. | 12 | console would delay booting (U-Boot's primary purpose) and confuse users. |
13 | 13 | ||
14 | But for digging into what is happening in a particular area, or for debugging | 14 | But for digging into what is happening in a particular area, or for debugging |
15 | a problem it is often useful to see what U-Boot is doing in more detail than | 15 | a problem it is often useful to see what U-Boot is doing in more detail than |
16 | is visible from the basic console output. | 16 | is visible from the basic console output. |
17 | 17 | ||
18 | U-Boot's logging feature aims to satisfy this goal for both users and | 18 | U-Boot's logging feature aims to satisfy this goal for both users and |
19 | developers. | 19 | developers. |
20 | 20 | ||
21 | 21 | ||
22 | Logging levels | 22 | Logging levels |
23 | -------------- | 23 | -------------- |
24 | 24 | ||
25 | There are a number logging levels available, in increasing order of verbosity: | 25 | There are a number logging levels available, in increasing order of verbosity: |
26 | 26 | ||
27 | LOGL_EMERG - Printed before U-Boot halts | 27 | LOGL_EMERG - Printed before U-Boot halts |
28 | LOGL_ALERT - Indicates action must be taken immediate or U-Boot will crash | 28 | LOGL_ALERT - Indicates action must be taken immediate or U-Boot will crash |
29 | LOGL_CRIT - Indicates a critical error that will cause boot failure | 29 | LOGL_CRIT - Indicates a critical error that will cause boot failure |
30 | LOGL_ERR - Indicates an error that may cause boot failure | 30 | LOGL_ERR - Indicates an error that may cause boot failure |
31 | LOGL_WARNING - Warning about an unexpected condition | 31 | LOGL_WARNING - Warning about an unexpected condition |
32 | LOGL_NOTE - Important information about progress | 32 | LOGL_NOTE - Important information about progress |
33 | LOGL_INFO - Information about normal boot progress | 33 | LOGL_INFO - Information about normal boot progress |
34 | LOGL_DEBUG - Debug information (useful for debugging a driver or subsystem) | 34 | LOGL_DEBUG - Debug information (useful for debugging a driver or subsystem) |
35 | LOGL_DEBUG_CONTENT - Debug message showing full message content | 35 | LOGL_DEBUG_CONTENT - Debug message showing full message content |
36 | LOGL_DEBUG_IO - Debug message showing hardware I/O access | 36 | LOGL_DEBUG_IO - Debug message showing hardware I/O access |
37 | 37 | ||
38 | 38 | ||
39 | Logging category | 39 | Logging category |
40 | ---------------- | 40 | ---------------- |
41 | 41 | ||
42 | Logging can come from a wide variety of places within U-Boot. Each log message | 42 | Logging can come from a wide variety of places within U-Boot. Each log message |
43 | has a category which is intended to allow messages to be filtered according to | 43 | has a category which is intended to allow messages to be filtered according to |
44 | their source. | 44 | their source. |
45 | 45 | ||
46 | The following main categories are defined: | 46 | The following main categories are defined: |
47 | 47 | ||
48 | LOGC_NONE - Unknown category (e.g. a debug() statement) | 48 | LOGC_NONE - Unknown category (e.g. a debug() statement) |
49 | UCLASS_... - Related to a particular uclass (e.g. UCLASS_USB) | 49 | UCLASS_... - Related to a particular uclass (e.g. UCLASS_USB) |
50 | LOGC_ARCH - Related to architecture-specific code | 50 | LOGC_ARCH - Related to architecture-specific code |
51 | LOGC_BOARD - Related to board-specific code | 51 | LOGC_BOARD - Related to board-specific code |
52 | LOGC_CORE - Related to core driver-model support | 52 | LOGC_CORE - Related to core driver-model support |
53 | LOGC_DT - Related to device tree control | 53 | LOGC_DT - Related to device tree control |
54 | 54 | ||
55 | 55 | ||
56 | Enabling logging | 56 | Enabling logging |
57 | ---------------- | 57 | ---------------- |
58 | 58 | ||
59 | The following options are used to enable logging at compile time: | 59 | The following options are used to enable logging at compile time: |
60 | 60 | ||
61 | CONFIG_LOG - Enables the logging system | 61 | CONFIG_LOG - Enables the logging system |
62 | CONFIG_MAX_LOG_LEVEL - Max log level to build (anything higher is compiled | 62 | CONFIG_MAX_LOG_LEVEL - Max log level to build (anything higher is compiled |
63 | out) | 63 | out) |
64 | CONFIG_LOG_CONSOLE - Enable writing log records to the console | 64 | CONFIG_LOG_CONSOLE - Enable writing log records to the console |
65 | 65 | ||
66 | If CONFIG_LOG is not set, then no logging will be available. | 66 | If CONFIG_LOG is not set, then no logging will be available. |
67 | 67 | ||
68 | The above have SPL versions also, e.g. CONFIG_SPL_MAX_LOG_LEVEL. | 68 | The above have SPL versions also, e.g. CONFIG_SPL_MAX_LOG_LEVEL. |
69 | 69 | ||
70 | 70 | ||
71 | Log commands | 71 | Log commands |
72 | ------------ | 72 | ------------ |
73 | 73 | ||
74 | The 'log' command provides access to several features: | 74 | The 'log' command provides access to several features: |
75 | 75 | ||
76 | level - access the default log level | 76 | level - access the default log level |
77 | format - access the console log format | 77 | format - access the console log format |
78 | rec - output a log record | 78 | rec - output a log record |
79 | test - run tests | 79 | test - run tests |
80 | 80 | ||
81 | Type 'help log' for details. | 81 | Type 'help log' for details. |
82 | 82 | ||
83 | 83 | ||
84 | Using DEBUG | 84 | Using DEBUG |
85 | ----------- | 85 | ----------- |
86 | 86 | ||
87 | U-Boot has traditionally used a #define called DEBUG to enable debugging on a | 87 | U-Boot has traditionally used a #define called DEBUG to enable debugging on a |
88 | file-by-file basis. The debug() macro compiles to a printf() statement if | 88 | file-by-file basis. The debug() macro compiles to a printf() statement if |
89 | DEBUG is enabled, and an empty statement if not. | 89 | DEBUG is enabled, and an empty statement if not. |
90 | 90 | ||
91 | With logging enabled, debug() statements are interpreted as logging output | 91 | With logging enabled, debug() statements are interpreted as logging output |
92 | with a level of LOGL_DEBUG and a category of LOGC_NONE. | 92 | with a level of LOGL_DEBUG and a category of LOGC_NONE. |
93 | 93 | ||
94 | The logging facilities are intended to replace DEBUG, but if DEBUG is defined | 94 | The logging facilities are intended to replace DEBUG, but if DEBUG is defined |
95 | at the top of a file, then it takes precedence. This means that debug() | 95 | at the top of a file, then it takes precedence. This means that debug() |
96 | statements will result in output to the console and this output will not be | 96 | statements will result in output to the console and this output will not be |
97 | logged. | 97 | logged. |
98 | 98 | ||
99 | 99 | ||
100 | Logging destinations | 100 | Logging destinations |
101 | -------------------- | 101 | -------------------- |
102 | 102 | ||
103 | If logging information goes nowhere then it serves no purpose. U-Boot provides | 103 | If logging information goes nowhere then it serves no purpose. U-Boot provides |
104 | several possible determinations for logging information, all of which can be | 104 | several possible determinations for logging information, all of which can be |
105 | enabled or disabled independently: | 105 | enabled or disabled independently: |
106 | 106 | ||
107 | console - goes to stdout | 107 | console - goes to stdout |
108 | 108 | ||
109 | 109 | ||
110 | Log format | 110 | Log format |
111 | ---------- | 111 | ---------- |
112 | 112 | ||
113 | You can control the log format using the 'log format' command. The basic | 113 | You can control the log format using the 'log format' command. The basic |
114 | format is: | 114 | format is: |
115 | 115 | ||
116 | LEVEL.category,file.c:123-func() message | 116 | LEVEL.category,file.c:123-func() message |
117 | 117 | ||
118 | In the above, file.c:123 is the filename where the log record was generated and | 118 | In the above, file.c:123 is the filename where the log record was generated and |
119 | func() is the function name. By default ('log format default') only the | 119 | func() is the function name. By default ('log format default') only the |
120 | function name and message are displayed on the console. You can control which | 120 | function name and message are displayed on the console. You can control which |
121 | fields are present, but not the field order. | 121 | fields are present, but not the field order. |
122 | 122 | ||
123 | 123 | ||
124 | Filters | 124 | Filters |
125 | ------- | 125 | ------- |
126 | 126 | ||
127 | Filters are attached to log drivers to control what those drivers emit. Only | 127 | Filters are attached to log drivers to control what those drivers emit. Only |
128 | records that pass through the filter make it to the driver. | 128 | records that pass through the filter make it to the driver. |
129 | 129 | ||
130 | Filters can be based on several criteria: | 130 | Filters can be based on several criteria: |
131 | 131 | ||
132 | - maximum log level | 132 | - maximum log level |
133 | - in a set of categories | 133 | - in a set of categories |
134 | - in a set of files | 134 | - in a set of files |
135 | 135 | ||
136 | If no filters are attached to a driver then a default filter is used, which | 136 | If no filters are attached to a driver then a default filter is used, which |
137 | limits output to records with a level less than CONFIG_LOG_MAX_LEVEL. | 137 | limits output to records with a level less than CONFIG_LOG_MAX_LEVEL. |
138 | 138 | ||
139 | 139 | ||
140 | Logging statements | 140 | Logging statements |
141 | ------------------ | 141 | ------------------ |
142 | 142 | ||
143 | The main logging function is: | 143 | The main logging function is: |
144 | 144 | ||
145 | log(category, level, format_string, ...) | 145 | log(category, level, format_string, ...) |
146 | 146 | ||
147 | Also debug() and error() will generate log records - these use LOG_CATEGORY | 147 | Also debug() and error() will generate log records - these use LOG_CATEGORY |
148 | as the category, so you should #define this right at the top of the source | 148 | as the category, so you should #define this right at the top of the source |
149 | file to ensure the category is correct. | 149 | file to ensure the category is correct. |
150 | 150 | ||
151 | You can also define CONFIG_LOG_ERROR_RETURN to enable the log_ret() macro. This | ||
152 | can be used whenever your function returns an error value: | ||
153 | |||
154 | return log_ret(uclass_first_device(UCLASS_MMC, &dev)); | ||
155 | |||
156 | This will write a log record when an error code is detected (a value < 0). This | ||
157 | can make it easier to trace errors that are generated deep in the call stack. | ||
158 | |||
151 | 159 | ||
152 | Code size | 160 | Code size |
153 | --------- | 161 | --------- |
154 | 162 | ||
155 | Code size impact depends largely on what is enabled. The following numbers are | 163 | Code size impact depends largely on what is enabled. The following numbers are |
156 | for snow, which is a Thumb-2 board: | 164 | for snow, which is a Thumb-2 board: |
157 | 165 | ||
158 | This series: adds bss +20.0 data +4.0 rodata +4.0 text +44.0 | 166 | This series: adds bss +20.0 data +4.0 rodata +4.0 text +44.0 |
159 | CONFIG_LOG: bss -52.0 data +92.0 rodata -635.0 text +1048.0 | 167 | CONFIG_LOG: bss -52.0 data +92.0 rodata -635.0 text +1048.0 |
160 | CONFIG_LOG_MAX_LEVEL=7: bss +188.0 data +4.0 rodata +49183.0 text +98124.0 | 168 | CONFIG_LOG_MAX_LEVEL=7: bss +188.0 data +4.0 rodata +49183.0 text +98124.0 |
161 | 169 | ||
162 | The last option turns every debug() statement into a logging call, which | 170 | The last option turns every debug() statement into a logging call, which |
163 | bloats the code hugely. The advantage is that it is then possible to enable | 171 | bloats the code hugely. The advantage is that it is then possible to enable |
164 | all logging within U-Boot. | 172 | all logging within U-Boot. |
165 | 173 | ||
166 | 174 | ||
167 | To Do | 175 | To Do |
168 | ----- | 176 | ----- |
169 | 177 | ||
170 | There are lots of useful additions that could be made. None of the below is | 178 | There are lots of useful additions that could be made. None of the below is |
171 | implemented! If you do one, please add a test in test/py/tests/test_log.py | 179 | implemented! If you do one, please add a test in test/py/tests/test_log.py |
172 | 180 | ||
173 | Convenience functions to support setting the category: | 181 | Convenience functions to support setting the category: |
174 | 182 | ||
175 | log_arch(level, format_string, ...) - category LOGC_ARCH | 183 | log_arch(level, format_string, ...) - category LOGC_ARCH |
176 | log_board(level, format_string, ...) - category LOGC_BOARD | 184 | log_board(level, format_string, ...) - category LOGC_BOARD |
177 | log_core(level, format_string, ...) - category LOGC_CORE | 185 | log_core(level, format_string, ...) - category LOGC_CORE |
178 | log_dt(level, format_string, ...) - category LOGC_DT | 186 | log_dt(level, format_string, ...) - category LOGC_DT |
179 | 187 | ||
180 | Convenience functions to support a category defined for a single file, for | 188 | Convenience functions to support a category defined for a single file, for |
181 | example: | 189 | example: |
182 | 190 | ||
183 | #define LOG_CATEGORY UCLASS_USB | 191 | #define LOG_CATEGORY UCLASS_USB |
184 | 192 | ||
185 | all of these can use LOG_CATEGORY as the category, and a log level | 193 | all of these can use LOG_CATEGORY as the category, and a log level |
186 | corresponding to the function name: | 194 | corresponding to the function name: |
187 | 195 | ||
188 | logc(level, format_string, ...) | 196 | logc(level, format_string, ...) |
189 | 197 | ||
190 | More logging destinations: | 198 | More logging destinations: |
191 | 199 | ||
192 | device - goes to a device (e.g. serial) | 200 | device - goes to a device (e.g. serial) |
193 | buffer - recorded in a memory buffer | 201 | buffer - recorded in a memory buffer |
194 | 202 | ||
195 | Convert debug() statements in the code to log() statements | 203 | Convert debug() statements in the code to log() statements |
196 | 204 | ||
197 | Support making printf() emit log statements a L_INFO level | 205 | Support making printf() emit log statements a L_INFO level |
198 | 206 | ||
199 | Convert error() statements in the code to log() statements | 207 | Convert error() statements in the code to log() statements |
200 | 208 | ||
201 | Figure out what to do with BUG(), BUG_ON() and warn_non_spl() | 209 | Figure out what to do with BUG(), BUG_ON() and warn_non_spl() |
202 | 210 | ||
203 | Figure out what to do with assert() | 211 | Figure out what to do with assert() |
204 | 212 | ||
205 | Add a way to browse log records | 213 | Add a way to browse log records |
206 | 214 | ||
207 | Add a way to record log records for browsing using an external tool | 215 | Add a way to record log records for browsing using an external tool |
208 | 216 | ||
209 | Add commands to add and remove filters | 217 | Add commands to add and remove filters |
210 | 218 | ||
211 | Add commands to add and remove log devices | 219 | Add commands to add and remove log devices |
212 | 220 | ||
213 | Allow sharing of printf format strings in log records to reduce storage size | 221 | Allow sharing of printf format strings in log records to reduce storage size |
214 | for large numbers of log records | 222 | for large numbers of log records |
215 | 223 | ||
216 | Add a command-line option to sandbox to set the default logging level | 224 | Add a command-line option to sandbox to set the default logging level |
217 | 225 | ||
218 | Convert core driver model code to use logging | 226 | Convert core driver model code to use logging |
219 | 227 | ||
220 | Convert uclasses to use logging with the correct category | 228 | Convert uclasses to use logging with the correct category |
221 | 229 | ||
222 | Consider making log() calls emit an automatic newline, perhaps with a logn() | 230 | Consider making log() calls emit an automatic newline, perhaps with a logn() |
223 | function to avoid that | 231 | function to avoid that |
224 | 232 | ||
225 | Passing log records through to linux (e.g. via device tree /chosen) | 233 | Passing log records through to linux (e.g. via device tree /chosen) |
226 | 234 | ||
227 | Provide a command to access the number of log records generated, and the | 235 | Provide a command to access the number of log records generated, and the |
228 | number dropped due to them being generated before the log system was ready. | 236 | number dropped due to them being generated before the log system was ready. |
229 | 237 | ||
230 | Add a printf() format string pragma so that log statements are checked properly | 238 | Add a printf() format string pragma so that log statements are checked properly |
231 | 239 | ||
232 | Enhance the log console driver to show level / category / file / line | 240 | Enhance the log console driver to show level / category / file / line |
233 | information | 241 | information |
234 | 242 | ||
235 | Add a command to add new log records and delete existing records. | 243 | Add a command to add new log records and delete existing records. |
236 | 244 | ||
237 | Provide additional log() functions - e.g. logc() to specify the category | 245 | Provide additional log() functions - e.g. logc() to specify the category |
238 | 246 | ||
239 | -- | 247 | -- |
240 | Simon Glass <sjg@chromium.org> | 248 | Simon Glass <sjg@chromium.org> |
241 | 15-Sep-17 | 249 | 15-Sep-17 |
242 | 250 |
include/log.h
1 | /* | 1 | /* |
2 | * Logging support | 2 | * Logging support |
3 | * | 3 | * |
4 | * Copyright (c) 2017 Google, Inc | 4 | * Copyright (c) 2017 Google, Inc |
5 | * Written by Simon Glass <sjg@chromium.org> | 5 | * Written by Simon Glass <sjg@chromium.org> |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: GPL-2.0+ | 7 | * SPDX-License-Identifier: GPL-2.0+ |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifndef __LOG_H | 10 | #ifndef __LOG_H |
11 | #define __LOG_H | 11 | #define __LOG_H |
12 | 12 | ||
13 | #include <dm/uclass-id.h> | 13 | #include <dm/uclass-id.h> |
14 | #include <linux/list.h> | 14 | #include <linux/list.h> |
15 | 15 | ||
16 | /** Log levels supported, ranging from most to least important */ | 16 | /** Log levels supported, ranging from most to least important */ |
17 | enum log_level_t { | 17 | enum log_level_t { |
18 | LOGL_EMERG = 0, /*U-Boot is unstable */ | 18 | LOGL_EMERG = 0, /*U-Boot is unstable */ |
19 | LOGL_ALERT, /* Action must be taken immediately */ | 19 | LOGL_ALERT, /* Action must be taken immediately */ |
20 | LOGL_CRIT, /* Critical conditions */ | 20 | LOGL_CRIT, /* Critical conditions */ |
21 | LOGL_ERR, /* Error that prevents something from working */ | 21 | LOGL_ERR, /* Error that prevents something from working */ |
22 | LOGL_WARNING, /* Warning may prevent optimial operation */ | 22 | LOGL_WARNING, /* Warning may prevent optimial operation */ |
23 | LOGL_NOTICE, /* Normal but significant condition, printf() */ | 23 | LOGL_NOTICE, /* Normal but significant condition, printf() */ |
24 | LOGL_INFO, /* General information message */ | 24 | LOGL_INFO, /* General information message */ |
25 | LOGL_DEBUG, /* Basic debug-level message */ | 25 | LOGL_DEBUG, /* Basic debug-level message */ |
26 | LOGL_DEBUG_CONTENT, /* Debug message showing full message content */ | 26 | LOGL_DEBUG_CONTENT, /* Debug message showing full message content */ |
27 | LOGL_DEBUG_IO, /* Debug message showing hardware I/O access */ | 27 | LOGL_DEBUG_IO, /* Debug message showing hardware I/O access */ |
28 | 28 | ||
29 | LOGL_COUNT, | 29 | LOGL_COUNT, |
30 | LOGL_NONE, | 30 | LOGL_NONE, |
31 | 31 | ||
32 | LOGL_FIRST = LOGL_EMERG, | 32 | LOGL_FIRST = LOGL_EMERG, |
33 | LOGL_MAX = LOGL_DEBUG_IO, | 33 | LOGL_MAX = LOGL_DEBUG_IO, |
34 | }; | 34 | }; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * Log categories supported. Most of these correspond to uclasses (i.e. | 37 | * Log categories supported. Most of these correspond to uclasses (i.e. |
38 | * enum uclass_id) but there are also some more generic categories | 38 | * enum uclass_id) but there are also some more generic categories |
39 | */ | 39 | */ |
40 | enum log_category_t { | 40 | enum log_category_t { |
41 | LOGC_FIRST = 0, /* First part mirrors UCLASS_... */ | 41 | LOGC_FIRST = 0, /* First part mirrors UCLASS_... */ |
42 | 42 | ||
43 | LOGC_NONE = UCLASS_COUNT, | 43 | LOGC_NONE = UCLASS_COUNT, |
44 | LOGC_ARCH, | 44 | LOGC_ARCH, |
45 | LOGC_BOARD, | 45 | LOGC_BOARD, |
46 | LOGC_CORE, | 46 | LOGC_CORE, |
47 | LOGC_DM, /* Core driver-model */ | 47 | LOGC_DM, /* Core driver-model */ |
48 | LOGC_DT, /* Device-tree */ | 48 | LOGC_DT, /* Device-tree */ |
49 | 49 | ||
50 | LOGC_COUNT, | 50 | LOGC_COUNT, |
51 | LOGC_END, | 51 | LOGC_END, |
52 | }; | 52 | }; |
53 | 53 | ||
54 | /* Helper to cast a uclass ID to a log category */ | 54 | /* Helper to cast a uclass ID to a log category */ |
55 | static inline int log_uc_cat(enum uclass_id id) | 55 | static inline int log_uc_cat(enum uclass_id id) |
56 | { | 56 | { |
57 | return (enum log_category_t)id; | 57 | return (enum log_category_t)id; |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * _log() - Internal function to emit a new log record | 61 | * _log() - Internal function to emit a new log record |
62 | * | 62 | * |
63 | * @cat: Category of log record (indicating which subsystem generated it) | 63 | * @cat: Category of log record (indicating which subsystem generated it) |
64 | * @level: Level of log record (indicating its severity) | 64 | * @level: Level of log record (indicating its severity) |
65 | * @file: File name of file where log record was generated | 65 | * @file: File name of file where log record was generated |
66 | * @line: Line number in file where log record was generated | 66 | * @line: Line number in file where log record was generated |
67 | * @func: Function where log record was generated | 67 | * @func: Function where log record was generated |
68 | * @fmt: printf() format string for log record | 68 | * @fmt: printf() format string for log record |
69 | * @...: Optional parameters, according to the format string @fmt | 69 | * @...: Optional parameters, according to the format string @fmt |
70 | * @return 0 if log record was emitted, -ve on error | 70 | * @return 0 if log record was emitted, -ve on error |
71 | */ | 71 | */ |
72 | int _log(enum log_category_t cat, enum log_level_t level, const char *file, | 72 | int _log(enum log_category_t cat, enum log_level_t level, const char *file, |
73 | int line, const char *func, const char *fmt, ...); | 73 | int line, const char *func, const char *fmt, ...); |
74 | 74 | ||
75 | /* Define this at the top of a file to add a prefix to debug messages */ | 75 | /* Define this at the top of a file to add a prefix to debug messages */ |
76 | #ifndef pr_fmt | 76 | #ifndef pr_fmt |
77 | #define pr_fmt(fmt) fmt | 77 | #define pr_fmt(fmt) fmt |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | /* Use a default category if this file does not supply one */ | 80 | /* Use a default category if this file does not supply one */ |
81 | #ifndef LOG_CATEGORY | 81 | #ifndef LOG_CATEGORY |
82 | #define LOG_CATEGORY LOGC_NONE | 82 | #define LOG_CATEGORY LOGC_NONE |
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | /* | 85 | /* |
86 | * This header may be including when CONFIG_LOG is disabled, in which case | 86 | * This header may be including when CONFIG_LOG is disabled, in which case |
87 | * CONFIG_LOG_MAX_LEVEL is not defined. Add a check for this. | 87 | * CONFIG_LOG_MAX_LEVEL is not defined. Add a check for this. |
88 | */ | 88 | */ |
89 | #if CONFIG_IS_ENABLED(LOG) | 89 | #if CONFIG_IS_ENABLED(LOG) |
90 | #define _LOG_MAX_LEVEL CONFIG_VAL(LOG_MAX_LEVEL) | 90 | #define _LOG_MAX_LEVEL CONFIG_VAL(LOG_MAX_LEVEL) |
91 | #else | 91 | #else |
92 | #define _LOG_MAX_LEVEL LOGL_INFO | 92 | #define _LOG_MAX_LEVEL LOGL_INFO |
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | /* Emit a log record if the level is less that the maximum */ | 95 | /* Emit a log record if the level is less that the maximum */ |
96 | #define log(_cat, _level, _fmt, _args...) ({ \ | 96 | #define log(_cat, _level, _fmt, _args...) ({ \ |
97 | int _l = _level; \ | 97 | int _l = _level; \ |
98 | if (_l <= _LOG_MAX_LEVEL) \ | 98 | if (_l <= _LOG_MAX_LEVEL) \ |
99 | _log((enum log_category_t)(_cat), _l, __FILE__, __LINE__, \ | 99 | _log((enum log_category_t)(_cat), _l, __FILE__, __LINE__, \ |
100 | __func__, \ | 100 | __func__, \ |
101 | pr_fmt(_fmt), ##_args); \ | 101 | pr_fmt(_fmt), ##_args); \ |
102 | }) | 102 | }) |
103 | 103 | ||
104 | #ifdef DEBUG | 104 | #ifdef DEBUG |
105 | #define _DEBUG 1 | 105 | #define _DEBUG 1 |
106 | #else | 106 | #else |
107 | #define _DEBUG 0 | 107 | #define _DEBUG 0 |
108 | #endif | 108 | #endif |
109 | 109 | ||
110 | #ifdef CONFIG_SPL_BUILD | 110 | #ifdef CONFIG_SPL_BUILD |
111 | #define _SPL_BUILD 1 | 111 | #define _SPL_BUILD 1 |
112 | #else | 112 | #else |
113 | #define _SPL_BUILD 0 | 113 | #define _SPL_BUILD 0 |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | #if !_DEBUG && CONFIG_IS_ENABLED(LOG) | 116 | #if !_DEBUG && CONFIG_IS_ENABLED(LOG) |
117 | 117 | ||
118 | #define debug_cond(cond, fmt, args...) \ | 118 | #define debug_cond(cond, fmt, args...) \ |
119 | do { \ | 119 | do { \ |
120 | if (1) \ | 120 | if (1) \ |
121 | log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \ | 121 | log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \ |
122 | } while (0) | 122 | } while (0) |
123 | 123 | ||
124 | #else /* _DEBUG */ | 124 | #else /* _DEBUG */ |
125 | 125 | ||
126 | /* | 126 | /* |
127 | * Output a debug text when condition "cond" is met. The "cond" should be | 127 | * Output a debug text when condition "cond" is met. The "cond" should be |
128 | * computed by a preprocessor in the best case, allowing for the best | 128 | * computed by a preprocessor in the best case, allowing for the best |
129 | * optimization. | 129 | * optimization. |
130 | */ | 130 | */ |
131 | #define debug_cond(cond, fmt, args...) \ | 131 | #define debug_cond(cond, fmt, args...) \ |
132 | do { \ | 132 | do { \ |
133 | if (cond) \ | 133 | if (cond) \ |
134 | printf(pr_fmt(fmt), ##args); \ | 134 | printf(pr_fmt(fmt), ##args); \ |
135 | } while (0) | 135 | } while (0) |
136 | 136 | ||
137 | #endif /* _DEBUG */ | 137 | #endif /* _DEBUG */ |
138 | 138 | ||
139 | /* Show a message if DEBUG is defined in a file */ | 139 | /* Show a message if DEBUG is defined in a file */ |
140 | #define debug(fmt, args...) \ | 140 | #define debug(fmt, args...) \ |
141 | debug_cond(_DEBUG, fmt, ##args) | 141 | debug_cond(_DEBUG, fmt, ##args) |
142 | 142 | ||
143 | /* Show a message if not in SPL */ | 143 | /* Show a message if not in SPL */ |
144 | #define warn_non_spl(fmt, args...) \ | 144 | #define warn_non_spl(fmt, args...) \ |
145 | debug_cond(!_SPL_BUILD, fmt, ##args) | 145 | debug_cond(!_SPL_BUILD, fmt, ##args) |
146 | 146 | ||
147 | /* | 147 | /* |
148 | * An assertion is run-time check done in debug mode only. If DEBUG is not | 148 | * An assertion is run-time check done in debug mode only. If DEBUG is not |
149 | * defined then it is skipped. If DEBUG is defined and the assertion fails, | 149 | * defined then it is skipped. If DEBUG is defined and the assertion fails, |
150 | * then it calls panic*( which may or may not reset/halt U-Boot (see | 150 | * then it calls panic*( which may or may not reset/halt U-Boot (see |
151 | * CONFIG_PANIC_HANG), It is hoped that all failing assertions are found | 151 | * CONFIG_PANIC_HANG), It is hoped that all failing assertions are found |
152 | * before release, and after release it is hoped that they don't matter. But | 152 | * before release, and after release it is hoped that they don't matter. But |
153 | * in any case these failing assertions cannot be fixed with a reset (which | 153 | * in any case these failing assertions cannot be fixed with a reset (which |
154 | * may just do the same assertion again). | 154 | * may just do the same assertion again). |
155 | */ | 155 | */ |
156 | void __assert_fail(const char *assertion, const char *file, unsigned int line, | 156 | void __assert_fail(const char *assertion, const char *file, unsigned int line, |
157 | const char *function); | 157 | const char *function); |
158 | #define assert(x) \ | 158 | #define assert(x) \ |
159 | ({ if (!(x) && _DEBUG) \ | 159 | ({ if (!(x) && _DEBUG) \ |
160 | __assert_fail(#x, __FILE__, __LINE__, __func__); }) | 160 | __assert_fail(#x, __FILE__, __LINE__, __func__); }) |
161 | 161 | ||
162 | #ifdef CONFIG_LOG_ERROR_RETURN | ||
163 | #define log_ret(_ret) ({ \ | ||
164 | int __ret = (_ret); \ | ||
165 | if (__ret < 0) \ | ||
166 | log(LOG_CATEGORY, LOGL_ERR, "returning err=%d\n", __ret); \ | ||
167 | __ret; \ | ||
168 | }) | ||
169 | #else | ||
170 | #define log_ret(_ret) (_ret) | ||
171 | #endif | ||
172 | |||
162 | /** | 173 | /** |
163 | * struct log_rec - a single log record | 174 | * struct log_rec - a single log record |
164 | * | 175 | * |
165 | * Holds information about a single record in the log | 176 | * Holds information about a single record in the log |
166 | * | 177 | * |
167 | * Members marked as 'not allocated' are stored as pointers and the caller is | 178 | * Members marked as 'not allocated' are stored as pointers and the caller is |
168 | * responsible for making sure that the data pointed to is not overwritten. | 179 | * responsible for making sure that the data pointed to is not overwritten. |
169 | * Memebers marked as 'allocated' are allocated (e.g. via strdup()) by the log | 180 | * Memebers marked as 'allocated' are allocated (e.g. via strdup()) by the log |
170 | * system. | 181 | * system. |
171 | * | 182 | * |
172 | * @cat: Category, representing a uclass or part of U-Boot | 183 | * @cat: Category, representing a uclass or part of U-Boot |
173 | * @level: Severity level, less severe is higher | 184 | * @level: Severity level, less severe is higher |
174 | * @file: Name of file where the log record was generated (not allocated) | 185 | * @file: Name of file where the log record was generated (not allocated) |
175 | * @line: Line number where the log record was generated | 186 | * @line: Line number where the log record was generated |
176 | * @func: Function where the log record was generated (not allocated) | 187 | * @func: Function where the log record was generated (not allocated) |
177 | * @msg: Log message (allocated) | 188 | * @msg: Log message (allocated) |
178 | */ | 189 | */ |
179 | struct log_rec { | 190 | struct log_rec { |
180 | enum log_category_t cat; | 191 | enum log_category_t cat; |
181 | enum log_level_t level; | 192 | enum log_level_t level; |
182 | const char *file; | 193 | const char *file; |
183 | int line; | 194 | int line; |
184 | const char *func; | 195 | const char *func; |
185 | const char *msg; | 196 | const char *msg; |
186 | }; | 197 | }; |
187 | 198 | ||
188 | struct log_device; | 199 | struct log_device; |
189 | 200 | ||
190 | /** | 201 | /** |
191 | * struct log_driver - a driver which accepts and processes log records | 202 | * struct log_driver - a driver which accepts and processes log records |
192 | * | 203 | * |
193 | * @name: Name of driver | 204 | * @name: Name of driver |
194 | */ | 205 | */ |
195 | struct log_driver { | 206 | struct log_driver { |
196 | const char *name; | 207 | const char *name; |
197 | /** | 208 | /** |
198 | * emit() - emit a log record | 209 | * emit() - emit a log record |
199 | * | 210 | * |
200 | * Called by the log system to pass a log record to a particular driver | 211 | * Called by the log system to pass a log record to a particular driver |
201 | * for processing. The filter is checked before calling this function. | 212 | * for processing. The filter is checked before calling this function. |
202 | */ | 213 | */ |
203 | int (*emit)(struct log_device *ldev, struct log_rec *rec); | 214 | int (*emit)(struct log_device *ldev, struct log_rec *rec); |
204 | }; | 215 | }; |
205 | 216 | ||
206 | /** | 217 | /** |
207 | * struct log_device - an instance of a log driver | 218 | * struct log_device - an instance of a log driver |
208 | * | 219 | * |
209 | * Since drivers are set up at build-time we need to have a separate device for | 220 | * Since drivers are set up at build-time we need to have a separate device for |
210 | * the run-time aspects of drivers (currently just a list of filters to apply | 221 | * the run-time aspects of drivers (currently just a list of filters to apply |
211 | * to records send to this device). | 222 | * to records send to this device). |
212 | * | 223 | * |
213 | * @next_filter_num: Seqence number of next filter filter added (0=no filters | 224 | * @next_filter_num: Seqence number of next filter filter added (0=no filters |
214 | * yet). This increments with each new filter on the device, but never | 225 | * yet). This increments with each new filter on the device, but never |
215 | * decrements | 226 | * decrements |
216 | * @drv: Pointer to driver for this device | 227 | * @drv: Pointer to driver for this device |
217 | * @filter_head: List of filters for this device | 228 | * @filter_head: List of filters for this device |
218 | * @sibling_node: Next device in the list of all devices | 229 | * @sibling_node: Next device in the list of all devices |
219 | */ | 230 | */ |
220 | struct log_device { | 231 | struct log_device { |
221 | int next_filter_num; | 232 | int next_filter_num; |
222 | struct log_driver *drv; | 233 | struct log_driver *drv; |
223 | struct list_head filter_head; | 234 | struct list_head filter_head; |
224 | struct list_head sibling_node; | 235 | struct list_head sibling_node; |
225 | }; | 236 | }; |
226 | 237 | ||
227 | enum { | 238 | enum { |
228 | LOGF_MAX_CATEGORIES = 5, /* maximum categories per filter */ | 239 | LOGF_MAX_CATEGORIES = 5, /* maximum categories per filter */ |
229 | }; | 240 | }; |
230 | 241 | ||
231 | enum log_filter_flags { | 242 | enum log_filter_flags { |
232 | LOGFF_HAS_CAT = 1 << 0, /* Filter has a category list */ | 243 | LOGFF_HAS_CAT = 1 << 0, /* Filter has a category list */ |
233 | }; | 244 | }; |
234 | 245 | ||
235 | /** | 246 | /** |
236 | * struct log_filter - criterial to filter out log messages | 247 | * struct log_filter - criterial to filter out log messages |
237 | * | 248 | * |
238 | * @filter_num: Sequence number of this filter. This is returned when adding a | 249 | * @filter_num: Sequence number of this filter. This is returned when adding a |
239 | * new filter, and must be provided when removing a previously added | 250 | * new filter, and must be provided when removing a previously added |
240 | * filter. | 251 | * filter. |
241 | * @flags: Flags for this filter (LOGFF_...) | 252 | * @flags: Flags for this filter (LOGFF_...) |
242 | * @cat_list: List of categories to allow (terminated by LOGC_none). If empty | 253 | * @cat_list: List of categories to allow (terminated by LOGC_none). If empty |
243 | * then all categories are permitted. Up to LOGF_MAX_CATEGORIES entries | 254 | * then all categories are permitted. Up to LOGF_MAX_CATEGORIES entries |
244 | * can be provided | 255 | * can be provided |
245 | * @max_level: Maximum log level to allow | 256 | * @max_level: Maximum log level to allow |
246 | * @file_list: List of files to allow, separated by comma. If NULL then all | 257 | * @file_list: List of files to allow, separated by comma. If NULL then all |
247 | * files are permitted | 258 | * files are permitted |
248 | * @sibling_node: Next filter in the list of filters for this log device | 259 | * @sibling_node: Next filter in the list of filters for this log device |
249 | */ | 260 | */ |
250 | struct log_filter { | 261 | struct log_filter { |
251 | int filter_num; | 262 | int filter_num; |
252 | int flags; | 263 | int flags; |
253 | enum log_category_t cat_list[LOGF_MAX_CATEGORIES]; | 264 | enum log_category_t cat_list[LOGF_MAX_CATEGORIES]; |
254 | enum log_level_t max_level; | 265 | enum log_level_t max_level; |
255 | const char *file_list; | 266 | const char *file_list; |
256 | struct list_head sibling_node; | 267 | struct list_head sibling_node; |
257 | }; | 268 | }; |
258 | 269 | ||
259 | #define LOG_DRIVER(_name) \ | 270 | #define LOG_DRIVER(_name) \ |
260 | ll_entry_declare(struct log_driver, _name, log_driver) | 271 | ll_entry_declare(struct log_driver, _name, log_driver) |
261 | 272 | ||
262 | /** | 273 | /** |
263 | * log_get_cat_name() - Get the name of a category | 274 | * log_get_cat_name() - Get the name of a category |
264 | * | 275 | * |
265 | * @cat: Category to look up | 276 | * @cat: Category to look up |
266 | * @return category name (which may be a uclass driver name) | 277 | * @return category name (which may be a uclass driver name) |
267 | */ | 278 | */ |
268 | const char *log_get_cat_name(enum log_category_t cat); | 279 | const char *log_get_cat_name(enum log_category_t cat); |
269 | 280 | ||
270 | /** | 281 | /** |
271 | * log_get_cat_by_name() - Look up a category by name | 282 | * log_get_cat_by_name() - Look up a category by name |
272 | * | 283 | * |
273 | * @name: Name to look up | 284 | * @name: Name to look up |
274 | * @return category ID, or LOGC_NONE if not found | 285 | * @return category ID, or LOGC_NONE if not found |
275 | */ | 286 | */ |
276 | enum log_category_t log_get_cat_by_name(const char *name); | 287 | enum log_category_t log_get_cat_by_name(const char *name); |
277 | 288 | ||
278 | /** | 289 | /** |
279 | * log_get_level_name() - Get the name of a log level | 290 | * log_get_level_name() - Get the name of a log level |
280 | * | 291 | * |
281 | * @level: Log level to look up | 292 | * @level: Log level to look up |
282 | * @return log level name (in ALL CAPS) | 293 | * @return log level name (in ALL CAPS) |
283 | */ | 294 | */ |
284 | const char *log_get_level_name(enum log_level_t level); | 295 | const char *log_get_level_name(enum log_level_t level); |
285 | 296 | ||
286 | /** | 297 | /** |
287 | * log_get_level_by_name() - Look up a log level by name | 298 | * log_get_level_by_name() - Look up a log level by name |
288 | * | 299 | * |
289 | * @name: Name to look up | 300 | * @name: Name to look up |
290 | * @return log level ID, or LOGL_NONE if not found | 301 | * @return log level ID, or LOGL_NONE if not found |
291 | */ | 302 | */ |
292 | enum log_level_t log_get_level_by_name(const char *name); | 303 | enum log_level_t log_get_level_by_name(const char *name); |
293 | 304 | ||
294 | /* Log format flags (bit numbers) for gd->log_fmt. See log_fmt_chars */ | 305 | /* Log format flags (bit numbers) for gd->log_fmt. See log_fmt_chars */ |
295 | enum log_fmt { | 306 | enum log_fmt { |
296 | LOGF_CAT = 0, | 307 | LOGF_CAT = 0, |
297 | LOGF_LEVEL, | 308 | LOGF_LEVEL, |
298 | LOGF_FILE, | 309 | LOGF_FILE, |
299 | LOGF_LINE, | 310 | LOGF_LINE, |
300 | LOGF_FUNC, | 311 | LOGF_FUNC, |
301 | LOGF_MSG, | 312 | LOGF_MSG, |
302 | 313 | ||
303 | LOGF_COUNT, | 314 | LOGF_COUNT, |
304 | LOGF_DEFAULT = (1 << LOGF_FUNC) | (1 << LOGF_MSG), | 315 | LOGF_DEFAULT = (1 << LOGF_FUNC) | (1 << LOGF_MSG), |
305 | LOGF_ALL = 0x3f, | 316 | LOGF_ALL = 0x3f, |
306 | }; | 317 | }; |
307 | 318 | ||
308 | /* Handle the 'log test' command */ | 319 | /* Handle the 'log test' command */ |
309 | int do_log_test(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]); | 320 | int do_log_test(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]); |
310 | 321 | ||
311 | /** | 322 | /** |
312 | * log_add_filter() - Add a new filter to a log device | 323 | * log_add_filter() - Add a new filter to a log device |
313 | * | 324 | * |
314 | * @drv_name: Driver name to add the filter to (since each driver only has a | 325 | * @drv_name: Driver name to add the filter to (since each driver only has a |
315 | * single device) | 326 | * single device) |
316 | * @cat_list: List of categories to allow (terminated by LOGC_none). If empty | 327 | * @cat_list: List of categories to allow (terminated by LOGC_none). If empty |
317 | * then all categories are permitted. Up to LOGF_MAX_CATEGORIES entries | 328 | * then all categories are permitted. Up to LOGF_MAX_CATEGORIES entries |
318 | * can be provided | 329 | * can be provided |
319 | * @max_level: Maximum log level to allow | 330 | * @max_level: Maximum log level to allow |
320 | * @file_list: List of files to allow, separated by comma. If NULL then all | 331 | * @file_list: List of files to allow, separated by comma. If NULL then all |
321 | * files are permitted | 332 | * files are permitted |
322 | * @return the sequence number of the new filter (>=0) if the filter was added, | 333 | * @return the sequence number of the new filter (>=0) if the filter was added, |
323 | * or a -ve value on error | 334 | * or a -ve value on error |
324 | */ | 335 | */ |
325 | int log_add_filter(const char *drv_name, enum log_category_t cat_list[], | 336 | int log_add_filter(const char *drv_name, enum log_category_t cat_list[], |
326 | enum log_level_t max_level, const char *file_list); | 337 | enum log_level_t max_level, const char *file_list); |
327 | 338 | ||
328 | /** | 339 | /** |
329 | * log_remove_filter() - Remove a filter from a log device | 340 | * log_remove_filter() - Remove a filter from a log device |
330 | * | 341 | * |
331 | * @drv_name: Driver name to remove the filter from (since each driver only has | 342 | * @drv_name: Driver name to remove the filter from (since each driver only has |
332 | * a single device) | 343 | * a single device) |
333 | * @filter_num: Filter number to remove (as returned by log_add_filter()) | 344 | * @filter_num: Filter number to remove (as returned by log_add_filter()) |
334 | * @return 0 if the filter was removed, -ENOENT if either the driver or the | 345 | * @return 0 if the filter was removed, -ENOENT if either the driver or the |
335 | * filter number was not found | 346 | * filter number was not found |
336 | */ | 347 | */ |
337 | int log_remove_filter(const char *drv_name, int filter_num); | 348 | int log_remove_filter(const char *drv_name, int filter_num); |
338 | 349 | ||
339 | #if CONFIG_IS_ENABLED(LOG) | 350 | #if CONFIG_IS_ENABLED(LOG) |
340 | /** | 351 | /** |
341 | * log_init() - Set up the log system ready for use | 352 | * log_init() - Set up the log system ready for use |
342 | * | 353 | * |
343 | * @return 0 if OK, -ENOMEM if out of memory | 354 | * @return 0 if OK, -ENOMEM if out of memory |
344 | */ | 355 | */ |
345 | int log_init(void); | 356 | int log_init(void); |
346 | #else | 357 | #else |
347 | static inline int log_init(void) | 358 | static inline int log_init(void) |
348 | { | 359 | { |
349 | return 0; | 360 | return 0; |
350 | } | 361 | } |
351 | #endif | 362 | #endif |
352 | 363 | ||
353 | #endif | 364 | #endif |
354 | 365 |