Re: [Yaffs] Questions about NAND spare space orgnizations wi…

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: He Yong
Date:  
To: ian@brightstareng.com
CC: yaffs
Subject: Re: [Yaffs] Questions about NAND spare space orgnizations with HWECC in Yaffs2
Ian McDonnell,
sorry, I made a mistake. the yaffs2's mini-ecc actually only checks the 16
bytes of ext tags (struct yaffs_PackedTags2TagsPart).
and generates 9 bytes of parity code (struct yaffs_ECCOther). but the
sizeof(struct yaffs_ECCOther) = 12 byte, simply because the struct is 4-byte
aligned, I made a little change to save 3 bytes for other usage (like mtd
bad block mark).

Index: yaffs_ecc.h
===================================================================
--- yaffs_ecc.h (修订版 100)
+++ yaffs_ecc.h (工作拷贝)
@@ -31,10 +31,10 @@
#endif // CONFIG_YAFFS_IGNORE_TAGS_ECC

 typedef struct {
-       unsigned char colParity;
        unsigned lineParity;
        unsigned lineParityPrime;
-} yaffs_ECCOther;
+       unsigned char colParity;
+} __attribute__((packed)) yaffs_ECCOther;


void yaffs_ECCCalculate(const unsigned char *data, unsigned char *ecc);
int yaffs_ECCCorrect(unsigned char *data, unsigned char *read_ecc,

now there's enough oob/spare space to save hwecc codes.( mtd bad block mark
2B, yaffs2 ext tags 16B, mini-ecc for ext tags 9B, hwecc code 36B, totally
63B < 64B oob/spare space )

thanks!!

-- He Yong

2007/7/4, He Yong <>:
>
> Ian McDonnell,
>
> Thanks for the reminding, it's not safe.
> the hardware ECC could only check for the 2K data and its own 36 bytes of
> parity code, not for the other data in spare space. so here is the
> problem,
>
> if the mini-ECC in yaffs2 is enabled, yaffs2 uses 28 bytes of spare space,
>
> add the 36 bytes of hwecc, it's 64 bytes, there's no more space to store
> the bad block mark (usually the first byte of spare space). and it causes
> MTD
> layer to recognize the block is 'bad', but actually it's not. if we
> disable the bad block
> check in MTD, then how can we know if a block is bad? since I haven't find
> any
> ext tags in yaffs2 that tells a block is bad.
>
> I think it's not necessary to use the mini-ECC when having a stronger
> hardware ECC,
> the only reason we must keep it is to make sure the ext tags in oob/spare
> is correct,
> so I started to think about writing a simpler CRC check only for the ext
> tags, this may
> work faster and take less spare bytes than mini-ECC, so that I can leave
> the first 2 bytes
> for bad block mark.
>
> Thanks!
>
> -- He Yong
>
> 2007/7/4, < >:
> >
> > He,
> >
> > On Tuesday 03 July 2007 01:42, He Yong wrote:
> > > I get yaffs2 working without ECC tags ( struct
> > > (yaffs_ECCOther) ). Now, yaffs2 only takes 12 bytes of Nand
> > > spare area, and our HWECC has enough space to store 36 bytes
> > > of parity code. Thanks!
> >
> > So are you saying that the underlying hardware has some form
> > of ECC check/correction not only for the pages primary data (2k
> > bytes), but also for the spare/oob/tags data as written/read by
> > the application (mtd/yaffs)? If not, simply dropping the
> > mini-ecc is not so safe.
> >
> > Thanks for the patch.
> >
>
>
>
> --
> Best Regards!
>
> He Yong
>
> School of Information Security,
> Shanghai Jiaotong University,
> Dong cuan Road #800,
> Minhang, Shanghai, P.R.China
>




--
Best Regards!

He Yong

School of Information Security,
Shanghai Jiaotong University,
Dong cuan Road #800,
Minhang, Shanghai, P.R.China