Lines Matching +full:pre +full:- +full:verified
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2006-2008 Nokia Corporation
7 * Author: Adrian Hunter <ext-adrian.hunter@nokia.com>
24 static int dev = -EINVAL;
47 use_len -= 1; in do_vary_offset()
52 use_len = use_len_max - use_offset; in do_vary_offset()
61 loff_t addr = (loff_t)ebnum * mtd->erasesize; in write_eraseblock()
64 for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) { in write_eraseblock()
80 return err ? err : -1; in write_eraseblock()
124 for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--, i++) { in memcmpshowoffset()
127 pr_info("error @addr[0x%lx:0x%lx] 0x%x -> 0x%x diff 0x%x\n", in memcmpshowoffset()
152 for (su1 = cs; 0 < count; ++su1, count--, i++) { in memffshow()
155 pr_info("error @addr[0x%lx:0x%lx] 0x%x -> 0xff diff 0x%x\n", in memffshow()
170 loff_t addr = (loff_t)ebnum * mtd->erasesize; in verify_eraseblock()
174 for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) { in verify_eraseblock()
191 return err ? err : -1; in verify_eraseblock()
203 return -1; in verify_eraseblock()
209 if (use_offset != 0 || use_len < mtd->oobavail) { in verify_eraseblock()
215 ops.ooblen = mtd->oobavail; in verify_eraseblock()
224 if (err || ops.oobretlen != mtd->oobavail) { in verify_eraseblock()
228 return err ? err : -1; in verify_eraseblock()
235 /* verify pre-offset area for 0xff */ in verify_eraseblock()
238 /* verify post-(use_offset + use_len) area for 0xff */ in verify_eraseblock()
241 mtd->oobavail - k); in verify_eraseblock()
249 return -1; in verify_eraseblock()
265 loff_t addr = (loff_t)ebnum * mtd->erasesize; in verify_eraseblock_in_one_go()
266 size_t len = mtd->oobavail * pgcnt; in verify_eraseblock_in_one_go()
267 size_t oobavail = mtd->oobavail; in verify_eraseblock_in_one_go()
290 return err ? err : -1; in verify_eraseblock_in_one_go()
294 for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) { in verify_eraseblock_in_one_go()
303 return -1; in verify_eraseblock_in_one_go()
326 pr_info("verified up to eraseblock %u\n", i); in verify_all_eraseblocks()
332 pr_info("verified %u eraseblocks\n", i); in verify_all_eraseblocks()
348 pr_info("Please specify a valid mtd-device via module parameter\n"); in mtd_oobtest_init()
350 return -EINVAL; in mtd_oobtest_init()
367 tmp = mtd->size; in mtd_oobtest_init()
368 do_div(tmp, mtd->erasesize); in mtd_oobtest_init()
370 pgcnt = mtd->erasesize / mtd->writesize; in mtd_oobtest_init()
375 (unsigned long long)mtd->size, mtd->erasesize, in mtd_oobtest_init()
376 mtd->writesize, ebcnt, pgcnt, mtd->oobsize); in mtd_oobtest_init()
378 err = -ENOMEM; in mtd_oobtest_init()
379 readbuf = kmalloc(mtd->erasesize, GFP_KERNEL); in mtd_oobtest_init()
382 writebuf = kmalloc(mtd->erasesize, GFP_KERNEL); in mtd_oobtest_init()
394 use_len = mtd->oobavail; in mtd_oobtest_init()
395 use_len_max = mtd->oobavail; in mtd_oobtest_init()
440 pr_info("verified up to eraseblock %u\n", i); in mtd_oobtest_init()
446 pr_info("verified %u eraseblocks\n", i); in mtd_oobtest_init()
460 use_len = mtd->oobavail; in mtd_oobtest_init()
461 use_len_max = mtd->oobavail; in mtd_oobtest_init()
471 use_len = mtd->oobavail; in mtd_oobtest_init()
472 use_len_max = mtd->oobavail; in mtd_oobtest_init()
480 use_len = mtd->oobavail; in mtd_oobtest_init()
481 use_len_max = mtd->oobavail; in mtd_oobtest_init()
493 addr0 += mtd->erasesize; in mtd_oobtest_init()
501 ops.ooboffs = mtd->oobavail; in mtd_oobtest_init()
520 ops.ooboffs = mtd->oobavail; in mtd_oobtest_init()
536 if (bbt[ebcnt - 1]) in mtd_oobtest_init()
544 ops.ooblen = mtd->oobavail + 1; in mtd_oobtest_init()
551 err = mtd_write_oob(mtd, mtd->size - mtd->writesize, &ops); in mtd_oobtest_init()
563 ops.ooblen = mtd->oobavail + 1; in mtd_oobtest_init()
570 err = mtd_read_oob(mtd, mtd->size - mtd->writesize, &ops); in mtd_oobtest_init()
581 err = mtdtest_erase_eraseblock(mtd, ebcnt - 1); in mtd_oobtest_init()
589 ops.ooblen = mtd->oobavail; in mtd_oobtest_init()
596 err = mtd_write_oob(mtd, mtd->size - mtd->writesize, &ops); in mtd_oobtest_init()
608 ops.ooblen = mtd->oobavail; in mtd_oobtest_init()
615 err = mtd_read_oob(mtd, mtd->size - mtd->writesize, &ops); in mtd_oobtest_init()
638 for (i = 0; i < ebcnt - 1; ++i) { in mtd_oobtest_init()
641 size_t sz = mtd->oobavail; in mtd_oobtest_init()
644 addr = (loff_t)(i + 1) * mtd->erasesize - mtd->writesize; in mtd_oobtest_init()
665 addr += mtd->writesize; in mtd_oobtest_init()
673 for (i = 0; i < ebcnt - 1; ++i) { in mtd_oobtest_init()
676 prandom_bytes_state(&rnd_state, writebuf, mtd->oobavail * 2); in mtd_oobtest_init()
677 addr = (loff_t)(i + 1) * mtd->erasesize - mtd->writesize; in mtd_oobtest_init()
681 ops.ooblen = mtd->oobavail * 2; in mtd_oobtest_init()
693 mtd->oobavail * 2)) { in mtd_oobtest_init()
698 err = -EINVAL; in mtd_oobtest_init()
704 pr_info("verified up to eraseblock %u\n", i); in mtd_oobtest_init()
710 pr_info("verified %u eraseblocks\n", i); in mtd_oobtest_init()
731 MODULE_DESCRIPTION("Out-of-band test module");