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
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()
278 /* Unfortunately, oob read will _always_ succeed, in sm_read_sector()
289 /* Do a basic test on the oob, to guard against returned garbage */ in sm_read_sector()
290 if (oob->reserved != 0xFFFFFFFF && !is_power_of_2(~oob->reserved)) in sm_read_sector()
301 if (!sm_sector_valid(oob)) { in sm_read_sector()
309 (ftl->smallpagenand && sm_correct_sector(buffer, oob))) { in sm_read_sector()
322 uint8_t *buffer, struct sm_oob *oob) in sm_write_sector() argument
343 ops.oobbuf = (void *)oob; in sm_write_sector()
371 struct sm_oob oob; in sm_write_block() local
375 /* Initialize the oob with requested values */ in sm_write_block()
376 memset(&oob, 0xFF, SM_OOB_SIZE); in sm_write_block()
377 sm_write_lba(&oob, lba); in sm_write_block()
385 oob.data_status = 0xFF; in sm_write_block()
393 oob.data_status = 0; in sm_write_block()
398 oob.ecc1, in sm_write_block()
402 SM_SMALL_PAGE, oob.ecc2, in sm_write_block()
406 buf + boffset, &oob)) in sm_write_block()
434 struct sm_oob oob; in sm_mark_block_bad() local
437 memset(&oob, 0xFF, SM_OOB_SIZE); in sm_mark_block_bad()
438 oob.block_status = 0xF0; in sm_mark_block_bad()
452 sm_write_sector(ftl, zone, block, boffset, NULL, &oob); in sm_mark_block_bad()
499 struct sm_oob oob; in sm_check_block() local
512 if (sm_read_sector(ftl, zone, block, boffset, NULL, &oob)) in sm_check_block()
515 test_lba = sm_read_lba(&oob); in sm_check_block()
617 /* Test for proper write,erase and oob sizes */ in sm_get_media_info()
630 /* We use OOB */ in sm_get_media_info()
654 struct sm_oob oob; in sm_read_cis() local
657 0, ftl->cis_block, ftl->cis_boffset, ftl->cis_buffer, &oob)) in sm_read_cis()
660 if (!sm_sector_valid(&oob) || !sm_block_valid(&oob)) in sm_read_cis()
674 struct sm_oob oob; in sm_find_cis() local
682 if (sm_read_sector(ftl, 0, block, 0, NULL, &oob)) in sm_find_cis()
685 if (!sm_block_valid(&oob)) in sm_find_cis()
698 if (sm_read_sector(ftl, 0, block, boffset, NULL, &oob)) in sm_find_cis()
701 if (!sm_sector_valid(&oob)) in sm_find_cis()
747 struct sm_oob oob; in sm_init_zone() local
776 /* Read the oob of first sector */ in sm_init_zone()
777 if (sm_read_sector(ftl, zone_num, block, 0, NULL, &oob)) { in sm_init_zone()
785 if (sm_block_erased(&oob)) { in sm_init_zone()
795 if (!sm_block_valid(&oob)) { in sm_init_zone()
801 lba = sm_read_lba(&oob); in sm_init_zone()