Files
OpenCellular/firmware/lib/include/ec_sync.h
Randall Spangler 79c1c6194b firmware: Include vb1 shared data in vb2 struct
Currently, firmware verification uses entirely vb2 structs, including
vb2_shared_data.  This goes through an ugly translation to the old vb1
VbSharedData to pass it to depthcharge.  The vboot kernel verification
maintains an equally ugly translation back to the vb2 struct
internally.

Eventually, we want to get rid of all that and use vb2 all the way
down to what crossystem picks up from the OS.

But before we can do that, we need to finish translating kernel
verification code to use the new vb2 structs.  This is a step on that
path, using vb2_shared_data equivalents where present and hiding the
old vb1 shared data struct as a member of vb2_shared_data so at least
the vboot functions don't need to pass around cparams to get at it.

This will be followed by more CLs which convert more vboot internals
to use vb2 structs directly, and eventually coreboot/depthcharge CLs
which pass the vb2 structs from firmware verification directly to
kernel verification.

No change in functionality.

BUG=chromium:611535
BRANCH=none
TEST=make -j runtests; build bob firmware and boot it

Change-Id: I5df8ce81ba3c3ac3f2cb4229db5461757cd89d8d
Reviewed-on: https://chromium-review.googlesource.com/852856
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
2018-01-09 14:14:17 -08:00

88 lines
2.4 KiB
C

/* Copyright 2016 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* EC software sync for verified boot
*/
#ifndef VBOOT_REFERENCE_EC_SYNC_H_
#define VBOOT_REFERENCE_EC_SYNC_H_
#include "vboot_api.h"
struct vb2_context;
struct VbCommonParams;
/**
* EC sync, phase 1
*
* This checks whether the EC is running the correct image to do EC sync, and
* whether any updates are necessary.
*
* @param ctx Vboot2 context
* @return VBERROR_SUCCESS, VBERROR_EC_REBOOT_TO_RO_REQUIRED if the EC must
* reboot back to its RO code to continue EC sync, or other non-zero error
* code.
*/
VbError_t ec_sync_phase1(struct vb2_context *ctx);
/**
* Returns non-zero if the EC will perform a slow update during phase 2.
*
* This is only valid after calling ec_sync_phase1(), before calling
* ec_sync_phase2().
*
* @param ctx Vboot2 context
* @return non-zero if a slow update will be done; zero if no update or a
* fast update.
*/
int ec_will_update_slowly(struct vb2_context *ctx);
/**
* Check if auxiliary firmware blobs need to be updated.
*
* @param ctx Vboot2 context
* @param severity VB_AUX_FW_{NO,FAST,SLOW}_UPDATE
* @return VBERROR_SUCCESS or non-zero error code.
*/
VbError_t ec_sync_check_aux_fw(struct vb2_context *ctx,
VbAuxFwUpdateSeverity_t *severity);
/**
* EC sync, phase 2
*
* This updates the EC if necessary, makes sure it has protected its image(s),
* and makes sure it has jumped to the correct image.
*
* If ec_will_update_slowly(), it is suggested that the caller display a
* warning screen before calling phase 2.
*
* @param ctx Vboot2 context
* @return VBERROR_SUCCESS, VBERROR_EC_REBOOT_TO_RO_REQUIRED if the EC must
* reboot back to its RO code to continue EC sync, or other non-zero error
* code.
*/
VbError_t ec_sync_phase2(struct vb2_context *ctx);
/**
* EC sync, phase 3
*
* This completes EC sync and handles battery cutoff if needed.
*
* @param ctx Vboot2 context
* @return VBERROR_SUCCESS or non-zero error code.
*/
VbError_t ec_sync_phase3(struct vb2_context *ctx);
/**
* Sync all EC devices to expected versions.
*
* This is a high-level function which calls the functions above.
*
* @param ctx Vboot context
* @return VBERROR_SUCCESS, or non-zero if error.
*/
VbError_t ec_sync_all(struct vb2_context *ctx);
#endif /* VBOOT_REFERENCE_EC_SYNC_H_ */