Hi All,
I used the YAFSS2 with "inband-tags" mode and found some error.
It is due to the wrong NAND access address calculation.
The NAND access address calculation in the code is:
loff_t addr = ((loff_t) chunkInNAND) * dev->nDataBytesPerChunk;
It is correct on normal "OOB-tags" mode but uncorrect on "inband-tags".
In the "inband-tags" mode, the chunk size is "totalBytesPerChunk" instead of "nDataBytesPerChunk"
and the address should be calculated by
loff_t addr = ((loff_t) chunkInNAND) * dev->totalBytesPerChunk;
After patch it as attached, the YAFSS2 runs in "inband-tags" mode well.
Besides yaffs_mtdif2.c, maybe other files also need to check.
Best Regards,
KJ
--- src/yaffs2/yaffs_mtdif2.c 2008-07-23 11:35:12.000000000 +0800
+++ yaffs2/yaffs_mtdif2.c 2008-10-08 01:10:24.000000000 +0800
@@ -107,7 +107,7 @@
int retval = 0;
int localData = 0;
- loff_t addr = ((loff_t) chunkInNAND) * dev->nDataBytesPerChunk;
+ loff_t addr = ((loff_t) chunkInNAND) * dev->totalBytesPerChunk
yaffs_PackedTags2 pt;
@@ -194,7 +194,7 @@
retval =
mtd->block_markbad(mtd,
blockNo * dev->nChunksPerBlock *
- dev->nDataBytesPerChunk);
+ dev->totalBytesPerChunk);
if (retval == 0)
return YAFFS_OK;
@@ -214,7 +214,7 @@
retval =
mtd->block_isbad(mtd,
blockNo * dev->nChunksPerBlock *
- dev->nDataBytesPerChunk);
+ dev->totalBytesPerChunk);
______________________________________________________________________________________________________
付費才容量無上限?Yahoo!奇摩電子信箱2.0免費給你,信件永遠不必刪! http://tw.mg0.mail.yahoo.com/dc/landing