treewide: replace GPLv2 long form headers with SPDX header
[coreboot.git] / src / commonlib / include / commonlib / loglevel.h
blob7992178e98f8d8299e11eba28157201f52d94624
1 /* This file is part of the coreboot project. */
2 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 #ifndef LOGLEVEL_H
5 #define LOGLEVEL_H
7 /**
8 * @file loglevel.h
10 * \brief Definitions of the log levels to be used in printk calls.
12 * Safe for inclusion in assembly.
16 /**
17 * \brief BIOS_EMERG - Emergency / Fatal
19 * Log level for when the system is entirely unusable. To be used when execution
20 * is halting as a result of the failure. No further instructions should run.
22 * Example - End of all debug output / death notice.
24 * @{
26 #define BIOS_EMERG 0
27 /** @} */
29 /**
30 * \brief BIOS_ALERT - Dying / Unrecoverable
32 * Log level for when the system is certainly in the process of dying.
33 * To be used when execution will eventually halt as a result of the
34 * failure, but the system can still output valuable debugging
35 * information.
37 * Example - Ram initialization fails, dumping relevant POST codes and
38 * information
40 * @{
42 #define BIOS_ALERT 1
43 /** @} */
45 /**
46 * \brief BIOS_CRIT - Recovery unlikely
48 * Log level for when the system has experienced a dire issue in essential
49 * components. To be used when boot will probably be unsuccessful as a
50 * result of the failure, but recovery/retry can be attempted.
52 * Example - MSR failures, SMM/SMI failures.
53 * or
55 * @{
57 #define BIOS_CRIT 2
58 /** @} */
60 /**
61 * \brief BIOS_ERR - System in incomplete state.
63 * Log level for when the system has experienced an issue that may not preclude
64 * a successful boot. To be used when coreboot execution may still succeed,
65 * but the error places some non-essential portion of the machine in a broken
66 * state that will be noticed downstream.
68 * Example - Payload could still load, but will be missing access to integral
69 * components such as drives.
71 * @{
73 #define BIOS_ERR 3
74 /** @} */
76 /**
77 * \brief BIOS_WARNING - Bad configuration
79 * Log level for when the system has noticed an issue that most likely will
80 * not preclude a successful boot. To be used when something is wrong, and
81 * would likely be noticed by an end user.
83 * Example - Bad ME firmware, bad microcode, mis-clocked CPU
85 * @{
87 #define BIOS_WARNING 4
88 /** @} */
90 /**
91 * \brief BIOS_NOTICE - Unexpected but relatively insignificant
93 * Log level for when the system has noticed an issue that is an edge case,
94 * but is handled and is recoverable. To be used when an end-user would likely
95 * not notice.
97 * Example - Hardware was misconfigured, but is promptly fixed.
99 * @{
101 #define BIOS_NOTICE 5
102 /** @} */
105 * \brief BIOS_INFO - Expected events.
107 * Log level for when the system has experienced some typical event.
108 * Messages should be superficial in nature.
110 * Example - Success messages. Status messages.
112 * @{
114 #define BIOS_INFO 6
115 /** @} */
118 * \brief BIOS_DEBUG - Verbose output
120 * Log level for details of a method. Messages may be dense,
121 * but should not be excessive. Messages should be detailed enough
122 * that this level provides sufficient details to diagnose a problem,
123 * but not necessarily enough to fix it.
125 * Example - Printing of important variables.
127 * @{
129 #define BIOS_DEBUG 7
130 /** @} */
133 * \brief BIOS_SPEW - Excessively verbose output
135 * Log level for intricacies of a method. Messages might contain raw
136 * data and will produce large logs. Developers should try to make sure
137 * that this level is not useful to anyone besides developers.
139 * Example - Data dumps.
141 * @{
143 #define BIOS_SPEW 8
144 /** @} */
147 * \brief BIOS_NEVER - Muted log level.
149 * Roughly equal to commenting out a printk statement. Because a user
150 * should not set their log level higher than 8, these statements
151 * are never printed.
153 * Example - A developer might locally define MY_LOGLEVEL to BIOS_SPEW,
154 * and later replace it with BIOS_NEVER as to mute their debug output.
156 * @{
158 #define BIOS_NEVER 9
159 /** @} */
161 #endif /* LOGLEVEL_H */