Introduce the notion of paranoia to programmers

This adds a boolean that is set on a per-programmer basis to govern
how paranoid we are. The intent is to allow us to tune behavior for
speed or early error detection depending on the use case. For now this
boils down to internal vs. external programmers.

For internal programmers, where the ROM is being programmed in-system
and on a live machine, it's assumed that we want to be paranoid and
catch errors early. If we're lucky the machine will be left in
a usable and recoverable state if an error is encountered. Internal
bus interfaces are assumed to be low-latency and fast, so transaction
overhead and overall speed are not as big of concerns.

For external programmers we assume that error recovery can be done at
any time and thus we're more concerned with speed than catching errors
immediately. To reduce transaction overhead over slow/high-latency
external buses we can erase large blocks (or the entire chip) and
defer verification until the very end.

BUG=none
BRANCH=none
TEST=needs testing

Change-Id: I3ed36d2201537fa033dd8804342fc231248ce5bb
Reviewed-on: https://chromium-review.googlesource.com/316006
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
diff --git a/programmer.h b/programmer.h
index 4028b1e..7b95435 100644
--- a/programmer.h
+++ b/programmer.h
@@ -118,6 +118,13 @@
 	void (*unmap_flash_region) (void *virt_addr, size_t len);
 
 	void (*delay) (int usecs);
+
+	/*
+	 * If set, use extra precautions such as erasing with small block sizes
+	 * and verifying more rigorously. This will incur a performance penalty
+	 * but is good for programming the ROM in-system on a live machine.
+	 */
+	int paranoid;
 };
 
 extern const struct programmer_entry programmer_table[];