diff options
-rw-r--r-- | firmware/2lib/include/2return_codes.h | 97 | ||||
-rw-r--r-- | firmware/include/vboot_api.h | 104 | ||||
-rw-r--r-- | firmware/stub/vboot_api_stub.c | 1 | ||||
-rw-r--r-- | firmware/stub/vboot_api_stub_disk.c | 1 | ||||
-rw-r--r-- | firmware/stub/vboot_api_stub_init.c | 1 | ||||
-rw-r--r-- | firmware/stub/vboot_api_stub_stream.c | 1 | ||||
-rw-r--r-- | tests/vboot_api_kernel6_tests.c | 1 |
7 files changed, 102 insertions, 104 deletions
diff --git a/firmware/2lib/include/2return_codes.h b/firmware/2lib/include/2return_codes.h index 5126555b..39165533 100644 --- a/firmware/2lib/include/2return_codes.h +++ b/firmware/2lib/include/2return_codes.h @@ -16,6 +16,9 @@ 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.). @@ -29,6 +32,100 @@ enum vb2_return_code { VB2_ERROR_MOCK, /********************************************************************** + * 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 */ + VBERROR_TPM_S3_RESUME = 0x10002, + /* VbSelectFirmware() failed to find a valid firmware */ + VBERROR_LOAD_FIRMWARE = 0x10003, + /* Unable to write firmware versions to TPM */ + VBERROR_TPM_WRITE_FIRMWARE = 0x10004, + /* Unable to lock firmware versions in TPM */ + VBERROR_TPM_LOCK_FIRMWARE = 0x10005, + /* Unable to set boot mode state in TPM */ + VBERROR_TPM_SET_BOOT_MODE_STATE = 0x10006, + /* Calling firmware needs to perform a reboot. */ + VBERROR_REBOOT_REQUIRED = 0x10007, + /* Unable to set up TPM */ + VBERROR_TPM_FIRMWARE_SETUP = 0x10008, + /* Unable to read kernel versions from TPM */ + VBERROR_TPM_READ_KERNEL = 0x10009, + /* Attempt to load developer-only firmware with developer switch off */ + VBERROR_DEV_FIRMWARE_SWITCH_MISMATCH = 0x1000A, + /* Unable to write kernel versions to TPM */ + VBERROR_TPM_WRITE_KERNEL = 0x1000B, + /* Unable to lock kernel versions in TPM */ + VBERROR_TPM_LOCK_KERNEL = 0x1000C, + /* Calling firmware requested shutdown via VbExIsShutdownRequested() */ + VBERROR_SHUTDOWN_REQUESTED = 0x1000D, + /* Unable to find a boot device on which to look for a kernel */ + VBERROR_NO_DISK_FOUND = 0x1000E, + /* No OS kernel found on any boot device */ + VBERROR_NO_KERNEL_FOUND = 0x1000F, + /* All OS kernels found were invalid (corrupt, improperly signed...) */ + VBERROR_INVALID_KERNEL_FOUND = 0x10010, + /* VbSelectAndLoadKernel() requested recovery mode */ + VBERROR_LOAD_KERNEL_RECOVERY = 0x10011, + /* Other error inside VbSelectAndLoadKernel() */ + VBERROR_LOAD_KERNEL = 0x10012, + /* Invalid Google binary block */ + VBERROR_INVALID_GBB = 0x10013, + /* Invalid bitmap volume */ + VBERROR_INVALID_BMPFV = 0x10014, + /* Invalid screen index */ + VBERROR_INVALID_SCREEN_INDEX = 0x10015, + /* Simulated (test) error */ + VBERROR_SIMULATED = 0x10016, + /* Invalid parameter */ + VBERROR_INVALID_PARAMETER = 0x10017, + /* VbExBeep() can't make sounds at all */ + VBERROR_NO_SOUND = 0x10018, + /* VbExBeep() can't make sound in the background */ + VBERROR_NO_BACKGROUND_SOUND = 0x10019, + /* Need EC to reboot to read-only code to switch RW slot */ + VBERROR_EC_REBOOT_TO_SWITCH_RW = 0x1001A, + /* Developer has requested a BIOS shell */ + VBERROR_BIOS_SHELL_REQUESTED = 0x10020, + /* Need initialized display and don't have it, or vice-versa. + Deprecated; should use VBERROR_REBOOT_REQUIRED instead. */ + VBERROR_DEPRECATED_DISPLAY_INIT_MISMATCH = 0x10021, + /* Need EC to reboot to read-only code */ + VBERROR_EC_REBOOT_TO_RO_REQUIRED = 0x10022, + /* Invalid region read parameters */ + VBERROR_REGION_READ_INVALID = 0x10023, + /* Cannot read from region */ + VBERROR_REGION_READ_FAILED = 0x10024, + /* Unsupported region type */ + VBERROR_UNSUPPORTED_REGION = 0x10025, + /* No image present (was returned from VbGbbReadImage(); deprecated */ + VBERROR_NO_IMAGE_PRESENT = 0x10026, + /* failed to draw screen */ + VBERROR_SCREEN_DRAW = 0x10027, + /* failed to jump to RW image */ + VBERROR_RW_JUMP_FAILED = 0x10028, + /* Error reading FWMP from TPM (note: not present is not an error) */ + VBERROR_TPM_READ_FWMP = 0x10029, + /* Peripheral busy. Cannot upgrade firmware at present. */ + VBERROR_PERIPHERAL_BUSY = 0x10030, + /* Error reading or writing Alt OS flags to TPM */ + VBERROR_DEPRECATED_TPM_ALT_OS = 0x10031, + /* Error writing VPD */ + VBERROR_VPD_WRITE = 0x10032, + + /* VbExEcGetExpectedRWHash() may return the following codes */ + /* Compute expected RW hash from the EC image; BIOS doesn't have it */ + VBERROR_EC_GET_EXPECTED_HASH_FROM_IMAGE = 0x20000, + + /* Detachable UI internal functions may return the following codes */ + /* No error; return to UI loop */ + VBERROR_KEEP_LOOPING = 0x30000, + + /********************************************************************** * SHA errors */ VB2_ERROR_SHA = VB2_ERROR_BASE + 0x010000, diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h index 518b8cd8..6f5aab2b 100644 --- a/firmware/include/vboot_api.h +++ b/firmware/include/vboot_api.h @@ -50,110 +50,6 @@ typedef uint32_t VbError_t; #define test_mockable __attribute__((weak)) #endif -/* - * Predefined error numbers. Success is 0. Errors are non-zero, but differ - * between functions. For example, the TPM functions may pass through TPM - * error codes, some of which may be recoverable. - */ -enum VbErrorPredefined_t { - /* No error; function completed successfully. */ - VBERROR_SUCCESS = 0, - - /* - * The verified boot entry points VbInit(), VbSelectFirmware(), - * VbSelectAndLoadKernel() may return the following errors. - */ - /* Unknown error */ - VBERROR_UNKNOWN = 0x10000, - /* Unable to initialize shared data */ - VBERROR_INIT_SHARED_DATA = 0x10001, - /* Error resuming TPM during a S3 resume */ - VBERROR_TPM_S3_RESUME = 0x10002, - /* VbSelectFirmware() failed to find a valid firmware */ - VBERROR_LOAD_FIRMWARE = 0x10003, - /* Unable to write firmware versions to TPM */ - VBERROR_TPM_WRITE_FIRMWARE = 0x10004, - /* Unable to lock firmware versions in TPM */ - VBERROR_TPM_LOCK_FIRMWARE = 0x10005, - /* Unable to set boot mode state in TPM */ - VBERROR_TPM_SET_BOOT_MODE_STATE = 0x10006, - /* Calling firmware needs to perform a reboot. */ - VBERROR_REBOOT_REQUIRED = 0x10007, - /* Unable to set up TPM */ - VBERROR_TPM_FIRMWARE_SETUP = 0x10008, - /* Unable to read kernel versions from TPM */ - VBERROR_TPM_READ_KERNEL = 0x10009, - /* Attempt to load developer-only firmware with developer switch off */ - VBERROR_DEV_FIRMWARE_SWITCH_MISMATCH = 0x1000A, - /* Unable to write kernel versions to TPM */ - VBERROR_TPM_WRITE_KERNEL = 0x1000B, - /* Unable to lock kernel versions in TPM */ - VBERROR_TPM_LOCK_KERNEL = 0x1000C, - /* Calling firmware requested shutdown via VbExIsShutdownRequested() */ - VBERROR_SHUTDOWN_REQUESTED = 0x1000D, - /* Unable to find a boot device on which to look for a kernel */ - VBERROR_NO_DISK_FOUND = 0x1000E, - /* No OS kernel found on any boot device */ - VBERROR_NO_KERNEL_FOUND = 0x1000F, - /* All OS kernels found were invalid (corrupt, improperly signed...) */ - VBERROR_INVALID_KERNEL_FOUND = 0x10010, - /* VbSelectAndLoadKernel() requested recovery mode */ - VBERROR_LOAD_KERNEL_RECOVERY = 0x10011, - /* Other error inside VbSelectAndLoadKernel() */ - VBERROR_LOAD_KERNEL = 0x10012, - /* Invalid Google binary block */ - VBERROR_INVALID_GBB = 0x10013, - /* Invalid bitmap volume */ - VBERROR_INVALID_BMPFV = 0x10014, - /* Invalid screen index */ - VBERROR_INVALID_SCREEN_INDEX = 0x10015, - /* Simulated (test) error */ - VBERROR_SIMULATED = 0x10016, - /* Invalid parameter */ - VBERROR_INVALID_PARAMETER = 0x10017, - /* VbExBeep() can't make sounds at all */ - VBERROR_NO_SOUND = 0x10018, - /* VbExBeep() can't make sound in the background */ - VBERROR_NO_BACKGROUND_SOUND = 0x10019, - /* Need EC to reboot to read-only code to switch RW slot */ - VBERROR_EC_REBOOT_TO_SWITCH_RW = 0x1001A, - /* Developer has requested a BIOS shell */ - VBERROR_BIOS_SHELL_REQUESTED = 0x10020, - /* Need initialized display and don't have it, or vice-versa. - Deprecated; should use VBERROR_REBOOT_REQUIRED instead. */ - VBERROR_DEPRECATED_DISPLAY_INIT_MISMATCH = 0x10021, - /* Need EC to reboot to read-only code */ - VBERROR_EC_REBOOT_TO_RO_REQUIRED = 0x10022, - /* Invalid region read parameters */ - VBERROR_REGION_READ_INVALID = 0x10023, - /* Cannot read from region */ - VBERROR_REGION_READ_FAILED = 0x10024, - /* Unsupported region type */ - VBERROR_UNSUPPORTED_REGION = 0x10025, - /* No image present (was returned from VbGbbReadImage(); deprecated */ - VBERROR_NO_IMAGE_PRESENT = 0x10026, - /* failed to draw screen */ - VBERROR_SCREEN_DRAW = 0x10027, - /* failed to jump to RW image */ - VBERROR_RW_JUMP_FAILED = 0x10028, - /* Error reading FWMP from TPM (note: not present is not an error) */ - VBERROR_TPM_READ_FWMP = 0x10029, - /* Peripheral busy. Cannot upgrade firmware at present. */ - VBERROR_PERIPHERAL_BUSY = 0x10030, - /* Error reading or writing Alt OS flags to TPM */ - VBERROR_DEPRECATED_TPM_ALT_OS = 0x10031, - /* Error writing VPD */ - VBERROR_VPD_WRITE = 0x10032, - - /* VbExEcGetExpectedRWHash() may return the following codes */ - /* Compute expected RW hash from the EC image; BIOS doesn't have it */ - VBERROR_EC_GET_EXPECTED_HASH_FROM_IMAGE = 0x20000, - - /* Detachable UI internal functions may return the following codes */ - /* No error; return to UI loop */ - VBERROR_KEEP_LOOPING = 0x30000, -}; - /*****************************************************************************/ /* Main entry points from firmware into vboot_reference */ diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c index 496d7204..23eb4d5b 100644 --- a/firmware/stub/vboot_api_stub.c +++ b/firmware/stub/vboot_api_stub.c @@ -13,6 +13,7 @@ #include <string.h> #include <sys/time.h> +#include "2common.h" #include "vboot_api.h" #include "vboot_test.h" diff --git a/firmware/stub/vboot_api_stub_disk.c b/firmware/stub/vboot_api_stub_disk.c index 975b42ad..9ff87cbb 100644 --- a/firmware/stub/vboot_api_stub_disk.c +++ b/firmware/stub/vboot_api_stub_disk.c @@ -12,6 +12,7 @@ #include <string.h> #include <sys/time.h> +#include "2common.h" #include "vboot_api.h" diff --git a/firmware/stub/vboot_api_stub_init.c b/firmware/stub/vboot_api_stub_init.c index 0f7a3482..828591bd 100644 --- a/firmware/stub/vboot_api_stub_init.c +++ b/firmware/stub/vboot_api_stub_init.c @@ -13,6 +13,7 @@ #include <string.h> #include <sys/time.h> +#include "2common.h" #include "vboot_api.h" uint64_t VbExGetTimer(void) diff --git a/firmware/stub/vboot_api_stub_stream.c b/firmware/stub/vboot_api_stub_stream.c index c65259d3..e8e960b9 100644 --- a/firmware/stub/vboot_api_stub_stream.c +++ b/firmware/stub/vboot_api_stub_stream.c @@ -7,6 +7,7 @@ #include <stdint.h> +#include "2common.h" #include "vboot_api.h" /* The stub implementation assumes 512-byte disk sectors */ diff --git a/tests/vboot_api_kernel6_tests.c b/tests/vboot_api_kernel6_tests.c index 27065ac2..dde977b3 100644 --- a/tests/vboot_api_kernel6_tests.c +++ b/tests/vboot_api_kernel6_tests.c @@ -10,6 +10,7 @@ #include <stdlib.h> #include <string.h> +#include "2common.h" #include "rollback_index.h" #include "test_common.h" #include "vboot_api.h" |