[go: nahoru, domu]

Lines Matching refs:oob

130 /* ----------------------- oob helpers -------------------------------------- */
151 static int sm_read_lba(struct sm_oob *oob)
160 if (!memcmp(oob, erased_pattern, SM_OOB_SIZE))
164 lba_test = *(uint16_t *)oob->lba_copy1 ^ *(uint16_t*)oob->lba_copy2;
169 lba = sm_get_lba(oob->lba_copy1);
172 lba = sm_get_lba(oob->lba_copy2);
177 static void sm_write_lba(struct sm_oob *oob, uint16_t lba)
189 oob->lba_copy1[0] = oob->lba_copy2[0] = tmp[0];
190 oob->lba_copy1[1] = oob->lba_copy2[1] = tmp[1];
219 static int sm_correct_sector(uint8_t *buffer, struct sm_oob *oob)
224 if (__nand_correct_data(buffer, ecc, oob->ecc1, SM_SMALL_PAGE) < 0)
230 if (__nand_correct_data(buffer, ecc, oob->ecc2, SM_SMALL_PAGE) < 0)
235 /* Reads a sector + oob*/
238 uint8_t *buffer, struct sm_oob *oob)
252 /* User might not need the oob, but we do for data verification */
253 if (!oob)
254 oob = &tmp_oob;
259 ops.oobbuf = (void *)oob;
276 /* Unfortunately, oob read will _always_ succeed,
287 /* Do a basic test on the oob, to guard against returned garbage */
288 if (oob->reserved != 0xFFFFFFFF && !is_power_of_2(~oob->reserved))
299 if (!sm_sector_valid(oob)) {
307 (ftl->smallpagenand && sm_correct_sector(buffer, oob))) {
320 uint8_t *buffer, struct sm_oob *oob)
341 ops.oobbuf = (void *)oob;
369 struct sm_oob oob;
373 /* Initialize the oob with requested values */
374 memset(&oob, 0xFF, SM_OOB_SIZE);
375 sm_write_lba(&oob, lba);
383 oob.data_status = 0xFF;
391 oob.data_status = 0;
396 SM_SMALL_PAGE, oob.ecc1);
399 SM_SMALL_PAGE, oob.ecc2);
402 buf + boffset, &oob))
430 struct sm_oob oob;
433 memset(&oob, 0xFF, SM_OOB_SIZE);
434 oob.block_status = 0xF0;
448 sm_write_sector(ftl, zone, block, boffset, NULL, &oob);
513 struct sm_oob oob;
526 if (sm_read_sector(ftl, zone, block, boffset, NULL, &oob))
529 test_lba = sm_read_lba(&oob);
631 /* Test for proper write,erase and oob sizes */
668 struct sm_oob oob;
671 0, ftl->cis_block, ftl->cis_boffset, ftl->cis_buffer, &oob))
674 if (!sm_sector_valid(&oob) || !sm_block_valid(&oob))
688 struct sm_oob oob;
696 if (sm_read_sector(ftl, 0, block, 0, NULL, &oob))
699 if (!sm_block_valid(&oob))
712 if (sm_read_sector(ftl, 0, block, boffset, NULL, &oob))
715 if (!sm_sector_valid(&oob))
761 struct sm_oob oob;
790 /* Read the oob of first sector */
791 if (sm_read_sector(ftl, zone_num, block, 0, NULL, &oob))
796 if (sm_block_erased(&oob)) {
806 if (!sm_block_valid(&oob)) {
812 lba = sm_read_lba(&oob);