Lines Matching full:oob
127 /* ----------------------- oob helpers -------------------------------------- */
148 static int sm_read_lba(struct sm_oob *oob) in sm_read_lba() argument
157 if (!memcmp(oob, erased_pattern, SM_OOB_SIZE)) in sm_read_lba()
161 lba_test = *(uint16_t *)oob->lba_copy1 ^ *(uint16_t*)oob->lba_copy2; in sm_read_lba()
166 lba = sm_get_lba(oob->lba_copy1); in sm_read_lba()
169 lba = sm_get_lba(oob->lba_copy2); in sm_read_lba()
174 static void sm_write_lba(struct sm_oob *oob, uint16_t lba) in sm_write_lba() argument
186 oob->lba_copy1[0] = oob->lba_copy2[0] = tmp[0]; in sm_write_lba()
187 oob->lba_copy1[1] = oob->lba_copy2[1] = tmp[1]; in sm_write_lba()
217 static int sm_correct_sector(uint8_t *buffer, struct sm_oob *oob) in sm_correct_sector() argument
223 if (__nand_correct_data(buffer, ecc, oob->ecc1, SM_SMALL_PAGE, in sm_correct_sector()
231 if (__nand_correct_data(buffer, ecc, oob->ecc2, SM_SMALL_PAGE, in sm_correct_sector()
237 /* Reads a sector + oob*/
240 uint8_t *buffer, struct sm_oob *oob) in sm_read_sector() argument
255 /* User might not need the oob, but we do for data verification */ in sm_read_sector()
256 if (!oob) in sm_read_sector()
257 oob = &tmp_oob; in sm_read_sector()
262 ops.oobbuf = (void *)oob; in sm_read_sector()
279 /* Unfortunately, oob read will _always_ succeed, in sm_read_sector()
290 /* Do a basic test on the oob, to guard against returned garbage */ in sm_read_sector()
291 if (oob->reserved != 0xFFFFFFFF && !is_power_of_2(~oob->reserved)) in sm_read_sector()
302 if (!sm_sector_valid(oob)) { in sm_read_sector()
310 (ftl->smallpagenand && sm_correct_sector(buffer, oob))) { in sm_read_sector()
323 uint8_t *buffer, struct sm_oob *oob) in sm_write_sector() argument
344 ops.oobbuf = (void *)oob; in sm_write_sector()
372 struct sm_oob oob; in sm_write_block() local
376 /* Initialize the oob with requested values */ in sm_write_block()
377 memset(&oob, 0xFF, SM_OOB_SIZE); in sm_write_block()
378 sm_write_lba(&oob, lba); in sm_write_block()
386 oob.data_status = 0xFF; in sm_write_block()
394 oob.data_status = 0; in sm_write_block()
399 oob.ecc1, in sm_write_block()
403 SM_SMALL_PAGE, oob.ecc2, in sm_write_block()
407 buf + boffset, &oob)) in sm_write_block()
435 struct sm_oob oob; in sm_mark_block_bad() local
438 memset(&oob, 0xFF, SM_OOB_SIZE); in sm_mark_block_bad()
439 oob.block_status = 0xF0; in sm_mark_block_bad()
453 sm_write_sector(ftl, zone, block, boffset, NULL, &oob); in sm_mark_block_bad()
500 struct sm_oob oob; in sm_check_block() local
513 if (sm_read_sector(ftl, zone, block, boffset, NULL, &oob)) in sm_check_block()
516 test_lba = sm_read_lba(&oob); in sm_check_block()
618 /* Test for proper write,erase and oob sizes */ in sm_get_media_info()
631 /* We use OOB */ in sm_get_media_info()
655 struct sm_oob oob; in sm_read_cis() local
658 0, ftl->cis_block, ftl->cis_boffset, ftl->cis_buffer, &oob)) in sm_read_cis()
661 if (!sm_sector_valid(&oob) || !sm_block_valid(&oob)) in sm_read_cis()
675 struct sm_oob oob; in sm_find_cis() local
683 if (sm_read_sector(ftl, 0, block, 0, NULL, &oob)) in sm_find_cis()
686 if (!sm_block_valid(&oob)) in sm_find_cis()
699 if (sm_read_sector(ftl, 0, block, boffset, NULL, &oob)) in sm_find_cis()
702 if (!sm_sector_valid(&oob)) in sm_find_cis()
748 struct sm_oob oob; in sm_init_zone() local
777 /* Read the oob of first sector */ in sm_init_zone()
778 if (sm_read_sector(ftl, zone_num, block, 0, NULL, &oob)) { in sm_init_zone()
786 if (sm_block_erased(&oob)) { in sm_init_zone()
796 if (!sm_block_valid(&oob)) { in sm_init_zone()
802 lba = sm_read_lba(&oob); in sm_init_zone()