![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <assert.h>
#include <cbfs.h>
#include <console/console.h>
#include <delay.h>
#include <ec/google/chromeec/ec.h>
#include <halt.h>
#include <security/vboot/misc.h>
#include <security/vboot/vbnv.h>
#include <security/vboot/vboot_common.h>
#include <timer.h>
#include <timestamp.h>
#include <vb2_api.h>
Go to the source code of this file.
Macros | |
#define | _EC_FILENAME(select, suffix) (select == VB_SELECT_FIRMWARE_READONLY ? "ecro" suffix : "ecrw" suffix) |
#define | EC_IMAGE_FILENAME(select) _EC_FILENAME(select, "") |
#define | EC_HASH_FILENAME(select) _EC_FILENAME(select, ".hash") |
#define | CROS_EC_HASH_CHECK_DELAY_MS 10 |
#define | CROS_EC_HASH_TIMEOUT_MS 2000 |
#define | LIMIT_POWER_WAIT_TIMEOUT_MS 3000 |
#define | LIMIT_POWER_POLL_SLEEP_MS 10 |
#define | CROS_EC_SYSJUMP_TIMEOUT_MS 3000 |
Functions | |
void | vboot_sync_ec (void) |
static uint32_t | get_vboot_hash_offset (enum vb2_firmware_selection select) |
static vb2_error_t | ec_hash_image (enum vb2_firmware_selection select, const uint8_t **hash, int *hash_size) |
static vb2_error_t | ec_protect_flash (enum vb2_firmware_selection select, int enable) |
static enum ec_flash_region | vboot_to_ec_region (enum vb2_firmware_selection select) |
static vb2_error_t | ec_flash_write (void *image, uint32_t region_offset, int image_size) |
static vb2_error_t | ec_update_image (enum vb2_firmware_selection select) |
static vb2_error_t | ec_get_expected_hash (enum vb2_firmware_selection select, const uint8_t **hash, int *hash_size) |
vb2_error_t | vb2ex_commit_data (struct vb2_context *ctx) |
vb2_error_t | vb2ex_ec_running_rw (int *in_rw) |
vb2_error_t | vb2ex_ec_vboot_done (struct vb2_context *ctx) |
vb2_error_t | vb2ex_ec_battery_cutoff (void) |
vb2_error_t | vb2ex_ec_hash_image (enum vb2_firmware_selection select, const uint8_t **hash, int *hash_size) |
vb2_error_t | vb2ex_ec_protect (enum vb2_firmware_selection select) |
vb2_error_t | vb2ex_ec_get_expected_image_hash (enum vb2_firmware_selection select, const uint8_t **hash, int *hash_size) |
vb2_error_t | vb2ex_ec_disable_jump (void) |
vb2_error_t | vb2ex_ec_update_image (enum vb2_firmware_selection select) |
vb2_error_t | vb2ex_ec_jump_to_rw (void) |
#define _EC_FILENAME | ( | select, | |
suffix | |||
) | (select == VB_SELECT_FIRMWARE_READONLY ? "ecro" suffix : "ecrw" suffix) |
#define EC_HASH_FILENAME | ( | select | ) | _EC_FILENAME(select, ".hash") |
#define EC_IMAGE_FILENAME | ( | select | ) | _EC_FILENAME(select, "") |
Definition at line 245 of file ec_sync.c.
References alloca, BIOS_ERR, google_chromeec_flash_info(), google_chromeec_flash_write_block(), google_chromeec_get_protocol_info(), ec_response_get_protocol_info::max_request_packet_size, memcpy(), MIN, params, printk, region_offset(), and ec_response_flash_info::write_block_size.
Referenced by ec_update_image().
|
static |
Definition at line 376 of file ec_sync.c.
References cbfs_map(), EC_HASH_FILENAME, NULL, and ec_params_flash_write::size.
Referenced by vb2ex_ec_get_expected_image_hash().
|
static |
Definition at line 107 of file ec_sync.c.
References BIOS_ERR, BIOS_INFO, BIOS_WARNING, CROS_EC_HASH_CHECK_DELAY_MS, CROS_EC_HASH_TIMEOUT_MS, ec_response_vboot_hash::digest_size, EC_VBOOT_HASH_STATUS_BUSY, EC_VBOOT_HASH_STATUS_DONE, EC_VBOOT_HASH_STATUS_NONE, EC_VBOOT_HASH_TYPE_SHA256, get_vboot_hash_offset(), google_chromeec_get_vboot_hash(), google_chromeec_start_vboot_hash(), ec_response_vboot_hash::hash_digest, ec_response_vboot_hash::hash_type, mdelay(), printk, ec_response_vboot_hash::size, ec_response_vboot_hash::status, stopwatch_duration_usecs(), stopwatch_expired(), stopwatch_init_msecs_expire(), timestamp_add_now(), and TS_EC_HASH_READY.
Referenced by vb2ex_ec_hash_image().
|
static |
Definition at line 189 of file ec_sync.c.
References EC_FLASH_PROTECT_ALL_AT_BOOT, EC_FLASH_PROTECT_ALL_NOW, EC_FLASH_PROTECT_GPIO_ASSERTED, EC_FLASH_PROTECT_RO_AT_BOOT, EC_FLASH_PROTECT_RO_NOW, ec_response_flash_protect::flags, google_chromeec_flash_protect(), and mask.
Referenced by ec_update_image(), and vb2ex_ec_protect().
|
static |
Definition at line 325 of file ec_sync.c.
References cbfs_map(), cbfs_unmap(), ec_flash_write(), EC_IMAGE_FILENAME, ec_protect_flash(), google_chromeec_efs_verify(), google_chromeec_flash_erase(), google_chromeec_flash_region_info(), region_offset(), and vboot_to_ec_region().
Referenced by vb2ex_ec_update_image().
|
static |
Definition at line 91 of file ec_sync.c.
References EC_VBOOT_HASH_OFFSET_ACTIVE, EC_VBOOT_HASH_OFFSET_RO, and EC_VBOOT_HASH_OFFSET_UPDATE.
Referenced by ec_hash_image().
vb2_error_t vb2ex_commit_data | ( | struct vb2_context * | ctx | ) |
Definition at line 402 of file ec_sync.c.
References save_vbnv().
vb2_error_t vb2ex_ec_battery_cutoff | ( | void | ) |
Definition at line 473 of file ec_sync.c.
References EC_BATTERY_CUTOFF_FLAG_AT_SHUTDOWN, and google_chromeec_battery_cutoff().
vb2_error_t vb2ex_ec_disable_jump | ( | void | ) |
Definition at line 511 of file ec_sync.c.
References EC_REBOOT_DISABLE_JUMP, and google_chromeec_reboot().
vb2_error_t vb2ex_ec_get_expected_image_hash | ( | enum vb2_firmware_selection | select, |
const uint8_t ** | hash, | ||
int * | hash_size | ||
) |
Definition at line 501 of file ec_sync.c.
References ec_get_expected_hash().
vb2_error_t vb2ex_ec_hash_image | ( | enum vb2_firmware_selection | select, |
const uint8_t ** | hash, | ||
int * | hash_size | ||
) |
Definition at line 484 of file ec_sync.c.
References ec_hash_image().
vb2_error_t vb2ex_ec_jump_to_rw | ( | void | ) |
Definition at line 530 of file ec_sync.c.
References BIOS_ERR, BIOS_INFO, CROS_EC_SYSJUMP_TIMEOUT_MS, EC_REBOOT_JUMP_RW, google_chromeec_hello(), google_chromeec_reboot(), mdelay(), printk, stopwatch_duration_usecs(), stopwatch_expired(), and stopwatch_init_msecs_expire().
vb2_error_t vb2ex_ec_protect | ( | enum vb2_firmware_selection | select | ) |
Definition at line 493 of file ec_sync.c.
References ec_protect_flash().
vb2_error_t vb2ex_ec_running_rw | ( | int * | in_rw | ) |
Definition at line 411 of file ec_sync.c.
References google_ec_running_ro().
vb2_error_t vb2ex_ec_update_image | ( | enum vb2_firmware_selection | select | ) |
Definition at line 522 of file ec_sync.c.
References ec_update_image().
vb2_error_t vb2ex_ec_vboot_done | ( | struct vb2_context * | ctx | ) |
Definition at line 420 of file ec_sync.c.
References BIOS_ERR, BIOS_INFO, BIOS_SPEW, google_chromeec_read_limit_power_request(), LIMIT_POWER_POLL_SLEEP_MS, LIMIT_POWER_WAIT_TIMEOUT_MS, mdelay(), printk, stopwatch_duration_usecs(), stopwatch_expired(), stopwatch_init_msecs_expire(), timestamp_add_now(), and TS_EC_POWER_LIMIT_WAIT.
Definition at line 40 of file ec_sync.c.
References BIOS_EMERG, BIOS_ERR, BIOS_INFO, EC_REBOOT_COLD, EC_REBOOT_FLAG_SWITCH_RW_SLOT, google_chromeec_reboot(), halt(), printk, timestamp_add_now(), TS_EC_SYNC_END, TS_EC_SYNC_START, vboot_get_context(), vboot_reboot(), and vboot_save_data().
Referenced by romstage_main().
|
static |
Definition at line 189 of file ec_sync.c.
Referenced by ec_update_image().