coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
loglevel.h File Reference

Definitions of the log levels to be used in printk calls. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BIOS_LOG_PREFIX_PATTERN   "[%.5s] "
 
#define BIOS_LOG_PREFIX_MAX_LEVEL   BIOS_SPEW
 
#define BIOS_LOG_ESCAPE_PATTERN   "\x1b[%sm"
 
#define BIOS_LOG_ESCAPE_RESET   "\x1b[0m"
 
#define BIOS_LOG_MARKER_START   0x10
 
#define BIOS_LOG_MARKER_END   (BIOS_LOG_MARKER_START + BIOS_LOG_PREFIX_MAX_LEVEL)
 
#define BIOS_LOG_IS_MARKER(c)   ((c) >= BIOS_LOG_MARKER_START && (c) <= BIOS_LOG_MARKER_END)
 
#define BIOS_LOG_LEVEL_TO_MARKER(level)   (BIOS_LOG_MARKER_START + (level))
 
#define BIOS_LOG_MARKER_TO_LEVEL(c)   ((c) - BIOS_LOG_MARKER_START)
 
#define BIOS_EMERG   0
 BIOS_EMERG - Emergency / Fatal. More...
 
#define BIOS_ALERT   1
 BIOS_ALERT - Dying / Unrecoverable. More...
 
#define BIOS_CRIT   2
 BIOS_CRIT - Recovery unlikely. More...
 
#define BIOS_ERR   3
 BIOS_ERR - System in incomplete state. More...
 
#define BIOS_WARNING   4
 BIOS_WARNING - Bad configuration. More...
 
#define BIOS_NOTICE   5
 BIOS_NOTICE - Unexpected but relatively insignificant. More...
 
#define BIOS_INFO   6
 BIOS_INFO - Expected events. More...
 
#define BIOS_DEBUG   7
 BIOS_DEBUG - Verbose output. More...
 
#define BIOS_SPEW   8
 BIOS_SPEW - Excessively verbose output. More...
 
#define BIOS_NEVER   9
 BIOS_NEVER - Muted log level. More...
 

Variables

static const char bios_log_prefix [BIOS_LOG_PREFIX_MAX_LEVEL+1][5]
 
static const char bios_log_escape [BIOS_LOG_PREFIX_MAX_LEVEL+1][8]
 

Detailed Description

Definitions of the log levels to be used in printk calls.

Safe for inclusion in assembly.

Definition in file loglevel.h.

Macro Definition Documentation

◆ BIOS_ALERT

#define BIOS_ALERT   1

BIOS_ALERT - Dying / Unrecoverable.

Log level for when the system is certainly in the process of dying. To be used when execution will eventually halt as a result of the failure, but the system can still output valuable debugging information.

Example - Ram initialization fails, dumping relevant POST codes and information

Definition at line 41 of file loglevel.h.

◆ BIOS_CRIT

#define BIOS_CRIT   2

BIOS_CRIT - Recovery unlikely.

Log level for when the system has experienced a dire issue in essential components. To be used when boot will probably be unsuccessful as a result of the failure, but recovery/retry can be attempted.

Example - MSR failures, SMM/SMI failures. or

Definition at line 56 of file loglevel.h.

◆ BIOS_DEBUG

#define BIOS_DEBUG   7

BIOS_DEBUG - Verbose output.

Log level for details of a method. Messages may be dense, but should not be excessive. Messages should be detailed enough that this level provides sufficient details to diagnose a problem, but not necessarily enough to fix it.

Example - Printing of important variables.

Definition at line 128 of file loglevel.h.

◆ BIOS_EMERG

#define BIOS_EMERG   0

BIOS_EMERG - Emergency / Fatal.

Log level for when the system is entirely unusable. To be used when execution is halting as a result of the failure. No further instructions should run.

Example - End of all debug output / death notice.

Definition at line 25 of file loglevel.h.

◆ BIOS_ERR

#define BIOS_ERR   3

BIOS_ERR - System in incomplete state.

Log level for when the system has experienced an issue that may not preclude a successful boot. To be used when coreboot execution may still succeed, but the error places some non-essential portion of the machine in a broken state that will be noticed downstream.

Example - Payload could still load, but will be missing access to integral components such as drives.

Definition at line 72 of file loglevel.h.

◆ BIOS_INFO

#define BIOS_INFO   6

BIOS_INFO - Expected events.

Log level for when the system has experienced some typical event. Messages should be superficial in nature.

Example - Success messages. Status messages.

Definition at line 113 of file loglevel.h.

◆ BIOS_LOG_ESCAPE_PATTERN

#define BIOS_LOG_ESCAPE_PATTERN   "\x1b[%sm"

Definition at line 190 of file loglevel.h.

◆ BIOS_LOG_ESCAPE_RESET

#define BIOS_LOG_ESCAPE_RESET   "\x1b[0m"

Definition at line 191 of file loglevel.h.

◆ BIOS_LOG_IS_MARKER

#define BIOS_LOG_IS_MARKER (   c)    ((c) >= BIOS_LOG_MARKER_START && (c) <= BIOS_LOG_MARKER_END)

Definition at line 214 of file loglevel.h.

◆ BIOS_LOG_LEVEL_TO_MARKER

#define BIOS_LOG_LEVEL_TO_MARKER (   level)    (BIOS_LOG_MARKER_START + (level))

Definition at line 215 of file loglevel.h.

◆ BIOS_LOG_MARKER_END

#define BIOS_LOG_MARKER_END   (BIOS_LOG_MARKER_START + BIOS_LOG_PREFIX_MAX_LEVEL)

Definition at line 213 of file loglevel.h.

◆ BIOS_LOG_MARKER_START

#define BIOS_LOG_MARKER_START   0x10

Definition at line 212 of file loglevel.h.

◆ BIOS_LOG_MARKER_TO_LEVEL

#define BIOS_LOG_MARKER_TO_LEVEL (   c)    ((c) - BIOS_LOG_MARKER_START)

Definition at line 216 of file loglevel.h.

◆ BIOS_LOG_PREFIX_MAX_LEVEL

#define BIOS_LOG_PREFIX_MAX_LEVEL   BIOS_SPEW

Definition at line 167 of file loglevel.h.

◆ BIOS_LOG_PREFIX_PATTERN

#define BIOS_LOG_PREFIX_PATTERN   "[%.5s] "

Definition at line 166 of file loglevel.h.

◆ BIOS_NEVER

#define BIOS_NEVER   9

BIOS_NEVER - Muted log level.

Roughly equal to commenting out a printk statement. Because a user should not set their log level higher than 8, these statements are never printed.

Example - A developer might locally define MY_LOGLEVEL to BIOS_SPEW, and later replace it with BIOS_NEVER as to mute their debug output.

Definition at line 157 of file loglevel.h.

◆ BIOS_NOTICE

#define BIOS_NOTICE   5

BIOS_NOTICE - Unexpected but relatively insignificant.

Log level for when the system has noticed an issue that is an edge case, but is handled and is recoverable. To be used when an end-user would likely not notice.

Example - Hardware was misconfigured, but is promptly fixed.

Definition at line 100 of file loglevel.h.

◆ BIOS_SPEW

#define BIOS_SPEW   8

BIOS_SPEW - Excessively verbose output.

Log level for intricacies of a method. Messages might contain raw data and will produce large logs. Developers should try to make sure that this level is not useful to anyone besides developers.

Example - Data dumps.

Definition at line 142 of file loglevel.h.

◆ BIOS_WARNING

#define BIOS_WARNING   4

BIOS_WARNING - Bad configuration.

Log level for when the system has noticed an issue that most likely will not preclude a successful boot. To be used when something is wrong, and would likely be noticed by an end user.

Example - Bad ME firmware, bad microcode, mis-clocked CPU

Definition at line 86 of file loglevel.h.

Variable Documentation

◆ bios_log_escape

const char bios_log_escape[BIOS_LOG_PREFIX_MAX_LEVEL+1][8]
static
Initial value:
= {
[BIOS_EMERG] = "1;4;5;7",
[BIOS_ALERT] = "1;4;7",
[BIOS_CRIT] = "1;7",
[BIOS_ERR] = "7",
[BIOS_WARNING] = "1;4",
[BIOS_NOTICE] = "1",
[BIOS_INFO] = "0",
[BIOS_DEBUG] = "0",
[BIOS_SPEW] = "0",
}
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
#define BIOS_CRIT
BIOS_CRIT - Recovery unlikely.
Definition: loglevel.h:56
#define BIOS_NOTICE
BIOS_NOTICE - Unexpected but relatively insignificant.
Definition: loglevel.h:100
#define BIOS_ALERT
BIOS_ALERT - Dying / Unrecoverable.
Definition: loglevel.h:41
#define BIOS_EMERG
BIOS_EMERG - Emergency / Fatal.
Definition: loglevel.h:25
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
Definition: loglevel.h:72
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
Definition: loglevel.h:142
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
Definition: loglevel.h:86

Definition at line 192 of file loglevel.h.

Referenced by line_start().

◆ bios_log_prefix

const char bios_log_prefix[BIOS_LOG_PREFIX_MAX_LEVEL+1][5]
static
Initial value:
= {
[BIOS_EMERG] = "EMERG",
[BIOS_ALERT] = "ALERT",
[BIOS_CRIT] = "CRIT ",
[BIOS_ERR] = "ERROR",
[BIOS_WARNING] = "WARN ",
[BIOS_NOTICE] = "NOTE ",
[BIOS_INFO] = "INFO ",
[BIOS_DEBUG] = "DEBUG",
[BIOS_SPEW] = "SPEW ",
}

Definition at line 168 of file loglevel.h.

Referenced by line_start().