diff options
author | david.oberhollenzer@sigma-star.at <david.oberhollenzer@sigma-star.at> | 2015-03-26 18:59:50 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-04-13 15:05:17 -0400 |
commit | 502690674281a047abd45f81e64c498bc23a8bb3 (patch) | |
tree | 5aa08ca80d7de94bf0b3050a7f458ad0ed25d004 /drivers/mtd/ubi/ubi.h | |
parent | 1a7e985dd1bf5939af0f56bbd6d13d2caf48dd63 (diff) |
UBI: power cut emulation for testing
Emulate random power cuts by switching device to ro after a number of
writes to allow simple power cut testing with nand-sim.
Maximum and minimum number of successful writes before power cut and
what kind of writes (EC header, VID header or none) to interrupt
configurable via debugfs.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/ubi/ubi.h')
-rw-r--r-- | drivers/mtd/ubi/ubi.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 3d58c749f9f1..c998212fc680 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
@@ -151,6 +151,17 @@ enum { | |||
151 | UBI_BAD_FASTMAP, | 151 | UBI_BAD_FASTMAP, |
152 | }; | 152 | }; |
153 | 153 | ||
154 | /* | ||
155 | * Flags for emulate_power_cut in ubi_debug_info | ||
156 | * | ||
157 | * POWER_CUT_EC_WRITE: Emulate a power cut when writing an EC header | ||
158 | * POWER_CUT_VID_WRITE: Emulate a power cut when writing a VID header | ||
159 | */ | ||
160 | enum { | ||
161 | POWER_CUT_EC_WRITE = 0x01, | ||
162 | POWER_CUT_VID_WRITE = 0x02, | ||
163 | }; | ||
164 | |||
154 | /** | 165 | /** |
155 | * struct ubi_wl_entry - wear-leveling entry. | 166 | * struct ubi_wl_entry - wear-leveling entry. |
156 | * @u.rb: link in the corresponding (free/used) RB-tree | 167 | * @u.rb: link in the corresponding (free/used) RB-tree |
@@ -360,6 +371,10 @@ struct ubi_wl_entry; | |||
360 | * @disable_bgt: disable the background task for testing purposes | 371 | * @disable_bgt: disable the background task for testing purposes |
361 | * @emulate_bitflips: emulate bit-flips for testing purposes | 372 | * @emulate_bitflips: emulate bit-flips for testing purposes |
362 | * @emulate_io_failures: emulate write/erase failures for testing purposes | 373 | * @emulate_io_failures: emulate write/erase failures for testing purposes |
374 | * @emulate_power_cut: emulate power cut for testing purposes | ||
375 | * @power_cut_counter: count down for writes left until emulated power cut | ||
376 | * @power_cut_min: minimum number of writes before emulating a power cut | ||
377 | * @power_cut_max: maximum number of writes until emulating a power cut | ||
363 | * @dfs_dir_name: name of debugfs directory containing files of this UBI device | 378 | * @dfs_dir_name: name of debugfs directory containing files of this UBI device |
364 | * @dfs_dir: direntry object of the UBI device debugfs directory | 379 | * @dfs_dir: direntry object of the UBI device debugfs directory |
365 | * @dfs_chk_gen: debugfs knob to enable UBI general extra checks | 380 | * @dfs_chk_gen: debugfs knob to enable UBI general extra checks |
@@ -368,6 +383,9 @@ struct ubi_wl_entry; | |||
368 | * @dfs_disable_bgt: debugfs knob to disable the background task | 383 | * @dfs_disable_bgt: debugfs knob to disable the background task |
369 | * @dfs_emulate_bitflips: debugfs knob to emulate bit-flips | 384 | * @dfs_emulate_bitflips: debugfs knob to emulate bit-flips |
370 | * @dfs_emulate_io_failures: debugfs knob to emulate write/erase failures | 385 | * @dfs_emulate_io_failures: debugfs knob to emulate write/erase failures |
386 | * @dfs_emulate_power_cut: debugfs knob to emulate power cuts | ||
387 | * @dfs_power_cut_min: debugfs knob for minimum writes before power cut | ||
388 | * @dfs_power_cut_max: debugfs knob for maximum writes until power cut | ||
371 | */ | 389 | */ |
372 | struct ubi_debug_info { | 390 | struct ubi_debug_info { |
373 | unsigned int chk_gen:1; | 391 | unsigned int chk_gen:1; |
@@ -376,6 +394,10 @@ struct ubi_debug_info { | |||
376 | unsigned int disable_bgt:1; | 394 | unsigned int disable_bgt:1; |
377 | unsigned int emulate_bitflips:1; | 395 | unsigned int emulate_bitflips:1; |
378 | unsigned int emulate_io_failures:1; | 396 | unsigned int emulate_io_failures:1; |
397 | unsigned int emulate_power_cut:2; | ||
398 | unsigned int power_cut_counter; | ||
399 | unsigned int power_cut_min; | ||
400 | unsigned int power_cut_max; | ||
379 | char dfs_dir_name[UBI_DFS_DIR_LEN + 1]; | 401 | char dfs_dir_name[UBI_DFS_DIR_LEN + 1]; |
380 | struct dentry *dfs_dir; | 402 | struct dentry *dfs_dir; |
381 | struct dentry *dfs_chk_gen; | 403 | struct dentry *dfs_chk_gen; |
@@ -384,6 +406,9 @@ struct ubi_debug_info { | |||
384 | struct dentry *dfs_disable_bgt; | 406 | struct dentry *dfs_disable_bgt; |
385 | struct dentry *dfs_emulate_bitflips; | 407 | struct dentry *dfs_emulate_bitflips; |
386 | struct dentry *dfs_emulate_io_failures; | 408 | struct dentry *dfs_emulate_io_failures; |
409 | struct dentry *dfs_emulate_power_cut; | ||
410 | struct dentry *dfs_power_cut_min; | ||
411 | struct dentry *dfs_power_cut_max; | ||
387 | }; | 412 | }; |
388 | 413 | ||
389 | /** | 414 | /** |