• Home
  • Raw
  • Download

Lines Matching full:oob

130 /* ----------------------- oob helpers -------------------------------------- */
151 static int sm_read_lba(struct sm_oob *oob) in sm_read_lba() argument
160 if (!memcmp(oob, erased_pattern, SM_OOB_SIZE)) in sm_read_lba()
164 lba_test = *(uint16_t *)oob->lba_copy1 ^ *(uint16_t*)oob->lba_copy2; in sm_read_lba()
169 lba = sm_get_lba(oob->lba_copy1); in sm_read_lba()
172 lba = sm_get_lba(oob->lba_copy2); in sm_read_lba()
177 static void sm_write_lba(struct sm_oob *oob, uint16_t lba) in sm_write_lba() argument
189 oob->lba_copy1[0] = oob->lba_copy2[0] = tmp[0]; in sm_write_lba()
190 oob->lba_copy1[1] = oob->lba_copy2[1] = tmp[1]; in sm_write_lba()
220 static int sm_correct_sector(uint8_t *buffer, struct sm_oob *oob) in sm_correct_sector() argument
225 if (__nand_correct_data(buffer, ecc, oob->ecc1, SM_SMALL_PAGE) < 0) in sm_correct_sector()
231 if (__nand_correct_data(buffer, ecc, oob->ecc2, SM_SMALL_PAGE) < 0) in sm_correct_sector()
236 /* Reads a sector + oob*/
239 uint8_t *buffer, struct sm_oob *oob) in sm_read_sector() argument
253 /* User might not need the oob, but we do for data verification */ in sm_read_sector()
254 if (!oob) in sm_read_sector()
255 oob = &tmp_oob; in sm_read_sector()
260 ops.oobbuf = (void *)oob; in sm_read_sector()
277 /* Unfortunately, oob read will _always_ succeed, in sm_read_sector()
288 /* Do a basic test on the oob, to guard against returned garbage */ in sm_read_sector()
289 if (oob->reserved != 0xFFFFFFFF && !is_power_of_2(~oob->reserved)) in sm_read_sector()
300 if (!sm_sector_valid(oob)) { in sm_read_sector()
308 (ftl->smallpagenand && sm_correct_sector(buffer, oob))) { in sm_read_sector()
321 uint8_t *buffer, struct sm_oob *oob) in sm_write_sector() argument
342 ops.oobbuf = (void *)oob; in sm_write_sector()
370 struct sm_oob oob; in sm_write_block() local
374 /* Initialize the oob with requested values */ in sm_write_block()
375 memset(&oob, 0xFF, SM_OOB_SIZE); in sm_write_block()
376 sm_write_lba(&oob, lba); in sm_write_block()
384 oob.data_status = 0xFF; in sm_write_block()
392 oob.data_status = 0; in sm_write_block()
397 SM_SMALL_PAGE, oob.ecc1); in sm_write_block()
400 SM_SMALL_PAGE, oob.ecc2); in sm_write_block()
403 buf + boffset, &oob)) in sm_write_block()
431 struct sm_oob oob; in sm_mark_block_bad() local
434 memset(&oob, 0xFF, SM_OOB_SIZE); in sm_mark_block_bad()
435 oob.block_status = 0xF0; in sm_mark_block_bad()
449 sm_write_sector(ftl, zone, block, boffset, NULL, &oob); in sm_mark_block_bad()
496 struct sm_oob oob; in sm_check_block() local
509 if (sm_read_sector(ftl, zone, block, boffset, NULL, &oob)) in sm_check_block()
512 test_lba = sm_read_lba(&oob); in sm_check_block()
614 /* Test for proper write,erase and oob sizes */ in sm_get_media_info()
627 /* We use OOB */ in sm_get_media_info()
651 struct sm_oob oob; in sm_read_cis() local
654 0, ftl->cis_block, ftl->cis_boffset, ftl->cis_buffer, &oob)) in sm_read_cis()
657 if (!sm_sector_valid(&oob) || !sm_block_valid(&oob)) in sm_read_cis()
671 struct sm_oob oob; in sm_find_cis() local
679 if (sm_read_sector(ftl, 0, block, 0, NULL, &oob)) in sm_find_cis()
682 if (!sm_block_valid(&oob)) in sm_find_cis()
695 if (sm_read_sector(ftl, 0, block, boffset, NULL, &oob)) in sm_find_cis()
698 if (!sm_sector_valid(&oob)) in sm_find_cis()
744 struct sm_oob oob; in sm_init_zone() local
773 /* Read the oob of first sector */ in sm_init_zone()
774 if (sm_read_sector(ftl, zone_num, block, 0, NULL, &oob)) in sm_init_zone()
779 if (sm_block_erased(&oob)) { in sm_init_zone()
789 if (!sm_block_valid(&oob)) { in sm_init_zone()
795 lba = sm_read_lba(&oob); in sm_init_zone()