Ensure partial verify accounts for erase alignment

This applies the same logic to handle_partial_verify() that was
added earlier to handle_partial_read(). The idea is to ensure
that verification using --fast-verify catches errors that may occur
at the edges of a targeted region within an eraseblock, where old
content may need to be restored after an erase operation.

BUG=chrome-os-partner:40230
BRANCH=storm
TEST=Tested on veyron_brain w/ Servo:
1. Created two randomized 2K blobs.
2. Targeted a single 4K block using a custom layout file.
3. Inserted pause before verification step.
4. Had flashrom on host write one blob to bottom half of eraseblock
   using --fast-verify.
5. Once it reached the pause in the verification step, used
   Servo to write the other blob to the upper half of the eraseblock.
6. Verbose debug print showed re-aligned verification that read the
   whole erase block.
7. Verification failed (expected) as it would had there been a host
   SPI controller error when restoring old content.

Change-Id: Ife27be5c7073961ccdb6c3290a29b13356209ed0
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/272936
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
1 file changed