From 02e11b323b819140590d99b6af440d36c12d161b Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Wed, 19 Nov 2014 12:48:36 -0800 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/230844 --- firmware/2lib/include/2return_codes.h | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'firmware/2lib/include') 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_ */ -- cgit v1.2.1