coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
cbmem.h File Reference
#include <commonlib/bsd/cbmem_id.h>
#include <stddef.h>
#include <stdint.h>
#include <boot/coreboot_tables.h>
Include dependency graph for cbmem.h:

Go to the source code of this file.

Macros

#define CBMEM_FSP_HOB_PTR   0x614
 
#define DYN_CBMEM_ALIGN_SIZE   (4096)
 
#define CBMEM_ROOT_SIZE   DYN_CBMEM_ALIGN_SIZE
 
#define CBMEM_ROOT_MIN_SIZE   DYN_CBMEM_ALIGN_SIZE
 
#define CBMEM_LG_ALIGN   CBMEM_ROOT_MIN_SIZE
 
#define CBMEM_SM_ROOT_SIZE   1024
 
#define CBMEM_SM_ALIGN   32
 
#define ROMSTAGE_CBMEM_INIT_HOOK(init_fn_)
 
#define RAMSTAGE_CBMEM_INIT_HOOK(init_fn_)
 
#define POSTCAR_CBMEM_INIT_HOOK(init_fn_)
 
#define ROMSTAGE_CBMEM_INIT_HOOK_EARLY(init_fn_)
 

Typedefs

typedef void(*const cbmem_init_hook_t) (int is_recovery)
 

Functions

static size_t cbmem_overhead_size (void)
 
int cbmem_initialize (void)
 
int cbmem_initialize_id_size (u32 id, u64 size)
 
void cbmem_initialize_empty (void)
 
void cbmem_initialize_empty_id_size (u32 id, u64 size)
 
voidcbmem_top (void)
 
voidcbmem_top_chipset (void)
 
const struct cbmem_entry * cbmem_entry_add (u32 id, u64 size)
 
const struct cbmem_entry * cbmem_entry_find (u32 id)
 
int cbmem_entry_remove (const struct cbmem_entry *entry)
 
voidcbmem_entry_start (const struct cbmem_entry *entry)
 
u64 cbmem_entry_size (const struct cbmem_entry *entry)
 
int cbmem_recovery (int s3resume)
 
voidcbmem_add (u32 id, u64 size)
 
voidcbmem_find (u32 id)
 
void cbmem_run_init_hooks (int is_recovery)
 
void cbmem_add_bootmem (void)
 
void cbmem_get_region (void **baseptr, size_t *size)
 
void cbmem_list (void)
 
void cbmem_add_records_to_cbtable (struct lb_header *header)
 
static int cbmem_possibly_online (void)
 
static int cbmem_online (void)
 

Variables

uintptr_t _cbmem_top_ptr
 

Macro Definition Documentation

◆ CBMEM_FSP_HOB_PTR

#define CBMEM_FSP_HOB_PTR   0x614

Definition at line 11 of file cbmem.h.

◆ CBMEM_LG_ALIGN

#define CBMEM_LG_ALIGN   CBMEM_ROOT_MIN_SIZE

Definition at line 31 of file cbmem.h.

◆ CBMEM_ROOT_MIN_SIZE

#define CBMEM_ROOT_MIN_SIZE   DYN_CBMEM_ALIGN_SIZE

Definition at line 30 of file cbmem.h.

◆ CBMEM_ROOT_SIZE

#define CBMEM_ROOT_SIZE   DYN_CBMEM_ALIGN_SIZE

Definition at line 27 of file cbmem.h.

◆ CBMEM_SM_ALIGN

#define CBMEM_SM_ALIGN   32

Definition at line 35 of file cbmem.h.

◆ CBMEM_SM_ROOT_SIZE

#define CBMEM_SM_ROOT_SIZE   1024

Definition at line 34 of file cbmem.h.

◆ DYN_CBMEM_ALIGN_SIZE

#define DYN_CBMEM_ALIGN_SIZE   (4096)

Definition at line 26 of file cbmem.h.

◆ POSTCAR_CBMEM_INIT_HOOK

#define POSTCAR_CBMEM_INIT_HOOK (   init_fn_)
Value:
__attribute__((unused)) \
static cbmem_init_hook_t init_fn_ ## _unused_pc_ = init_fn_;
void(*const cbmem_init_hook_t)(int is_recovery)
Definition: cbmem.h:98

Definition at line 138 of file cbmem.h.

◆ RAMSTAGE_CBMEM_INIT_HOOK

#define RAMSTAGE_CBMEM_INIT_HOOK (   init_fn_)
Value:
__attribute__((unused)) \
static cbmem_init_hook_t init_fn_ ## _unused_ram_ = init_fn_;

Definition at line 136 of file cbmem.h.

◆ ROMSTAGE_CBMEM_INIT_HOOK

#define ROMSTAGE_CBMEM_INIT_HOOK (   init_fn_)
Value:
__attribute__((unused)) \
static cbmem_init_hook_t init_fn_ ## _unused_rom_ = init_fn_;

Definition at line 134 of file cbmem.h.

◆ ROMSTAGE_CBMEM_INIT_HOOK_EARLY

#define ROMSTAGE_CBMEM_INIT_HOOK_EARLY (   init_fn_)
Value:
__attribute__((unused)) \
static cbmem_init_hook_t init_fn_ ## _unused_rom_ = init_fn_;

Definition at line 149 of file cbmem.h.

Typedef Documentation

◆ cbmem_init_hook_t

typedef void(* const cbmem_init_hook_t) (int is_recovery)

Definition at line 98 of file cbmem.h.

Function Documentation

◆ cbmem_add()

◆ cbmem_add_bootmem()

void cbmem_add_bootmem ( void  )

Definition at line 195 of file imd_cbmem.c.

References BM_MEM_TABLE, bootmem_add_range(), cbmem_get_region(), NULL, and imd_entry::size.

Referenced by bootmem_init().

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

◆ cbmem_add_records_to_cbtable()

void cbmem_add_records_to_cbtable ( struct lb_header header)

◆ cbmem_entry_add()

const struct cbmem_entry* cbmem_entry_add ( u32  id,
u64  size 
)

Definition at line 135 of file imd_cbmem.c.

References imd_entry_find_or_add(), and imd_to_cbmem().

Referenced by bmp_load_logo().

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

◆ cbmem_entry_find()

const struct cbmem_entry* cbmem_entry_find ( u32  id)

◆ cbmem_entry_remove()

int cbmem_entry_remove ( const struct cbmem_entry *  entry)

Definition at line 180 of file imd_cbmem.c.

References cbmem_to_imd(), and imd_entry_remove().

Referenced by bmp_release_logo(), and fmap_add_cbmem_cache().

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

◆ cbmem_entry_size()

u64 cbmem_entry_size ( const struct cbmem_entry *  entry)

Definition at line 185 of file imd_cbmem.c.

References cbmem_to_imd(), and imd_entry_size().

Referenced by acpi_ssdt_write_cbtable(), cbfs_boot_device_find_mcache(), fmap_register_cbmem_cache(), get_tcpa_log(), get_tpm2_log(), lb_smmstorev2(), smm_load_module(), stage_cache_get_raw(), stage_cache_load_stage(), and update_mrc_cache_from_cbmem().

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

◆ cbmem_entry_start()

void* cbmem_entry_start ( const struct cbmem_entry *  entry)

◆ cbmem_find()

◆ cbmem_get_region()

void cbmem_get_region ( void **  baseptr,
size_t size 
)

Definition at line 204 of file imd_cbmem.c.

References imd_region_used(), and imd_entry::size.

Referenced by add_cb_fdt_data(), cbmem_add_bootmem(), clear_memory(), and fill_postcar_frame().

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

◆ cbmem_initialize()

int cbmem_initialize ( void  )

Definition at line 88 of file imd_cbmem.c.

References cbmem_initialize_id_size().

Referenced by cbmem_recovery(), chipset_teardown_car_main(), and main().

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

◆ cbmem_initialize_empty()

void cbmem_initialize_empty ( void  )

Definition at line 45 of file imd_cbmem.c.

References cbmem_initialize_empty_id_size().

Referenced by cbmem_recovery(), main(), mainboard_romstage_entry(), platform_romstage_main(), and romstage().

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

◆ cbmem_initialize_empty_id_size()

void cbmem_initialize_empty_id_size ( u32  id,
u64  size 
)

◆ cbmem_initialize_id_size()

int cbmem_initialize_id_size ( u32  id,
u64  size 
)

Definition at line 93 of file imd_cbmem.c.

References cbmem_add(), cbmem_initialized, cbmem_run_init_hooks(), cbmem_top(), cbmem_top_init_once(), ENV_ROMSTAGE, imd_handle_init(), imd_lockdown(), imd_recover(), and imd_entry::size.

Referenced by cbmem_initialize(), do_fsp_post_memory_init(), and raminit().

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

◆ cbmem_list()

void cbmem_list ( void  )

Referenced by write_tables().

Here is the caller graph for this function:

◆ cbmem_online()

static int cbmem_online ( void  )
inlinestatic

Definition at line 170 of file cbmem.h.

References cbmem_initialized, and cbmem_possibly_online().

Referenced by main().

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

◆ cbmem_overhead_size()

static size_t cbmem_overhead_size ( void  )
inlinestatic

Definition at line 38 of file cbmem.h.

References CBMEM_ROOT_MIN_SIZE.

Referenced by do_fsp_memory_init(), fsp_verify_memory_init_hobs(), platform_fsp_memory_init_params_cb(), and raminit().

Here is the caller graph for this function:

◆ cbmem_possibly_online()

static int cbmem_possibly_online ( void  )
inlinestatic

◆ cbmem_recovery()

int cbmem_recovery ( int  s3resume)

Definition at line 125 of file imd_cbmem.c.

References cbmem_initialize(), and cbmem_initialize_empty().

Referenced by car_stage_entry(), i945_prepare_resume(), init_dram_ddr3(), mainboard_romstage_entry(), perform_raminit(), raminit(), romstage_main(), and sdram_initialize().

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

◆ cbmem_run_init_hooks()

void cbmem_run_init_hooks ( int  is_recovery)

Definition at line 6 of file cbmem_common.c.

References REGION_SIZE.

Referenced by cbmem_initialize_empty_id_size(), and cbmem_initialize_id_size().

Here is the caller graph for this function:

◆ cbmem_top()

◆ cbmem_top_chipset()

Variable Documentation

◆ _cbmem_top_ptr

uintptr_t _cbmem_top_ptr
extern

Definition at line 14 of file imd_cbmem.c.

Referenced by cbmem_top(), ramstage_entry(), and stage_entry().