diff options
Diffstat (limited to 'flashrom.c')
-rw-r--r-- | flashrom.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -1075,10 +1075,12 @@ static int selfcheck_eraseblocks(const struct flashchip *chip) { int i, j, k; int ret = 0; + unsigned int prev_eraseblock_count = chip->total_size * 1024; for (k = 0; k < NUM_ERASEFUNCTIONS; k++) { unsigned int done = 0; struct block_eraser eraser = chip->block_erasers[k]; + unsigned int curr_eraseblock_count = 0; for (i = 0; i < NUM_ERASEREGIONS; i++) { /* Blocks with zero size are bugs in flashchips.c. */ @@ -1101,6 +1103,7 @@ static int selfcheck_eraseblocks(const struct flashchip *chip) } done += eraser.eraseblocks[i].count * eraser.eraseblocks[i].size; + curr_eraseblock_count += eraser.eraseblocks[i].count; } /* Empty eraseblock definition with erase function. */ if (!done && eraser.block_erase) @@ -1132,6 +1135,14 @@ static int selfcheck_eraseblocks(const struct flashchip *chip) ret = 1; } } + if(curr_eraseblock_count > prev_eraseblock_count) + { + msg_gerr("ERROR: Flash chip %s erase function %i is not " + "in order. Please report a bug at flashrom@flashrom.org\n", + chip->name, k); + ret = 1; + } + prev_eraseblock_count = curr_eraseblock_count; } return ret; } |