coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
vbnv_flash.c File Reference
#include <commonlib/region.h>
#include <console/console.h>
#include <fmap.h>
#include <string.h>
#include <vb2_api.h>
#include <security/vboot/vboot_common.h>
#include <security/vboot/vbnv.h>
#include <security/vboot/vbnv_layout.h>
Include dependency graph for vbnv_flash.c:

Go to the source code of this file.

Data Structures

struct  vbnv_flash_ctx
 

Macros

#define BLOB_SIZE   VB2_NVDATA_SIZE
 

Functions

static uint8_t erase_value (void)
 
static int can_overwrite (uint8_t current, uint8_t new)
 
static int init_vbnv (void)
 
static int erase_nvram (void)
 
void read_vbnv_flash (uint8_t *vbnv_copy)
 
void save_vbnv_flash (const uint8_t *vbnv_copy)
 

Variables

static struct vbnv_flash_ctx vbnv_flash
 

Macro Definition Documentation

◆ BLOB_SIZE

#define BLOB_SIZE   VB2_NVDATA_SIZE

Definition at line 12 of file vbnv_flash.c.

Function Documentation

◆ can_overwrite()

static int can_overwrite ( uint8_t  current,
uint8_t  new 
)
inlinestatic

Definition at line 42 of file vbnv_flash.c.

Referenced by save_vbnv_flash().

Here is the caller graph for this function:

◆ erase_nvram()

static int erase_nvram ( void  )
static

Definition at line 103 of file vbnv_flash.c.

References BIOS_ERR, BIOS_INFO, printk, rdev, rdev_eraseat(), region_device_sz(), vbnv_flash_ctx::vbnv_dev, and vbnv_flash.

Referenced by save_vbnv_flash().

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

◆ erase_value()

static uint8_t erase_value ( void  )
inlinestatic

Definition at line 37 of file vbnv_flash.c.

Referenced by init_vbnv().

Here is the caller graph for this function:

◆ init_vbnv()

static int init_vbnv ( void  )
static

◆ read_vbnv_flash()

void read_vbnv_flash ( uint8_t vbnv_copy)

Definition at line 117 of file vbnv_flash.c.

References BLOB_SIZE, vbnv_flash_ctx::cache, init_vbnv(), vbnv_flash_ctx::initialized, memcpy(), and vbnv_flash.

Referenced by read_vbnv(), and restore_from_backup().

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

◆ save_vbnv_flash()

void save_vbnv_flash ( const uint8_t vbnv_copy)

Definition at line 128 of file vbnv_flash.c.

References BIOS_ERR, vbnv_flash_ctx::blob_offset, BLOB_SIZE, vbnv_flash_ctx::cache, can_overwrite(), erase_nvram(), init_vbnv(), vbnv_flash_ctx::initialized, memcmp(), memcpy(), printk, rdev, rdev_writeat(), vbnv_flash_ctx::top_offset, vbnv_flash_ctx::vbnv_dev, and vbnv_flash.

Referenced by save_vbnv().

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

Variable Documentation

◆ vbnv_flash

struct vbnv_flash_ctx vbnv_flash
static

Definition at line 1 of file vbnv_flash.c.

Referenced by erase_nvram(), init_vbnv(), read_vbnv_flash(), and save_vbnv_flash().