Lines Matching refs:pnum

37 static int ubi_io_read(struct ubi_scan_info *ubi, void *buf, int pnum,  in ubi_io_read()  argument
40 return ubi->read(pnum + ubi->peb_offset, from, len, buf); in ubi_io_read()
48 static int ubi_io_read_vid_hdr(struct ubi_scan_info *ubi, int pnum, in ubi_io_read_vid_hdr() argument
55 if (test_bit(pnum, ubi->corrupt)) in ubi_io_read_vid_hdr()
60 if (test_and_set_bit(pnum, ubi->scanned)) in ubi_io_read_vid_hdr()
63 res = ubi_io_read(ubi, vh, pnum, ubi->vid_offset, sizeof(*vh)); in ubi_io_read_vid_hdr()
69 ubi_dbg("Skipping bad or unreadable block %d", pnum); in ubi_io_read_vid_hdr()
71 generic_set_bit(pnum, ubi->corrupt); in ubi_io_read_vid_hdr()
78 generic_set_bit(pnum, ubi->corrupt); in ubi_io_read_vid_hdr()
81 ubi_msg("Bad magic in block 0%d %08x", pnum, magic); in ubi_io_read_vid_hdr()
88 ubi_msg("Bad CRC in block 0%d", pnum); in ubi_io_read_vid_hdr()
89 generic_set_bit(pnum, ubi->corrupt); in ubi_io_read_vid_hdr()
93 ubi_dbg("RV: pnum: %i sqnum %llu", pnum, be64_to_cpu(vh->sqnum)); in ubi_io_read_vid_hdr()
125 u32 pnum, u32 lnum) in ubi_add_peb_to_vol() argument
139 pnum, vol_id, lnum, !!test_bit(lnum, vi->found), in ubi_add_peb_to_vol()
140 !!test_bit(pnum, ubi->scanned)); in ubi_add_peb_to_vol()
162 *ltp = pnum; in ubi_add_peb_to_vol()
171 *ltp = pnum; in ubi_add_peb_to_vol()
176 vol_id, lnum, cur_pnum, be64_to_cpu(cur->sqnum), pnum, in ubi_add_peb_to_vol()
183 *ltp = pnum; in ubi_add_peb_to_vol()
185 *ltp = pnum; in ubi_add_peb_to_vol()
194 u32 pnum) in ubi_scan_vid_hdr() argument
199 if (ubi_io_is_bad(ubi, pnum)) in ubi_scan_vid_hdr()
202 res = ubi_io_read_vid_hdr(ubi, pnum, vh, 0); in ubi_scan_vid_hdr()
222 return ubi_add_peb_to_vol(ubi, vh, vol_id, pnum, lnum); in ubi_scan_vid_hdr()
225 static int assign_aeb_to_av(struct ubi_scan_info *ubi, u32 pnum, u32 lnum, in assign_aeb_to_av() argument
230 if (ubi_io_is_bad(ubi, pnum)) in assign_aeb_to_av()
242 vh = ubi->blockinfo + pnum; in assign_aeb_to_av()
244 return ubi_scan_vid_hdr(ubi, vh, pnum); in assign_aeb_to_av()
250 u32 pnum; in scan_pool() local
256 pnum = be32_to_cpu(pebs[i]); in scan_pool()
258 if (ubi_io_is_bad(ubi, pnum)) { in scan_pool()
259 ubi_err("FM: Bad PEB in fastmap pool! %u", pnum); in scan_pool()
263 vh = ubi->blockinfo + pnum; in scan_pool()
268 ubi_scan_vid_hdr(ubi, vh, pnum); in scan_pool()
373 generic_set_bit(be32_to_cpu(fmec->pnum), ubi->fm_used); in ubi_attach_fastmap()
428 int pnum = be32_to_cpu(fm_eba->pnum[j]); in ubi_attach_fastmap() local
430 if ((int)be32_to_cpu(fm_eba->pnum[j]) < 0) in ubi_attach_fastmap()
433 if (!__test_and_clear_bit(pnum, ubi->fm_used)) in ubi_attach_fastmap()
444 ret = assign_aeb_to_av(ubi, pnum, j, vol_id, in ubi_attach_fastmap()
498 int i, used_blocks, pnum, ret = 0; in ubi_scan_fastmap() local
544 pnum = be32_to_cpu(fmsb->block_loc[i]); in ubi_scan_fastmap()
546 if (ubi_io_is_bad(ubi, pnum)) { in ubi_scan_fastmap()
553 ret = ubi_io_read_ec_hdr(ubi, pnum, ech, 0); in ubi_scan_fastmap()
556 i, pnum); in ubi_scan_fastmap()
577 ret = ubi_io_read_vid_hdr(ubi, pnum, vh, 0); in ubi_scan_fastmap()
580 i, pnum); in ubi_scan_fastmap()
588 if (pnum == fm_anchor) in ubi_scan_fastmap()
589 memcpy(vh, ubi->blockinfo + pnum, sizeof(*fm)); in ubi_scan_fastmap()
614 ret = ubi_io_read(ubi, ubi->fm_buf + (ubi->leb_size * i), pnum, in ubi_scan_fastmap()
618 "err: %i)", i, pnum, ret); in ubi_scan_fastmap()
668 unsigned int pnum; in ipl_scan() local
674 for (pnum = 0; pnum < UBI_FM_MAX_START; pnum++) { in ipl_scan()
675 res = ubi_scan_vid_hdr(ubi, ubi->blockinfo + pnum, pnum); in ipl_scan()
695 if (!ubi_scan_fastmap(ubi, NULL, pnum)) in ipl_scan()
702 pnum = 0; in ipl_scan()
710 for (; pnum < ubi->peb_count; pnum++) in ipl_scan()
711 ubi_scan_vid_hdr(ubi, ubi->blockinfo + pnum, pnum); in ipl_scan()
722 u32 pnum, crc, dlen; in ubi_load_block() local
734 pnum = vi->lebs_to_pebs[lnum]; in ubi_load_block()
736 ubi_dbg("Load vol %u LEB %u PEB %u", vol_id, lnum, pnum); in ubi_load_block()
738 if (ubi_io_is_bad(ubi, pnum)) { in ubi_load_block()
739 ubi_warn("Corrupted mapping block %d PB %d\n", lnum, pnum); in ubi_load_block()
743 if (test_bit(pnum, ubi->corrupt)) in ubi_load_block()
749 vh = ubi->blockinfo + pnum; in ubi_load_block()
751 if (!test_bit(pnum, ubi->scanned)) { in ubi_load_block()
753 lnum, pnum); in ubi_load_block()
754 if (ubi_rescan_fm_vid_hdr(ubi, vh, pnum, vol_id, lnum)) in ubi_load_block()
765 generic_set_bit(pnum, ubi->corrupt); in ubi_load_block()
779 ubi_io_read(ubi, laddr, pnum, ubi->leb_start, dlen); in ubi_load_block()
786 lnum, pnum); in ubi_load_block()
787 generic_set_bit(pnum, ubi->corrupt); in ubi_load_block()
795 ubi_dbg("Find replacement for LEB %u PEB %u", lnum, pnum); in ubi_load_block()
799 for (pnum = 0; pnum < ubi->peb_count; pnum++) { in ubi_load_block()
800 struct ubi_vid_hdr *tmp = ubi->blockinfo + pnum; in ubi_load_block()
804 if (test_bit(pnum, ubi->corrupt)) in ubi_load_block()
810 if (!test_bit(pnum, ubi->scanned)) { in ubi_load_block()
812 vol_id, lnum, pnum); in ubi_load_block()
813 if (ubi_rescan_fm_vid_hdr(ubi, tmp, pnum, vol_id, lnum)) in ubi_load_block()
834 pnum = vrepl - ubi->blockinfo; in ubi_load_block()
835 vi->lebs_to_pebs[lnum] = pnum; in ubi_load_block()
836 ubi_dbg("Trying PEB %u for LEB %u", pnum, lnum); in ubi_load_block()