summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-07-29 18:53:38 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-13 08:23:55 +0000
commit9908a9a305699bbca42d0fcff88008ebea522b66 (patch)
treed9fe6fdbb7c4a30990ec835500b49ff25dfe7729
parentcf49e7b6ae5abee0552b596ec11b695b5d15853c (diff)
downloadvboot-9908a9a305699bbca42d0fcff88008ebea522b66.tar.gz
vboot: replace VBERROR_UNKNOWN with VB2_ERROR_UNKNOWN
Replace vboot1-style VBERROR_UNKNOWN with VB2_ERROR_UNKNOWN. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: Icd2158e328142cff69ce94b5396ab021a1f7839c Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1728115 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1722916 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--firmware/2lib/include/2return_codes.h2
-rw-r--r--firmware/lib/vboot_api_kernel.c2
-rw-r--r--firmware/lib/vboot_display.c2
-rw-r--r--firmware/lib/vboot_kernel.c2
-rw-r--r--firmware/lib/vboot_ui_menu.c2
-rw-r--r--firmware/stub/tpm_lite_stub.c7
-rw-r--r--firmware/stub/vboot_api_stub_stream.c8
-rw-r--r--tests/ec_sync_tests.c4
-rw-r--r--tests/vboot_api_devmode_tests.c6
-rw-r--r--tests/vboot_api_kernel2_tests.c2
-rw-r--r--tests/vboot_display_tests.c2
-rw-r--r--tests/verify_kernel.c12
12 files changed, 25 insertions, 26 deletions
diff --git a/firmware/2lib/include/2return_codes.h b/firmware/2lib/include/2return_codes.h
index 644a6d9a..7c6551e8 100644
--- a/firmware/2lib/include/2return_codes.h
+++ b/firmware/2lib/include/2return_codes.h
@@ -38,8 +38,6 @@ enum vb2_return_code {
* vboot1-style errors
* TODO: deprecate these once they have all moved over to vboot2 style
*/
- /* Unknown error */
- VBERROR_UNKNOWN = 0x10000,
/* Unable to initialize shared data */
VBERROR_INIT_SHARED_DATA = 0x10001,
/* Error resuming TPM during a S3 resume */
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 806874f5..727abc50 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -68,7 +68,7 @@ uint32_t vb2_get_fwmp_flags(void)
vb2_error_t VbTryLoadKernel(struct vb2_context *ctx, uint32_t get_info_flags)
{
- vb2_error_t retval = VBERROR_UNKNOWN;
+ vb2_error_t retval = VB2_ERROR_UNKNOWN;
VbDiskInfo* disk_info = NULL;
uint32_t disk_count = 0;
uint32_t i;
diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c
index 6661885e..89ed694e 100644
--- a/firmware/lib/vboot_display.c
+++ b/firmware/lib/vboot_display.c
@@ -24,7 +24,7 @@ static uint32_t disp_disabled_idx_mask = 0;
__attribute__((weak))
vb2_error_t VbExGetLocalizationCount(uint32_t *count) {
*count = 0;
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
}
__attribute__((weak))
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index 34e41cd7..85cc7823 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -436,7 +436,7 @@ vb2_error_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
VbSharedDataKernelCall *shcall = NULL;
int found_partitions = 0;
uint32_t lowest_version = LOWEST_TPM_VERSION;
- vb2_error_t retval = VBERROR_UNKNOWN;
+ vb2_error_t retval = VB2_ERROR_UNKNOWN;
int recovery = VB2_RECOVERY_LK_UNSPECIFIED;
vb2_error_t rv;
diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c
index 9827c1ea..628b6b89 100644
--- a/firmware/lib/vboot_ui_menu.c
+++ b/firmware/lib/vboot_ui_menu.c
@@ -719,7 +719,7 @@ static vb2_error_t vb2_init_menus(struct vb2_context *ctx)
items = malloc(count * sizeof(struct vb2_menu_item));
if (!items)
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
for (i = 0; i < count; i++) {
/* The actual language is drawn by the bootloader */
diff --git a/firmware/stub/tpm_lite_stub.c b/firmware/stub/tpm_lite_stub.c
index 2e4d8141..dced1448 100644
--- a/firmware/stub/tpm_lite_stub.c
+++ b/firmware/stub/tpm_lite_stub.c
@@ -225,7 +225,8 @@ vb2_error_t VbExTpmOpen(void)
delay.tv_nsec = OPEN_RETRY_DELAY_NS;
nanosleep(&delay, NULL);
}
- return DoError(VBERROR_UNKNOWN, "TPM: Cannot open TPM device %s: %s\n",
+ return DoError(VB2_ERROR_UNKNOWN,
+ "TPM: Cannot open TPM device %s: %s\n",
device_path, strerror(saved_errno));
}
@@ -298,12 +299,12 @@ vb2_error_t VbExTpmGetRandom(uint8_t *buf, uint32_t length)
if (urandom_fd < 0) {
urandom_fd = open("/dev/urandom", O_RDONLY);
if (urandom_fd == -1) {
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
}
}
if (length != read(urandom_fd, buf, length)) {
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
}
return VB2_SUCCESS;
diff --git a/firmware/stub/vboot_api_stub_stream.c b/firmware/stub/vboot_api_stub_stream.c
index 6748274a..ae0a6745 100644
--- a/firmware/stub/vboot_api_stub_stream.c
+++ b/firmware/stub/vboot_api_stub_stream.c
@@ -32,7 +32,7 @@ vb2_error_t VbExStreamOpen(VbExDiskHandle_t handle, uint64_t lba_start,
if (!handle) {
*stream = NULL;
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
}
s = malloc(sizeof(*s));
@@ -52,16 +52,16 @@ vb2_error_t VbExStreamRead(VbExStream_t stream, uint32_t bytes, void *buffer)
vb2_error_t rv;
if (!s)
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
/* For now, require reads to be a multiple of the LBA size */
if (bytes % LBA_BYTES)
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
/* Fail on overflow */
sectors = bytes / LBA_BYTES;
if (sectors > s->sectors_left)
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
rv = VbExDiskRead(s->handle, s->sector, sectors, buffer);
if (rv != VB2_SUCCESS)
diff --git a/tests/ec_sync_tests.c b/tests/ec_sync_tests.c
index ac4a4c52..7e5df6c3 100644
--- a/tests/ec_sync_tests.c
+++ b/tests/ec_sync_tests.c
@@ -495,8 +495,8 @@ static void VbSoftwareSyncTest(void)
ResetMocks();
ec_aux_fw_mock_severity = VB_AUX_FW_FAST_UPDATE;
- ec_aux_fw_retval = VBERROR_UNKNOWN;
- test_ssync(VBERROR_UNKNOWN, VB2_RECOVERY_AUX_FW_UPDATE,
+ ec_aux_fw_retval = VB2_ERROR_UNKNOWN;
+ test_ssync(VB2_ERROR_UNKNOWN, VB2_RECOVERY_AUX_FW_UPDATE,
"Error updating AUX firmware");
}
diff --git a/tests/vboot_api_devmode_tests.c b/tests/vboot_api_devmode_tests.c
index 0989aa05..7077b1ed 100644
--- a/tests/vboot_api_devmode_tests.c
+++ b/tests/vboot_api_devmode_tests.c
@@ -163,7 +163,7 @@ vb2_error_t VbExNvStorageWrite(const uint8_t* buf)
vb2_error_t VbExDiskGetInfo(VbDiskInfo** infos_ptr, uint32_t* count,
uint32_t disk_flags)
{
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
}
vb2_error_t VbExDiskFreeInfo(VbDiskInfo* infos,
@@ -175,13 +175,13 @@ vb2_error_t VbExDiskFreeInfo(VbDiskInfo* infos,
vb2_error_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start,
uint64_t lba_count, void* buffer)
{
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
}
vb2_error_t VbExDiskWrite(VbExDiskHandle_t handle, uint64_t lba_start,
uint64_t lba_count, const void* buffer)
{
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
}
uint32_t VbExIsShutdownRequested(void)
diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c
index 035c0501..c23f87fc 100644
--- a/tests/vboot_api_kernel2_tests.c
+++ b/tests/vboot_api_kernel2_tests.c
@@ -186,7 +186,7 @@ vb2_error_t VbExLegacy(enum VbAltFwIndex_t _altfw_num)
altfw_num = _altfw_num;
/* VbExLegacy() can only return failure, or not return at all. */
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
}
void VbExSleepMs(uint32_t msec)
diff --git a/tests/vboot_display_tests.c b/tests/vboot_display_tests.c
index b95867b4..bd3fca8d 100644
--- a/tests/vboot_display_tests.c
+++ b/tests/vboot_display_tests.c
@@ -56,7 +56,7 @@ static void ResetMocks(void)
vb2_error_t VbExGetLocalizationCount(uint32_t *count) {
if (mock_localization_count == 0xffffffff)
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
*count = mock_localization_count;
return VB2_SUCCESS;
diff --git a/tests/verify_kernel.c b/tests/verify_kernel.c
index a916f8f0..b14d77fe 100644
--- a/tests/verify_kernel.c
+++ b/tests/verify_kernel.c
@@ -30,11 +30,11 @@ vb2_error_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start,
uint64_t lba_count, void *buffer)
{
if (handle != (VbExDiskHandle_t)1)
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
if (lba_start >= params.streaming_lba_count)
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
if (lba_start + lba_count > params.streaming_lba_count)
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
memcpy(buffer, diskbuf + lba_start * 512, lba_count * 512);
return VB2_SUCCESS;
@@ -44,11 +44,11 @@ vb2_error_t VbExDiskWrite(VbExDiskHandle_t handle, uint64_t lba_start,
uint64_t lba_count, const void *buffer)
{
if (handle != (VbExDiskHandle_t)1)
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
if (lba_start >= params.streaming_lba_count)
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
if (lba_start + lba_count > params.streaming_lba_count)
- return VBERROR_UNKNOWN;
+ return VB2_ERROR_UNKNOWN;
memcpy(diskbuf + lba_start * 512, buffer, lba_count * 512);
return VB2_SUCCESS;