• Home
  • Raw
  • Download

Lines Matching refs:ubi

92 static int self_check_ai(struct ubi_device *ubi, struct ubi_attach_info *ai);
322 int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, in ubi_compare_lebs() argument
370 vh = ubi_zalloc_vid_hdr(ubi, GFP_KERNEL); in ubi_compare_lebs()
375 err = ubi_io_read_vid_hdr(ubi, pnum, vh, 0); in ubi_compare_lebs()
396 mutex_lock(&ubi->buf_mutex); in ubi_compare_lebs()
397 err = ubi_io_read_data(ubi, ubi->peb_buf, pnum, 0, len); in ubi_compare_lebs()
402 crc = crc32(UBI_CRC32_INIT, ubi->peb_buf, len); in ubi_compare_lebs()
413 mutex_unlock(&ubi->buf_mutex); in ubi_compare_lebs()
415 ubi_free_vid_hdr(ubi, vh); in ubi_compare_lebs()
425 mutex_unlock(&ubi->buf_mutex); in ubi_compare_lebs()
427 ubi_free_vid_hdr(ubi, vh); in ubi_compare_lebs()
447 int ubi_add_to_av(struct ubi_device *ubi, struct ubi_attach_info *ai, int pnum, in ubi_add_to_av() argument
521 cmp_res = ubi_compare_lebs(ubi, aeb, pnum, vid_hdr); in ubi_add_to_av()
660 static int early_erase_peb(struct ubi_device *ubi, in early_erase_peb() argument
675 ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_KERNEL); in early_erase_peb()
681 err = ubi_io_sync_erase(ubi, pnum, 0); in early_erase_peb()
685 err = ubi_io_write_ec_hdr(ubi, pnum, ec_hdr); in early_erase_peb()
706 struct ubi_ainf_peb *ubi_early_get_peb(struct ubi_device *ubi, in ubi_early_get_peb() argument
729 err = early_erase_peb(ubi, ai, aeb->pnum, aeb->ec+1); in ubi_early_get_peb()
760 static int check_corruption(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr, in check_corruption() argument
765 mutex_lock(&ubi->buf_mutex); in check_corruption()
766 memset(ubi->peb_buf, 0x00, ubi->leb_size); in check_corruption()
768 err = ubi_io_read(ubi, ubi->peb_buf, pnum, ubi->leb_start, in check_corruption()
769 ubi->leb_size); in check_corruption()
785 if (ubi_check_pattern(ubi->peb_buf, 0xFF, ubi->leb_size)) in check_corruption()
793 pnum, ubi->leb_start, ubi->leb_size); in check_corruption()
795 ubi->peb_buf, ubi->leb_size, 1); in check_corruption()
799 mutex_unlock(&ubi->buf_mutex); in check_corruption()
816 static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, in scan_peb() argument
825 err = ubi_io_is_bad(ubi, pnum); in scan_peb()
833 err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); in scan_peb()
903 if (!ubi->image_seq && image_seq) in scan_peb()
904 ubi->image_seq = image_seq; in scan_peb()
905 if (ubi->image_seq && image_seq && in scan_peb()
906 ubi->image_seq != image_seq) { in scan_peb()
908 image_seq, pnum, ubi->image_seq); in scan_peb()
916 err = ubi_io_read_vid_hdr(ubi, pnum, vidh, 0); in scan_peb()
954 err = check_corruption(ubi, vidh, pnum); in scan_peb()
1015 ubi->ro_mode = 1; in scan_peb()
1037 err = ubi_add_to_av(ubi, ai, pnum, ec, vidh, bitflips); in scan_peb()
1065 static int late_analysis(struct ubi_device *ubi, struct ubi_attach_info *ai) in late_analysis() argument
1070 peb_count = ubi->peb_count - ai->bad_peb_count - ai->alien_peb_count; in late_analysis()
1115 get_random_bytes(&ubi->image_seq, in late_analysis()
1116 sizeof(ubi->image_seq)); in late_analysis()
1225 static int scan_all(struct ubi_device *ubi, struct ubi_attach_info *ai, in scan_all() argument
1235 ech = kzalloc(ubi->ec_hdr_alsize, GFP_KERNEL); in scan_all()
1239 vidh = ubi_zalloc_vid_hdr(ubi, GFP_KERNEL); in scan_all()
1243 for (pnum = start; pnum < ubi->peb_count; pnum++) { in scan_all()
1247 err = scan_peb(ubi, ai, pnum, NULL, NULL); in scan_all()
1258 err = late_analysis(ubi, ai); in scan_all()
1285 err = self_check_ai(ubi, ai); in scan_all()
1289 ubi_free_vid_hdr(ubi, vidh); in scan_all()
1295 ubi_free_vid_hdr(ubi, vidh); in scan_all()
1313 static int scan_fast(struct ubi_device *ubi, struct ubi_attach_info *ai) in scan_fast() argument
1320 ech = kzalloc(ubi->ec_hdr_alsize, GFP_KERNEL); in scan_fast()
1324 vidh = ubi_zalloc_vid_hdr(ubi, GFP_KERNEL); in scan_fast()
1334 err = scan_peb(ubi, ai, pnum, &vol_id, &sqnum); in scan_fast()
1344 ubi_free_vid_hdr(ubi, vidh); in scan_fast()
1350 return ubi_scan_fastmap(ubi, ai, fm_anchor); in scan_fast()
1353 ubi_free_vid_hdr(ubi, vidh); in scan_fast()
1394 int ubi_attach(struct ubi_device *ubi, int force_scan) in ubi_attach() argument
1405 if ((int)mtd_div_by_eb(ubi->mtd->size, ubi->mtd) <= UBI_FM_MAX_START) { in ubi_attach()
1406 ubi->fm_disabled = 1; in ubi_attach()
1411 err = scan_all(ubi, ai, 0); in ubi_attach()
1413 err = scan_fast(ubi, ai); in ubi_attach()
1422 err = scan_all(ubi, ai, UBI_FM_MAX_START); in ubi_attach()
1426 err = scan_all(ubi, ai, 0); in ubi_attach()
1431 ubi->bad_peb_count = ai->bad_peb_count; in ubi_attach()
1432 ubi->good_peb_count = ubi->peb_count - ubi->bad_peb_count; in ubi_attach()
1433 ubi->corr_peb_count = ai->corr_peb_count; in ubi_attach()
1434 ubi->max_ec = ai->max_ec; in ubi_attach()
1435 ubi->mean_ec = ai->mean_ec; in ubi_attach()
1438 err = ubi_read_volume_table(ubi, ai); in ubi_attach()
1442 err = ubi_wl_init(ubi, ai); in ubi_attach()
1446 err = ubi_eba_init(ubi, ai); in ubi_attach()
1451 if (ubi->fm && ubi_dbg_chk_gen(ubi)) { in ubi_attach()
1458 err = scan_all(ubi, scan_ai, 0); in ubi_attach()
1464 err = self_check_eba(ubi, ai, scan_ai); in ubi_attach()
1476 ubi_wl_close(ubi); in ubi_attach()
1478 ubi_free_internal_volumes(ubi); in ubi_attach()
1479 vfree(ubi->vtbl); in ubi_attach()
1493 static int self_check_ai(struct ubi_device *ubi, struct ubi_attach_info *ai) in self_check_ai() argument
1501 if (!ubi_dbg_chk_gen(ubi)) in self_check_ai()
1544 if (av->data_pad > ubi->leb_size / 2) { in self_check_ai()
1573 if (aeb->pnum >= ubi->peb_count) { in self_check_ai()
1575 aeb->pnum, ubi->peb_count); in self_check_ai()
1630 err = ubi_io_read_vid_hdr(ubi, aeb->pnum, vidh, 1); in self_check_ai()
1694 buf = kzalloc(ubi->peb_count, GFP_KERNEL); in self_check_ai()
1698 for (pnum = 0; pnum < ubi->peb_count; pnum++) { in self_check_ai()
1699 err = ubi_io_is_bad(ubi, pnum); in self_check_ai()
1724 for (pnum = 0; pnum < ubi->peb_count; pnum++) in self_check_ai()