Check ICH erase command support at run time.
When deciding which erasers should be used for a certain flashrom
session, one needs to take into account the fact that Intel SPI
controller (included in the ICH) could be allowing only a subset of
erase commands supported by the flash chip.
Instead of hardcoding the susbsets of supported commands let's
introduce the 'dry run' mode, where the command is invoked and
verified by the ICH driver, but actual action is not taken.
The nonzero return code indicates that a command is not supported by
the controller.
Note that ICH support should be verified only when programming the
main AP flash, ICH is not involved when programming the EC.
BRANCH=none
BUG=b:862703
TEST=verified that previously failing tests succeed on auron and cyan.
On auron, cyan and eve verified that reprogramming flash spaces
of 4K, 16K, 32K, 64K and 128K bytes works as expected.
Change-Id: Ifa248c9d42c28c644373fb28ec6a3d710211c228
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1139405
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/programmer.c b/programmer.c
index c6157d4..5b65e5b 100644
--- a/programmer.c
+++ b/programmer.c
@@ -21,6 +21,14 @@
#include "flash.h"
#include "programmer.h"
+/*
+ * The following two variables are used in the code even if the ich support is
+ * not compiled in, this is why they are exported through programmer.h and
+ * defined here.
+ */
+enum ich_chipset ich_generation = CHIPSET_ICH_UNKNOWN;
+int ich_dry_run;
+
static const struct par_master par_master_none = {
.chip_readb = noop_chip_readb,
.chip_readw = fallback_chip_readw,