diff options
author | Randall Spangler <rspangler@chromium.org> | 2014-11-19 12:48:36 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-11-27 05:22:32 +0000 |
commit | 02e11b323b819140590d99b6af440d36c12d161b (patch) | |
tree | 005edf6e64093741553e8520028ef0ad26a978b8 /firmware | |
parent | 8577b5360ca4c9514d9091ed9aded2bb3193f1f0 (diff) | |
download | vboot-02e11b323b819140590d99b6af440d36c12d161b.tar.gz |
vboot2: Add host library functions to read/write files and objects
And unit tests for them.
Move roundup32() into hostlib.
Fix WriteFile() returning success even if it failed to write to the file.
BUG=chromium:423882
BRANCH=none
TEST=VBOOT2=1 make runtests
Change-Id: I8a115335c088dc5c66c88423d1ccbda7eaca1996
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/230844
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/2lib/include/2return_codes.h | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/firmware/2lib/include/2return_codes.h b/firmware/2lib/include/2return_codes.h index fa7437e0..69a9494f 100644 --- a/firmware/2lib/include/2return_codes.h +++ b/firmware/2lib/include/2return_codes.h @@ -20,7 +20,7 @@ enum vb2_return_code { * All vboot2 error codes start at a large offset from zero, to reduce * the risk of overlap with other error codes (TPM, etc.). */ - VB2_ERROR_BASE = 0x0100000, + VB2_ERROR_BASE = 0x10000000, /* Unknown / unspecified error */ VB2_ERROR_UNKNOWN = VB2_ERROR_BASE + 1, @@ -443,12 +443,41 @@ enum vb2_return_code { /* TPM clear owner not implemented */ VB2_ERROR_EX_TPM_CLEAR_OWNER_UNIMPLEMENTED, + + /********************************************************************** + * Errors generated by host library (non-firmware) start here. + */ + VB2_ERROR_HOST_BASE = 0x20000000, + + /********************************************************************** + * Errors generated by host library misc functions + */ + VB2_ERROR_HOST_MISC = VB2_ERROR_HOST_BASE + 0x010000, + + /* Unable to open file in read_file() */ + VB2_ERROR_READ_FILE_OPEN, + + /* Bad size in read_file() */ + VB2_ERROR_READ_FILE_SIZE, + + /* Unable to allocate buffer in read_file() */ + VB2_ERROR_READ_FILE_ALLOC, + + /* Unable to read data in read_file() */ + VB2_ERROR_READ_FILE_DATA, + + /* Unable to open file in write_file() */ + VB2_ERROR_WRITE_FILE_OPEN, + + /* Unable to write data in write_file() */ + VB2_ERROR_WRITE_FILE_DATA, + /********************************************************************** * Highest non-zero error generated inside vboot library. Note that * error codes passed through vboot when it calls external APIs may * still be outside this range. */ - VB2_ERROR_MAX = VB2_ERROR_BASE + 0xffffff, + VB2_ERROR_MAX = VB2_ERROR_BASE + 0x1fffffff, }; #endif /* VBOOT_2_RETURN_CODES_H_ */ |