![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <console/console.h>
#include <bootmem.h>
#include <cbmem.h>
#include <device/resource.h>
#include <symbols.h>
#include <assert.h>
#include <types.h>
Go to the source code of this file.
Data Structures | |
struct | range_strings |
Functions | |
static int | bootmem_is_initialized (void) |
static int | bootmem_memory_table_written (void) |
void | bootmem_platform_add_ranges (void) |
static uint32_t | bootmem_to_lb_tag (const enum bootmem_type tag) |
static void | bootmem_init (void) |
void | bootmem_add_range (uint64_t start, uint64_t size, const enum bootmem_type tag) |
void | bootmem_write_memory_table (struct lb_memory *mem) |
Write memory coreboot table. More... | |
static const char * | bootmem_range_string (const enum bootmem_type tag) |
void | bootmem_dump_ranges (void) |
bool | bootmem_walk_os_mem (range_action_t action, void *arg) |
Walk memory tables from OS point of view and call the provided function, for every region. More... | |
bool | bootmem_walk (range_action_t action, void *arg) |
Walk memory tables and call the provided function, for every region. More... | |
int | bootmem_region_targets_type (uint64_t start, uint64_t size, enum bootmem_type dest_type) |
void * | bootmem_allocate_buffer (size_t size) |
Variables | |
static int | initialized |
static int | table_written |
static struct memranges | bootmem |
static struct memranges | bootmem_os |
static const struct range_strings | type_strings [] |
void bootmem_add_range | ( | uint64_t | start, |
uint64_t | size, | ||
const enum bootmem_type | tag | ||
) |
Definition at line 88 of file bootmem.c.
References assert, BM_MEM_FIRST, BM_MEM_LAST, BM_MEM_OS_CUTOFF, bootmem, bootmem_is_initialized(), bootmem_memory_table_written(), bootmem_os, and memranges_insert().
Referenced by bootmem_arch_add_ranges(), bootmem_init(), bootmem_platform_add_ranges(), cbmem_add_bootmem(), and fit_payload_arch().
Definition at line 155 of file bootmem.c.
References BIOS_DEBUG, bootmem, bootmem_range_string(), memranges_each_entry, printk, range_entry_base(), range_entry_end(), and range_entry_tag().
Referenced by bootmem_write_memory_table(), fit_payload(), fit_payload_arch(), and segment_targets_type().
Definition at line 59 of file bootmem.c.
References BM_MEM_RAM, BM_MEM_RAMSTAGE, BM_MEM_RESERVED, bootmem, bootmem_add_range(), bootmem_arch_add_ranges(), bootmem_os, bootmem_platform_add_ranges(), cbmem_add_bootmem(), initialized, IORESOURCE_CACHEABLE, IORESOURCE_RESERVE, memranges_add_resources(), memranges_clone(), memranges_init, and REGION_SIZE.
Referenced by bootmem_write_memory_table().
|
static |
Definition at line 16 of file bootmem.c.
References initialized.
Referenced by bootmem_add_range(), bootmem_walk(), and bootmem_walk_os_mem().
|
static |
Definition at line 21 of file bootmem.c.
References table_written.
Referenced by bootmem_add_range().
Definition at line 27 of file bootmem.c.
Referenced by bootmem_init().
|
static |
Definition at line 143 of file bootmem.c.
References ARRAY_SIZE, range_strings::str, range_strings::tag, and type_strings.
Referenced by bootmem_dump_ranges().
int bootmem_region_targets_type | ( | uint64_t | start, |
uint64_t | size, | ||
enum bootmem_type | dest_type | ||
) |
Definition at line 197 of file bootmem.c.
References bootmem, range_entry::end, memranges_each_entry, range_entry_base(), range_entry_end(), and range_entry_tag().
Referenced by segment_targets_type().
|
static |
Definition at line 32 of file bootmem.c.
References BIOS_ERR, BM_MEM_ACPI, BM_MEM_BL31, BM_MEM_NVS, BM_MEM_OPENSBI, BM_MEM_RAM, BM_MEM_RESERVED, BM_MEM_TABLE, BM_MEM_UNUSABLE, BM_MEM_VENDOR_RSVD, LB_MEM_ACPI, LB_MEM_NVS, LB_MEM_RAM, LB_MEM_RESERVED, LB_MEM_TABLE, LB_MEM_UNUSABLE, LB_MEM_VENDOR_RSVD, and printk.
Referenced by bootmem_write_memory_table().
bool bootmem_walk | ( | range_action_t | action, |
void * | arg | ||
) |
Walk memory tables and call the provided function, for every region.
The caller has to return false to break out of the loop any time, or return true to continue.
action | The function to call for each memory range. |
arg | Pointer passed to function @action. Set to NULL if unused. |
Definition at line 183 of file bootmem.c.
References arg, assert, bootmem, bootmem_is_initialized(), and memranges_each_entry.
Referenced by fit_payload_arch().
bool bootmem_walk_os_mem | ( | range_action_t | action, |
void * | arg | ||
) |
Walk memory tables from OS point of view and call the provided function, for every region.
The caller has to return false to break out of the loop any time, or return true to continue.
action | The function to call for each memory range. |
arg | Pointer passed to function @action. Set to NULL if unused. |
Definition at line 169 of file bootmem.c.
References arg, assert, bootmem_is_initialized(), bootmem_os, and memranges_each_entry.
Referenced by fit_update_memory().
Write memory coreboot table.
Current resource map is serialized into memtable (LB_MEM_* types). bootmem library is unusable until this function is called first in the write tables path before payload is loaded.
Bootmem types match to LB_MEM tags, except for the following: BM_MEM_RAMSTAGE : Translates to LB_MEM_RAM. BM_MEM_PAYLOAD : Translates to LB_MEM_RAM. BM_MEM_BL31 : Translates to LB_MEM_RESERVED.
Definition at line 102 of file bootmem.c.
References bootmem_dump_ranges(), bootmem_init(), bootmem_os, bootmem_to_lb_tag(), lb_memory::map, memranges_each_entry, range_entry_base(), range_entry_size(), range_entry_tag(), lb_memory_range::size, lb_memory::size, lb_memory_range::start, table_written, and lb_memory_range::type.
Referenced by write_coreboot_table().
|
static |
Definition at line 12 of file bootmem.c.
Referenced by bootmem_add_range(), bootmem_dump_ranges(), bootmem_init(), bootmem_region_targets_type(), and bootmem_walk().
|
static |
Definition at line 12 of file bootmem.c.
Referenced by bootmem_add_range(), bootmem_init(), bootmem_walk_os_mem(), and bootmem_write_memory_table().
|
static |
Definition at line 11 of file bootmem.c.
Referenced by as3722rtc_init(), bootmem_init(), bootmem_is_initialized(), and init_save_state().
|
static |
Definition at line 12 of file bootmem.c.
Referenced by bootmem_memory_table_written(), and bootmem_write_memory_table().
|
static |
Definition at line 102 of file bootmem.c.
Referenced by bootmem_range_string().