Commit 1bfb7068 authored by Sandrine Bailleux's avatar Sandrine Bailleux Committed by Dan Handley
Browse files

Add some debug assertions in BL1 FWU copy code



These debug assertions sanity check the state of the internal
FWU state machine data when resuming an incomplete image copy
operation.

Change-Id: I38a125b0073658c3e2b4b1bdc623ec221741f43e
Signed-off-by: default avatarSandrine Bailleux <sandrine.bailleux@arm.com>
parent b38a9e5c
...@@ -158,7 +158,19 @@ static int bl1_fwu_image_copy(unsigned int image_id, ...@@ -158,7 +158,19 @@ static int bl1_fwu_image_copy(unsigned int image_id,
} }
if (image_desc->state == IMAGE_STATE_COPYING) { if (image_desc->state == IMAGE_STATE_COPYING) {
/*
* There must have been at least 1 copy operation for this image
* previously.
*/
assert(image_desc->copied_size != 0);
/*
* The image size must have been recorded in the 1st copy
* operation.
*/
image_size = image_desc->image_info.image_size; image_size = image_desc->image_info.image_size;
assert(image_size != 0);
assert(image_desc->copied_size < image_size);
INFO("BL1-FWU: Continuing image copy in blocks\n"); INFO("BL1-FWU: Continuing image copy in blocks\n");
} else { /* image_desc->state == IMAGE_STATE_RESET */ } else { /* image_desc->state == IMAGE_STATE_RESET */
INFO("BL1-FWU: Initial call to copy an image\n"); INFO("BL1-FWU: Initial call to copy an image\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment