coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
fit.c File Reference
#include <assert.h>
#include <console/console.h>
#include <ctype.h>
#include <endian.h>
#include <bootmem.h>
#include <string.h>
#include <program_loading.h>
#include <memrange.h>
#include <fit.h>
#include <boardid.h>
#include <commonlib/stdlib.h>
#include <types.h>
Include dependency graph for fit.c:

Go to the source code of this file.

Data Structures

struct  compat_string_entry
 
struct  entry_params
 
struct  mem_map
 

Functions

static char * clean_compat_string (char *str)
 
static void fit_add_default_compat_strings (void)
 
static struct fit_image_nodefind_image (const char *name)
 
static struct fit_image_nodefind_image_with_overlays (const char *name, int bytes, struct list_node *prev)
 
static void image_node (struct device_tree_node *node)
 
static void config_node (struct device_tree_node *node)
 
static void fit_unpack (struct device_tree *tree, const char **default_config)
 
static int fdt_find_compat (const void *blob, uint32_t start_offset, struct fdt_property *prop)
 
static int fit_check_compat (struct fdt_property *compat_prop, const char *compat_name)
 
void fit_update_chosen (struct device_tree *tree, const char *cmd_line)
 
void fit_add_ramdisk (struct device_tree *tree, void *ramdisk_addr, size_t ramdisk_size)
 
static void update_reserve_map (uint64_t start, uint64_t end, struct device_tree *tree)
 
static uint64_t max_range (unsigned int size_cells)
 
static void update_mem_property (u64 start, u64 end, struct entry_params *params)
 
static bool walk_memory_table (const struct range_entry *r, void *arg)
 
void fit_add_compat_string (const char *str)
 
void fit_update_memory (struct device_tree *tree)
 
static int fit_update_compat (struct fit_config_node *config)
 
struct fit_config_nodefit_load (void *fit)
 

Variables

static struct list_node image_nodes
 
static struct list_node config_nodes
 
static struct list_node compat_strings
 

Function Documentation

◆ clean_compat_string()

static char* clean_compat_string ( char *  str)
static

Definition at line 27 of file fit.c.

References strlen(), and tolower().

Referenced by fit_add_compat_string().

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

◆ config_node()

static void config_node ( struct device_tree_node node)
static

Definition at line 136 of file fit.c.

References config, config_nodes, fdt_property::data, find_image(), find_image_with_overlays(), list_for_each, list_insert_after(), fdt_property::name, device_tree_node::name, device_tree_property::prop, device_tree_node::properties, fdt_property::size, strcmp(), and xzalloc.

Referenced by fit_unpack().

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

◆ fdt_find_compat()

static int fdt_find_compat ( const void blob,
uint32_t  start_offset,
struct fdt_property prop 
)
static

Definition at line 175 of file fit.c.

References fdt_next_property(), fdt_node_name(), fdt_property::name, NULL, offset, and strcmp().

Referenced by fit_update_compat().

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

◆ find_image()

static struct fit_image_node* find_image ( const char *  name)
static

Definition at line 73 of file fit.c.

References BIOS_ERR, image_nodes, list_for_each, name, fit_image_node::name, NULL, printk, and strcmp().

Referenced by config_node(), and find_image_with_overlays().

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

◆ find_image_with_overlays()

static struct fit_image_node* find_image_with_overlays ( const char *  name,
int  bytes,
struct list_node prev 
)
static

Definition at line 84 of file fit.c.

References base, find_image(), list_insert_after(), fit_overlay_chain::list_node, name, NULL, fit_overlay_chain::overlay, strnlen(), and xzalloc.

Referenced by config_node().

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

◆ fit_add_compat_string()

void fit_add_compat_string ( const char *  str)

Definition at line 322 of file fit.c.

References clean_compat_string(), compat_string_entry::compat_string, compat_strings, list_insert_after(), compat_string_entry::list_node, strdup(), and xzalloc.

Referenced by fit_add_default_compat_strings().

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

◆ fit_add_default_compat_strings()

static void fit_add_default_compat_strings ( void  )
static

Definition at line 38 of file fit.c.

References board_id(), fit_add_compat_string(), sku_id(), snprintf(), and UNDEFINED_STRAPPING_ID.

Referenced by fit_load().

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

◆ fit_add_ramdisk()

void fit_add_ramdisk ( struct device_tree tree,
void ramdisk_addr,
size_t  ramdisk_size 
)

Definition at line 222 of file fit.c.

References dt_add_u64_prop(), dt_find_node(), NULL, and device_tree::root.

Referenced by fit_payload().

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

◆ fit_check_compat()

static int fit_check_compat ( struct fdt_property compat_prop,
const char *  compat_name 
)
static

Definition at line 197 of file fit.c.

References fdt_property::data, fdt_property::size, strlen(), and strncmp().

Referenced by fit_update_compat().

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

◆ fit_load()

◆ fit_unpack()

static void fit_unpack ( struct device_tree tree,
const char **  default_config 
)
static

Definition at line 157 of file fit.c.

References device_tree_node::children, config_node(), dt_find_node_by_path(), dt_find_string_prop(), image_node(), list_for_each, and NULL.

Referenced by fit_load().

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

◆ fit_update_chosen()

void fit_update_chosen ( struct device_tree tree,
const char *  cmd_line 
)

Definition at line 213 of file fit.c.

References dt_add_string_prop(), dt_find_node(), NULL, and device_tree::root.

Referenced by fit_payload().

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

◆ fit_update_compat()

static int fit_update_compat ( struct fit_config_node config)
static

Definition at line 405 of file fit.c.

References BIOS_ERR, CBFS_COMPRESS_NONE, compat_string_entry::compat_string, compat_strings, config, fdt_find_compat(), fit_check_compat(), list_for_each, printk, and fdt_header::structure_offset.

Referenced by fit_load().

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

◆ fit_update_memory()

◆ image_node()

◆ max_range()

static uint64_t max_range ( unsigned int  size_cells)
static

Definition at line 253 of file fit.c.

Referenced by fit_update_memory(), and update_mem_property().

Here is the caller graph for this function:

◆ update_mem_property()

static void update_mem_property ( u64  start,
u64  end,
struct entry_params params 
)
static

Definition at line 263 of file fit.c.

References dt_write_int(), max_range(), MIN, and params.

Referenced by fit_update_memory().

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

◆ update_reserve_map()

static void update_reserve_map ( uint64_t  start,
uint64_t  end,
struct device_tree tree 
)
static

Definition at line 236 of file fit.c.

References list_insert_after(), device_tree_reserve_map_entry::list_node, device_tree::reserve_map, device_tree_reserve_map_entry::size, device_tree_reserve_map_entry::start, and xzalloc.

Referenced by fit_update_memory().

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

◆ walk_memory_table()

static bool walk_memory_table ( const struct range_entry r,
void arg 
)
static

Definition at line 287 of file fit.c.

References ALIGN_DOWN, ALIGN_UP, arg, BM_MEM_RAM, BM_MEM_RESERVED, mem_map::mem, memranges_insert(), MiB, range_entry_base(), range_entry_end(), range_entry_size(), range_entry_tag(), and mem_map::reserved.

Referenced by fit_update_memory().

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

Variable Documentation

◆ compat_strings

struct list_node compat_strings
static

Definition at line 1 of file fit.c.

Referenced by fit_add_compat_string(), fit_load(), and fit_update_compat().

◆ config_nodes

struct list_node config_nodes
static

Definition at line 1 of file fit.c.

Referenced by config_node(), and fit_load().

◆ image_nodes

struct list_node image_nodes
static

Definition at line 1 of file fit.c.

Referenced by find_image(), fit_load(), and image_node().