coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
vpd.c File Reference
#include <assert.h>
#include <console/console.h>
#include <cbmem.h>
#include <ctype.h>
#include <fmap.h>
#include <program_loading.h>
#include <string.h>
#include <timestamp.h>
#include <types.h>
#include "vpd.h"
#include "vpd_decode.h"
#include "vpd_tables.h"
Include dependency graph for vpd.c:

Go to the source code of this file.

Data Structures

struct  vpd_cbmem
 
struct  vpd_gets_arg
 

Enumerations

enum  { CROSVPD_CBMEM_MAGIC = 0x43524f53 , CROSVPD_CBMEM_VERSION = 0x0001 }
 

Functions

static void init_vpd_rdev (const char *fmap_name, struct region_device *rdev)
 
static int init_vpd_rdevs_from_cbmem (void)
 
static void init_vpd_rdevs (void)
 
static void cbmem_add_cros_vpd (int is_recovery)
 
static int vpd_gets_callback (const uint8_t *key, uint32_t key_len, const uint8_t *value, uint32_t value_len, void *arg)
 
static void vpd_find_in (struct region_device *rdev, struct vpd_gets_arg *arg)
 
const voidvpd_find (const char *key, int *size, enum vpd_region region)
 
char * vpd_gets (const char *key, char *buffer, int size, enum vpd_region region)
 
bool vpd_get_bool (const char *key, enum vpd_region region, uint8_t *val)
 
bool vpd_get_int (const char *const key, const enum vpd_region region, int *const val)
 

Variables

static struct region_device ro_vpd rw_vpd
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CROSVPD_CBMEM_MAGIC 
CROSVPD_CBMEM_VERSION 

Definition at line 18 of file vpd.c.

Function Documentation

◆ cbmem_add_cros_vpd()

◆ init_vpd_rdev()

static void init_vpd_rdev ( const char *  fmap_name,
struct region_device rdev 
)
static

Definition at line 47 of file vpd.c.

References BIOS_ERR, BIOS_WARNING, fmap_locate_area_as_rdev(), GOOGLE_VPD_2_0_OFFSET, info, memcmp(), memset(), printk, rdev, rdev_chain(), rdev_readat(), region_device_sz(), google_vpd_info::size, VPD_INFO_MAGIC, VPD_TYPE_IMPLICIT_TERMINATOR, and VPD_TYPE_TERMINATOR.

Referenced by init_vpd_rdevs().

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

◆ init_vpd_rdevs()

static void init_vpd_rdevs ( void  )
static

Definition at line 110 of file vpd.c.

References init_vpd_rdev(), init_vpd_rdevs_from_cbmem(), and rw_vpd.

Referenced by cbmem_add_cros_vpd(), and vpd_find().

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

◆ init_vpd_rdevs_from_cbmem()

static int init_vpd_rdevs_from_cbmem ( void  )
static

Definition at line 95 of file vpd.c.

References vpd_cbmem::blob, cbmem_find(), CBMEM_ID_VPD, cbmem_possibly_online(), rdev_chain_mem(), vpd_cbmem::ro_size, vpd_cbmem::rw_size, and rw_vpd.

Referenced by cbmem_add_cros_vpd(), and init_vpd_rdevs().

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

◆ vpd_find()

const void* vpd_find ( const char *  key,
int *  size,
enum vpd_region  region 
)

Definition at line 203 of file vpd.c.

References arg, init_vpd_rdevs(), vpd_gets_arg::key, NULL, rw_vpd, strlen(), vpd_find_in(), VPD_RO, VPD_RO_THEN_RW, VPD_RW, and VPD_RW_THEN_RO.

Referenced by vpd_get_bios_version(), vpd_get_bool(), and vpd_gets().

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

◆ vpd_find_in()

static void vpd_find_in ( struct region_device rdev,
struct vpd_gets_arg arg 
)
static

Definition at line 189 of file vpd.c.

References arg, rdev, rdev_mmap_full(), rdev_munmap(), region_device_sz(), VPD_DECODE_OK, vpd_decode_string(), and vpd_gets_callback().

Referenced by vpd_find().

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

◆ vpd_get_bool()

bool vpd_get_bool ( const char *  key,
enum vpd_region  region,
uint8_t val 
)

Definition at line 252 of file vpd.c.

References BIOS_CRIT, vpd_gets_arg::key, printk, val, value, and vpd_find().

Referenced by init_frb2_wdt(), mainboard_config_upd(), mainboard_memory_init_params(), and skip_intel_txt_lockdown().

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

◆ vpd_get_int()

bool vpd_get_int ( const char *const  key,
const enum vpd_region  region,
int *const  val 
)

Definition at line 284 of file vpd.c.

References atol(), isdigit(), vpd_gets_arg::key, val, value, and vpd_gets().

Referenced by fw_config_get(), get_console_loglevel(), get_uart_for_console(), init_frb2_wdt(), and mainboard_config_upd().

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

◆ vpd_gets()

char* vpd_gets ( const char *  key,
char *  buffer,
int  size,
enum vpd_region  region 
)

Definition at line 229 of file vpd.c.

References assert, buffer, vpd_gets_arg::key, memcpy(), MIN, NULL, and vpd_find().

Referenced by init_frb2_wdt(), smbios_mainboard_serial_number(), smbios_system_serial_number(), smbios_system_set_uuid(), variant_board_sku(), and vpd_get_int().

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

◆ vpd_gets_callback()

static int vpd_gets_callback ( const uint8_t key,
uint32_t  key_len,
const uint8_t value,
uint32_t  value_len,
void arg 
)
static

Definition at line 172 of file vpd.c.

References arg, vpd_gets_arg::key, vpd_gets_arg::key_len, memcmp(), value, vpd_gets_arg::value_len, VPD_DECODE_FAIL, and VPD_DECODE_OK.

Referenced by vpd_find_in().

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

Variable Documentation

◆ rw_vpd

struct region_device ro_vpd rw_vpd
static

Definition at line 1 of file vpd.c.

Referenced by cbmem_add_cros_vpd(), init_vpd_rdevs(), init_vpd_rdevs_from_cbmem(), and vpd_find().