Lines Matching refs:oob
127 /* ----------------------- oob helpers -------------------------------------- */
148 static int sm_read_lba(struct sm_oob *oob)
157 if (!memcmp(oob, erased_pattern, SM_OOB_SIZE))
161 lba_test = *(uint16_t *)oob->lba_copy1 ^ *(uint16_t*)oob->lba_copy2;
166 lba = sm_get_lba(oob->lba_copy1);
169 lba = sm_get_lba(oob->lba_copy2);
174 static void sm_write_lba(struct sm_oob *oob, uint16_t lba)
186 oob->lba_copy1[0] = oob->lba_copy2[0] = tmp[0];
187 oob->lba_copy1[1] = oob->lba_copy2[1] = tmp[1];
217 static int sm_correct_sector(uint8_t *buffer, struct sm_oob *oob)
223 if (ecc_sw_hamming_correct(buffer, ecc, oob->ecc1, SM_SMALL_PAGE,
230 if (ecc_sw_hamming_correct(buffer, ecc, oob->ecc2, SM_SMALL_PAGE,
236 /* Reads a sector + oob*/
239 uint8_t *buffer, struct sm_oob *oob)
254 /* User might not need the oob, but we do for data verification */
255 if (!oob)
256 oob = &tmp_oob;
261 ops.oobbuf = (void *)oob;
279 /* Unfortunately, oob read will _always_ succeed,
291 /* Do a basic test on the oob, to guard against returned garbage */
292 if (oob->reserved != 0xFFFFFFFF && !is_power_of_2(~oob->reserved))
303 if (!sm_sector_valid(oob)) {
311 (ftl->smallpagenand && sm_correct_sector(buffer, oob))) {
324 uint8_t *buffer, struct sm_oob *oob)
345 ops.oobbuf = (void *)oob;
374 struct sm_oob oob;
378 /* Initialize the oob with requested values */
379 memset(&oob, 0xFF, SM_OOB_SIZE);
380 sm_write_lba(&oob, lba);
388 oob.data_status = 0xFF;
396 oob.data_status = 0;
401 SM_SMALL_PAGE, oob.ecc1,
405 SM_SMALL_PAGE, oob.ecc2,
409 buf + boffset, &oob))
438 struct sm_oob oob;
441 memset(&oob, 0xFF, SM_OOB_SIZE);
442 oob.block_status = 0xF0;
457 sm_write_sector(ftl, zone, block, boffset, NULL, &oob);
504 struct sm_oob oob;
518 if (sm_read_sector(ftl, zone, block, boffset, NULL, &oob))
521 test_lba = sm_read_lba(&oob);
625 /* Test for proper write,erase and oob sizes */
662 struct sm_oob oob;
665 0, ftl->cis_block, ftl->cis_boffset, ftl->cis_buffer, &oob))
668 if (!sm_sector_valid(&oob) || !sm_block_valid(&oob))
682 struct sm_oob oob;
690 if (sm_read_sector(ftl, 0, block, 0, NULL, &oob))
693 if (!sm_block_valid(&oob))
706 if (sm_read_sector(ftl, 0, block, boffset, NULL, &oob))
709 if (!sm_sector_valid(&oob))
755 struct sm_oob oob;
784 /* Read the oob of first sector */
785 if (sm_read_sector(ftl, zone_num, block, 0, NULL, &oob)) {
794 if (sm_block_erased(&oob)) {
805 if (!sm_block_valid(&oob)) {
811 lba = sm_read_lba(&oob);