Read entire flash during verification when not paranoid

This makes verify_range() choose between two methods of verifying the
ROM depending on the level of paranoia we're working under:
1. If we're paranoid, read and verify small chunks. This way we know
   exactly where an error occurs and can handle it appropriately.
2. If we're not paranoid, read the entire ROM at once to reduce
   transaction overhead.

The former approach is useful for Intel-based systems with a
management engine (paranoid) where we may need to skip regions that
are locked. The latter approach is designed to cut down on transaction
overhead especially for external programmers.

On veyron_danger (4MB ROM), this resulted in a ~29 second speed-up
when verifying the ROM content via Servo, from ~37s to ~8s. As
expected, there was no significant difference when verifying using
the "internal" SoC SPI controller.

Based on Simon Glass's patch to read entire flash at once during
verification: https://chromium-review.googlesource.com/#/c/240543/

BUG=none
BRANCH=none
TEST=Tested full and partial verify on veyron_danger and paine
using "internal" programmers and Servo.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off by: David Hendricks <dhendrix@chromium.org>
Change-Id: I1ea3fc9e567f53eaa81f9ae2470e6e02b83ad28e
Reviewed-on: https://chromium-review.googlesource.com/316007
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
1 file changed