aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2011-03-27 21:27:01 +0200
committerArnd Bergmann <arnd@arndb.de>2011-03-27 21:27:01 +0200
commit61472b698bb573ec135982d55749394c276140b6 (patch)
treed2ad83c4934878da8e4bafd4401a5d2fc9db4aba
parent969161a0bf57f36ee65452f8e2c2369b98957ba4 (diff)
flashbench: add try_open_au_oob
This function is needed for certain USB sticks that use an odd erase block size (4128 KiB in one case). We will probably need this later, commit it as unused for now. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--flashbench.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/flashbench.c b/flashbench.c
index cc5e567..9d04a23 100644
--- a/flashbench.c
+++ b/flashbench.c
@@ -466,6 +466,46 @@ static int try_program(struct device *dev)
return 0;
}
+static int try_open_au_oob(struct device *dev, unsigned int erasesize,
+ unsigned int blocksize,
+ unsigned int count,
+ bool random)
+{
+ /* find maximum number of open AUs */
+ struct operation program[] = {
+ /* loop through power of two multiple of one sector */
+ {O_LEN_POW2, find_order(erasesize, blocksize), -(long long)blocksize},
+ {O_SEQUENCE, 4},
+ /* print block size */
+ {O_DROP},
+ {O_PRINTF},
+ {O_FORMAT},
+ {O_LENGTH},
+ /* start 16 MB into the device, to skip FAT */
+ {O_OFF_FIXED, .val = 4 * 1024 * 4128}, {O_DROP},
+ /* print one line of aggregated
+ per second results */
+ {O_PRINTF}, {O_FORMAT}, {O_BPS},
+ /* linear write 0x5a */
+ {O_REDUCE, .aggregate = A_MAXIMUM}, {O_REPEAT, 1},
+ {O_REDUCE, .aggregate = A_AVERAGE},
+ { (random ? O_OFF_RAND : O_OFF_LIN),
+ erasesize / blocksize, -1},
+ {O_REDUCE, .aggregate = A_AVERAGE}, // {O_BPS},
+ {O_OFF_RAND, count, /* 2 * erasesize */ 2 * 4128 * 1024}, {O_WRITE_RAND},
+ {O_DROP},
+ {O_OFF_FIXED, .val = 4 * 1024 * 4128 + 4 * 1024 * 1024}, {O_DROP},
+ {O_LEN_FIXED, .val = 32 * 1024},
+ {O_OFF_RAND, count, 2 * 4128 * 1024}, {O_WRITE_RAND},
+ {O_NEWLINE},
+ {O_END},
+ {O_END},
+ };
+ call(program, dev, 0, erasesize, 0);
+
+ return 0;
+}
+
static int try_open_au(struct device *dev, unsigned int erasesize,
unsigned int blocksize,
unsigned int count,