2009/6/3 Scott Wood <scottw...@freescale.com> > > On Tue, Jun 02, 2009 at 07:27:01PM +0800, adrian wen wrote: > > Hi all, > > > > I found a bug in nand.h which prevent UBOOT to supprt large NAND chip. > > > > The bug description as below: > > In the original implementation, we use a wrapper function in > > nand.h to facilitate nand_base function usage in other files, > > like cmd_nand.c, nand_util.c etc. > > > > However, the wrapper in nand.h is using off_t which is long type. > > If we pass a address like 0x80000000, which is allowed by nand_base.c, > > the wrapper would recognize it as a negative num. So we would get a > > huge num when this parameter get into nand_base.c > > > > Fix it by replacing off_t to loff_t type. > > > > Signed-off-by: Lei Wen <lei...@marvell.com> > > A substantially similar patch was posted here: > http://lists.denx.de/pipermail/u-boot/2009-May/052847.html > > I'm fine with this change, but it should also handle large erases. > > -Scott I don't quitly catch the meaning. Do you mean that uboot erases begin with large address or large length?
This patch only solve the wrapper bug. For the nand_block_isbad as a example, this function defined in nand.h as: static inline int nand_block_isbad(nand_info_t *info, off_t ofs) { return info->block_isbad(info, ofs); } However, in nand_base.c, we define this function as: static int nand_block_markbad(struct mtd_info *mtd, loff_t ofs) Also, in nand_util.c, it use a lot of nand_block_markbad, which is the one _defined_ in nand.h. So the problem comes that when we pass a address greater than 0x80000000, the off_t type would recognize it as a negative number, while loff_t recognize it valid. When this _0x80000000_ pass to the nand_block_markbad in nand_base.c, it would be recognized as 0xffffffff80000000, which is caused by the wrapper in nand.h. -Adrian _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot