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 (ecc_sw_hamming_correct(buffer, ecc, oob->ecc1, SM_SMALL_PAGE, in sm_correct_sector()
230 if (ecc_sw_hamming_correct(buffer, ecc, oob->ecc2, SM_SMALL_PAGE, in sm_correct_sector()
236 /* Reads a sector + oob*/
239 uint8_t *buffer, struct sm_oob *oob) in sm_read_sector() argument
254 /* User might not need the oob, but we do for data verification */ in sm_read_sector()
255 if (!oob) in sm_read_sector()
256 oob = &tmp_oob; in sm_read_sector()
261 ops.oobbuf = (void *)oob; in sm_read_sector()
279 /* Unfortunately, oob read will _always_ succeed, in sm_read_sector()
291 /* Do a basic test on the oob, to guard against returned garbage */ in sm_read_sector()
292 if (oob->reserved != 0xFFFFFFFF && !is_power_of_2(~oob->reserved)) in sm_read_sector()
303 if (!sm_sector_valid(oob)) { in sm_read_sector()
311 (ftl->smallpagenand && sm_correct_sector(buffer, oob))) { in sm_read_sector()
324 uint8_t *buffer, struct sm_oob *oob) in sm_write_sector() argument
345 ops.oobbuf = (void *)oob; in sm_write_sector()
374 struct sm_oob oob; in sm_write_block() local
378 /* Initialize the oob with requested values */ in sm_write_block()
379 memset(&oob, 0xFF, SM_OOB_SIZE); in sm_write_block()
380 sm_write_lba(&oob, lba); in sm_write_block()
388 oob.data_status = 0xFF; in sm_write_block()
396 oob.data_status = 0; in sm_write_block()
401 SM_SMALL_PAGE, oob.ecc1, in sm_write_block()
405 SM_SMALL_PAGE, oob.ecc2, in sm_write_block()
409 buf + boffset, &oob)) in sm_write_block()
438 struct sm_oob oob; in sm_mark_block_bad() local
441 memset(&oob, 0xFF, SM_OOB_SIZE); in sm_mark_block_bad()
442 oob.block_status = 0xF0; in sm_mark_block_bad()
457 sm_write_sector(ftl, zone, block, boffset, NULL, &oob); in sm_mark_block_bad()
504 struct sm_oob oob; in sm_check_block() local
518 if (sm_read_sector(ftl, zone, block, boffset, NULL, &oob)) in sm_check_block()
521 test_lba = sm_read_lba(&oob); in sm_check_block()
625 /* Test for proper write,erase and oob sizes */ in sm_get_media_info()
638 /* We use OOB */ in sm_get_media_info()
662 struct sm_oob oob; in sm_read_cis() local
665 0, ftl->cis_block, ftl->cis_boffset, ftl->cis_buffer, &oob)) in sm_read_cis()
668 if (!sm_sector_valid(&oob) || !sm_block_valid(&oob)) in sm_read_cis()
682 struct sm_oob oob; in sm_find_cis() local
690 if (sm_read_sector(ftl, 0, block, 0, NULL, &oob)) in sm_find_cis()
693 if (!sm_block_valid(&oob)) in sm_find_cis()
706 if (sm_read_sector(ftl, 0, block, boffset, NULL, &oob)) in sm_find_cis()
709 if (!sm_sector_valid(&oob)) in sm_find_cis()
755 struct sm_oob oob; in sm_init_zone() local
784 /* Read the oob of first sector */ in sm_init_zone()
785 if (sm_read_sector(ftl, zone_num, block, 0, NULL, &oob)) { in sm_init_zone()
794 if (sm_block_erased(&oob)) { in sm_init_zone()
805 if (!sm_block_valid(&oob)) { in sm_init_zone()
811 lba = sm_read_lba(&oob); in sm_init_zone()