coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
timestamp.c File Reference
#include <assert.h>
#include <stdint.h>
#include <console/console.h>
#include <cbmem.h>
#include <symbols.h>
#include <timer.h>
#include <timestamp.h>
#include <smp/node.h>
Include dependency graph for timestamp.c:

Go to the source code of this file.

Macros

#define MAX_TIMESTAMPS   192
 

Functions

static void timestamp_cache_init (struct timestamp_table *ts_cache, uint64_t base)
 
static struct timestamp_tabletimestamp_cache_get (void)
 
static struct timestamp_tabletimestamp_alloc_cbmem_table (void)
 
static int timestamp_should_run (void)
 
static struct timestamp_tabletimestamp_table_get (void)
 
static void timestamp_table_set (struct timestamp_table *ts)
 
static const char * timestamp_name (enum timestamp_id id)
 
static void timestamp_add_table_entry (struct timestamp_table *ts_table, enum timestamp_id id, int64_t ts_time)
 
void timestamp_add (enum timestamp_id id, int64_t ts_time)
 
void timestamp_add_now (enum timestamp_id id)
 
void timestamp_init (uint64_t base)
 
static void timestamp_sync_cache_to_cbmem (struct timestamp_table *ts_cbmem_table)
 
static void timestamp_reinit (int is_recovery)
 
void timestamp_rescale_table (uint16_t N, uint16_t M)
 
uint32_t get_us_since_boot (void)
 
uint64_t __weak timestamp_get (void)
 
int __weak timestamp_tick_freq_mhz (void)
 

Variables

static struct timestamp_tableglob_ts_table
 

Macro Definition Documentation

◆ MAX_TIMESTAMPS

#define MAX_TIMESTAMPS   192

Definition at line 12 of file timestamp.c.

Function Documentation

◆ get_us_since_boot()

uint32_t get_us_since_boot ( void  )

Definition at line 273 of file timestamp.c.

References timestamp_table::base_time, NULL, timestamp_table::tick_freq_mhz, timestamp_get(), and timestamp_table_get().

Referenced by wait_for_legacy_dev().

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

◆ timestamp_add()

void timestamp_add ( enum timestamp_id  id,
int64_t  ts_time 
)

Definition at line 120 of file timestamp.c.

References timestamp_table::base_time, BIOS_ERR, BIOS_INFO, CONFIG, printk, timestamp_add_table_entry(), timestamp_name(), timestamp_should_run(), and timestamp_table_get().

Referenced by bootblock_main_with_timestamp(), cbmem_inject_telemetry_data(), hash_body(), and timestamp_add_now().

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

◆ timestamp_add_now()

◆ timestamp_add_table_entry()

static void timestamp_add_table_entry ( struct timestamp_table ts_table,
enum timestamp_id  id,
int64_t  ts_time 
)
static

◆ timestamp_alloc_cbmem_table()

static struct timestamp_table* timestamp_alloc_cbmem_table ( void  )
static

Definition at line 44 of file timestamp.c.

References timestamp_table::base_time, cbmem_add(), CBMEM_ID_TIMESTAMP, timestamp_table::max_entries, MAX_TIMESTAMPS, NULL, and timestamp_table::num_entries.

Referenced by timestamp_reinit().

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

◆ timestamp_cache_get()

static struct timestamp_table* timestamp_cache_get ( void  )
static

Definition at line 28 of file timestamp.c.

References BUG, ENV_ROMSTAGE_OR_BEFORE, NULL, and REGION_SIZE.

Referenced by timestamp_init(), and timestamp_table_get().

Here is the caller graph for this function:

◆ timestamp_cache_init()

static void timestamp_cache_init ( struct timestamp_table ts_cache,
uint64_t  base 
)
static

Definition at line 18 of file timestamp.c.

References base, timestamp_table::base_time, timestamp_table::entries, timestamp_table::max_entries, timestamp_table::num_entries, offsetof, and REGION_SIZE.

Referenced by timestamp_init().

Here is the caller graph for this function:

◆ timestamp_get()

uint64_t __weak timestamp_get ( void  )

Definition at line 287 of file timestamp.c.

References CONFIG, mono_time_diff_microseconds(), mono_time_set_usecs(), and timer_monotonic_get().

Here is the call graph for this function:

◆ timestamp_init()

void timestamp_init ( uint64_t  base)

Definition at line 146 of file timestamp.c.

References assert, base, BIOS_ERR, ENV_ROMSTAGE_OR_BEFORE, printk, timestamp_cache_get(), timestamp_cache_init(), timestamp_should_run(), and timestamp_table_set().

Referenced by bootblock_main(), bootblock_main_with_timestamp(), main(), Main(), romstage(), and tegra124_main().

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

◆ timestamp_name()

static const char* timestamp_name ( enum timestamp_id  id)
static

Definition at line 92 of file timestamp.c.

References ARRAY_SIZE, timestamp_id_to_name::name, and timestamp_ids.

Referenced by timestamp_add().

Here is the caller graph for this function:

◆ timestamp_reinit()

◆ timestamp_rescale_table()

void timestamp_rescale_table ( uint16_t  N,
uint16_t  M 
)

Definition at line 241 of file timestamp.c.

References timestamp_table::base_time, BIOS_ERR, timestamp_table::entries, timestamp_entry::entry_stamp, M, NULL, timestamp_table::num_entries, printk, timestamp_should_run(), and timestamp_table_get().

Referenced by romstage_dispatch().

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

◆ timestamp_should_run()

static int timestamp_should_run ( void  )
static

Definition at line 65 of file timestamp.c.

References boot_cpu(), ENV_PAYLOAD_LOADER, and ENV_X86.

Referenced by timestamp_add(), timestamp_init(), timestamp_reinit(), and timestamp_rescale_table().

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

◆ timestamp_sync_cache_to_cbmem()

static void timestamp_sync_cache_to_cbmem ( struct timestamp_table ts_cbmem_table)
static

Definition at line 166 of file timestamp.c.

References timestamp_table::base_time, BIOS_ERR, timestamp_table::entries, timestamp_entry::entry_id, timestamp_entry::entry_stamp, timestamp_table::num_entries, printk, timestamp_add_table_entry(), and timestamp_table_get().

Referenced by timestamp_reinit().

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

◆ timestamp_table_get()

static struct timestamp_table* timestamp_table_get ( void  )
static

Definition at line 77 of file timestamp.c.

References glob_ts_table, and timestamp_cache_get().

Referenced by get_us_since_boot(), timestamp_add(), timestamp_rescale_table(), and timestamp_sync_cache_to_cbmem().

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

◆ timestamp_table_set()

static void timestamp_table_set ( struct timestamp_table ts)
static

Definition at line 87 of file timestamp.c.

References glob_ts_table.

Referenced by timestamp_init(), and timestamp_reinit().

Here is the caller graph for this function:

◆ timestamp_tick_freq_mhz()

int __weak timestamp_tick_freq_mhz ( void  )

Definition at line 301 of file timestamp.c.

Variable Documentation

◆ glob_ts_table

struct timestamp_table* glob_ts_table
static

Definition at line 16 of file timestamp.c.

Referenced by timestamp_table_get(), and timestamp_table_set().