lbtable.c File Reference

#include <string.h>
#include <sys/mman.h>
#include "common.h"
#include "coreboot_tables.h"
#include "ip_checksum.h"
#include "lbtable.h"
#include "layout.h"
#include "cmos_lowlevel.h"
#include "hexdump.h"

Include dependency graph for lbtable.c:

Go to the source code of this file.

Data Structures

struct  lbtable_choice_t
struct  mem_range_t

Defines

#define NUM_LBTABLE_CHOICES   14
#define NUM_MEM_RANGES   2
#define vtophys(vaddr)
#define phystov(paddr)

Typedefs

typedef void(* lbtable_print_fn_t )(const struct lb_record *rec)

Functions

static struct lb_headerlbtable_scan (unsigned long start, unsigned long end, int *bad_header_count, int *bad_table_count)
static void process_cmos_table (void)
static void get_cmos_checksum_info (void)
static void try_convert_checksum_layout (cmos_checksum_layout_t *layout)
static void try_add_cmos_table_enum (cmos_enum_t *cmos_enum)
static void try_add_cmos_table_entry (cmos_entry_t *cmos_entry)
static struct lb_recordfind_lbrec (uint32_t tag)
static const char * lbrec_tag_to_str (uint32_t tag)
static struct cmos_entriesfirst_cmos_table_entry (void)
static struct cmos_entriesnext_cmos_table_entry (const struct cmos_entries *last)
static struct cmos_enumsfirst_cmos_table_enum (void)
static struct cmos_enumsnext_cmos_table_enum (const struct cmos_enums *last)
static struct lb_recordfirst_cmos_rec (uint32_t tag)
static struct lb_recordnext_cmos_rec (const struct lb_record *last, uint32_t tag)
static void memory_print_fn (const struct lb_record *rec)
static void mainboard_print_fn (const struct lb_record *rec)
static void cmos_opt_table_print_fn (const struct lb_record *rec)
static void print_option_record (const struct cmos_entries *cmos_entry)
static void print_enum_record (const struct cmos_enums *cmos_enum)
static void print_defaults_record (const struct cmos_defaults *cmos_defaults)
static void print_unknown_record (const struct lb_record *cmos_item)
static void option_checksum_print_fn (const struct lb_record *rec)
static void string_print_fn (const struct lb_record *rec)
static void uint64_to_hex_string (char str[], uint64_t n)
void get_lbtable (void)
void get_layout_from_cmos_table (void)
void dump_lbtable (void)
void list_lbtable_choices (void)
void list_lbtable_item (const char item[])

Variables

static const char memory_desc []
static const char mainboard_desc []
static const char version_desc []
static const char extra_version_desc []
static const char build_desc []
static const char compile_time_desc []
static const char compile_by_desc []
static const char compile_host_desc []
static const char compile_domain_desc []
static const char compiler_desc []
static const char linker_desc []
static const char assembler_desc []
static const char cmos_opt_table_desc []
static const char option_checksum_desc []
static const char generic_nofound_msg []
static const char nofound_msg_cmos_opt_table []
static const char nofound_msg_option_checksum []
static const lbtable_choice_t lbtable_choices [NUM_LBTABLE_CHOICES]
static const mem_range_t mem_ranges [NUM_MEM_RANGES]
static const size_t BYTES_TO_MAP = (1024 * 1024)
static const void * low_phys_mem
static struct lb_headerlbtable = NULL
static struct cmos_option_tablecmos_table = NULL
static const hexdump_format_t format


Define Documentation

#define NUM_LBTABLE_CHOICES   14

Definition at line 155 of file lbtable.c.

Referenced by list_lbtable_choices(), and list_lbtable_item().

#define NUM_MEM_RANGES   2

Definition at line 224 of file lbtable.c.

Referenced by get_lbtable().

#define phystov ( paddr   ) 

Value:

(((unsigned long) low_phys_mem) + \
                        ((unsigned long) paddr))

Definition at line 274 of file lbtable.c.

Referenced by get_lbtable().

#define vtophys ( vaddr   ) 

Value:

(((unsigned long) vaddr) -       \
                        ((unsigned long) low_phys_mem))

Definition at line 263 of file lbtable.c.

Referenced by cmos_opt_table_print_fn(), dump_lbtable(), print_defaults_record(), print_enum_record(), print_option_record(), and print_unknown_record().


Typedef Documentation

typedef void(* lbtable_print_fn_t)(const struct lb_record *rec)

Definition at line 42 of file lbtable.c.


Function Documentation

static void cmos_opt_table_print_fn ( const struct lb_record rec  )  [static]

void dump_lbtable ( void   ) 

Definition at line 364 of file lbtable.c.

References data, lb_header::header_bytes, lb_header::header_checksum, hexdump(), lbrec_tag_to_str(), printf, lb_header::signature, lb_record::size, lb_header::table_bytes, lb_header::table_checksum, lb_header::table_entries, lb_record::tag, and vtophys.

Referenced by op_lbtable_dump().

Here is the call graph for this function:

Here is the caller graph for this function:

static struct lb_record * find_lbrec ( uint32_t  tag  )  [static, read]

Definition at line 799 of file lbtable.c.

References lb_header::header_bytes, NULL, lb_record::size, lb_header::table_bytes, and lb_record::tag.

Referenced by get_cmos_checksum_info(), get_layout_from_cmos_table(), and list_lbtable_item().

Here is the caller graph for this function:

static struct lb_record * first_cmos_rec ( uint32_t  tag  )  [static, read]

Definition at line 941 of file lbtable.c.

References cmos_option_table::header_length, NULL, lb_record::size, cmos_option_table::size, and lb_record::tag.

Referenced by first_cmos_table_entry(), and first_cmos_table_enum().

Here is the caller graph for this function:

static struct cmos_entries * first_cmos_table_entry ( void   )  [static, read]

Definition at line 887 of file lbtable.c.

References first_cmos_rec(), and LB_TAG_OPTION.

Referenced by process_cmos_table().

Here is the call graph for this function:

Here is the caller graph for this function:

static struct cmos_enums * first_cmos_table_enum ( void   )  [static, read]

Definition at line 909 of file lbtable.c.

References first_cmos_rec(), and LB_TAG_OPTION_ENUM.

Referenced by process_cmos_table().

Here is the call graph for this function:

Here is the caller graph for this function:

static void get_cmos_checksum_info ( void   )  [static]

void get_layout_from_cmos_table ( void   ) 

Definition at line 339 of file lbtable.c.

References find_lbrec(), get_cmos_checksum_info(), get_lbtable(), LB_TAG_CMOS_OPTION_TABLE, NULL, process_cmos_table(), and prog_name.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void get_lbtable ( void   ) 

Definition at line 282 of file lbtable.c.

References BYTES_TO_MAP, lbtable_scan(), low_phys_mem, NULL, NUM_MEM_RANGES, phystov, and prog_name.

Referenced by get_layout_from_cmos_table(), op_lbtable_dump(), and op_lbtable_show_info().

Here is the call graph for this function:

Here is the caller graph for this function:

static const char * lbrec_tag_to_str ( uint32_t  tag  )  [static]

static struct lb_header * lbtable_scan ( unsigned long  start,
unsigned long  end,
int *  bad_header_count,
int *  bad_table_count 
) [static, read]

Definition at line 491 of file lbtable.c.

References compute_ip_checksum(), NULL, lb_header::signature, table(), lb_header::table_bytes, and lb_header::table_checksum.

Referenced by get_lbtable().

Here is the call graph for this function:

Here is the caller graph for this function:

void list_lbtable_choices ( void   ) 

Definition at line 424 of file lbtable.c.

References name, NUM_LBTABLE_CHOICES, and printf.

Referenced by op_lbtable_show_info().

Here is the caller graph for this function:

void list_lbtable_item ( const char  item[]  ) 

Definition at line 443 of file lbtable.c.

References find_lbrec(), name, NULL, NUM_LBTABLE_CHOICES, lbtable_choice_t::print_fn, prog_name, strcmp(), and lb_record::tag.

Referenced by op_lbtable_show_info().

Here is the call graph for this function:

Here is the caller graph for this function:

static void mainboard_print_fn ( const struct lb_record rec  )  [static]

static void memory_print_fn ( const struct lb_record rec  )  [static]

Definition at line 995 of file lbtable.c.

References LB_MEM_RAM, LB_MEM_RESERVED, LB_MEM_TABLE, lb_memory::map, printf, lb_memory::size, lb_memory_range::size, lb_memory_range::start, uint64_to_hex_string(), and unpack_lb64().

Here is the call graph for this function:

static struct lb_record * next_cmos_rec ( const struct lb_record last,
uint32_t  tag 
) [static, read]

Definition at line 968 of file lbtable.c.

References cmos_option_table::header_length, NULL, lb_record::size, cmos_option_table::size, and lb_record::tag.

Referenced by next_cmos_table_entry(), and next_cmos_table_enum().

Here is the caller graph for this function:

static struct cmos_entries * next_cmos_table_entry ( const struct cmos_entries last  )  [static, read]

Definition at line 897 of file lbtable.c.

References LB_TAG_OPTION, and next_cmos_rec().

Referenced by process_cmos_table().

Here is the call graph for this function:

Here is the caller graph for this function:

static struct cmos_enums * next_cmos_table_enum ( const struct cmos_enums last  )  [static, read]

Definition at line 920 of file lbtable.c.

References LB_TAG_OPTION_ENUM, and next_cmos_rec().

Referenced by process_cmos_table().

Here is the call graph for this function:

Here is the caller graph for this function:

static void option_checksum_print_fn ( const struct lb_record rec  )  [static]

static void print_defaults_record ( const struct cmos_defaults cmos_defaults  )  [static]

Definition at line 1193 of file lbtable.c.

References CMOS_IMAGE_BUFFER_SIZE, cmos_defaults::default_set, hexdump(), cmos_defaults::name, cmos_defaults::name_length, printf, cmos_defaults::size, cmos_defaults::tag, and vtophys.

Referenced by cmos_opt_table_print_fn().

Here is the call graph for this function:

Here is the caller graph for this function:

static void print_enum_record ( const struct cmos_enums cmos_enum  )  [static]

Definition at line 1176 of file lbtable.c.

References cmos_enums::config_id, printf, cmos_enums::size, cmos_enums::tag, cmos_enums::text, cmos_enums::value, and vtophys.

Referenced by cmos_opt_table_print_fn().

Here is the caller graph for this function:

static void print_option_record ( const struct cmos_entries cmos_entry  )  [static]

Definition at line 1134 of file lbtable.c.

References cmos_entries::bit, cmos_entries::config, cmos_entries::config_id, cmos_entries::length, cmos_entries::name, printf, cmos_entries::size, strcpy(), cmos_entries::tag, and vtophys.

Referenced by cmos_opt_table_print_fn().

Here is the call graph for this function:

Here is the caller graph for this function:

static void print_unknown_record ( const struct lb_record cmos_item  )  [static]

Definition at line 1213 of file lbtable.c.

References data, hexdump(), printf, lb_record::size, lb_record::tag, and vtophys.

Referenced by cmos_opt_table_print_fn().

Here is the call graph for this function:

Here is the caller graph for this function:

static void process_cmos_table ( void   )  [static]

static void string_print_fn ( const struct lb_record rec  )  [static]

Definition at line 1248 of file lbtable.c.

References printf, and lb_string::string.

static void try_add_cmos_table_entry ( cmos_entry_t cmos_entry  )  [static]

Definition at line 754 of file lbtable.c.

References add_cmos_entry(), BUG, CMOS_AREA_OUT_OF_RANGE, CMOS_AREA_TOO_WIDE, LAYOUT_ENTRY_BAD_LENGTH, LAYOUT_ENTRY_OVERLAP, cmos_entry_t::name, OK, and prog_name.

Referenced by process_cmos_table().

Here is the call graph for this function:

Here is the caller graph for this function:

static void try_add_cmos_table_enum ( cmos_enum_t cmos_enum  )  [static]

Definition at line 731 of file lbtable.c.

References add_cmos_enum(), BUG, LAYOUT_DUPLICATE_ENUM, OK, prog_name, and cmos_enum_t::text.

Referenced by process_cmos_table().

Here is the call graph for this function:

Here is the caller graph for this function:

static void try_convert_checksum_layout ( cmos_checksum_layout_t layout  )  [static]

static void uint64_to_hex_string ( char  str[],
uint64_t  n 
) [static]

Definition at line 1264 of file lbtable.c.

References sprintf().

Referenced by memory_print_fn().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char assembler_desc[] [static]

Initial value:

"    This shows the name of the assembler used to build coreboot.\n"

Definition at line 126 of file lbtable.c.

const char build_desc[] [static]

Initial value:

"    This shows coreboot build information.\n"

Definition at line 105 of file lbtable.c.

const size_t BYTES_TO_MAP = (1024 * 1024) [static]

Definition at line 237 of file lbtable.c.

Referenced by get_lbtable().

const char cmos_opt_table_desc[] [static]

Initial value:

"    This does a low-level dump of the CMOS option table.  The table "
"contains\n"
"    information about the layout of the values that coreboot stores in\n"
"    nonvolatile RAM.\n"

Definition at line 129 of file lbtable.c.

struct cmos_option_table* cmos_table = NULL [static]

Definition at line 250 of file lbtable.c.

Referenced by main().

const char compile_by_desc[] [static]

Initial value:

"    This shows who compiled coreboot.\n"

Definition at line 111 of file lbtable.c.

const char compile_domain_desc[] [static]

Initial value:

"    This shows the domain name of the machine that compiled coreboot.\n"

Definition at line 117 of file lbtable.c.

const char compile_host_desc[] [static]

Initial value:

"    This shows the name of the machine that compiled coreboot.\n"

Definition at line 114 of file lbtable.c.

const char compile_time_desc[] [static]

Initial value:

"    This shows when coreboot was compiled.\n"

Definition at line 108 of file lbtable.c.

const char compiler_desc[] [static]

Initial value:

"    This shows the name of the compiler used to build coreboot.\n"

Definition at line 120 of file lbtable.c.

const char extra_version_desc[] [static]

Initial value:

"    This shows extra coreboot version information.\n"

Definition at line 102 of file lbtable.c.

const hexdump_format_t format [static]

Initial value:

 { 12, 4, "            ", " | ", " ", " | ", '.', NULL }

Definition at line 252 of file lbtable.c.

const char generic_nofound_msg[] [static]

Initial value:

"%s: Item %s not found in coreboot table.\n"

Definition at line 140 of file lbtable.c.

struct lb_header* lbtable = NULL [static]

Definition at line 245 of file lbtable.c.

const lbtable_choice_t lbtable_choices[NUM_LBTABLE_CHOICES] [static]

Definition at line 160 of file lbtable.c.

const char linker_desc[] [static]

Initial value:

"    This shows the name of the linker used to build coreboot.\n"

Definition at line 123 of file lbtable.c.

const void* low_phys_mem [static]

Definition at line 242 of file lbtable.c.

Referenced by get_lbtable().