coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
printk.c File Reference
#include <console/cbmem_console.h>
#include <console/console.h>
#include <console/streams.h>
#include <console/vtxprintf.h>
#include <smp/spinlock.h>
#include <smp/node.h>
#include <timer.h>
Include dependency graph for printk.c:

Go to the source code of this file.

Data Structures

union  log_state
 

Macros

#define TRACK_CONSOLE_TIME   (!ENV_SMM && CONFIG(HAVE_MONOTONIC_TIMER))
 
#define LOG_FAST(state)   (HAS_ONLY_FAST_CONSOLES || ((state).speed == CONSOLE_LOG_FAST))
 

Functions

static void console_time_run (void)
 
static void console_time_stop (void)
 
void console_time_report (void)
 
long console_time_get_and_reset (void)
 
void do_putchar (unsigned char byte)
 
static void wrap_interactive_printf (const char *fmt,...)
 
static void line_start (union log_state state)
 
static void line_end (union log_state state)
 
static void wrap_putchar (unsigned char byte, void *data)
 
int vprintk (int msg_level, const char *fmt, va_list args)
 
int printk (int msg_level, const char *fmt,...)
 

Variables

static struct mono_time mt_start mt_stop
 
static long console_usecs
 

Macro Definition Documentation

◆ LOG_FAST

#define LOG_FAST (   state)    (HAS_ONLY_FAST_CONSOLES || ((state).speed == CONSOLE_LOG_FAST))

Definition at line 70 of file printk.c.

◆ TRACK_CONSOLE_TIME

#define TRACK_CONSOLE_TIME   (!ENV_SMM && CONFIG(HAVE_MONOTONIC_TIMER))

Definition at line 17 of file printk.c.

Function Documentation

◆ console_time_get_and_reset()

long console_time_get_and_reset ( void  )

Definition at line 45 of file printk.c.

References console_usecs, and TRACK_CONSOLE_TIME.

Referenced by bs_sample_time().

Here is the caller graph for this function:

◆ console_time_report()

void console_time_report ( void  )

Definition at line 36 of file printk.c.

References BIOS_DEBUG, console_usecs, DIV_ROUND_CLOSEST, ENV_STRING, printk(), TRACK_CONSOLE_TIME, and USECS_PER_MSEC.

Referenced by run_postcar_phase(), run_ramstage(), and run_romstage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ console_time_run()

static void console_time_run ( void  )
static

Definition at line 22 of file printk.c.

References boot_cpu(), timer_monotonic_get(), and TRACK_CONSOLE_TIME.

Referenced by do_putchar(), and vprintk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ console_time_stop()

static void console_time_stop ( void  )
static

Definition at line 28 of file printk.c.

References boot_cpu(), console_usecs, mono_time_diff_microseconds(), mt_stop, timer_monotonic_get(), and TRACK_CONSOLE_TIME.

Referenced by do_putchar(), and vprintk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_putchar()

void do_putchar ( unsigned char  byte)

Definition at line 55 of file printk.c.

References console_time_run(), console_time_stop(), and console_tx_byte().

Referenced by cbmem_dump_console(), dram_run_full_calibration(), run_dram_blob(), sdram_initialize(), and send_to_console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ line_end()

static void line_end ( union log_state  state)
static

Definition at line 103 of file printk.c.

References BIOS_LOG_ESCAPE_RESET, CONFIG, LOG_FAST, and wrap_interactive_printf().

Referenced by wrap_putchar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ line_start()

static void line_start ( union log_state  state)
static

Definition at line 80 of file printk.c.

References __cbmemc_tx_byte(), bios_log_escape, BIOS_LOG_ESCAPE_PATTERN, BIOS_LOG_LEVEL_TO_MARKER, bios_log_prefix, BIOS_LOG_PREFIX_MAX_LEVEL, BIOS_LOG_PREFIX_PATTERN, CONFIG, console_stored_tx_byte(), LOG_FAST, NULL, and wrap_interactive_printf().

Referenced by wrap_putchar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printk()

int printk ( int  msg_level,
const char *  fmt,
  ... 
)

Definition at line 155 of file printk.c.

References args, va_end, va_start, and vprintk().

Referenced by console_time_report().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vprintk()

int vprintk ( int  msg_level,
const char *  fmt,
va_list  args 
)

Definition at line 128 of file printk.c.

References args, boot_cpu(), CONFIG, console_log_level(), console_time_run(), console_time_stop(), console_tx_flush(), ENV_ROMSTAGE_OR_BEFORE, log_state::level, LOG_FAST, spin_lock, spin_unlock, vtxprintf(), and wrap_putchar().

Referenced by die(), printk(), and vb2ex_printf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wrap_interactive_printf()

static void wrap_interactive_printf ( const char *  fmt,
  ... 
)
static

Definition at line 72 of file printk.c.

References args, console_interactive_tx_byte(), NULL, va_end, va_start, and vtxprintf().

Referenced by line_end(), and line_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wrap_putchar()

static void wrap_putchar ( unsigned char  byte,
void data 
)
static

Definition at line 109 of file printk.c.

References __cbmemc_tx_byte(), log_state::as_ptr, console_tx_byte(), line_end(), line_start(), and LOG_FAST.

Referenced by vprintk().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ console_usecs

long console_usecs
static

Definition at line 20 of file printk.c.

Referenced by console_time_get_and_reset(), console_time_report(), and console_time_stop().

◆ mt_stop

struct mono_time mt_start mt_stop
static

Definition at line 1 of file printk.c.

Referenced by bs_call_callbacks(), and console_time_stop().