summaryrefslogtreecommitdiff
path: root/tests/vboot_api_kernel4_tests.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2018-02-26 17:01:24 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-03-07 16:55:15 -0800
commita80a79f9f5ca0250eb31330d9dfdacf3a250efb0 (patch)
tree8a3bba693db4514e8a8ae5649b94e4c0b7b94605 /tests/vboot_api_kernel4_tests.c
parent7bb45097af1e8b5f2bcf8e7a8bc6557c6505693b (diff)
downloadvboot-a80a79f9f5ca0250eb31330d9dfdacf3a250efb0.tar.gz
2lib: Add support for 64-byte nvstorage record
The calling firmware can set ctx->flags VB2_CONTEXT_NVDATA_V2 to tell vboot that nvdata is a 64-byte record instead of a 16-byte record, or equivalently, set the VBSD_NVDATA_V2 flag if calling the old vboot1 API. If calling firmware does not (which is the current coreboot and depthcharge default), then the 16-byte record is used, and V2 fields return explicit default values. Added the fw_max_rollforward V2 field, which defaults to 0xfffffffe on V1. This will be used by a subsequent CL. Added unit tests to verify all that. Added crossystem support, though it will only work with the current 16-byte records until firmware sets the VBSD flag and mosys supports larger records. (Note that because coreboot/depthcharge do not yet set the new context flag, this CL should not change ToT firmware behavior.) See go/vboot-nvstorage for design doc. BUG=chromium:789276 BRANCH=none TEST=make runtests Change-Id: I43072ef153dfa016c051f560892af1fbb3508e3a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/942031
Diffstat (limited to 'tests/vboot_api_kernel4_tests.c')
-rw-r--r--tests/vboot_api_kernel4_tests.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/vboot_api_kernel4_tests.c b/tests/vboot_api_kernel4_tests.c
index 2e73b8b2..82d6d5db 100644
--- a/tests/vboot_api_kernel4_tests.c
+++ b/tests/vboot_api_kernel4_tests.c
@@ -81,13 +81,13 @@ static void ResetMocks(void)
VbError_t VbExNvStorageRead(uint8_t *buf)
{
- memcpy(buf, ctx.nvdata, sizeof(ctx.nvdata));
+ memcpy(buf, ctx.nvdata, vb2_nv_get_size(&ctx));
return VBERROR_SUCCESS;
}
VbError_t VbExNvStorageWrite(const uint8_t *buf)
{
- memcpy(ctx.nvdata, buf, sizeof(ctx.nvdata));
+ memcpy(ctx.nvdata, buf, vb2_nv_get_size(&ctx));
return VBERROR_SUCCESS;
}