summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-07-29 18:51:00 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-13 08:23:54 +0000
commitcf49e7b6ae5abee0552b596ec11b695b5d15853c (patch)
treea6a6ef6cdf73ee3078b07f0c195795d67c625b0b /firmware
parente6b803355ee3dc548a4519a71b29672d856f9bc5 (diff)
downloadvboot-cf49e7b6ae5abee0552b596ec11b695b5d15853c.tar.gz
vboot: replace VBERROR_SUCCESS with VB2_SUCCESS
Replace vboot1-style VBERROR_SUCCESS with VB2_SUCCESS (trivial change since both are equal values). BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I46e02471a031e9f36ec869d11d0b957d1c1b5769 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1728114 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1722915 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r--firmware/2lib/include/2return_codes.h3
-rw-r--r--firmware/include/vboot_api.h26
-rw-r--r--firmware/lib/ec_sync.c40
-rw-r--r--firmware/lib/ec_sync_all.c2
-rw-r--r--firmware/lib/include/ec_sync.h12
-rw-r--r--firmware/lib/include/load_kernel_fw.h2
-rw-r--r--firmware/lib/include/vboot_kernel.h4
-rw-r--r--firmware/lib/mocked_rollback_index.c2
-rw-r--r--firmware/lib/rollback_index.c2
-rw-r--r--firmware/lib/vboot_api_kernel.c20
-rw-r--r--firmware/lib/vboot_display.c8
-rw-r--r--firmware/lib/vboot_kernel.c4
-rw-r--r--firmware/lib/vboot_ui.c38
-rw-r--r--firmware/lib/vboot_ui_menu.c22
-rw-r--r--firmware/stub/tpm_lite_stub.c8
-rw-r--r--firmware/stub/vboot_api_stub.c34
-rw-r--r--firmware/stub/vboot_api_stub_disk.c8
-rw-r--r--firmware/stub/vboot_api_stub_init.c4
-rw-r--r--firmware/stub/vboot_api_stub_stream.c6
19 files changed, 121 insertions, 124 deletions
diff --git a/firmware/2lib/include/2return_codes.h b/firmware/2lib/include/2return_codes.h
index f1245875..644a6d9a 100644
--- a/firmware/2lib/include/2return_codes.h
+++ b/firmware/2lib/include/2return_codes.h
@@ -22,9 +22,6 @@ enum vb2_return_code {
/* Success - no error */
VB2_SUCCESS = 0,
- /* vboot1-style success (TODO: deprecate) */
- VBERROR_SUCCESS = 0,
-
/*
* All vboot2 error codes start at a large offset from zero, to reduce
* the risk of overlap with other error codes (TPM, etc.).
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index 8fdc18f7..01106c0e 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -152,7 +152,7 @@ typedef struct VbSelectAndLoadKernelParams {
/**
* Select and loads the kernel.
*
- * Returns VBERROR_SUCCESS if success, non-zero if error; on error, caller
+ * Returns VB2_SUCCESS if success, non-zero if error; on error, caller
* should reboot. */
vb2_error_t VbSelectAndLoadKernel(struct vb2_context *ctx,
VbSharedDataHeader *shared,
@@ -172,7 +172,7 @@ vb2_error_t VbSelectAndLoadKernel(struct vb2_context *ctx,
* @param kparams kernel params
* @param boot_image Image in memory that needs to be verified
* @param image_size Size of the image in memory
- * @return VBERROR_... error, VBERROR_SUCCESS on success.
+ * @return VBERROR_... error, VB2_SUCCESS on success.
*/
vb2_error_t VbVerifyMemoryBootImage(struct vb2_context *ctx,
VbSharedDataHeader *shared,
@@ -190,7 +190,7 @@ vb2_error_t VbVerifyMemoryBootImage(struct vb2_context *ctx,
* before calling this function! Also, on successful return from this function,
* the caller needs to reboot the device immediately for changes to take effect.
*
- * @return VBERROR_... error, VBERROR_SUCCESS on success.
+ * @return VBERROR_... error, VB2_SUCCESS on success.
*/
vb2_error_t VbUnlockDevice(void);
@@ -437,7 +437,7 @@ typedef void *VbExStream_t;
* @param lba_count Maximum extent of the stream in sectors
* @param stream out-paramter for the generated stream
*
- * @return Error code, or VBERROR_SUCCESS.
+ * @return Error code, or VB2_SUCCESS.
*
* This is used for access to the contents of the actual partitions on the
* device. It is not used to access the GPT. The size of the content addressed
@@ -453,7 +453,7 @@ vb2_error_t VbExStreamOpen(VbExDiskHandle_t handle, uint64_t lba_start,
* @param bytes Number of bytes to read
* @param buffer Destination to read into
*
- * @return Error code, or VBERROR_SUCCESS. Failure to read as much data as
+ * @return Error code, or VB2_SUCCESS. Failure to read as much data as
* requested is an error.
*
* This is used for access to the contents of the actual partitions on the
@@ -561,7 +561,7 @@ vb2_error_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale,
* each bit corresponds to the menu item's index.
* @param redraw_base Setting 1 will force a full redraw of the screen
*
- * @return VBERROR_SUCCESS or error code on error.
+ * @return VB2_SUCCESS or error code on error.
*/
vb2_error_t VbExDisplayMenu(uint32_t screen_type, uint32_t locale,
uint32_t selected_index, uint32_t disabled_idx_mask,
@@ -578,7 +578,7 @@ vb2_error_t VbExDisplayMenu(uint32_t screen_type, uint32_t locale,
* @param info_str The debug string to display
* @param full_info 1 if firmware should append its own info, 0 if not
*
- * @return VBERROR_SUCCESS or error code on error.
+ * @return VB2_SUCCESS or error code on error.
*/
vb2_error_t VbExDisplayDebugInfo(const char *info_str, int full_info);
@@ -589,7 +589,7 @@ vb2_error_t VbExDisplayDebugInfo(const char *info_str, int full_info);
* string length will be exactly VENDOR_DATA_LENGTH
* characters and null-terminated.
*
- * @return VBERROR_SUCCESS or error code on error.
+ * @return VB2_SUCCESS or error code on error.
*/
vb2_error_t VbExSetVendorData(const char *vendor_data_value);
@@ -719,7 +719,7 @@ vb2_error_t VbExEcDisableJump(int devidx);
* @param select Image to get hash of. RO or RW.
* @param hash Pointer to the hash.
* @param hash_size Pointer to the hash size.
- * @return VBERROR_... error, VBERROR_SUCCESS on success.
+ * @return VBERROR_... error, VB2_SUCCESS on success.
*/
vb2_error_t VbExEcHashImage(int devidx, enum VbSelectFirmware_t select,
const uint8_t **hash, int *hash_size);
@@ -768,7 +768,7 @@ vb2_error_t VbExEcEnteringMode(int devidx, enum VbEcBootMode_t mode);
* enough power is available to continue with boot.
*
* @param in_recovery 1 if recovery mode is selected by the AP, 0 otherwise.
- * @return VBERROR_... error, VBERROR_SUCCESS on success.
+ * @return VBERROR_... error, VB2_SUCCESS on success.
*/
vb2_error_t VbExEcVbootDone(int in_recovery);
@@ -801,7 +801,7 @@ typedef enum {
* 0: no update needed
* 1: fast update needed
* 2: slow update needed
- * @return VBERROR_... error, VBERROR_SUCCESS on success.
+ * @return VBERROR_... error, VB2_SUCCESS on success.
*/
vb2_error_t VbExCheckAuxFw(VbAuxFwUpdateSeverity_t *severity);
@@ -812,7 +812,7 @@ vb2_error_t VbExCheckAuxFw(VbAuxFwUpdateSeverity_t *severity);
* This is called after the EC has been updated and is intended to
* update additional firmware blobs such as TCPCs.
*
- * @return VBERROR_... error, VBERROR_SUCCESS on success.
+ * @return VBERROR_... error, VB2_SUCCESS on success.
*/
vb2_error_t VbExUpdateAuxFw(void);
@@ -903,7 +903,7 @@ uint8_t VbExOverrideGptEntryPriority(const GptEntry *e);
* Return number of locales supported
*
* @param count Pointer to the number of locales.
- * @return VBERROR_... error, VBERROR_SUCCESS on success.
+ * @return VBERROR_... error, VB2_SUCCESS on success.
*/
vb2_error_t VbExGetLocalizationCount(uint32_t *count);
diff --git a/firmware/lib/ec_sync.c b/firmware/lib/ec_sync.c
index bdea2f9a..447bc843 100644
--- a/firmware/lib/ec_sync.c
+++ b/firmware/lib/ec_sync.c
@@ -50,7 +50,7 @@ static vb2_error_t protect_ec(struct vb2_context *ctx, int devidx,
if (rv == VBERROR_EC_REBOOT_TO_RO_REQUIRED) {
VB2_DEBUG("VbExEcProtect() needs reboot\n");
- } else if (rv != VBERROR_SUCCESS) {
+ } else if (rv != VB2_SUCCESS) {
VB2_DEBUG("VbExEcProtect() returned %d\n", rv);
request_recovery(ctx, VB2_RECOVERY_EC_PROTECT);
}
@@ -144,7 +144,7 @@ static vb2_error_t check_ec_hash(struct vb2_context *ctx, int devidx,
* @param ctx Vboot2 context
* @param devidx Index of EC device to check
* @param select Which firmware image to check
- * @return VBERROR_SUCCESS, or non-zero error code.
+ * @return VB2_SUCCESS, or non-zero error code.
*/
static vb2_error_t update_ec(struct vb2_context *ctx, int devidx,
enum VbSelectFirmware_t select)
@@ -166,7 +166,7 @@ static vb2_error_t update_ec(struct vb2_context *ctx, int devidx,
VB2_DEBUG("image len = %d\n", want_size);
rv = VbExEcUpdateImage(devidx, select, want, want_size);
- if (rv != VBERROR_SUCCESS) {
+ if (rv != VB2_SUCCESS) {
VB2_DEBUG("VbExEcUpdateImage() returned %d\n", rv);
/*
@@ -194,7 +194,7 @@ static vb2_error_t update_ec(struct vb2_context *ctx, int devidx,
return VBERROR_EC_REBOOT_TO_RO_REQUIRED;
}
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
/**
@@ -216,7 +216,7 @@ static vb2_error_t check_ec_active(struct vb2_context *ctx, int devidx)
vb2_error_t rv = VbExEcRunningRW(devidx, &in_rw);
/* If we couldn't determine where the EC was, reboot to recovery. */
- if (rv != VBERROR_SUCCESS) {
+ if (rv != VB2_SUCCESS) {
VB2_DEBUG("VbExEcRunningRW() returned %d\n", rv);
request_recovery(ctx, VB2_RECOVERY_EC_UNKNOWN_IMAGE);
return VBERROR_EC_REBOOT_TO_RO_REQUIRED;
@@ -225,7 +225,7 @@ static vb2_error_t check_ec_active(struct vb2_context *ctx, int devidx)
if (in_rw)
sd->flags |= IN_RW(devidx);
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
#define RO_RETRIES 2 /* Maximum times to retry flashing RO */
@@ -235,7 +235,7 @@ static vb2_error_t check_ec_active(struct vb2_context *ctx, int devidx)
*
* @param ctx Vboot2 context
* @param devidx Which device (EC=0, PD=1)
- * @return VBERROR_SUCCESS, or non-zero if error.
+ * @return VB2_SUCCESS, or non-zero if error.
*/
static vb2_error_t sync_one_ec(struct vb2_context *ctx, int devidx)
{
@@ -264,7 +264,7 @@ static vb2_error_t sync_one_ec(struct vb2_context *ctx, int devidx)
if (!(sd->flags & IN_RW(devidx))) {
VB2_DEBUG("jumping to EC-RW\n");
rv = VbExEcJumpToRW(devidx);
- if (rv != VBERROR_SUCCESS) {
+ if (rv != VB2_SUCCESS) {
VB2_DEBUG("VbExEcJumpToRW() returned %x\n", rv);
/*
@@ -319,16 +319,16 @@ static vb2_error_t sync_one_ec(struct vb2_context *ctx, int devidx)
/* Protect RO flash */
rv = protect_ec(ctx, devidx, VB_SELECT_FIRMWARE_READONLY);
- if (rv != VBERROR_SUCCESS)
+ if (rv != VB2_SUCCESS)
return rv;
/* Protect RW flash */
rv = protect_ec(ctx, devidx, select_rw);
- if (rv != VBERROR_SUCCESS)
+ if (rv != VB2_SUCCESS)
return rv;
rv = VbExEcDisableJump(devidx);
- if (rv != VBERROR_SUCCESS) {
+ if (rv != VB2_SUCCESS) {
VB2_DEBUG("VbExEcDisableJump() returned %d\n", rv);
request_recovery(ctx, VB2_RECOVERY_EC_SOFTWARE_SYNC);
return VBERROR_EC_REBOOT_TO_RO_REQUIRED;
@@ -344,9 +344,9 @@ vb2_error_t ec_sync_phase1(struct vb2_context *ctx)
/* Reasons not to do sync at all */
if (!(ctx->flags & VB2_CONTEXT_EC_SYNC_SUPPORTED))
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
if (gbb->flags & VB2_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC)
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
#ifdef PD_SYNC
const int do_pd_sync = !(gbb->flags &
@@ -391,7 +391,7 @@ vb2_error_t ec_sync_phase1(struct vb2_context *ctx)
return VBERROR_EC_REBOOT_TO_RO_REQUIRED;
}
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
int ec_will_update_slowly(struct vb2_context *ctx)
@@ -433,7 +433,7 @@ vb2_error_t ec_sync_check_aux_fw(struct vb2_context *ctx,
if (!ec_sync_allowed(ctx) ||
(gbb->flags & VB2_GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC)) {
*severity = VB_AUX_FW_NO_UPDATE;
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
return VbExCheckAuxFw(severity);
}
@@ -455,11 +455,11 @@ vb2_error_t ec_sync_update_aux_fw(struct vb2_context *ctx)
vb2_error_t ec_sync_phase2(struct vb2_context *ctx)
{
if (!ec_sync_allowed(ctx))
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
/* Handle updates and jumps for EC */
vb2_error_t retval = sync_one_ec(ctx, 0);
- if (retval != VBERROR_SUCCESS)
+ if (retval != VB2_SUCCESS)
return retval;
#ifdef PD_SYNC
@@ -467,12 +467,12 @@ vb2_error_t ec_sync_phase2(struct vb2_context *ctx)
struct vb2_gbb_header *gbb = vb2_get_gbb(ctx);
if (!(gbb->flags & VB2_GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC)) {
retval = sync_one_ec(ctx, 1);
- if (retval != VBERROR_SUCCESS)
+ if (retval != VB2_SUCCESS)
return retval;
}
#endif
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t ec_sync_phase3(struct vb2_context *ctx)
@@ -495,5 +495,5 @@ vb2_error_t ec_sync_phase3(struct vb2_context *ctx)
return VBERROR_SHUTDOWN_REQUESTED;
}
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
diff --git a/firmware/lib/ec_sync_all.c b/firmware/lib/ec_sync_all.c
index 600218d5..4a8cf670 100644
--- a/firmware/lib/ec_sync_all.c
+++ b/firmware/lib/ec_sync_all.c
@@ -96,5 +96,5 @@ vb2_error_t ec_sync_all(struct vb2_context *ctx)
if (rv)
return rv;
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
diff --git a/firmware/lib/include/ec_sync.h b/firmware/lib/include/ec_sync.h
index e71d68b0..ec1be2b2 100644
--- a/firmware/lib/include/ec_sync.h
+++ b/firmware/lib/include/ec_sync.h
@@ -19,7 +19,7 @@ struct vb2_context;
* whether any updates are necessary.
*
* @param ctx Vboot2 context
- * @return VBERROR_SUCCESS, VBERROR_EC_REBOOT_TO_RO_REQUIRED if the EC must
+ * @return VB2_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.
*/
@@ -42,7 +42,7 @@ int ec_will_update_slowly(struct vb2_context *ctx);
*
* @param ctx Vboot2 context
* @param severity VB_AUX_FW_{NO,FAST,SLOW}_UPDATE
- * @return VBERROR_SUCCESS or non-zero error code.
+ * @return VB2_SUCCESS or non-zero error code.
*/
vb2_error_t ec_sync_check_aux_fw(struct vb2_context *ctx,
VbAuxFwUpdateSeverity_t *severity);
@@ -51,7 +51,7 @@ vb2_error_t ec_sync_check_aux_fw(struct vb2_context *ctx,
* Update and protect auxiliary firmware.
*
* @param ctx Vboot2 context
- * @return VBERROR_SUCCESS or non-zero error code.
+ * @return VB2_SUCCESS or non-zero error code.
*/
vb2_error_t ec_sync_update_aux_fw(struct vb2_context *ctx);
@@ -65,7 +65,7 @@ vb2_error_t ec_sync_update_aux_fw(struct vb2_context *ctx);
* warning screen before calling phase 2.
*
* @param ctx Vboot2 context
- * @return VBERROR_SUCCESS, VBERROR_EC_REBOOT_TO_RO_REQUIRED if the EC must
+ * @return VB2_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.
*/
@@ -77,7 +77,7 @@ vb2_error_t ec_sync_phase2(struct vb2_context *ctx);
* This completes EC sync and handles battery cutoff if needed.
*
* @param ctx Vboot2 context
- * @return VBERROR_SUCCESS or non-zero error code.
+ * @return VB2_SUCCESS or non-zero error code.
*/
vb2_error_t ec_sync_phase3(struct vb2_context *ctx);
@@ -87,7 +87,7 @@ vb2_error_t ec_sync_phase3(struct vb2_context *ctx);
* This is a high-level function which calls the functions above.
*
* @param ctx Vboot context
- * @return VBERROR_SUCCESS, or non-zero if error.
+ * @return VB2_SUCCESS, or non-zero if error.
*/
vb2_error_t ec_sync_all(struct vb2_context *ctx);
diff --git a/firmware/lib/include/load_kernel_fw.h b/firmware/lib/include/load_kernel_fw.h
index 4b7fb639..f76d7535 100644
--- a/firmware/lib/include/load_kernel_fw.h
+++ b/firmware/lib/include/load_kernel_fw.h
@@ -62,7 +62,7 @@ typedef struct LoadKernelParams {
* @param ctx Vboot context
* @param params Params specific to loading the kernel
*
- * Returns VBERROR_SUCCESS if successful. If unsuccessful, sets a recovery
+ * Returns VB2_SUCCESS if successful. If unsuccessful, sets a recovery
* reason via VbNvStorage and returns an error code.
*/
vb2_error_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params);
diff --git a/firmware/lib/include/vboot_kernel.h b/firmware/lib/include/vboot_kernel.h
index 7044ba10..cf3c4bb3 100644
--- a/firmware/lib/include/vboot_kernel.h
+++ b/firmware/lib/include/vboot_kernel.h
@@ -20,11 +20,11 @@ struct vb2_context;
* Attempt loading a kernel from the specified type(s) of disks.
*
* If successful, sets lkp.disk_handle to the disk for the kernel and returns
- * VBERROR_SUCCESS.
+ * VB2_SUCCESS.
*
* @param ctx Vboot context
* @param get_info_flags Flags to pass to VbExDiskGetInfo()
- * @return VBERROR_SUCCESS, VBERROR_NO_DISK_FOUND if no disks of the specified
+ * @return VB2_SUCCESS, VBERROR_NO_DISK_FOUND if no disks of the specified
* type were found, or other non-zero VBERROR_ codes for other failures.
*/
vb2_error_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags);
diff --git a/firmware/lib/mocked_rollback_index.c b/firmware/lib/mocked_rollback_index.c
index 37b314a9..6dfeb5cf 100644
--- a/firmware/lib/mocked_rollback_index.c
+++ b/firmware/lib/mocked_rollback_index.c
@@ -16,7 +16,7 @@
vb2_error_t SetVirtualDevMode(int val)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
uint32_t TPMClearAndReenable(void)
diff --git a/firmware/lib/rollback_index.c b/firmware/lib/rollback_index.c
index 41df72bb..663d50c1 100644
--- a/firmware/lib/rollback_index.c
+++ b/firmware/lib/rollback_index.c
@@ -166,7 +166,7 @@ vb2_error_t SetVirtualDevMode(int val)
return VBERROR_TPM_SET_BOOT_MODE_STATE;
VB2_DEBUG("TPM: Leaving\n");
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
uint32_t ReadSpaceKernel(RollbackSpaceKernel *rsk)
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 1a59e674..806874f5 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -80,8 +80,8 @@ vb2_error_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
lkp.disk_handle = NULL;
/* Find disks */
- if (VBERROR_SUCCESS != VbExDiskGetInfo(&disk_info, &disk_count,
- get_info_flags))
+ if (VB2_SUCCESS != VbExDiskGetInfo(&disk_info, &disk_count,
+ get_info_flags))
disk_count = 0;
VB2_DEBUG("VbTryLoadKernel() found %d disks\n", (int)disk_count);
@@ -131,12 +131,12 @@ vb2_error_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
* get, instead of just returning the value from the last disk
* attempted.
*/
- if (VBERROR_SUCCESS == retval)
+ if (VB2_SUCCESS == retval)
break;
}
/* If we didn't find any good kernels, don't return a disk handle. */
- if (VBERROR_SUCCESS != retval) {
+ if (VB2_SUCCESS != retval) {
VbSetRecoveryRequest(ctx, VB2_RECOVERY_RW_NO_KERNEL);
lkp.disk_handle = NULL;
}
@@ -343,7 +343,7 @@ static vb2_error_t vb2_kernel_setup(struct vb2_context *ctx,
}
}
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
static vb2_error_t vb2_kernel_phase4(struct vb2_context *ctx,
@@ -370,7 +370,7 @@ static vb2_error_t vb2_kernel_phase4(struct vb2_context *ctx,
return VBERROR_TPM_LOCK_KERNEL;
}
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
static void vb2_kernel_cleanup(struct vb2_context *ctx)
@@ -448,7 +448,7 @@ vb2_error_t VbSelectAndLoadKernel(struct vb2_context *ctx,
VbSelectAndLoadKernel_exit:
- if (VBERROR_SUCCESS == retval)
+ if (VB2_SUCCESS == retval)
retval = vb2_kernel_phase4(ctx, kparams);
vb2_kernel_cleanup(ctx);
@@ -607,7 +607,7 @@ vb2_error_t VbVerifyMemoryBootImage(struct vb2_context *ctx,
if (VbKernelHasFlags(preamble) == VBOOT_SUCCESS)
kparams->flags = preamble->flags;
- retval = VBERROR_SUCCESS;
+ retval = VB2_SUCCESS;
fail:
vb2_kernel_cleanup(ctx);
@@ -617,9 +617,9 @@ vb2_error_t VbVerifyMemoryBootImage(struct vb2_context *ctx,
vb2_error_t VbUnlockDevice(void)
{
VB2_DEBUG("Enabling dev-mode...\n");
- if (VBERROR_SUCCESS != SetVirtualDevMode(1))
+ if (VB2_SUCCESS != SetVirtualDevMode(1))
return VBERROR_TPM_SET_BOOT_MODE_STATE;
VB2_DEBUG("Mode change will take effect on next reboot.\n");
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c
index 364cd131..6661885e 100644
--- a/firmware/lib/vboot_display.c
+++ b/firmware/lib/vboot_display.c
@@ -39,7 +39,7 @@ vb2_error_t VbDisplayScreen(struct vb2_context *ctx, uint32_t screen, int force,
/* If requested screen is the same as the current one, we're done. */
if (disp_current_screen == screen && !force)
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
/* Keep track of the currently displayed screen */
disp_current_screen = screen;
@@ -63,7 +63,7 @@ vb2_error_t VbDisplayMenu(struct vb2_context *ctx, uint32_t screen, int force,
if (disp_current_screen == screen &&
disp_current_index == selected_index &&
!force)
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
/*
* If current screen is not the same, make sure we redraw the base
@@ -430,7 +430,7 @@ vb2_error_t VbCheckDisplayKey(struct vb2_context *ctx, uint32_t key,
case VB_KEY_DOWN:
/* Arrow keys = change localization */
loc = vb2_nv_get(ctx, VB2_NV_LOCALIZATION_INDEX);
- if (VBERROR_SUCCESS != VbExGetLocalizationCount(&count))
+ if (VB2_SUCCESS != VbExGetLocalizationCount(&count))
loc = 0; /* No localization count (bad GBB?) */
else if (VB_KEY_RIGHT == key || VB_KEY_UP == key)
loc = (loc < count - 1 ? loc + 1 : 0);
@@ -458,5 +458,5 @@ vb2_error_t VbCheckDisplayKey(struct vb2_context *ctx, uint32_t key,
return VbDisplayScreen(ctx, disp_current_screen, 1, data);
}
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index a8c536d5..34e41cd7 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -645,7 +645,7 @@ gpt_done:
shared->kernel_version_tpm = lowest_version;
/* Success! */
- retval = VBERROR_SUCCESS;
+ retval = VB2_SUCCESS;
} else if (found_partitions > 0) {
shcall->check_result = VBSD_LKC_CHECK_INVALID_PARTITIONS;
recovery = VB2_RECOVERY_RW_INVALID_OS;
@@ -659,7 +659,7 @@ gpt_done:
load_kernel_exit:
/* Store recovery request, if any */
vb2_nv_set(ctx, VB2_NV_RECOVERY_REQUEST,
- VBERROR_SUCCESS != retval ?
+ VB2_SUCCESS != retval ?
recovery : VB2_RECOVERY_NOT_REQUESTED);
shcall->return_code = (uint8_t)retval;
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
index c93783a4..3bb1efa9 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -85,8 +85,8 @@ static int VbWantShutdown(struct vb2_context *ctx, uint32_t key)
static vb2_error_t VbTryUsb(struct vb2_context *ctx)
{
- uint32_t retval = VbTryLoadKernel(ctx, VB_DISK_FLAG_REMOVABLE);
- if (VBERROR_SUCCESS == retval) {
+ int retval = VbTryLoadKernel(ctx, VB_DISK_FLAG_REMOVABLE);
+ if (VB2_SUCCESS == retval) {
VB2_DEBUG("VbBootDeveloper() - booting USB\n");
} else {
vb2_error_notify("Could not boot from USB\n",
@@ -271,7 +271,7 @@ static vb2_error_t vb2_enter_vendor_data_ui(struct vb2_context *ctx,
VB2_DEBUG("Vendor Data UI - user pressed Esc: "
"exit to Developer screen\n");
data_value[0] = '\0';
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
case 'a'...'z':
key = toupper(key);
/* fall through */
@@ -305,7 +305,7 @@ static vb2_error_t vb2_enter_vendor_data_ui(struct vb2_context *ctx,
/* Enter pressed - confirm input */
VB2_DEBUG("Vendor Data UI - user pressed "
"Enter: confirm vendor data\n");
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
} else {
vb2_error_beep(VB_BEEP_NOT_ALLOWED);
}
@@ -318,7 +318,7 @@ static vb2_error_t vb2_enter_vendor_data_ui(struct vb2_context *ctx,
VbExSleepMs(DEV_KEY_DELAY);
} while (1);
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
/*
@@ -338,7 +338,7 @@ static vb2_error_t vb2_vendor_data_ui(struct vb2_context *ctx)
/* Vendor data was not entered just return */
if (data_value[0] == '\0')
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
VbDisplayScreen(ctx, VB_SCREEN_CONFIRM_VENDOR_DATA, 1, &data);
/* We'll loop until the user decides what to do */
@@ -357,7 +357,7 @@ static vb2_error_t vb2_vendor_data_ui(struct vb2_context *ctx)
/* Escape pressed - return to developer screen */
VB2_DEBUG("Vendor Data UI - user pressed Esc: "
"exit to Developer screen\n");
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
case VB_KEY_ENTER:
/* Enter pressed - write vendor data */
VB2_DEBUG("Vendor Data UI - user pressed Enter: "
@@ -365,7 +365,7 @@ static vb2_error_t vb2_vendor_data_ui(struct vb2_context *ctx)
data_value);
ret = VbExSetVendorData(data_value);
- if (ret == VBERROR_SUCCESS) {
+ if (ret == VB2_SUCCESS) {
vb2_nv_set(ctx, VB2_NV_DISABLE_DEV_REQUEST, 1);
return VBERROR_REBOOT_REQUIRED;
} else {
@@ -385,7 +385,7 @@ static vb2_error_t vb2_vendor_data_ui(struct vb2_context *ctx)
VbExSleepMs(DEV_KEY_DELAY);
} while (1);
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
static vb2_error_t vb2_check_diagnostic_key(struct vb2_context *ctx,
@@ -397,7 +397,7 @@ static vb2_error_t vb2_check_diagnostic_key(struct vb2_context *ctx,
return VBERROR_REBOOT_REQUIRED;
}
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
/*
@@ -739,8 +739,8 @@ static vb2_error_t vb2_developer_ui(struct vb2_context *ctx)
* key press.
*/
VbDisplayScreen(ctx, VB_SCREEN_BLANK, 0, NULL);
- if (VBERROR_SUCCESS == VbTryUsb(ctx)) {
- return VBERROR_SUCCESS;
+ if (VB2_SUCCESS == VbTryUsb(ctx)) {
+ return VB2_SUCCESS;
} else {
/* Show dev mode warning screen again */
VbDisplayScreen(ctx,
@@ -774,8 +774,8 @@ static vb2_error_t vb2_developer_ui(struct vb2_context *ctx)
}
if ((use_usb && !ctrl_d_pressed) && allow_usb) {
- if (VBERROR_SUCCESS == VbTryUsb(ctx)) {
- return VBERROR_SUCCESS;
+ if (VB2_SUCCESS == VbTryUsb(ctx)) {
+ return VB2_SUCCESS;
}
}
@@ -847,7 +847,7 @@ static vb2_error_t recovery_ui(struct vb2_context *ctx)
return VBERROR_SHUTDOWN_REQUESTED;
else if ((retval =
vb2_check_diagnostic_key(ctx, key)) !=
- VBERROR_SUCCESS)
+ VB2_SUCCESS)
return retval;
VbExSleepMs(REC_KEY_DELAY);
}
@@ -868,7 +868,7 @@ static vb2_error_t recovery_ui(struct vb2_context *ctx)
vb2_nv_set(ctx, VB2_NV_RECOVERY_REQUEST,
VB2_RECOVERY_NOT_REQUESTED);
- if (VBERROR_SUCCESS == retval)
+ if (VB2_SUCCESS == retval)
break; /* Found a recovery kernel */
VbDisplayScreen(ctx, VBERROR_NO_DISK_FOUND == retval ?
@@ -919,7 +919,7 @@ static vb2_error_t recovery_ui(struct vb2_context *ctx)
switch (VbUserConfirms(ctx, vbc_flags)) {
case 1:
VB2_DEBUG("Enabling dev-mode...\n");
- if (VBERROR_SUCCESS != SetVirtualDevMode(1))
+ if (VB2_SUCCESS != SetVirtualDevMode(1))
return VBERROR_TPM_SET_BOOT_MODE_STATE;
VB2_DEBUG("Reboot so it will take "
"effect\n");
@@ -941,7 +941,7 @@ static vb2_error_t recovery_ui(struct vb2_context *ctx)
}
} else if ((retval =
vb2_check_diagnostic_key(ctx, key)) !=
- VBERROR_SUCCESS) {
+ VB2_SUCCESS) {
return retval;
} else {
VbCheckDisplayKey(ctx, key, NULL);
@@ -952,7 +952,7 @@ static vb2_error_t recovery_ui(struct vb2_context *ctx)
}
}
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbBootRecovery(struct vb2_context *ctx)
diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c
index cad0d5a6..9827c1ea 100644
--- a/firmware/lib/vboot_ui_menu.c
+++ b/firmware/lib/vboot_ui_menu.c
@@ -192,9 +192,9 @@ static vb2_error_t boot_usb_action(struct vb2_context *ctx)
return VBERROR_KEEP_LOOPING;
}
- if (VBERROR_SUCCESS == VbTryLoadKernel(ctx, VB_DISK_FLAG_REMOVABLE)) {
+ if (VB2_SUCCESS == VbTryLoadKernel(ctx, VB_DISK_FLAG_REMOVABLE)) {
VB2_DEBUG("booting USB\n");
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
/* Loading kernel failed. Clear recovery request from that. */
@@ -362,7 +362,7 @@ static vb2_error_t to_dev_action(struct vb2_context *ctx)
return VBERROR_KEEP_LOOPING;
VB2_DEBUG("Enabling dev-mode...\n");
- if (VBERROR_SUCCESS != SetVirtualDevMode(1))
+ if (VB2_SUCCESS != SetVirtualDevMode(1))
return VBERROR_TPM_SET_BOOT_MODE_STATE;
/* This was meant for headless devices, shouldn't really matter here. */
@@ -729,14 +729,14 @@ static vb2_error_t vb2_init_menus(struct vb2_context *ctx)
menus[VB_MENU_LANGUAGES].size = count;
menus[VB_MENU_LANGUAGES].items = items;
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
/**
* Main function that handles developer warning menu functionality
*
* @param ctx Vboot2 context
- * @return VBERROR_SUCCESS, or non-zero error code if error.
+ * @return VB2_SUCCESS, or non-zero error code if error.
*/
static vb2_error_t vb2_developer_menu(struct vb2_context *ctx)
{
@@ -826,8 +826,8 @@ static vb2_error_t vb2_developer_menu(struct vb2_context *ctx)
boot_legacy_action(ctx); /* Doesn't return on success. */
if (default_boot == VB2_DEV_DEFAULT_BOOT_USB)
- if (VBERROR_SUCCESS == boot_usb_action(ctx))
- return VBERROR_SUCCESS;
+ if (VB2_SUCCESS == boot_usb_action(ctx))
+ return VB2_SUCCESS;
return boot_disk_action(ctx);
}
@@ -836,7 +836,7 @@ static vb2_error_t vb2_developer_menu(struct vb2_context *ctx)
vb2_error_t VbBootDeveloperMenu(struct vb2_context *ctx)
{
vb2_error_t retval = vb2_init_menus(ctx);
- if (VBERROR_SUCCESS != retval)
+ if (VB2_SUCCESS != retval)
return retval;
retval = vb2_developer_menu(ctx);
VbDisplayScreen(ctx, VB_SCREEN_BLANK, 0, NULL);
@@ -878,7 +878,7 @@ static vb2_error_t broken_ui(struct vb2_context *ctx)
* Main function that handles recovery menu functionality
*
* @param ctx Vboot2 context
- * @return VBERROR_SUCCESS, or non-zero error code if error.
+ * @return VB2_SUCCESS, or non-zero error code if error.
*/
static vb2_error_t recovery_ui(struct vb2_context *ctx)
{
@@ -903,7 +903,7 @@ static vb2_error_t recovery_ui(struct vb2_context *ctx)
vb2_nv_set(ctx, VB2_NV_RECOVERY_REQUEST,
VB2_RECOVERY_NOT_REQUESTED);
- if (VBERROR_SUCCESS == ret)
+ if (VB2_SUCCESS == ret)
return ret; /* Found a recovery kernel */
if (usb_nogood != (ret != VBERROR_NO_DISK_FOUND)) {
@@ -938,7 +938,7 @@ static vb2_error_t recovery_ui(struct vb2_context *ctx)
vb2_error_t VbBootRecoveryMenu(struct vb2_context *ctx)
{
vb2_error_t retval = vb2_init_menus(ctx);
- if (VBERROR_SUCCESS != retval)
+ if (VB2_SUCCESS != retval)
return retval;
if (vb2_allow_recovery(ctx))
retval = recovery_ui(ctx);
diff --git a/firmware/stub/tpm_lite_stub.c b/firmware/stub/tpm_lite_stub.c
index 53fac7b4..2e4d8141 100644
--- a/firmware/stub/tpm_lite_stub.c
+++ b/firmware/stub/tpm_lite_stub.c
@@ -190,7 +190,7 @@ vb2_error_t VbExTpmClose(void)
close(tpm_fd);
tpm_fd = -1;
}
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExTpmOpen(void)
@@ -200,7 +200,7 @@ vb2_error_t VbExTpmOpen(void)
int retries, saved_errno;
if (tpm_fd >= 0)
- return VBERROR_SUCCESS; /* Already open */
+ return VB2_SUCCESS; /* Already open */
device_path = getenv("TPM_DEVICE_PATH");
if (device_path == NULL) {
@@ -213,7 +213,7 @@ vb2_error_t VbExTpmOpen(void)
tpm_fd = open(device_path, O_RDWR | O_CLOEXEC);
saved_errno = errno;
if (tpm_fd >= 0)
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
if (saved_errno != EBUSY)
break;
@@ -306,5 +306,5 @@ vb2_error_t VbExTpmGetRandom(uint8_t *buf, uint32_t length)
return VBERROR_UNKNOWN;
}
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c
index bc2aa59f..c9fa541f 100644
--- a/firmware/stub/vboot_api_stub.c
+++ b/firmware/stub/vboot_api_stub.c
@@ -25,25 +25,25 @@ void VbExSleepMs(uint32_t msec)
vb2_error_t VbExBeep(uint32_t msec, uint32_t frequency)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale,
const VbScreenData *data)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExDisplayMenu(uint32_t screen_type, uint32_t locale,
uint32_t selected_index, uint32_t disabled_idx_mask,
uint32_t redraw_base)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExDisplayDebugInfo(const char *info_str, int full_info)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
uint32_t VbExKeyboardRead(void)
@@ -74,17 +74,17 @@ int VbExTrustEC(int devidx)
vb2_error_t VbExEcRunningRW(int devidx, int *in_rw)
{
*in_rw = 0;
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExEcJumpToRW(int devidx)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExEcDisableJump(int devidx)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
#define SHA256_HASH_SIZE 32
@@ -96,7 +96,7 @@ vb2_error_t VbExEcHashImage(int devidx, enum VbSelectFirmware_t select,
*hash = fake_hash;
*hash_size = sizeof(fake_hash);
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExEcGetExpectedImage(int devidx, enum VbSelectFirmware_t select,
@@ -105,7 +105,7 @@ vb2_error_t VbExEcGetExpectedImage(int devidx, enum VbSelectFirmware_t select,
static uint8_t fake_image[64] = {5, 6, 7, 8};
*image = fake_image;
*image_size = sizeof(fake_image);
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExEcGetExpectedImageHash(int devidx,
@@ -116,45 +116,45 @@ vb2_error_t VbExEcGetExpectedImageHash(int devidx,
*hash = fake_hash;
*hash_size = sizeof(fake_hash);
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExEcUpdateImage(int devidx, enum VbSelectFirmware_t select,
const uint8_t *image, int image_size)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExEcProtect(int devidx, enum VbSelectFirmware_t select)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExEcEnteringMode(int devidx, enum VbEcBootMode_t mode)
{
vboot_mode = mode;
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExEcVbootDone(int in_recovery)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExEcBatteryCutOff(void)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExCheckAuxFw(VbAuxFwUpdateSeverity_t *severity)
{
*severity = VB_AUX_FW_NO_UPDATE;
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExUpdateAuxFw(void)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
enum VbEcBootMode_t VbGetMode(void)
diff --git a/firmware/stub/vboot_api_stub_disk.c b/firmware/stub/vboot_api_stub_disk.c
index f377b3ae..7dc413fb 100644
--- a/firmware/stub/vboot_api_stub_disk.c
+++ b/firmware/stub/vboot_api_stub_disk.c
@@ -21,26 +21,26 @@ vb2_error_t VbExDiskGetInfo(VbDiskInfo** infos_ptr, uint32_t* count,
{
*infos_ptr = NULL;
*count = 0;
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExDiskFreeInfo(VbDiskInfo* infos_ptr,
VbExDiskHandle_t preserve_handle)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start,
uint64_t lba_count, void* buffer)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExDiskWrite(VbExDiskHandle_t handle, uint64_t lba_start,
uint64_t lba_count, const void* buffer)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
diff --git a/firmware/stub/vboot_api_stub_init.c b/firmware/stub/vboot_api_stub_init.c
index 25b31cd5..8fbc31df 100644
--- a/firmware/stub/vboot_api_stub_init.c
+++ b/firmware/stub/vboot_api_stub_init.c
@@ -25,10 +25,10 @@ uint64_t VbExGetTimer(void)
vb2_error_t test_mockable VbExNvStorageRead(uint8_t *buf)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExNvStorageWrite(const uint8_t *buf)
{
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
diff --git a/firmware/stub/vboot_api_stub_stream.c b/firmware/stub/vboot_api_stub_stream.c
index 8e5d8a16..6748274a 100644
--- a/firmware/stub/vboot_api_stub_stream.c
+++ b/firmware/stub/vboot_api_stub_stream.c
@@ -42,7 +42,7 @@ vb2_error_t VbExStreamOpen(VbExDiskHandle_t handle, uint64_t lba_start,
*stream = (void *)s;
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
vb2_error_t VbExStreamRead(VbExStream_t stream, uint32_t bytes, void *buffer)
@@ -64,13 +64,13 @@ vb2_error_t VbExStreamRead(VbExStream_t stream, uint32_t bytes, void *buffer)
return VBERROR_UNKNOWN;
rv = VbExDiskRead(s->handle, s->sector, sectors, buffer);
- if (rv != VBERROR_SUCCESS)
+ if (rv != VB2_SUCCESS)
return rv;
s->sector += sectors;
s->sectors_left -= sectors;
- return VBERROR_SUCCESS;
+ return VB2_SUCCESS;
}
void VbExStreamClose(VbExStream_t stream)