aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--flashrom.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/flashrom.c b/flashrom.c
index 1f94f33d..8d44c3d4 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -73,8 +73,6 @@ static int may_register_shutdown = 0;
/* Did we change something or was every erase/write skipped (if any)? */
static bool all_skipped = true;
-static int check_block_eraser(const struct flashctx *flash, int k, int log);
-
/* Register a function to be executed on programmer shutdown.
* The advantage over atexit() is that you can supply a void pointer which will
* be used as parameter to the registered function upon programmer shutdown.
@@ -333,6 +331,31 @@ char *extract_programmer_param(const char *param_name)
return extract_param(&programmer_param, param_name, ",");
}
+static int check_block_eraser(const struct flashctx *flash, int k, int log)
+{
+ struct block_eraser eraser = flash->chip->block_erasers[k];
+
+ if (!eraser.block_erase && !eraser.eraseblocks[0].count) {
+ if (log)
+ msg_cdbg("not defined. ");
+ return 1;
+ }
+ if (!eraser.block_erase && eraser.eraseblocks[0].count) {
+ if (log)
+ msg_cdbg("eraseblock layout is known, but matching "
+ "block erase function is not implemented. ");
+ return 1;
+ }
+ if (eraser.block_erase && !eraser.eraseblocks[0].count) {
+ if (log)
+ msg_cdbg("block erase function found, but "
+ "eraseblock layout is not defined. ");
+ return 1;
+ }
+ // TODO: Once erase functions are annotated with allowed buses, check that as well.
+ return 0;
+}
+
/* Returns the number of well-defined erasers for a chip. */
static unsigned int count_usable_erasers(const struct flashctx *flash)
{
@@ -1125,31 +1148,6 @@ static int selfcheck_eraseblocks(const struct flashchip *chip)
return ret;
}
-static int check_block_eraser(const struct flashctx *flash, int k, int log)
-{
- struct block_eraser eraser = flash->chip->block_erasers[k];
-
- if (!eraser.block_erase && !eraser.eraseblocks[0].count) {
- if (log)
- msg_cdbg("not defined. ");
- return 1;
- }
- if (!eraser.block_erase && eraser.eraseblocks[0].count) {
- if (log)
- msg_cdbg("eraseblock layout is known, but matching "
- "block erase function is not implemented. ");
- return 1;
- }
- if (eraser.block_erase && !eraser.eraseblocks[0].count) {
- if (log)
- msg_cdbg("block erase function found, but "
- "eraseblock layout is not defined. ");
- return 1;
- }
- // TODO: Once erase functions are annotated with allowed buses, check that as well.
- return 0;
-}
-
/**
* @brief Reads the included layout regions into a buffer.
*